diff options
author | Noel Grandin <noel@peralex.com> | 2013-01-11 13:12:07 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-01-28 08:25:24 +0200 |
commit | 77856e81ce4d279f00d0f92e917099f4f5220034 (patch) | |
tree | b2d006504cb2cb4cf678877de5a27f1b1dbc862a /sw | |
parent | fdo#46808, don't cache the result of comphelper::getProcessComponentContext (diff) | |
download | core-77856e81ce4d279f00d0f92e917099f4f5220034.tar.gz core-77856e81ce4d279f00d0f92e917099f4f5220034.zip |
fdo#46808, Adapt document::*PropertyValues UNO service to new style
The services are:
document::NamedPropertyValues
document::IndexedPropertyValues
The services already existed, they just did not have IDL files
Change-Id: Ibafe9b5afb9b30785df4f66aa923f4b96ceabeed
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8toolbar.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/xml/swxml.cxx | 17 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexp.cxx | 18 |
4 files changed, 14 insertions, 30 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 6cabcbd54e95..fdef14c3dc35 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -91,6 +91,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XViewDataSupplier.hpp> +#include <com/sun/star/document/IndexedPropertyValues.hpp> #include <svl/itemiter.hxx> //SfxItemIter #include <comphelper/processfactory.hxx> @@ -1504,8 +1505,7 @@ void SwWW8ImplReader::ImportDop() aViewProps[2].Value <<= sal_Int16(0); uno::Reference< uno::XComponentContext > xComponentContext(comphelper::getProcessComponentContext()); - uno::Reference<container::XIndexContainer> xBox(xComponentContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.IndexedPropertyValues", - xComponentContext), uno::UNO_QUERY); + uno::Reference<container::XIndexContainer> xBox = document::IndexedPropertyValues::create(xComponentContext); xBox->insertByIndex(sal_Int32(0), uno::makeAny(aViewProps)); uno::Reference<container::XIndexAccess> xIndexAccess(xBox, uno::UNO_QUERY); uno::Reference<document::XViewDataSupplier> xViewDataSupplier(mpDocShell->GetModel(), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx index 5d8c5028458f..f74857bd6fde 100644 --- a/sw/source/filter/ww8/ww8toolbar.cxx +++ b/sw/source/filter/ww8/ww8toolbar.cxx @@ -32,6 +32,7 @@ #include "ww8scan.hxx" #include <rtl/ustrbuf.hxx> #include <stdarg.h> +#include <com/sun/star/document/IndexedPropertyValues.hpp> #include <com/sun/star/ui/XUIConfigurationPersistence.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -731,9 +732,7 @@ SwTBC::ImportToolBarControl( SwCTBWrapper& rWrapper, const css::uno::Reference< SwCTB* pCustTB = rWrapper.GetCustomizationData( pMenu->Name() ); if ( pCustTB ) { - uno::Reference< container::XIndexContainer > xMenuDesc; - uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - xMenuDesc.set( xMSF->createInstance( "com.sun.star.document.IndexedPropertyValues" ), uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexContainer > xMenuDesc = document::IndexedPropertyValues::create( comphelper::getProcessComponentContext() ); if ( !pCustTB->ImportMenuTB( rWrapper,xMenuDesc, helper ) ) return false; if ( !bIsMenuBar ) diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index 84a49a34ba45..736a5a8baea0 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/io/XActiveDataControl.hpp> #include <com/sun/star/text/XTextRange.hpp> #include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/document/NamedPropertyValues.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/NamedValue.hpp> @@ -514,10 +515,8 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con // Get service factory uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - OSL_ENSURE( xServiceFactory.is(), - "XMLReader::Read: got no service manager" ); - if( !xServiceFactory.is() ) - return ERR_SWG_READ_ERROR; + uno::Reference< uno::XComponentContext > xContext = + comphelper::getProcessComponentContext(); uno::Reference< io::XActiveDataSource > xSource; uno::Reference< XInterface > xPipe; @@ -696,9 +695,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con OUString sProgressRange(RTL_CONSTASCII_USTRINGPARAM("ProgressRange")); xInfoSet->setPropertyValue(sProgressRange, aProgRange); - ::comphelper::ComponentContext aContext( xServiceFactory ); - Reference< container::XNameAccess > xLateInitSettings( - aContext.createComponent( "com.sun.star.document.NamedPropertyValues" ), UNO_QUERY_THROW ); + Reference< container::XNameAccess > xLateInitSettings( document::NamedPropertyValues::create(xContext), UNO_QUERY_THROW ); beans::NamedValue aLateInitSettings( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LateInitSettings" ) ), makeAny( xLateInitSettings ) @@ -872,7 +869,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(xModelComp, uno::UNO_QUERY_THROW); const uno::Reference<rdf::XURI> xBaseURI( ::sfx2::createBaseURI( - aContext.getUNOContext(), xStorage, aBaseURL, StreamPath) ); + xContext, xStorage, aBaseURL, StreamPath) ); const uno::Reference<task::XInteractionHandler> xHandler( pDocSh->GetMedium()->GetInteractionHandler() ); xDMA->loadMetadataFromStorage(xStorage, xBaseURI, xHandler); @@ -1054,10 +1051,8 @@ size_t XMLReader::GetSectionList( SfxMedium& rMedium, comphelper::getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - OSL_ENSURE( xServiceFactory.is(), - "XMLReader::Read: got no service manager" ); uno::Reference < embed::XStorage > xStg2; - if( xServiceFactory.is() && ( xStg2 = rMedium.GetStorage() ).is() ) + if( ( xStg2 = rMedium.GetStorage() ).is() ) { try { diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 578269fd47c1..7148709f854d 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/document/IndexedPropertyValues.hpp> #include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/xforms/XFormsSupplier.hpp> @@ -367,25 +368,14 @@ void SwXMLExport::_ExportFontDecls() #define NUM_EXPORTED_VIEW_SETTINGS 11 void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps) { - Reference< XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); - OSL_ENSURE( xServiceFactory.is(), - "XMLReader::Read: got no service manager" ); - if( !xServiceFactory.is() ) - return; - aProps.realloc( NUM_EXPORTED_VIEW_SETTINGS ); // Currently exporting 9 properties PropertyValue *pValue = aProps.getArray(); sal_Int32 nIndex = 0; - Reference < XIndexContainer > xBox (xServiceFactory->createInstance - (OUString( RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.document.IndexedPropertyValues") ) ), UNO_QUERY); - if (xBox.is() ) - { - pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "Views") ); - pValue[nIndex++].Value <<= Reference < XIndexAccess > ( xBox, UNO_QUERY ); - } + Reference < XIndexContainer > xBox = IndexedPropertyValues::create( comphelper::getProcessComponentContext() ); + pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "Views") ); + pValue[nIndex++].Value <<= Reference < XIndexAccess > ( xBox, UNO_QUERY ); Reference < XText > xText; SwXText *pText = 0; |