diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 70 | ||||
-rw-r--r-- | sfx2/source/doc/doctempl.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 10 |
3 files changed, 34 insertions, 55 deletions
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 8e0d05b68635..4d830dcc9e2c 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -648,10 +648,8 @@ SfxDocumentMetaData::getURLProperties( "com.sun.star.beans.PropertyBag"), m_xContext), css::uno::UNO_QUERY_THROW); try { - OUString dburl = - OUString("DocumentBaseURL"); - OUString hdn = - OUString("HierarchicalDocumentName"); + OUString dburl("DocumentBaseURL"); + OUString hdn("HierarchicalDocumentName"); for (sal_Int32 i = 0; i < i_rMedium.getLength(); ++i) { if (i_rMedium[i].Name.equals(dburl)) { xPropArg->addProperty( @@ -682,8 +680,7 @@ getNodeText(css::uno::Reference<css::xml::dom::XNode> i_xNode) throw (css::uno::RuntimeException) { if (!i_xNode.is()) throw css::uno::RuntimeException( - OUString( - "SfxDocumentMetaData::getNodeText: argument is null"), i_xNode); + OUString("SfxDocumentMetaData::getNodeText: argument is null"), i_xNode); for (css::uno::Reference<css::xml::dom::XNode> c = i_xNode->getFirstChild(); c.is(); c = c->getNextSibling()) { @@ -762,8 +759,7 @@ SfxDocumentMetaData::setMetaText(const char* i_name, } catch (const css::xml::dom::DOMException & e) { css::uno::Any a(e); throw css::lang::WrappedTargetRuntimeException( - OUString( - "SfxDocumentMetaData::setMetaText: DOM exception"), + OUString("SfxDocumentMetaData::setMetaText: DOM exception"), css::uno::Reference<css::uno::XInterface>(*this), a); } } @@ -899,8 +895,7 @@ SfxDocumentMetaData::setMetaList(const char* i_name, } catch (const css::xml::dom::DOMException & e) { css::uno::Any a(e); throw css::lang::WrappedTargetRuntimeException( - OUString( - "SfxDocumentMetaData::setMetaList: DOM exception"), + OUString("SfxDocumentMetaData::setMetaList: DOM exception"), css::uno::Reference<css::uno::XInterface>(*this), a); } } @@ -1040,8 +1035,7 @@ SfxDocumentMetaData::updateElement(const char *i_name, } catch (const css::xml::dom::DOMException & e) { css::uno::Any a(e); throw css::lang::WrappedTargetRuntimeException( - OUString( - "SfxDocumentMetaData::updateElement: DOM exception"), + OUString("SfxDocumentMetaData::updateElement: DOM exception"), css::uno::Reference<css::uno::XInterface>(*this), a); } } @@ -1141,8 +1135,7 @@ void SAL_CALL SfxDocumentMetaData::init( css::uno::Reference<css::xml::dom::XDocument> i_xDoc) { if (!i_xDoc.is()) throw css::uno::RuntimeException( - OUString( - "SfxDocumentMetaData::init: no DOM tree given"), *this); + OUString("SfxDocumentMetaData::init: no DOM tree given"), *this); css::uno::Reference<css::xml::xpath::XXPathAPI> xPath = css::xml::xpath::XPathAPI::create(m_xContext); @@ -1220,8 +1213,7 @@ void SAL_CALL SfxDocumentMetaData::init( } catch (const css::xml::dom::DOMException & e) { css::uno::Any a(e); throw css::lang::WrappedTargetRuntimeException( - OUString( - "SfxDocumentMetaData::init: DOM exception"), + OUString("SfxDocumentMetaData::init: DOM exception"), css::uno::Reference<css::uno::XInterface>(*this), a); } } @@ -1703,9 +1695,8 @@ SfxDocumentMetaData::setAutoloadSecs(::sal_Int32 the_value) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException) { if (the_value < 0) throw css::lang::IllegalArgumentException( - OUString( - "SfxDocumentMetaData::setAutoloadSecs: argument is negative"), - *this, 0); + OUString("SfxDocumentMetaData::setAutoloadSecs: argument is negative"), + *this, 0); ::osl::ClearableMutexGuard g(m_aMutex); checkInit(); if (m_AutoloadSecs != the_value) { @@ -1817,9 +1808,8 @@ SfxDocumentMetaData::setEditingCycles(::sal_Int16 the_value) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException) { if (the_value < 0) throw css::lang::IllegalArgumentException( - OUString( - "SfxDocumentMetaData::setEditingCycles: argument is negative"), - *this, 0); + OUString("SfxDocumentMetaData::setEditingCycles: argument is negative"), + *this, 0); OUStringBuffer buf; ::sax::Converter::convertNumber(buf, the_value); setMetaTextAndNotify("meta:editing-cycles", buf.makeStringAndClear()); @@ -1837,9 +1827,8 @@ SfxDocumentMetaData::setEditingDuration(::sal_Int32 the_value) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException) { if (the_value < 0) throw css::lang::IllegalArgumentException( - OUString( - "SfxDocumentMetaData::setEditingDuration: argument is negative"), - *this, 0); + OUString("SfxDocumentMetaData::setEditingDuration: argument is negative"), + *this, 0); setMetaTextAndNotify("meta:editing-duration", durationToText(the_value)); } @@ -1891,8 +1880,7 @@ SfxDocumentMetaData::loadFromStorage( css::lang::WrappedTargetException, css::io::IOException) { if (!xStorage.is()) throw css::lang::IllegalArgumentException( - OUString("SfxDocumentMetaData::loadFromStorage:" - " argument is null"), *this, 0); + OUString("SfxDocumentMetaData::loadFromStorage: argument is null"), *this, 0); ::osl::MutexGuard g(m_aMutex); // open meta data file @@ -2060,8 +2048,7 @@ SfxDocumentMetaData::loadFromMedium(const OUString & URL, throw; } catch (const css::uno::Exception & e) { throw css::lang::WrappedTargetException( - OUString( - "SfxDocumentMetaData::loadFromMedium: exception"), + OUString("SfxDocumentMetaData::loadFromMedium: exception"), css::uno::Reference<css::uno::XInterface>(*this), css::uno::makeAny(e)); } @@ -2185,8 +2172,7 @@ SfxDocumentMetaData::createClone() } catch (const css::uno::Exception & e) { css::uno::Any a(e); throw css::lang::WrappedTargetRuntimeException( - OUString( - "SfxDocumentMetaData::createClone: exception"), + OUString("SfxDocumentMetaData::createClone: exception"), css::uno::Reference<css::uno::XInterface>(*this), a); } return css::uno::Reference<css::util::XCloneable> (pNew); @@ -2314,8 +2300,7 @@ void SfxDocumentMetaData::createUserDefined() m_xContext->getServiceManager()); m_xUserDefined.set( xMsf->createInstanceWithContext( - OUString( - "com.sun.star.beans.PropertyBag"), m_xContext), + OUString("com.sun.star.beans.PropertyBag"), m_xContext), css::uno::UNO_QUERY_THROW); const css::uno::Reference<css::lang::XInitialization> xInit( m_xUserDefined, css::uno::UNO_QUERY); @@ -2347,16 +2332,16 @@ void SfxDocumentMetaData::createUserDefined() namespace comp_CompatWriterDocProps { OUString SAL_CALL _getImplementationName() { - return OUString( - "CompatWriterDocPropsImpl"); -} + return OUString("CompatWriterDocPropsImpl"); + } - css::uno::Sequence< OUString > SAL_CALL _getSupportedServiceNames() - { + css::uno::Sequence< OUString > SAL_CALL _getSupportedServiceNames() + { css::uno::Sequence< rtl::OUString > aServiceNames(1); aServiceNames[ 0 ] = rtl::OUString( "com.sun.star.writer.DocumentProperties" ); return aServiceNames; - } + } + css::uno::Reference< css::uno::XInterface > SAL_CALL _create( const css::uno::Reference< css::uno::XComponentContext > & context) SAL_THROW((css::uno::Exception)) @@ -2366,18 +2351,17 @@ namespace comp_CompatWriterDocProps { } } + namespace comp_SfxDocumentMetaData { OUString SAL_CALL _getImplementationName() { - return OUString( - "SfxDocumentMetaData"); + return OUString("SfxDocumentMetaData"); } css::uno::Sequence< OUString > SAL_CALL _getSupportedServiceNames() { css::uno::Sequence< OUString > s(1); - s[0] = OUString( - "com.sun.star.document.DocumentProperties"); + s[0] = OUString("com.sun.star.document.DocumentProperties"); return s; } diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 4d8ea0724219..ef0dd02b7bba 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/document/XTypeDetection.hpp> +#include <com/sun/star/document/DocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> @@ -105,8 +106,6 @@ using ::std::advance; #define TARGET_DIR_URL "TargetDirURL" #define COMMAND_TRANSFER "transfer" -#define SERVICENAME_DOCINFO "com.sun.star.document.DocumentProperties" - //======================================================================== class RegionData_Impl; @@ -1668,11 +1667,9 @@ sal_Bool SfxDocTemplate_Impl::Construct( ) if ( mbConstructed ) return sal_True; - uno::Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); uno::Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - OUString aService( SERVICENAME_DOCINFO ); - uno::Reference< XPersist > xInfo( xFactory->createInstance( aService ), UNO_QUERY ); + uno::Reference< XPersist > xInfo( document::DocumentProperties::create(xContext), UNO_QUERY ); mxInfo = xInfo; mxTemplates = frame::DocumentTemplates::create(xContext); @@ -1695,7 +1692,7 @@ sal_Bool SfxDocTemplate_Impl::Construct( ) if ( aLongNames.Count() ) maStandardGroup = aLongNames.GetString( 0 ); - Content aTemplRoot( aRootContent, aCmdEnv, comphelper::getProcessComponentContext() ); + Content aTemplRoot( aRootContent, aCmdEnv, xContext ); CreateFromHierarchy( aTemplRoot ); return sal_True; diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index c25faa6a9811..9251b5f11512 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -178,7 +178,7 @@ class SfxDocTplService_Impl { uno::Reference< XMultiServiceFactory > mxFactory; uno::Reference< XCommandEnvironment > maCmdEnv; - uno::Reference<XDocumentProperties> m_xDocProps; + uno::Reference< XDocumentProperties> m_xDocProps; uno::Reference< XTypeDetection > mxType; ::osl::Mutex maMutex; @@ -1809,12 +1809,10 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, try { uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - if ( !xFactory.is() ) - throw uno::RuntimeException(); + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); // get document service name - uno::Reference< frame::XModuleManager2 > xModuleManager( - frame::ModuleManager::create(comphelper::getComponentContext(xFactory)) ); + uno::Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xContext) ); sDocServiceName = xModuleManager->identify( uno::Reference< uno::XInterface >( rStorable, uno::UNO_QUERY ) ); if ( sDocServiceName.isEmpty() ) throw uno::RuntimeException(); @@ -1823,7 +1821,7 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, ::rtl::OUString aFilterName; uno::Reference< lang::XMultiServiceFactory > xConfigProvider = - configuration::theDefaultProvider::get( comphelper::getComponentContext(xFactory) ); + configuration::theDefaultProvider::get( xContext ); uno::Sequence< uno::Any > aArgs( 1 ); beans::PropertyValue aPathProp; |