diff options
Diffstat (limited to 'filter/source')
-rw-r--r-- | filter/source/config/cache/lateinitthread.cxx | 5 | ||||
-rw-r--r-- | filter/source/config/cache/lateinitthread.hxx | 2 | ||||
-rw-r--r-- | filter/source/config/cache/typedetection.cxx | 9 | ||||
-rw-r--r-- | filter/source/msfilter/msvbahelper.cxx | 27 | ||||
-rw-r--r-- | filter/source/msfilter/svxmsbas.cxx | 10 |
5 files changed, 39 insertions, 14 deletions
diff --git a/filter/source/config/cache/lateinitthread.cxx b/filter/source/config/cache/lateinitthread.cxx index 13432c30ad0f..1cae15996876 100644 --- a/filter/source/config/cache/lateinitthread.cxx +++ b/filter/source/config/cache/lateinitthread.cxx @@ -76,5 +76,10 @@ void SAL_CALL LateInitThread::run() rCache->load(FilterCache::E_CONTAINS_ALL, sal_True); } +void SAL_CALL LateInitThread::onTerminated() +{ + delete this; +} + } // namespace config } // namespace filter diff --git a/filter/source/config/cache/lateinitthread.hxx b/filter/source/config/cache/lateinitthread.hxx index c330394d434d..b37d0525dd4b 100644 --- a/filter/source/config/cache/lateinitthread.hxx +++ b/filter/source/config/cache/lateinitthread.hxx @@ -81,6 +81,8 @@ class LateInitThread : public ::osl::Thread /** @short thread function. */ virtual void SAL_CALL run(); + + virtual void SAL_CALL onTerminated(); }; } // namespace config diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index 4fe9a1df64e6..418c95f0f819 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -1103,12 +1103,11 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript try { // create a new request to ask user for it's decision about the usable filter - ::framework::RequestFilterSelect* pRequest = new ::framework::RequestFilterSelect(sURL); - css::uno::Reference< css::task::XInteractionRequest > xRequest(static_cast< css::task::XInteractionRequest* >(pRequest), css::uno::UNO_QUERY_THROW); - xInteraction->handle(xRequest); + ::framework::RequestFilterSelect aRequest(sURL); + xInteraction->handle(aRequest.GetRequest()); // "Cancel" pressed? => return with error - if (pRequest->isAbort()) + if (aRequest.isAbort()) return ::rtl::OUString(); // "OK" pressed => verify the selected filter, get it's coressponding @@ -1117,7 +1116,7 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript // a type here only. But we must be shure, that the selected filter is used // too and no ambigous filter registration disturb us .-) - ::rtl::OUString sFilter = pRequest->getFilter(); + ::rtl::OUString sFilter = aRequest.getFilter(); if (!impl_validateAndSetFilterOnDescriptor(rDescriptor, sFilter)) return ::rtl::OUString(); diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 19e93dbb791a..e40c3c2c61c2 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -92,6 +92,24 @@ SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath ) , rtl::OUStringToOString( xModel->getURL(), RTL_TEXTENCODING_UTF8 ).getStr() , rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() ); + ::rtl::OUString aName = xModel->getURL() ; + if (0 == aName.getLength()) + { + + const static rtl::OUString sTitle( RTL_CONSTASCII_USTRINGPARAM("Title" ) ); + uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); + xProps->getPropertyValue(sTitle) >>= aName; + sal_Int32 pos = 0; + aName = aName.getToken(0,'-',pos); + aName = aName.trim(); + if( sMacroURLOrPath.lastIndexOf( aName ) >= 0 ) + { + pFoundShell = pShell; + break; + } + } + if ( sMacroURLOrPath.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) ) { uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( xModel, uno::UNO_QUERY ); @@ -261,10 +279,13 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin // macro format = Container.Module.Procedure parseMacro( sMacroUrl, sContainer, sModule, sProcedure ); - uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY); uno::Reference< container::XNameContainer > xPrjNameCache; - if ( xSF.is() ) - xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY ); + + // As long as service VBAProjectNameProvider isn't supported in the model, disable the createInstance call + // (the ServiceNotRegisteredException is wrongly caught in ScModelObj::createInstance) + //uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY); + //if ( xSF.is() ) + // xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY ); std::vector< rtl::OUString > sSearchList; diff --git a/filter/source/msfilter/svxmsbas.cxx b/filter/source/msfilter/svxmsbas.cxx index 5214b2d022c3..d17af3b2681b 100644 --- a/filter/source/msfilter/svxmsbas.cxx +++ b/filter/source/msfilter/svxmsbas.cxx @@ -252,14 +252,12 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName, Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer(); DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" ); + /* Set library container to VBA compatibility mode. This will create + the VBA Globals object and store it in the Basic manager of the + document. */ 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" ) ) ); + Reference< vba::XVBACompatibility >( xLibContainer, UNO_QUERY_THROW )->setVBACompatibilityMode( sal_True ); } catch( Exception& ) { |