diff options
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 21 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 153 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/core/xmluconv.cxx | 70 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlexp.cxx | 7 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlexp_impl.hxx | 3 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport4.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/forms/layerexport.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/meta/MetaExportComponent.cxx | 91 | ||||
-rw-r--r-- | xmloff/source/meta/xmlversion.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/style/xmlnumfe.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/text/XMLAutoTextEventExport.cxx | 48 | ||||
-rw-r--r-- | xmloff/source/text/XMLAutoTextEventExport.hxx | 2 |
13 files changed, 187 insertions, 235 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index e15819bf91ec..833a3b0f4196 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -1086,7 +1086,7 @@ SchXMLExportHelper_Impl::SchXMLExportHelper_Impl( // #110680# // changed initialisation for msCLSID. Compare the ServiceInfo name with // the known name of the LegacyServiceManager. - Reference<lang::XServiceInfo> xServiceInfo( mrExport.getServiceFactory(), uno::UNO_QUERY ); + Reference<lang::XServiceInfo> xServiceInfo( mrExport.getComponentContext()->getServiceManager(), uno::UNO_QUERY ); DBG_ASSERT( xServiceInfo.is(), "XMultiServiceFactory without xServiceInfo (!)" ); OUString rdbURL = xServiceInfo->getImplementationName(); OUString implLegacyServiceManagerName( "com.sun.star.comp.office.LegacyServiceManager" ); @@ -3626,11 +3626,10 @@ void SchXMLExportHelper_Impl::exportText( const OUString& rText, bool bConvertTa // class SchXMLExport // ======================================== -// #110680# SchXMLExport::SchXMLExport( - const Reference< lang::XMultiServiceFactory >& xServiceFactory, + const Reference< uno::XComponentContext >& xContext, sal_uInt16 nExportFlags ) -: SvXMLExport( util::MeasureUnit::CM, xServiceFactory, +: SvXMLExport( util::MeasureUnit::CM, xContext, ::xmloff::token::XML_CHART, nExportFlags ), maAutoStylePool( *this ), maExportHelper( *this, maAutoStylePool ) @@ -3836,7 +3835,7 @@ Reference< uno::XInterface > SAL_CALL SchXMLExport_createInstance(const Referenc { // #110680# // #103997# removed some flags from EXPORT_ALL - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_ALL ^ ( EXPORT_SETTINGS | EXPORT_MASTERSTYLES | EXPORT_SCRIPTS )); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_ALL ^ ( EXPORT_SETTINGS | EXPORT_MASTERSTYLES | EXPORT_SCRIPTS )); } // Oasis format @@ -3855,7 +3854,7 @@ OUString SAL_CALL SchXMLExport_Oasis_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { // #103997# removed some flags from EXPORT_ALL - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), (EXPORT_ALL ^ ( EXPORT_SETTINGS | EXPORT_MASTERSTYLES | EXPORT_SCRIPTS )) | EXPORT_OASIS ); } @@ -3878,7 +3877,7 @@ OUString SAL_CALL SchXMLExport_Styles_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Styles_createInstance(const Reference< lang::XMultiServiceFactory >& rSMgr) throw( uno::Exception ) { // #110680# - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_STYLES ); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_STYLES ); } // Oasis format @@ -3896,7 +3895,7 @@ OUString SAL_CALL SchXMLExport_Oasis_Styles_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Styles_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_STYLES | EXPORT_OASIS ); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_STYLES | EXPORT_OASIS ); } // ------------------------------------------------------------ @@ -3916,7 +3915,7 @@ OUString SAL_CALL SchXMLExport_Content_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Content_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { // #110680# - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS ); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS ); } // Oasis format @@ -3934,7 +3933,7 @@ OUString SAL_CALL SchXMLExport_Oasis_Content_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Content_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS | EXPORT_OASIS ); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS | EXPORT_OASIS ); } // ------------------------------------------------------------ @@ -3954,7 +3953,7 @@ OUString SAL_CALL SchXMLExport_Oasis_Meta_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Meta_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_META | EXPORT_OASIS ); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_META | EXPORT_OASIS ); } diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 94e145412a34..3d0f92342b14 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -81,6 +81,7 @@ #include <unotools/configmgr.hxx> #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XMLOasisBasicExporter.hpp> #include <com/sun/star/embed/XEncryptionProtectedSource2.hpp> #include <com/sun/star/rdf/XMetadatable.hpp> #include "RDFaExportHelper.hxx" @@ -204,7 +205,7 @@ void SettingsExportFacade::Characters( const ::rtl::OUString& i_rCharacters ) Reference< XComponentContext > SettingsExportFacade::GetComponentContext() const { - return comphelper::getComponentContext( m_rExport.getServiceFactory() ); + return m_rExport.getComponentContext(); } //============================================================================== @@ -441,13 +442,13 @@ void SvXMLExport::_DetermineModelType() SvXMLExport::SvXMLExport( sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, - const uno::Reference< lang::XMultiServiceFactory >& xServiceFactory, + const uno::Reference< uno::XComponentContext >& xContext, const enum XMLTokenEnum eClass, sal_uInt16 nExportFlags ) : mpImpl( new SvXMLExport_Impl ), - mxServiceFactory(xServiceFactory), + m_xContext(xContext), mpAttrList( new SvXMLAttributeList ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter(getServiceFactory(), + mpUnitConv( new SvXMLUnitConverter( xContext, util::MeasureUnit::MM_100TH, eDefaultMeasureUnit) ), mpNumExport(0L), mpProgressBarHelper( NULL ), @@ -461,23 +462,23 @@ SvXMLExport::SvXMLExport( msWS( GetXMLToken(XML_WS) ), mbSaveLinkedSections(sal_True) { - DBG_ASSERT( mxServiceFactory.is(), "got no service manager" ); + DBG_ASSERT( xContext.is(), "got no service manager" ); _InitCtor(); } SvXMLExport::SvXMLExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, const OUString &rFileName, sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, const uno::Reference< xml::sax::XDocumentHandler > & rHandler) : mpImpl( new SvXMLExport_Impl ), - mxServiceFactory(xServiceFactory), + m_xContext(xContext), mxHandler( rHandler ), mxExtHandler( rHandler, uno::UNO_QUERY ), mpAttrList( new SvXMLAttributeList ), msOrigFileName( rFileName ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter(getServiceFactory(), + mpUnitConv( new SvXMLUnitConverter( xContext, util::MeasureUnit::MM_100TH, eDefaultMeasureUnit) ), mpNumExport(0L), mpProgressBarHelper( NULL ), @@ -491,8 +492,8 @@ SvXMLExport::SvXMLExport( msWS( GetXMLToken(XML_WS) ), mbSaveLinkedSections(sal_True) { + DBG_ASSERT( xContext.is(), "got no service manager" ); mpImpl->SetSchemeOf( msOrigFileName ); - DBG_ASSERT( mxServiceFactory.is(), "got no service manager" ); _InitCtor(); if (mxNumberFormatsSupplier.is()) @@ -500,13 +501,13 @@ SvXMLExport::SvXMLExport( } SvXMLExport::SvXMLExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, const OUString &rFileName, const uno::Reference< xml::sax::XDocumentHandler > & rHandler, const Reference< XModel >& rModel, sal_Int16 const eDefaultFieldUnit) : mpImpl( new SvXMLExport_Impl ), - mxServiceFactory(xServiceFactory), + m_xContext(xContext), mxModel( rModel ), mxHandler( rHandler ), mxExtHandler( rHandler, uno::UNO_QUERY ), @@ -514,7 +515,7 @@ SvXMLExport::SvXMLExport( mpAttrList( new SvXMLAttributeList ), msOrigFileName( rFileName ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter(getServiceFactory(), + mpUnitConv( new SvXMLUnitConverter( xContext, util::MeasureUnit::MM_100TH, SvXMLUnitConverter::GetMeasureUnit(eDefaultFieldUnit)) ), mpNumExport(0L), @@ -529,8 +530,8 @@ SvXMLExport::SvXMLExport( msWS( GetXMLToken(XML_WS) ), mbSaveLinkedSections(sal_True) { + DBG_ASSERT( xContext.is(), "got no service manager" ); mpImpl->SetSchemeOf( msOrigFileName ); - DBG_ASSERT( mxServiceFactory.is(), "got no service manager" ); _InitCtor(); if (mxNumberFormatsSupplier.is()) @@ -1262,55 +1263,50 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) } if( (getExportFlags() & EXPORT_OASIS) == 0 ) { - Reference< lang::XMultiServiceFactory > xFactory = getServiceFactory(); - if( xFactory.is() ) + try { - try + ::comphelper::PropertyMapEntry aInfoMap[] = { - ::comphelper::PropertyMapEntry aInfoMap[] = - { - { "Class", sizeof("Class")-1, 0, - &::getCppuType((::rtl::OUString*)0), - PropertyAttribute::MAYBEVOID, 0}, - { NULL, 0, 0, NULL, 0, 0 } - }; - Reference< XPropertySet > xConvPropSet( - ::comphelper::GenericPropertySet_CreateInstance( - new ::comphelper::PropertySetInfo( aInfoMap ) ) ); - - Any aAny; - aAny <<= GetXMLToken( eClass ); - xConvPropSet->setPropertyValue( - OUString("Class"), aAny ); - - Reference< XPropertySet > xPropSet = - mxExportInfo.is() - ? PropertySetMerger_CreateInstance( mxExportInfo, - xConvPropSet ) - : xConvPropSet; - - Sequence<Any> aArgs( 3 ); - aArgs[0] <<= mxHandler; - aArgs[1] <<= xPropSet; - aArgs[2] <<= mxModel; - - // get filter component - Reference< xml::sax::XDocumentHandler > xTmpDocHandler( - xFactory->createInstanceWithArguments( - OUString("com.sun.star.comp.Oasis2OOoTransformer"), - aArgs), UNO_QUERY); - OSL_ENSURE( xTmpDocHandler.is(), - "can't instantiate OASIS transformer component" ); - if( xTmpDocHandler.is() ) - { - mxHandler = xTmpDocHandler; - mxExtHandler = uno::Reference<xml::sax::XExtendedDocumentHandler>( mxHandler, UNO_QUERY ); - } - } - catch(const com::sun::star::uno::Exception&) + { "Class", sizeof("Class")-1, 0, + &::getCppuType((::rtl::OUString*)0), + PropertyAttribute::MAYBEVOID, 0}, + { NULL, 0, 0, NULL, 0, 0 } + }; + Reference< XPropertySet > xConvPropSet( + ::comphelper::GenericPropertySet_CreateInstance( + new ::comphelper::PropertySetInfo( aInfoMap ) ) ); + + Any aAny; + aAny <<= GetXMLToken( eClass ); + xConvPropSet->setPropertyValue( + OUString("Class"), aAny ); + + Reference< XPropertySet > xPropSet = + mxExportInfo.is() + ? PropertySetMerger_CreateInstance( mxExportInfo, + xConvPropSet ) + : xConvPropSet; + + Sequence<Any> aArgs( 3 ); + aArgs[0] <<= mxHandler; + aArgs[1] <<= xPropSet; + aArgs[2] <<= mxModel; + + // get filter component + Reference< xml::sax::XDocumentHandler > xTmpDocHandler( + m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.Oasis2OOoTransformer", aArgs, m_xContext), + UNO_QUERY); + OSL_ENSURE( xTmpDocHandler.is(), + "can't instantiate OASIS transformer component" ); + if( xTmpDocHandler.is() ) { + mxHandler = xTmpDocHandler; + mxExtHandler = uno::Reference<xml::sax::XExtendedDocumentHandler>( mxHandler, UNO_QUERY ); } } + catch(const com::sun::star::uno::Exception&) + { + } } mxHandler->startDocument(); @@ -1501,32 +1497,13 @@ void SvXMLExport::_ExportScripts() xPSet->getPropertyValue( ::rtl::OUString( "BasicLibraries" ) ); } - Reference< document::XExporter > xExporter; - Reference< lang::XMultiServiceFactory > xMSF( getServiceFactory() ); - if ( xMSF.is() ) - { - Reference < XDocumentHandler > xHdl( new XMLBasicExportFilter( mxHandler ) ); - Sequence < Any > aArgs( 1 ); - aArgs[0] <<= xHdl; - xExporter.set( xMSF->createInstanceWithArguments( - OUString( "com.sun.star.document.XMLOasisBasicExporter" ), aArgs ), - UNO_QUERY ); - } + Reference < XDocumentHandler > xHdl( new XMLBasicExportFilter( mxHandler ) ); + Reference< document::XXMLBasicExporter > xExporter = document::XMLOasisBasicExporter::createWithHandler( m_xContext, xHdl ); - OSL_ENSURE( xExporter.is(), - "SvXMLExport::_ExportScripts: can't instantiate export filter component for Basic macros" ); - - if ( xExporter.is() ) - { - Reference< XComponent > xComp( mxModel, UNO_QUERY ); - xExporter->setSourceDocument( xComp ); - Reference< XFilter > xFilter( xExporter, UNO_QUERY ); - if ( xFilter.is() ) - { - Sequence < PropertyValue > aMediaDesc( 0 ); - xFilter->filter( aMediaDesc ); - } - } + Reference< XComponent > xComp( mxModel, UNO_QUERY ); + xExporter->setSourceDocument( xComp ); + Sequence< PropertyValue > aMediaDesc( 0 ); + xExporter->filter( aMediaDesc ); } // export document events @@ -2144,13 +2121,9 @@ sal_Bool SvXMLExport::ExportEmbeddedOwnObject( Reference< XComponent >& rComp ) } aArgs[0] <<= xHdl; - // #110680# - // Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - Reference< lang::XMultiServiceFactory > xServiceFactory = getServiceFactory(); - Reference< document::XExporter > xExporter( - xServiceFactory->createInstanceWithArguments( sFilterService, aArgs), - UNO_QUERY); + m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(sFilterService, aArgs, m_xContext), + UNO_QUERY); OSL_ENSURE( xExporter.is(), "can't instantiate export filter component for own object" ); if( !xExporter.is() ) @@ -2365,9 +2338,9 @@ void SvXMLExport::DisposingModel() mxEventListener.clear(); } -::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SvXMLExport::getServiceFactory() +::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > SvXMLExport::getComponentContext() { - return mxServiceFactory; + return m_xContext; } ::comphelper::UnoInterfaceToUniqueIdentifierMapper& SvXMLExport::getInterfaceToIdentifierMapper() diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 1db8a015f5f7..bfa39220bee9 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -400,7 +400,7 @@ SvXMLImport::SvXMLImport( : mpImpl( new SvXMLImport_Impl() ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter( xServiceFactory, + mpUnitConv( new SvXMLUnitConverter( comphelper::getComponentContext(xServiceFactory), util::MeasureUnit::MM_100TH, util::MeasureUnit::MM_100TH) ), mpContexts( new SvXMLImportContexts_Impl ), diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx index cb8f1036b8b2..604c0cd6d90b 100644 --- a/xmloff/source/core/xmluconv.cxx +++ b/xmloff/source/core/xmluconv.cxx @@ -37,7 +37,6 @@ #include <com/sun/star/text/DefaultNumberingProvider.hpp> #include <com/sun/star/text/XDefaultNumberingProvider.hpp> #include <com/sun/star/text/XNumberingTypeInfo.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/i18n/CharacterClassification.hpp> #include <com/sun/star/i18n/UnicodeType.hpp> #include <basegfx/vector/b3dvector.hxx> @@ -66,19 +65,19 @@ struct SvXMLUnitConverter::Impl sal_Int16 m_eCoreMeasureUnit; sal_Int16 m_eXMLMeasureUnit; util::Date m_aNullDate; - uno::Reference< text::XNumberingTypeInfo > m_xNumTypeInfo; - uno::Reference< i18n::XCharacterClassification > m_xCharClass; - uno::Reference< lang::XMultiServiceFactory > m_xServiceFactory; + mutable uno::Reference< text::XNumberingTypeInfo > m_xNumTypeInfo; + mutable uno::Reference< i18n::XCharacterClassification > m_xCharClass; + uno::Reference< uno::XComponentContext > m_xContext; - Impl(uno::Reference<lang::XMultiServiceFactory> const& xServiceFactory, + Impl(uno::Reference<uno::XComponentContext> const& xContext, sal_Int16 const eCoreMeasureUnit, sal_Int16 const eXMLMeasureUnit) : m_eCoreMeasureUnit(eCoreMeasureUnit) , m_eXMLMeasureUnit(eXMLMeasureUnit) , m_aNullDate(30, 12, 1899) - , m_xServiceFactory(xServiceFactory) + , m_xContext(xContext) { - OSL_ENSURE( m_xServiceFactory.is(), "got no service manager" ); + OSL_ENSURE( m_xContext.is(), "got no service manager" ); } void createNumTypeInfo() const; @@ -87,13 +86,8 @@ struct SvXMLUnitConverter::Impl void SvXMLUnitConverter::Impl::createNumTypeInfo() const { - if (m_xServiceFactory.is()) - { - Reference<XComponentContext> xContext( comphelper::getComponentContext(m_xServiceFactory) ); - Reference<XDefaultNumberingProvider> xDefNum = DefaultNumberingProvider::create(xContext); - const_cast<Impl*>(this)->m_xNumTypeInfo = - Reference<XNumberingTypeInfo>(xDefNum, uno::UNO_QUERY); - } + Reference<XDefaultNumberingProvider> xDefNum = DefaultNumberingProvider::create(m_xContext); + m_xNumTypeInfo = Reference<XNumberingTypeInfo>(xDefNum, uno::UNO_QUERY); } const uno::Reference< text::XNumberingTypeInfo >& @@ -127,10 +121,10 @@ sal_Int16 SvXMLUnitConverter::GetXMLMeasureUnit() const */ SvXMLUnitConverter::SvXMLUnitConverter( - const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory, + const uno::Reference<uno::XComponentContext>& xContext, sal_Int16 const eCoreMeasureUnit, sal_Int16 const eXMLMeasureUnit) -: m_pImpl(new Impl(xServiceFactory, eCoreMeasureUnit, eXMLMeasureUnit)) +: m_pImpl(new Impl(xContext, eCoreMeasureUnit, eXMLMeasureUnit)) { } @@ -799,34 +793,26 @@ OUString SvXMLUnitConverter::encodeStyleName( { if (!m_pImpl->m_xCharClass.is()) { - if (m_pImpl->m_xServiceFactory.is()) - { - const_cast < SvXMLUnitConverter * >(this) - ->m_pImpl->m_xCharClass = CharacterClassification::create( - comphelper::getComponentContext(m_pImpl->m_xServiceFactory) ); - } + this->m_pImpl->m_xCharClass = CharacterClassification::create( m_pImpl->m_xContext ); } - if (m_pImpl->m_xCharClass.is()) + sal_Int16 nType = m_pImpl->m_xCharClass->getType(rName, i); + + switch( nType ) { - sal_Int16 nType = m_pImpl->m_xCharClass->getType(rName, i); - - switch( nType ) - { - case UnicodeType::UPPERCASE_LETTER: // Lu - case UnicodeType::LOWERCASE_LETTER: // Ll - case UnicodeType::TITLECASE_LETTER: // Lt - case UnicodeType::OTHER_LETTER: // Lo - case UnicodeType::LETTER_NUMBER: // Nl - bValidChar = sal_True; - break; - case UnicodeType::NON_SPACING_MARK: // Ms - case UnicodeType::ENCLOSING_MARK: // Me - case UnicodeType::COMBINING_SPACING_MARK: //Mc - case UnicodeType::MODIFIER_LETTER: // Lm - case UnicodeType::DECIMAL_DIGIT_NUMBER: // Nd - bValidChar = i > 0; - break; - } + case UnicodeType::UPPERCASE_LETTER: // Lu + case UnicodeType::LOWERCASE_LETTER: // Ll + case UnicodeType::TITLECASE_LETTER: // Lt + case UnicodeType::OTHER_LETTER: // Lo + case UnicodeType::LETTER_NUMBER: // Nl + bValidChar = sal_True; + break; + case UnicodeType::NON_SPACING_MARK: // Ms + case UnicodeType::ENCLOSING_MARK: // Me + case UnicodeType::COMBINING_SPACING_MARK: //Mc + case UnicodeType::MODIFIER_LETTER: // Lm + case UnicodeType::DECIMAL_DIGIT_NUMBER: // Nd + bValidChar = i > 0; + break; } } } diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 237f670c45f0..d33db725215f 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -64,6 +64,7 @@ #include <cppuhelper/implbase1.hxx> #include <comphelper/extract.hxx> +#include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include "PropertySetMerger.hxx" #include "layerexp.hxx" @@ -396,9 +397,9 @@ ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterI // #110680# SdXMLExport::SdXMLExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_Bool bIsDraw, sal_uInt16 nExportFlags ) -: SvXMLExport( util::MeasureUnit::CM, xServiceFactory, +: SvXMLExport( util::MeasureUnit::CM, xContext, (bIsDraw) ? XML_GRAPHICS : XML_PRESENTATION, nExportFlags ), mnDocMasterPageCount(0L), mnDocDrawPageCount(0L), @@ -2802,7 +2803,7 @@ OUString SAL_CALL classname##_getImplementationName() throw()\ }\ uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )\ {\ - return (cppu::OWeakObject*)new SdXMLExport( rSMgr, draw, flags );\ + return (cppu::OWeakObject*)new SdXMLExport( comphelper::getComponentContext(rSMgr), draw, flags );\ } SERVICE( XMLImpressExportOasis, "com.sun.star.comp.Impress.XMLOasisExporter", "XMLImpressExportOasis", sal_False, EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED ); diff --git a/xmloff/source/draw/sdxmlexp_impl.hxx b/xmloff/source/draw/sdxmlexp_impl.hxx index 3e3f1e445833..166f57328e17 100644 --- a/xmloff/source/draw/sdxmlexp_impl.hxx +++ b/xmloff/source/draw/sdxmlexp_impl.hxx @@ -176,9 +176,8 @@ protected: virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps); public: - // #110680# SdXMLExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_Bool bIsDraw, sal_uInt16 nExportFlags = EXPORT_ALL ); virtual ~SdXMLExport(); diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx index ce504fe2b793..58b895e24f4e 100644 --- a/xmloff/source/draw/shapeexport4.cxx +++ b/xmloff/source/draw/shapeexport4.cxx @@ -1234,7 +1234,7 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape uno::Reference< graphic::XGraphic > xGraphic( xPropSet->getPropertyValue( OUString( "ReplacementGraphic" ) ), uno::UNO_QUERY ); if( xGraphic.is() ) try { - Reference< lang::XMultiServiceFactory > xSM( GetExport().getServiceFactory(), UNO_QUERY_THROW ); + Reference< uno::XComponentContext > xContext = GetExport().getComponentContext(); uno::Reference< embed::XStorage > xPictureStorage; uno::Reference< embed::XStorage > xStorage; @@ -1243,7 +1243,7 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape OUString sPictureName; if( bExportEmbedded ) { - xPictureStream.set( xSM->createInstance( OUString( "com.sun.star.comp.MemoryStream" ) ), UNO_QUERY_THROW ); + xPictureStream.set( xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.comp.MemoryStream", xContext), UNO_QUERY_THROW ); } else { @@ -1265,7 +1265,7 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape xPictureStream.set( xPictureStorage->openStreamElement( sPictureName, ::embed::ElementModes::READWRITE ), UNO_QUERY_THROW ); } - Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(comphelper::getComponentContext(xSM)) ); + Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) ); Sequence< beans::PropertyValue > aArgs( 2 ); aArgs[ 0 ].Name = OUString( "MimeType" ); aArgs[ 0 ].Value <<= OUString( "image/x-vclgraphic" ); diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx index bb3838102f8d..af886136ec0d 100644 --- a/xmloff/source/forms/layerexport.cxx +++ b/xmloff/source/forms/layerexport.cxx @@ -766,7 +766,7 @@ namespace xmloff ::rtl::OUString("US"), ::rtl::OUString() ); - xFormatsSupplier = NumberFormatsSupplier::createWithLocale( comphelper::getComponentContext(m_rContext.getServiceFactory()), aLocale ); + xFormatsSupplier = NumberFormatsSupplier::createWithLocale( m_rContext.getComponentContext(), aLocale ); m_xControlNumberFormats = xFormatsSupplier->getNumberFormats(); } catch(const Exception&) diff --git a/xmloff/source/meta/MetaExportComponent.cxx b/xmloff/source/meta/MetaExportComponent.cxx index 4c1299b04113..515879dbaf8c 100644 --- a/xmloff/source/meta/MetaExportComponent.cxx +++ b/xmloff/source/meta/MetaExportComponent.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <comphelper/genericpropertyset.hxx> +#include <comphelper/processfactory.hxx> #include <rtl/ustrbuf.hxx> #include "xmloff/xmlnmspe.hxx" #include <xmloff/nmspmap.hxx> @@ -41,9 +42,9 @@ using namespace ::com::sun::star; using namespace ::xmloff::token; XMLMetaExportComponent::XMLMetaExportComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_uInt16 nFlags ) -: SvXMLExport( util::MeasureUnit::CM, xServiceFactory, XML_TEXT, nFlags ) +: SvXMLExport( util::MeasureUnit::CM, xContext, XML_TEXT, nFlags ) { } @@ -74,51 +75,47 @@ sal_uInt32 XMLMetaExportComponent::exportDoc( enum XMLTokenEnum ) if( (getExportFlags() & EXPORT_OASIS) == 0 ) { - uno::Reference< lang::XMultiServiceFactory > xFactory = getServiceFactory(); - if( xFactory.is() ) + uno::Reference< uno::XComponentContext > xContext = getComponentContext(); + try { - try + ::comphelper::PropertyMapEntry aInfoMap[] = { - ::comphelper::PropertyMapEntry aInfoMap[] = - { - { "Class", sizeof("Class")-1, 0, - &::getCppuType((::rtl::OUString*)0), - beans::PropertyAttribute::MAYBEVOID, 0}, - { NULL, 0, 0, NULL, 0, 0 } - }; - uno::Reference< beans::XPropertySet > xConvPropSet( - ::comphelper::GenericPropertySet_CreateInstance( - new ::comphelper::PropertySetInfo( aInfoMap ) ) ); - - uno::Any aAny; - aAny <<= GetXMLToken( XML_TEXT ); - xConvPropSet->setPropertyValue( - ::rtl::OUString("Class"), aAny ); - - uno::Reference< beans::XPropertySet > xPropSet = - getExportInfo().is() - ? PropertySetMerger_CreateInstance( getExportInfo(), - xConvPropSet ) - : getExportInfo(); - - uno::Sequence< uno::Any > aArgs( 3 ); - aArgs[0] <<= xDocHandler; - aArgs[1] <<= xPropSet; - aArgs[2] <<= GetModel(); - - // get filter component - xDocHandler = uno::Reference< xml::sax::XDocumentHandler >( - xFactory->createInstanceWithArguments( - ::rtl::OUString("com.sun.star.comp.Oasis2OOoTransformer"), - aArgs), - uno::UNO_QUERY_THROW ); - - SetDocHandler( xDocHandler ); - } - catch( com::sun::star::uno::Exception& ) - { - OSL_FAIL( "Cannot instantiate com.sun.star.comp.Oasis2OOoTransformer!\n"); - } + { "Class", sizeof("Class")-1, 0, + &::getCppuType((::rtl::OUString*)0), + beans::PropertyAttribute::MAYBEVOID, 0}, + { NULL, 0, 0, NULL, 0, 0 } + }; + uno::Reference< beans::XPropertySet > xConvPropSet( + ::comphelper::GenericPropertySet_CreateInstance( + new ::comphelper::PropertySetInfo( aInfoMap ) ) ); + + uno::Any aAny; + aAny <<= GetXMLToken( XML_TEXT ); + xConvPropSet->setPropertyValue( + ::rtl::OUString("Class"), aAny ); + + uno::Reference< beans::XPropertySet > xPropSet = + getExportInfo().is() + ? PropertySetMerger_CreateInstance( getExportInfo(), + xConvPropSet ) + : getExportInfo(); + + uno::Sequence< uno::Any > aArgs( 3 ); + aArgs[0] <<= xDocHandler; + aArgs[1] <<= xPropSet; + aArgs[2] <<= GetModel(); + + // get filter component + xDocHandler = uno::Reference< xml::sax::XDocumentHandler >( + xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.comp.Oasis2OOoTransformer", aArgs, xContext), + uno::UNO_QUERY_THROW ); + + SetDocHandler( xDocHandler ); + } + catch( com::sun::star::uno::Exception& ) + { + OSL_FAIL( "Cannot instantiate com.sun.star.comp.Oasis2OOoTransformer!\n"); } } @@ -202,7 +199,7 @@ uno::Reference< uno::XInterface > SAL_CALL XMLMetaExportComponent_createInstance const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new XMLMetaExportComponent(rSMgr, EXPORT_META|EXPORT_OASIS); + return (cppu::OWeakObject*)new XMLMetaExportComponent( comphelper::getComponentContext(rSMgr), EXPORT_META|EXPORT_OASIS); } uno::Sequence< rtl::OUString > SAL_CALL XMLMetaExportOOO_getSupportedServiceNames() @@ -223,7 +220,7 @@ uno::Reference< uno::XInterface > SAL_CALL XMLMetaExportOOO_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new XMLMetaExportComponent(rSMgr, EXPORT_META); + return (cppu::OWeakObject*)new XMLMetaExportComponent( comphelper::getComponentContext(rSMgr), EXPORT_META); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx index 1a2d0bc87f99..39c74cb17df2 100644 --- a/xmloff/source/meta/xmlversion.cxx +++ b/xmloff/source/meta/xmlversion.cxx @@ -46,11 +46,11 @@ const char XMLN_VERSIONSLIST[] = "VersionList.xml"; // ------------------------------------------------------------------------ // #110897# XMLVersionListExport::XMLVersionListExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions, const OUString &rFileName, Reference< XDocumentHandler > &rHandler ) -: SvXMLExport( xServiceFactory, rFileName, util::MeasureUnit::CM, rHandler ), +: SvXMLExport( xContext, rFileName, util::MeasureUnit::CM, rHandler ), maVersions( rVersions ) { _GetNamespaceMap().AddAtIndex( XML_NAMESPACE_DC_IDX, xmloff::token::GetXMLToken(xmloff::token::XML_NP_DC), @@ -345,9 +345,6 @@ void SAL_CALL XMLVersionListPersistence::store( const uno::Reference< embed::XSt if ( xRoot.is() ) { // get the services needed for writing the xml data - Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); - DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); @@ -374,7 +371,7 @@ void SAL_CALL XMLVersionListPersistence::store( const uno::Reference< embed::XSt Reference< XDocumentHandler > xHandler( xWriter, uno::UNO_QUERY ); - XMLVersionListExport aExp( xServiceFactory, rVersions, sVerName, xHandler ); + XMLVersionListExport aExp( xContext, rVersions, sVerName, xHandler ); aExp.exportDoc( ::xmloff::token::XML_VERSION ); diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 0a124371de2d..66e0c121f380 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -246,8 +246,8 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( { LanguageTag aLanguageTag( MsLangId::getSystemLanguage() ); - pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); - pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); + pCharClass = new CharClass( rExport.getComponentContext(), aLanguageTag ); + pLocaleData = new LocaleDataWrapper( rExport.getComponentContext(), aLanguageTag ); } pUsedList = new SvXMLNumUsedList_Impl; @@ -281,8 +281,8 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( { LanguageTag aLanguageTag( MsLangId::getSystemLanguage() ); - pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); - pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); + pCharClass = new CharClass( rExport.getComponentContext(), aLanguageTag ); + pLocaleData = new LocaleDataWrapper( rExport.getComponentContext(), aLanguageTag ); } pUsedList = new SvXMLNumUsedList_Impl; diff --git a/xmloff/source/text/XMLAutoTextEventExport.cxx b/xmloff/source/text/XMLAutoTextEventExport.cxx index d2f865da938c..48175de93543 100644 --- a/xmloff/source/text/XMLAutoTextEventExport.cxx +++ b/xmloff/source/text/XMLAutoTextEventExport.cxx @@ -35,6 +35,7 @@ #include <xmloff/XMLEventExport.hxx> #include <tools/debug.hxx> #include <tools/fldunit.hxx> +#include <comphelper/processfactory.hxx> using namespace ::com::sun::star; @@ -63,10 +64,10 @@ const sal_Char sAPI_AutoText[] = "com.sun.star.text.AutoTextContainer"; XMLAutoTextEventExport::XMLAutoTextEventExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_uInt16 nFlags ) -: SvXMLExport(util::MeasureUnit::INCH, xServiceFactory, XML_AUTO_TEXT, nFlags) +: SvXMLExport(util::MeasureUnit::INCH, xContext, XML_AUTO_TEXT, nFlags) , sEventType("EventType"), sNone("None") @@ -115,31 +116,30 @@ sal_uInt32 XMLAutoTextEventExport::exportDoc( enum XMLTokenEnum ) { if( (getExportFlags() & EXPORT_OASIS) == 0 ) { - Reference< lang::XMultiServiceFactory > xFactory = getServiceFactory(); - if( xFactory.is() ) + Reference< uno::XComponentContext> xContext = getComponentContext(); + try { - try - { - Sequence<Any> aArgs( 1 ); - aArgs[0] <<= GetDocHandler(); - - // get filter component - Reference< xml::sax::XDocumentHandler > xTmpDocHandler( - xFactory->createInstanceWithArguments( - OUString("com.sun.star.comp.Oasis2OOoTransformer"), - aArgs), UNO_QUERY); - OSL_ENSURE( xTmpDocHandler.is(), - "can't instantiate OASIS transformer component" ); - if( xTmpDocHandler.is() ) - { - SetDocHandler( xTmpDocHandler ); - } - } - catch( com::sun::star::uno::Exception& ) + Sequence<Any> aArgs( 1 ); + aArgs[0] <<= GetDocHandler(); + + // get filter component + Reference< xml::sax::XDocumentHandler > xTmpDocHandler( + xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.comp.Oasis2OOoTransformer", + aArgs, + xContext), + UNO_QUERY); + OSL_ENSURE( xTmpDocHandler.is(), + "can't instantiate OASIS transformer component" ); + if( xTmpDocHandler.is() ) { + SetDocHandler( xTmpDocHandler ); } } + catch( com::sun::star::uno::Exception& ) + { + } } if (hasEvents()) { @@ -235,7 +235,7 @@ Reference< XInterface > SAL_CALL XMLAutoTextEventExport_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new XMLAutoTextEventExport(rSMgr, EXPORT_ALL|EXPORT_OASIS); + return (cppu::OWeakObject*)new XMLAutoTextEventExport( comphelper::getComponentContext(rSMgr), EXPORT_ALL|EXPORT_OASIS); } // methods to support the component registration @@ -257,7 +257,7 @@ Reference< XInterface > SAL_CALL XMLAutoTextEventExportOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new XMLAutoTextEventExport(rSMgr,EXPORT_ALL); + return (cppu::OWeakObject*)new XMLAutoTextEventExport( comphelper::getComponentContext(rSMgr),EXPORT_ALL); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/XMLAutoTextEventExport.hxx b/xmloff/source/text/XMLAutoTextEventExport.hxx index 45ce88eb2ff3..ed0e50fd6467 100644 --- a/xmloff/source/text/XMLAutoTextEventExport.hxx +++ b/xmloff/source/text/XMLAutoTextEventExport.hxx @@ -57,7 +57,7 @@ class XMLAutoTextEventExport : public SvXMLExport public: XMLAutoTextEventExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, sal_uInt16 nFlags + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_uInt16 nFlags ); ~XMLAutoTextEventExport(); |