[ooo-build-commit] patches/dev300 patches/vba

Noel Power noelp at kemper.freedesktop.org
Wed Jun 3 11:27:01 PDT 2009


 patches/dev300/apply                                       |   10 +
 patches/vba/fix-sheet-control-valueset.diff                |   72 +++++++++++++
 patches/vba/vba-fix-path-fullname.diff                     |   32 +++++
 patches/vba/vba-fix-range-delete-shift.diff                |   42 +++++++
 patches/vba/vba-fix-worksheet-add-activate.diff            |   15 ++
 patches/vba/vba-fix-worksheet-add-before-param-object.diff |   31 +++++
 6 files changed, 202 insertions(+)

New commits:
commit ec37cf8a9624b987b8282ad8ecfde1e14c35625d
Author: Noel Power <noel.power at novell.com>
Date:   Wed Jun 3 19:23:32 2009 +0100

    fix some excel bugs ( n#507748, n#507745, n#508101, n#507758, n#507760 )
    
    * patches/dev300/apply:
    * patches/vba/fix-sheet-control-valueset.diff: fix setting control default value ( when accessed from sheet ), n#507748
    * patches/vba/vba-fix-path-fullname.diff: fix vbadocumentbase::getPath & vbadocumentbase::getFullName, n#507745
    * patches/vba/vba-fix-range-delete-shift.diff: fix auto calculation of shift direction for delete ( where none specified ), n#508101
    * patches/vba/vba-fix-worksheet-add-activate.diff: active newly added worksheet, n#507758
    * patches/vba/vba-fix-worksheet-add-before-param-object.diff: allow worksheet to be passed as ( before or after ) param, n#507760

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 0934aa9..fa9ff7c 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1794,6 +1794,16 @@ vba-currentcomponent-rework.diff
 vba-testclient-fix-project.diff
 #fix checkbox access via vba api
 vba-fix-checkbox-ole-access.diff, n#507400
+# fix vbadocumentbase::getPath & vbadocumentbase::getFullName
+vba-fix-path-fullname.diff, n#507745 
+# fix setting control default value ( when accessed from sheet )
+fix-sheet-control-valueset.diff, n#507748 
+# fix auto calculation of shift direction for delete ( where none specified )
+vba-fix-range-delete-shift.diff, n#508101
+# allow worksheet to be passed as ( before or after ) param
+vba-fix-worksheet-add-before-param-object.diff, n#507760 
+# active newly added worksheet
+vba-fix-worksheet-add-activate.diff, n#507758
 [VBAUntested]
 SectionOwner => noelpwer
 # doesn't work
diff --git a/patches/vba/fix-sheet-control-valueset.diff b/patches/vba/fix-sheet-control-valueset.diff
new file mode 100644
index 0000000..7a1c875
--- /dev/null
+++ b/patches/vba/fix-sheet-control-valueset.diff
@@ -0,0 +1,72 @@
+diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
+index 310f81e..166abfe 100644
+--- sc/source/ui/vba/vbaworksheet.cxx
++++ sc/source/ui/vba/vbaworksheet.cxx
+@@ -32,6 +32,7 @@
+ 
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ #include <com/sun/star/beans/XIntrospectionAccess.hpp>
++#include <com/sun/star/beans/XIntrospection.hpp>
+ #include <com/sun/star/container/XNamed.hpp>
+ #include <com/sun/star/util/XProtectable.hpp>
+ #include <com/sun/star/table/XCellRange.hpp>
+@@ -764,9 +765,9 @@ ScVbaWorksheet::invoke( const ::rtl::OUString& aFunctionName, const uno::Sequenc
+ }
+ 
+ void SAL_CALL 
+-ScVbaWorksheet::setValue( const ::rtl::OUString& /*aPropertyName*/, const uno::Any& /*aValue*/ ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
++ScVbaWorksheet::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
+ {
+-	throw uno::RuntimeException(); // unsupported operation
++    setDefaultPropByIntrospection( uno::makeAny( getValue( aPropertyName ) ), aValue );
+ }
+ uno::Any SAL_CALL 
+ ScVbaWorksheet::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
+diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
+index 5749839..3fc1a62 100644
+--- vbahelper/inc/vbahelper/vbahelper.hxx
++++ vbahelper/inc/vbahelper/vbahelper.hxx
+@@ -91,6 +91,7 @@ namespace ooo
+ 	    VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
+         VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& );
+         VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite );
++        VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue  ) throw ( css::uno::RuntimeException );
+ 
+ class VBAHELPER_DLLPUBLIC Millimeter
+ {
+diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
+index b95ccf1..acdfb9e 100644
+--- vbahelper/source/vbahelper/vbahelper.cxx
++++ vbahelper/source/vbahelper/vbahelper.cxx
+@@ -34,6 +34,7 @@
+ #include <com/sun/star/frame/XFrame.hpp>
+ #include <com/sun/star/frame/XDesktop.hpp>
+ #include <com/sun/star/frame/XController.hpp>
++#include <com/sun/star/script/XDefaultProperty.hpp>
+ #include <com/sun/star/uno/XComponentContext.hpp>
+ #include <com/sun/star/lang/XMultiComponentFactory.hpp>
+ #include <com/sun/star/beans/XPropertySet.hpp>
+@@ -952,6 +953,23 @@ String docMacroExists( SfxObjectShell* pShell, const String& sMod, const String&
+ 	return sFullName;
+ }
+ 
++void setDefaultPropByIntrospection( const uno::Any& aObj, const uno::Any& aValue  ) throw ( uno::RuntimeException )
++{
++    uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObj ) );
++
++    // #MAYBE #FIXME sort of a bit of a hack, 
++    uno::Reference<  script::XDefaultProperty > xDflt( aObj, uno::UNO_QUERY_THROW );
++    uno::Reference< beans::XPropertySet > xPropSet;
++
++    if ( xUnoAccess.is() )
++        xPropSet.set( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY);
++           
++    if ( xPropSet.is() )
++        xPropSet->setPropertyValue( xDflt->getDefaultPropertyName(), aValue );
++    else
++        throw uno::RuntimeException();
++}
++
+ #define VBA_LEFT "PositionX"
+ #define VBA_TOP "PositionY"
+ UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
diff --git a/patches/vba/vba-fix-path-fullname.diff b/patches/vba/vba-fix-path-fullname.diff
new file mode 100644
index 0000000..ae87e8b
--- /dev/null
+++ b/patches/vba/vba-fix-path-fullname.diff
@@ -0,0 +1,32 @@
+diff --git vbahelper/source/vbahelper/vbadocumentbase.cxx vbahelper/source/vbahelper/vbadocumentbase.cxx
+index e53279e..b8054cc 100644
+--- vbahelper/source/vbahelper/vbadocumentbase.cxx
++++ vbahelper/source/vbahelper/vbadocumentbase.cxx
+@@ -82,17 +82,22 @@ VbaDocumentBase::getName() throw (uno::RuntimeException)
+ ::rtl::OUString
+ VbaDocumentBase::getPath() throw (uno::RuntimeException)
+ {
+-	INetURLObject aURL( getModel()->getURL() );
+-	aURL.CutLastName();
+-	return aURL.GetURLPath();
++        rtl::OUString sURL( getModel()->getURL() );
++	INetURLObject aURL( sURL );
++	sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() );
++        rtl::OUString sPath;
++	::osl::File::getSystemPathFromFileURL( sURL, sPath );
++	return sPath;
+ }
+ 
+ ::rtl::OUString
+ VbaDocumentBase::getFullName() throw (uno::RuntimeException)
+ {
+-	INetURLObject aURL( getModel()->getURL() );
+-	return aURL.GetURLPath();
++        rtl::OUString sPath;
++	::osl::File::getSystemPathFromFileURL( getModel()->getURL(), sPath );
++	return sPath;
+ }
++
+ void
+ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
+ 					  const uno::Any &rRouteArg ) throw (uno::RuntimeException)
diff --git a/patches/vba/vba-fix-range-delete-shift.diff b/patches/vba/vba-fix-range-delete-shift.diff
new file mode 100644
index 0000000..16679b2
--- /dev/null
+++ b/patches/vba/vba-fix-range-delete-shift.diff
@@ -0,0 +1,42 @@
+diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
+index 19bf089..9743989 100644
+--- sc/source/ui/vba/vbarange.cxx
++++ sc/source/ui/vba/vbarange.cxx
+@@ -3317,7 +3317,6 @@ ScVbaRange::characters( const uno::Any& Start, const uno::Any& Length ) throw (u
+  void SAL_CALL 
+ ScVbaRange::Delete( const uno::Any& Shift ) throw (uno::RuntimeException)
+ {
+-	
+ 	if ( m_Areas->getCount() > 1 )
+ 	{
+ 		sal_Int32 nItems = m_Areas->getCount();
+@@ -3329,6 +3328,8 @@ ScVbaRange::Delete( const uno::Any& Shift ) throw (uno::RuntimeException)
+ 		return;
+ 	}
+ 	sheet::CellDeleteMode mode = sheet::CellDeleteMode_NONE ; 
++	RangeHelper thisRange( mxRange );
++	table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
+ 	if ( Shift.hasValue() )		
+ 	{
+ 		sal_Int32 nShift = 0;
+@@ -3346,13 +3347,17 @@ ScVbaRange::Delete( const uno::Any& Shift ) throw (uno::RuntimeException)
+ 		}
+ 	}
+ 	else
+-		if ( getRow() >  getColumn() )
++        {
++		bool bFullRow = ( thisAddress.StartColumn == 0 && thisAddress.EndColumn == MAXCOL );
++	        sal_Int32 nCols = thisAddress.EndColumn - thisAddress.StartColumn;
++	        sal_Int32 nRows = thisAddress.EndRow - thisAddress.StartRow;
++		if ( mbIsRows || bFullRow || ( nCols >=  nRows ) )
+ 			mode = sheet::CellDeleteMode_UP;
+ 		else
+ 			mode = sheet::CellDeleteMode_LEFT;
+-	RangeHelper thisRange( mxRange );
++	}
+ 	uno::Reference< sheet::XCellRangeMovement > xCellRangeMove( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
+-	xCellRangeMove->removeRange( thisRange.getCellRangeAddressable()->getRangeAddress(), mode ); 
++	xCellRangeMove->removeRange( thisAddress, mode ); 
+ 	
+ }
+ 
diff --git a/patches/vba/vba-fix-worksheet-add-activate.diff b/patches/vba/vba-fix-worksheet-add-activate.diff
new file mode 100644
index 0000000..0f9a83b
--- /dev/null
+++ b/patches/vba/vba-fix-worksheet-add-activate.diff
@@ -0,0 +1,15 @@
+diff --git sc/source/ui/vba/vbaworksheets.cxx sc/source/ui/vba/vbaworksheets.cxx
+index f2c0312..a927236 100644
+--- sc/source/ui/vba/vbaworksheets.cxx
++++ sc/source/ui/vba/vbaworksheets.cxx
+@@ -252,7 +265,9 @@ ScVbaWorksheets::Add( const uno::Any& Before, const uno::Any& After,
+ 		m_xSheets->insertNewByName(aStringName, nSheetIndex + i);
+ 		result = getItemByStringIndex( aStringName );
+ 	}
+-	
++	uno::Reference< excel::XWorksheet > xNewSheet( result, uno::UNO_QUERY );
++	if ( xNewSheet.is() )
++		xNewSheet->Activate();	
+ 	return  result;
+ }
+ 
diff --git a/patches/vba/vba-fix-worksheet-add-before-param-object.diff b/patches/vba/vba-fix-worksheet-add-before-param-object.diff
new file mode 100644
index 0000000..c0f8682
--- /dev/null
+++ b/patches/vba/vba-fix-worksheet-add-before-param-object.diff
@@ -0,0 +1,31 @@
+diff --git sc/source/ui/vba/vbaworksheets.cxx sc/source/ui/vba/vbaworksheets.cxx
+index f2c0312..a927236 100644
+--- sc/source/ui/vba/vbaworksheets.cxx
++++ sc/source/ui/vba/vbaworksheets.cxx
+@@ -209,10 +209,23 @@ ScVbaWorksheets::Add( const uno::Any& Before, const uno::Any& After,
+ 	Count >>= nNewSheets;
+ 	Type >>= nType;
+ 	SCTAB nCount = 0;
+-	Before >>= aStringSheet;
+-	if (!aStringSheet.getLength())
++
++	uno::Reference< excel::XWorksheet > xBeforeAfterSheet;
++
++	if ( Before.hasValue() )
+ 	{
+-		After >>= aStringSheet;
++        	if ( Before >>= xBeforeAfterSheet )
++			aStringSheet = xBeforeAfterSheet->getName();
++		else
++			Before >>= aStringSheet;
++	}
++
++	if (!aStringSheet.getLength() && After.hasValue() )
++	{
++        	if ( After >>= xBeforeAfterSheet )
++			aStringSheet = xBeforeAfterSheet->getName();
++		else
++			After >>= aStringSheet;
+ 		bBefore = sal_False;
+ 	}
+ 	if (!aStringSheet.getLength())


More information about the ooo-build-commit mailing list