summaryrefslogtreecommitdiff
path: root/sc/source/ui/view
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-01-11 13:12:07 +0200
committerNoel Grandin <noel@peralex.com>2013-01-28 08:25:24 +0200
commit77856e81ce4d279f00d0f92e917099f4f5220034 (patch)
treeb2d006504cb2cb4cf678877de5a27f1b1dbc862a /sc/source/ui/view
parentce1b932bba8f90363399a9fa6515b91d7d679efa (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/source/ui/view')
-rw-r--r--sc/source/ui/view/viewdata.cxx56
1 files changed, 24 insertions, 32 deletions
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 );