[ooo-build-commit] Branch 'ooo-build-3-1-1' - patches/dev300 patches/vba
Noel Power
noelp at kemper.freedesktop.org
Thu Nov 12 03:40:04 PST 2009
patches/dev300/apply | 2
patches/vba/vba-fix-override-exportproblem.diff | 71 +++++++++
patches/vba/vba-fix-selection-dot-inproject.diff | 176 +++++++++++++++++++++++
3 files changed, 249 insertions(+)
New commits:
commit ff7c0716ba648499c2c06ac2fc85c73dcf71dac0
Author: Noel Power <noel.power at novell.com>
Date: Thu Nov 12 11:37:06 2009 +0000
add some fixes
* patches/dev300/apply:
* patches/vba/vba-fix-override-exportproblem.diff: fixes odd problem re-importing a roundtripped document that uses the rare hack of overriding the control name with that supplied in a funny attribute in the associated document module stream ( very rare problem )
* patches/vba/vba-fix-selection-dot-inproject.diff: fixes a couple of problems, a) some issues with resolving macros which use a project name ( that contains a '.' ) b) fixes selection of pasted range
diff --git a/patches/dev300/apply b/patches/dev300/apply
index 369169f..55d7e4c 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1892,6 +1892,8 @@ vba-autofiltermode.diff, n#549383
vba-control-api-vis-fix.diff, bnc#542132
vba-fix-isempty.diff, bnc#541749
vba-fix-wsfunction-booleanparam.diff, bnc#541735
+vba-fix-selection-dot-inproject.diff
+vba-fix-override-exportproblem.diff
[VBAUntested]
SectionOwner => noelpwer
# doesn't work
diff --git a/patches/vba/vba-fix-override-exportproblem.diff b/patches/vba/vba-fix-override-exportproblem.diff
new file mode 100644
index 0000000..4667775
--- /dev/null
+++ b/patches/vba/vba-fix-override-exportproblem.diff
@@ -0,0 +1,71 @@
+diff --git sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
+index 5eb246e..7a36a07 100644
+--- sc/source/filter/excel/xiescher.cxx
++++ sc/source/filter/excel/xiescher.cxx
+@@ -401,16 +401,11 @@ void XclImpDrawObjBase::SetAnchor( const XclObjAnchor& rAnchor )
+
+ String XclImpDrawObjBase::GetObjName() const
+ {
+- String sName( GetObjectManager().GetOleNameOverride( GetObjId() ) );
+-
+-
+ /* #118053# #i51348# Always return a non-empty name. Create English
+ default names depending on the object type. This is not implemented as
+ virtual functions in derived classes, as class type and object type may
+ not match. */
+- if ( sName.Len() == 0 )
+- sName = ( (maObjName.Len() > 0) ? maObjName : GetObjectManager().GetDefaultObjName( *this ) );
+- return sName;
++ return (maObjName.Len() > 0) ? maObjName : GetObjectManager().GetDefaultObjName( *this );
+ }
+
+ bool XclImpDrawObjBase::IsValidSize( const Rectangle& rAnchorRect ) const
+@@ -2788,6 +2783,17 @@ SdrObject* XclImpPictureObj::DoCreateSdrObj( const Rectangle& rAnchorRect, ScfPr
+ return xSdrObj.release();
+ }
+
++String XclImpPictureObj::GetObjName() const
++{
++ if( IsOcxControl() )
++ {
++ String sName( GetObjectManager().GetOleNameOverride( GetObjId() ) );
++ if ( sName.Len() > 0 )
++ return sName;
++ }
++ return XclImpDrawObjBase::GetObjName();
++}
++
+ void XclImpPictureObj::DoProcessSdrObj( SdrObject& rSdrObj ) const
+ {
+ if( IsOcxControl() )
+diff --git sc/source/filter/inc/xiescher.hxx sc/source/filter/inc/xiescher.hxx
+index a673a5e..a9eca6e 100644
+--- sc/source/filter/inc/xiescher.hxx
++++ sc/source/filter/inc/xiescher.hxx
+@@ -95,7 +95,7 @@ public:
+ /** Returns the Excel object type from OBJ record. */
+ inline sal_uInt16 GetObjType() const { return mnObjType; }
+ /** Returns the name of this object, may generate a default name. */
+- String GetObjName() const;
++ virtual String GetObjName() const;
+ /** Returns associated macro name, if set, otherwise zero length string. */
+ inline const String& GetMacroName() const { return maMacroName; }
+
+@@ -860,7 +860,8 @@ class XclImpPictureObj : public XclImpRectObj, public XclImpControlHelper
+ {
+ public:
+ explicit XclImpPictureObj( const XclImpRoot& rRoot );
+-
++ /** Returns the ObjectName - can use non-obvious lookup for override in the associated vba document module stream**/
++ virtual String GetObjName() const;
+ /** Returns the graphic imported from the IMGDATA record. */
+ inline const Graphic& GetGraphic() const { return maGraphic; }
+ /** Returns the visible area of the imported graphic. */
+@@ -891,7 +892,6 @@ protected:
+ virtual SdrObject* DoCreateSdrObj( const Rectangle& rAnchorRect, ScfProgressBar& rProgress ) const;
+ /** Overloaded to do additional processing on the SdrObject. */
+ virtual void DoProcessSdrObj( SdrObject& rSdrObj ) const;
+-
+ private:
+ /** Reads and sets the picture flags from a BIFF3-BIFF5 OBJ picture record. */
+ void ReadFlags3( XclImpStream& rStrm );
diff --git a/patches/vba/vba-fix-selection-dot-inproject.diff b/patches/vba/vba-fix-selection-dot-inproject.diff
new file mode 100644
index 0000000..cbfd285
--- /dev/null
+++ b/patches/vba/vba-fix-selection-dot-inproject.diff
@@ -0,0 +1,176 @@
+diff --git basic/source/runtime/stdobj.cxx basic/source/runtime/stdobj.cxx
+index 38ba7cd..4c8c807 100644
+--- basic/source/runtime/stdobj.cxx
++++ basic/source/runtime/stdobj.cxx
+@@ -73,6 +73,45 @@ struct Methods {
+ USHORT nHash; // Hashcode
+ };
+
++struct StringHashCode
++{
++ size_t operator()( const String& rStr ) const
++ {
++ return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
++ }
++};
++
++class VBABlacklist
++{
++friend class VBABlackListQuery;
++ std::hash_map< String, bool, StringHashCode > mBlackList;
++ VBABlacklist()
++ {
++ const char* list[] = { "Red" };
++ sal_Int32 nSize = sizeof( list ) / sizeof( list[ 0 ] );
++ for ( sal_Int32 index = 0; index < nSize; ++index )
++ {
++ mBlackList[ String::CreateFromAscii( list[ index ] ).ToLowerAscii() ] = true;
++ }
++ }
++public:
++ bool isBlackListed( const String& sName )
++ {
++ String sNameLower( sName );
++ sNameLower.ToLowerAscii();
++ return ( mBlackList.find( sNameLower ) != mBlackList.end() );
++ }
++};
++
++class VBABlackListQuery
++{
++public:
++ static bool isBlackListed( const String& sName )
++ {
++ static VBABlacklist blackList;
++ return blackList.isBlackListed( sName );
++ }
++};
+ static Methods aMethods[] = {
+
+ { "AboutStarBasic", SbxNULL, 1 | _FUNCTION, RTLNAME(AboutStarBasic),0 },
+@@ -759,13 +798,15 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
+ && ( p->nHash == nHash_ )
+ && ( rName.EqualsIgnoreCaseAscii( p->pName ) ) )
+ {
++ SbiInstance* pInst = pINST;
+ bFound = TRUE;
+ if( p->nArgs & _COMPTMASK )
+ {
+- SbiInstance* pInst = pINST;
+ if( !pInst || !pInst->IsCompatibility() )
+ bFound = FALSE;
+ }
++ if ( pInst && pInst->IsCompatibility() && VBABlackListQuery::isBlackListed( rName ) )
++ bFound = FALSE;
+ break;
+ }
+ nIndex += ( p->nArgs & _ARGSMASK ) + 1;
+diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
+index d09c699..7ba906e 100644
+--- sc/source/ui/vba/vbarange.cxx
++++ sc/source/ui/vba/vbarange.cxx
+@@ -2555,8 +2555,6 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
+
+ uno::Reference< frame::XModel > xModel( ( pShell ? pShell->GetModel() : NULL ), uno::UNO_QUERY_THROW );
+ uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
+- // save old selection
+- uno::Reference< uno::XInterface > xSel( xModel->getCurrentSelection() );
+ // select this range
+ xSelection->select( uno::makeAny( mxRange ) );
+ // set up defaults
+@@ -2577,8 +2575,6 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
+ USHORT nFlags = getPasteFlags(nPaste);
+ USHORT nFormulaBits = getPasteFormulaBits(nOperation);
+ excel::implnPasteSpecial(pShell->GetModel(), nFlags,nFormulaBits,bSkipBlanks,bTranspose);
+- // restore selection
+- xSelection->select( uno::makeAny( xSel ) );
+ }
+
+ uno::Reference< excel::XRange >
+diff --git scripting/source/basprov/basprov.cxx scripting/source/basprov/basprov.cxx
+index 562e605..562a8e5 100644
+--- scripting/source/basprov/basprov.cxx
++++ scripting/source/basprov/basprov.cxx
+@@ -374,7 +374,33 @@ namespace basprov
+ ::rtl::OUString::createFromAscii( "location" ) );
+
+ sal_Int32 nIndex = 0;
+- ::rtl::OUString aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
++ // In some strange circumstances the Library name can have an
++ // apparantly illegal '.' in it ( in imported VBA )
++
++ BasicManager* pBasicMgr = NULL;
++ if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) )
++ {
++ pBasicMgr = m_pDocBasicManager;
++ }
++ else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) )
++ {
++ pBasicMgr = m_pAppBasicManager;
++ }
++ rtl::OUString sProjectName;
++ if ( pBasicMgr )
++ sProjectName = pBasicMgr->GetName();
++
++ ::rtl::OUString aLibrary;
++ if ( sProjectName.getLength() && aDescription.match( sProjectName ) )
++ {
++ OSL_TRACE("LibraryName %s is part of the url %s",
++ rtl::OUStringToOString( sProjectName, RTL_TEXTENCODING_UTF8 ).getStr(),
++ rtl::OUStringToOString( aDescription, RTL_TEXTENCODING_UTF8 ).getStr() );
++ aLibrary = sProjectName;
++ nIndex = sProjectName.getLength() + 1;
++ }
++ else
++ aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
+ ::rtl::OUString aModule;
+ if ( nIndex != -1 )
+ aModule = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
+@@ -384,15 +410,6 @@ namespace basprov
+
+ if ( aLibrary.getLength() != 0 && aModule.getLength() != 0 && aMethod.getLength() != 0 && aLocation.getLength() != 0 )
+ {
+- BasicManager* pBasicMgr = NULL;
+- if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) )
+- {
+- pBasicMgr = m_pDocBasicManager;
+- }
+- else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) )
+- {
+- pBasicMgr = m_pAppBasicManager;
+- }
+
+ if ( pBasicMgr )
+ {
+diff --git svx/source/msfilter/msvbahelper.cxx svx/source/msfilter/msvbahelper.cxx
+index d02746f..cf66309 100644
+--- svx/source/msfilter/msvbahelper.cxx
++++ svx/source/msfilter/msvbahelper.cxx
+@@ -98,7 +98,17 @@ SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath )
+ }
+ else
+ {
+- if ( aURL.equals( xModel->getURL() ) )
++ // sometimes just the name of the document ( without the path
++ // is used
++ bool bDocNameNoPathMatch = false;
++ if ( aURL.getLength() && aURL.indexOf( '/' ) == -1 )
++ {
++ sal_Int32 lastSlashIndex = xModel->getURL().lastIndexOf( '/' );
++ if ( lastSlashIndex > -1 )
++ bDocNameNoPathMatch = xModel->getURL().copy( lastSlashIndex + 1 ).equals( aURL );
++ }
++
++ if ( aURL.equals( xModel->getURL() ) || bDocNameNoPathMatch )
+ {
+ pFoundShell = pShell;
+ break;
+@@ -207,7 +217,7 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin
+ OSL_TRACE("doc search, current shell is 0x%x", pShell );
+ SfxObjectShell* pFoundShell = findShellForUrl( sDocUrlOrPath );
+ OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell );
+- aRes = resolveVBAMacro( pFoundShell, sMacroUrl );
++ return resolveVBAMacro( pFoundShell, sMacroUrl );
+ }
+ else
+ {
More information about the ooo-build-commit
mailing list