diff options
Diffstat (limited to 'filter/source')
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 7 | ||||
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 2 | ||||
-rw-r--r-- | filter/source/msfilter/msvbahelper.cxx | 83 | ||||
-rw-r--r-- | filter/source/msfilter/svxmsbas.cxx | 24 |
4 files changed, 71 insertions, 45 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 2ad33b1e6195..805849279e6b 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -2094,6 +2094,13 @@ void ConvertEnhancedCustomShapeEquation( SdrObjCustomShape* pCustoShape, aEquation.nPara[ 0 ] = 1; // hoping that this will not break anything rEquations.push_back( aEquation ); } + catch ( ... ) + { + EnhancedCustomShapeEquation aEquation; // #i112309# EnhancedCustomShape::Parse error + aEquation.nOperation = 0; // not catched on linux platform + aEquation.nPara[ 0 ] = 1; + rEquations.push_back( aEquation ); + } rEquationOrder.push_back( rEquations.size() - 1 ); } // now updating our old equation indices, they are marked with a bit in the hiword of nOperation diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 05411501218e..3f8d632b882b 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -5373,8 +5373,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r aSet.Put( SdrEdgeNode2VertDistItem( n2VertDist ) ); ((SdrEdgeObj*)pRet)->SetEdgeTrackPath( aPoly ); + pRet->SetMergedItemSet( aSet ); } - pRet->SetMergedItemSet( aSet ); } } diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 18ecc5ae6530..19e93dbb791a 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/document/XDocumentInfoSupplier.hpp> #include <tools/urlobj.hxx> #include <osl/file.hxx> +#include <unotools/pathoptions.hxx> using namespace ::com::sun::star; @@ -108,7 +109,24 @@ 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 ( !bDocNameNoPathMatch ) + { + rtl::OUString aTmpName = rtl::OUString::createFromAscii("'") + xModel->getURL().copy( lastSlashIndex + 1 ) + rtl::OUString::createFromAscii("'"); + bDocNameNoPathMatch = aTmpName.equals( aURL ); + } + } + } + + if ( aURL.equals( xModel->getURL() ) || bDocNameNoPathMatch ) { pFoundShell = pShell; break; @@ -221,9 +239,19 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin String sDocUrlOrPath = sMacroUrl.copy( 0, nDocSepIndex ); sMacroUrl = sMacroUrl.copy( nDocSepIndex + 1 ); OSL_TRACE("doc search, current shell is 0x%x", pShell ); - SfxObjectShell* pFoundShell = findShellForUrl( sDocUrlOrPath ); + SfxObjectShell* pFoundShell = NULL; + if( bSearchGlobalTemplates ) + { + SvtPathOptions aPathOpt; + String aAddinPath = aPathOpt.GetAddinPath(); + if( rtl::OUString( sDocUrlOrPath ).indexOf( aAddinPath ) == 0 ) + pFoundShell = pShell; + } + if( pFoundShell == NULL ) + pFoundShell = findShellForUrl( sDocUrlOrPath ); OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell ); - aRes = resolveVBAMacro( pFoundShell, sMacroUrl ); + aRes = resolveVBAMacro( pFoundShell, sMacroUrl, bSearchGlobalTemplates ); + return aRes; } else { @@ -337,14 +365,14 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin break; } } + aRes.SetResolvedMacro( sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 ) ); } - aRes.SetResolvedMacro( sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 ) ); return aRes; } // Treat the args as possible inouts ( convertion at bottom of method ) -sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& /*aRet*/, const uno::Any& aCaller ) +sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet, const uno::Any& /*aCaller*/) { sal_Bool bRes = sal_False; if ( !pShell ) @@ -355,42 +383,25 @@ sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Se uno::Sequence< uno::Any > aOutArgs; try - { - uno::Reference< script::provider::XScriptProvider > xScriptProvider; - uno::Reference< script::provider::XScriptProviderSupplier > xSPS( pShell->GetModel(), uno::UNO_QUERY_THROW ); - - xScriptProvider.set( xSPS->getScriptProvider(), uno::UNO_QUERY_THROW ); - - uno::Reference< script::provider::XScript > xScript( xScriptProvider->getScript( sUrl ), uno::UNO_QUERY_THROW ); - - if ( aCaller.hasValue() ) + { ErrCode nErr( ERRCODE_BASIC_INTERNAL_ERROR ); + if ( pShell ) { - uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY ); - if ( xProps.is() ) + nErr = pShell->CallXScript( sUrl, + aArgs, aRet, aOutArgsIndex, aOutArgs, false ); + sal_Int32 nLen = aOutArgs.getLength(); + // convert any out params to seem like they were inouts + if ( nLen ) { - uno::Sequence< uno::Any > aCallerHack(1); - aCallerHack[ 0 ] = aCaller; - xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) ); + for ( sal_Int32 index=0; index < nLen; ++index ) + { + sal_Int32 nOutIndex = aOutArgsIndex[ index ]; + aArgs[ nOutIndex ] = aOutArgs[ index ]; + } } } - - - xScript->invoke( aArgs, aOutArgsIndex, aOutArgs ); - - sal_Int32 nLen = aOutArgs.getLength(); - // convert any out params to seem like they were inouts - if ( nLen ) - { - for ( sal_Int32 index=0; index < nLen; ++index ) - { - sal_Int32 nOutIndex = aOutArgsIndex[ index ]; - aArgs[ nOutIndex ] = aOutArgs[ index ]; - } - } - - bRes = sal_True; + bRes = ( nErr == ERRCODE_NONE ); } - catch ( uno::Exception& e ) + catch ( uno::Exception& ) { bRes = sal_False; } diff --git a/filter/source/msfilter/svxmsbas.cxx b/filter/source/msfilter/svxmsbas.cxx index 49fd4a7544f3..5214b2d022c3 100644 --- a/filter/source/msfilter/svxmsbas.cxx +++ b/filter/source/msfilter/svxmsbas.cxx @@ -52,8 +52,8 @@ using namespace com::sun::star::awt; #include <com/sun/star/script/XLibraryContainer.hpp> #include <com/sun/star/script/ModuleInfo.hpp> #include <com/sun/star/script/ModuleType.hpp> -#include <com/sun/star/script/XVBAModuleInfo.hpp> -#include <com/sun/star/script/XVBACompat.hpp> +#include <com/sun/star/script/vba/XVBACompatibility.hpp> +#include <com/sun/star/script/vba/XVBAModuleInfo.hpp> using namespace com::sun::star::container; using namespace com::sun::star::script; @@ -250,13 +250,21 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName, { SFX_APP()->EnterBasicCall(); Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer(); - Reference<XVBACompat> xVBACompat( xLibContainer, UNO_QUERY ); - - if ( xVBACompat.is() && !bAsComment ) - xVBACompat->setVBACompatModeOn( sal_True ); - DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" ); + if( !bAsComment ) try + { + Reference< vba::XVBACompatibility > xVBACompat( xLibContainer, UNO_QUERY_THROW ); + xVBACompat->setVBACompatibilityMode( sal_True ); + /* Force creation of the VBAGlobals object, each application will + create the right one and store it at the Basic manager. */ + Reference< XMultiServiceFactory > xFactory( rDocSh.GetModel(), UNO_QUERY_THROW ); + xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) ); + } + catch( Exception& ) + { + } + UINT16 nStreamCount = aVBA.GetNoStreams(); Reference<XNameContainer> xLib; String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); @@ -270,7 +278,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName, } if( xLib.is() ) { - Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY ); + Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY ); Reference< container::XNameAccess > xVBACodeNamedObjectAccess; if ( !bAsComment ) { |