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 /sc | |
parent | ce1b932bba8f90363399a9fa6515b91d7d679efa (diff) |
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 'sc')
-rw-r--r-- | sc/source/filter/excel/xltoolbar.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/oox/viewsettings.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 56 |
4 files changed, 42 insertions, 52 deletions
diff --git a/sc/source/filter/excel/xltoolbar.cxx b/sc/source/filter/excel/xltoolbar.cxx index 2bb994e379fb..cfc058e0bbe1 100644 --- a/sc/source/filter/excel/xltoolbar.cxx +++ b/sc/source/filter/excel/xltoolbar.cxx @@ -31,6 +31,7 @@ #include "xltoolbar.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> @@ -293,9 +294,7 @@ bool ScTBC::ImportToolBarControl( ScCTBWrapper& rWrapper, const css::uno::Refere ScCTB* 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( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "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 ( !bIsMenuToolbar ) diff --git a/sc/source/filter/oox/viewsettings.cxx b/sc/source/filter/oox/viewsettings.cxx index d3d86219c6c4..40c50db9362d 100644 --- a/sc/source/filter/oox/viewsettings.cxx +++ b/sc/source/filter/oox/viewsettings.cxx @@ -24,7 +24,9 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/document/IndexedPropertyValues.hpp> #include <com/sun/star/document/XViewDataSupplier.hpp> +#include <com/sun/star/document/NamedPropertyValues.hpp> #include <comphelper/mediadescriptor.hxx> #include "oox/core/filterbase.hxx" #include "oox/helper/attributelist.hxx" @@ -579,7 +581,7 @@ void ViewSettings::finalizeImport() sal_Int16 nShowMode = getWorkbookSettings().getApiShowObjectMode(); // view settings for all sheets - Reference< XNameContainer > xSheetsNC = ContainerHelper::createNameContainer( getBaseFilter().getComponentContext() ); + Reference< XNameContainer > xSheetsNC = NamedPropertyValues::create( getBaseFilter().getComponentContext() ); if( !xSheetsNC.is() ) return; for( SheetPropertiesMap::const_iterator aIt = maSheetProps.begin(), aEnd = maSheetProps.end(); aIt != aEnd; ++aIt ) ContainerHelper::insertByName( xSheetsNC, rWorksheets.getCalcSheetName( aIt->first ), aIt->second ); @@ -591,7 +593,7 @@ void ViewSettings::finalizeImport() if( !rxActiveSheetView ) rxActiveSheetView.reset( new SheetViewModel ); - Reference< XIndexContainer > xContainer = ContainerHelper::createIndexContainer( getBaseFilter().getComponentContext() ); + Reference< XIndexContainer > xContainer = IndexedPropertyValues::create( getBaseFilter().getComponentContext() ); if( xContainer.is() ) try { PropertyMap aPropMap; diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index a501a32b8666..1e174bbfc8b4 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> #include <com/sun/star/document/XDocumentEventBroadcaster.hpp> +#include <com/sun/star/document/IndexedPropertyValues.hpp> #include <com/sun/star/script/XInvocation.hpp> #include <com/sun/star/script/vba/XVBAEventProcessor.hpp> #include <comphelper/processfactory.hxx> @@ -1560,21 +1561,17 @@ uno::Reference< container::XIndexAccess > SAL_CALL ScModelObj::getViewData( ) SolarMutexGuard aGuard; if (pDocShell && pDocShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED) { - xRet.set(uno::Reference < container::XIndexAccess >::query(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues"))))); - - uno::Reference < container::XIndexContainer > xCont( xRet, uno::UNO_QUERY ); - OSL_ENSURE( xCont.is(), "ScModelObj::getViewData() failed for OLE object" ); - if( xCont.is() ) - { - uno::Sequence< beans::PropertyValue > aSeq; - aSeq.realloc(1); - rtl::OUString sName; - pDocShell->GetDocument()->GetName( pDocShell->GetDocument()->GetVisibleTab(), sName ); - rtl::OUString sOUName(sName); - aSeq[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ACTIVETABLE)); - aSeq[0].Value <<= sOUName; - xCont->insertByIndex( 0, uno::makeAny( aSeq ) ); - } + uno::Reference < container::XIndexContainer > xCont = document::IndexedPropertyValues::create( ::comphelper::getProcessComponentContext() ); + xRet.set( xCont, uno::UNO_QUERY_THROW ); + + uno::Sequence< beans::PropertyValue > aSeq; + aSeq.realloc(1); + rtl::OUString sName; + pDocShell->GetDocument()->GetName( pDocShell->GetDocument()->GetVisibleTab(), sName ); + rtl::OUString sOUName(sName); + aSeq[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ACTIVETABLE)); + aSeq[0].Value <<= sOUName; + xCont->insertByIndex( 0, uno::makeAny( aSeq ) ); } } diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index c1ce5ff2dc65..f727b7562bc1 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -62,6 +62,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> #include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/document/NamedPropertyValues.hpp> using namespace com::sun::star; @@ -2628,44 +2629,35 @@ void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSe static_cast<sal_Int32>(nViewID)); pSettings[SC_VIEW_ID].Value <<= sBuffer.makeStringAndClear(); - uno::Reference<lang::XMultiServiceFactory> xServiceFactory = - comphelper::getProcessServiceFactory(); - OSL_ENSURE( xServiceFactory.is(), "got no service manager" ); - if( xServiceFactory.is() ) + uno::Reference<container::XNameContainer> xNameContainer = + document::NamedPropertyValues::create( comphelper::getProcessComponentContext() ); + for (SCTAB nTab=0; nTab<static_cast<SCTAB>(maTabData.size()); nTab++) { - rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.NamedPropertyValues")); - uno::Reference<container::XNameContainer> xNameContainer = uno::Reference<container::XNameContainer>(xServiceFactory->createInstance(sName), uno::UNO_QUERY); - if (xNameContainer.is()) + if (maTabData[nTab]) { - for (SCTAB nTab=0; nTab<static_cast<SCTAB>(maTabData.size()); nTab++) + uno::Sequence <beans::PropertyValue> aTableViewSettings; + maTabData[nTab]->WriteUserDataSequence(aTableViewSettings, *this, nTab); + rtl::OUString sTabName; + GetDocument()->GetName( nTab, sTabName ); + uno::Any aAny; + aAny <<= aTableViewSettings; + try { - if (maTabData[nTab]) - { - uno::Sequence <beans::PropertyValue> aTableViewSettings; - maTabData[nTab]->WriteUserDataSequence(aTableViewSettings, *this, nTab); - rtl::OUString sTabName; - GetDocument()->GetName( nTab, sTabName ); - uno::Any aAny; - aAny <<= aTableViewSettings; - try - { - xNameContainer->insertByName(sTabName, aAny); - } - //#101739#; two tables with the same name are possible - catch ( container::ElementExistException& ) - { - OSL_FAIL("seems there are two tables with the same name"); - } - catch ( uno::RuntimeException& ) - { - OSL_FAIL("something went wrong"); - } - } + xNameContainer->insertByName(sTabName, aAny); + } + //#101739#; two tables with the same name are possible + catch ( container::ElementExistException& ) + { + OSL_FAIL("seems there are two tables with the same name"); + } + catch ( uno::RuntimeException& ) + { + OSL_FAIL("something went wrong"); } - pSettings[SC_TABLE_VIEWSETTINGS].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_TABLES)); - pSettings[SC_TABLE_VIEWSETTINGS].Value <<= xNameContainer; } } + pSettings[SC_TABLE_VIEWSETTINGS].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_TABLES)); + pSettings[SC_TABLE_VIEWSETTINGS].Value <<= xNameContainer; rtl::OUString sName; GetDocument()->GetName( nTabNo, sName ); |