summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-01-09 10:12:01 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-01-09 10:12:19 +0100
commit6e12fb3be33379fa87b90ffae047cffe1370eef9 (patch)
tree1e39f01609c1471bbb0a2b0dcb85c6c67a7ff1f4 /xmloff
parent6d25220ad6c869bb7cd79cf678d092b81558a8d2 (diff)
Consolidate XServiceInfo for classes derived from SvXMLImport
Change-Id: I5a269d8b7e95049c67ae14b06a79b417bc91a474
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/SchXMLImport.hxx5
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx33
-rw-r--r--xmloff/source/core/xmlimp.cxx17
-rw-r--r--xmloff/source/draw/animationimport.cxx51
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx50
-rw-r--r--xmloff/source/draw/sdxmlimp_impl.hxx6
-rw-r--r--xmloff/source/meta/MetaImportComponent.cxx2
-rw-r--r--xmloff/source/meta/xmlversion.cxx2
-rw-r--r--xmloff/source/text/XMLAutoTextEventImport.cxx2
9 files changed, 37 insertions, 131 deletions
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index f531de380e39..d42af3400b8a 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -164,13 +164,10 @@ public:
// #110680#
SchXMLImport(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
- sal_uInt16 nImportFlags = IMPORT_ALL );
+ OUString const & implementationName, sal_uInt16 nImportFlags );
virtual ~SchXMLImport() throw ();
- // XServiceInfo ( : SvXMLExport )
- virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
-
SvXMLImportContext* CreateStylesContext( const OUString& rLocalName,
const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index b7b99a56eacd..8becd466ef22 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -493,8 +493,8 @@ Reference< chart2::XDataSeries > SchXMLImportHelper::GetNewDataSeries(
// #110680#
SchXMLImport::SchXMLImport(
const Reference< uno::XComponentContext >& xContext,
- sal_uInt16 nImportFlags ) :
- SvXMLImport( xContext, nImportFlags )
+ OUString const & implementationName, sal_uInt16 nImportFlags ) :
+ SvXMLImport( xContext, implementationName, nImportFlags )
{
GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
@@ -658,7 +658,7 @@ OUString SAL_CALL SchXMLImport_getImplementationName() throw()
Reference< uno::XInterface > SAL_CALL SchXMLImport_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
{
// #110680#
- return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr));
+ return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr), SchXMLImport_getImplementationName(), IMPORT_ALL);
}
// multiple storage version: one for content / styles / meta
@@ -678,7 +678,7 @@ OUString SAL_CALL SchXMLImport_Styles_getImplementationName() throw()
Reference< uno::XInterface > SAL_CALL SchXMLImport_Styles_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
{
// #110680#
- return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_STYLES );
+ return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr), SchXMLImport_Styles_getImplementationName(), IMPORT_STYLES );
}
Sequence< OUString > SAL_CALL SchXMLImport_Content_getSupportedServiceNames() throw()
@@ -696,7 +696,7 @@ OUString SAL_CALL SchXMLImport_Content_getImplementationName() throw()
Reference< uno::XInterface > SAL_CALL SchXMLImport_Content_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
{
// #110680#
- return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_CONTENT | IMPORT_AUTOSTYLES | IMPORT_FONTDECLS );
+ return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr), SchXMLImport_Content_getImplementationName(), IMPORT_CONTENT | IMPORT_AUTOSTYLES | IMPORT_FONTDECLS );
}
Sequence< OUString > SAL_CALL SchXMLImport_Meta_getSupportedServiceNames() throw()
@@ -714,28 +714,7 @@ OUString SAL_CALL SchXMLImport_Meta_getImplementationName() throw()
Reference< uno::XInterface > SAL_CALL SchXMLImport_Meta_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
{
// #110680#
- return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_META );
-}
-
-// XServiceInfo
-OUString SAL_CALL SchXMLImport::getImplementationName() throw( uno::RuntimeException )
-{
- switch( getImportFlags())
- {
- case IMPORT_ALL:
- return SchXMLImport_getImplementationName();
- case IMPORT_STYLES:
- return SchXMLImport_Styles_getImplementationName();
- case ( IMPORT_CONTENT | IMPORT_AUTOSTYLES | IMPORT_FONTDECLS ):
- return SchXMLImport_Content_getImplementationName();
- case IMPORT_META:
- return SchXMLImport_Meta_getImplementationName();
-
- case IMPORT_SETTINGS:
- // there is no settings component in chart
- default:
- return OUString( "SchXMLImport" );
- }
+ return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr), SchXMLImport_Meta_getImplementationName(), IMPORT_META );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index c46757f70b5d..fdab947fcdd3 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -50,6 +50,7 @@
#include <comphelper/namecontainer.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <comphelper/extract.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/documentconstants.hxx>
@@ -268,6 +269,7 @@ public:
sal_Bool mbTextDocInOOoFileFormat;
const uno::Reference< uno::XComponentContext > mxComponentContext;
+ OUString implementationName;
uno::Reference< embed::XStorage > mxSourceStorage;
@@ -275,7 +277,8 @@ public:
std::auto_ptr< DocumentInfo > mpDocumentInfo;
- SvXMLImport_Impl( const uno::Reference< uno::XComponentContext >& rxContext)
+ SvXMLImport_Impl( const uno::Reference< uno::XComponentContext >& rxContext,
+ OUString const & theImplementationName)
: hBatsFontConv( 0 )
, hMathFontConv( 0 )
, mbOwnGraphicResolver( false )
@@ -285,6 +288,7 @@ public:
, mbShapePositionInHoriL2R( sal_False )
, mbTextDocInOOoFileFormat( sal_False )
, mxComponentContext( rxContext )
+ , implementationName(theImplementationName)
, mpRDFaHelper() // lazy
, mpDocumentInfo() // lazy
{
@@ -383,8 +387,8 @@ void SvXMLImport::_InitCtor()
SvXMLImport::SvXMLImport(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
- sal_uInt16 nImportFlags ) throw ()
-: mpImpl( new SvXMLImport_Impl(xContext) ),
+ OUString const & implementationName, sal_uInt16 nImportFlags ) throw ()
+: mpImpl( new SvXMLImport_Impl(xContext, implementationName) ),
mpNamespaceMap( new SvXMLNamespaceMap ),
mpUnitConv( new SvXMLUnitConverter( xContext,
@@ -965,16 +969,13 @@ void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
OUString SAL_CALL SvXMLImport::getImplementationName()
throw(uno::RuntimeException)
{
- OUString aStr;
- return aStr;
+ return mpImpl->implementationName;
}
sal_Bool SAL_CALL SvXMLImport::supportsService( const OUString& rServiceName )
throw(::com::sun::star::uno::RuntimeException)
{
- return
- (rServiceName == "com.sun.star.document.ImportFilter") ||
- (rServiceName == "com.sun.star.xml.XMLImportFilter");
+ return cppu::supportsService(this, rServiceName);
}
uno::Sequence< OUString > SAL_CALL SvXMLImport::getSupportedServiceNames( )
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
index f455858d499f..00b531c2c00c 100644
--- a/xmloff/source/draw/animationimport.cxx
+++ b/xmloff/source/draw/animationimport.cxx
@@ -85,6 +85,18 @@ using ::com::sun::star::container::XEnumeration;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::lang::XInitialization;
+Sequence< OUString > SAL_CALL AnimationsImport_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( "com.sun.star.comp.Xmloff.AnimationsImport" );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL AnimationsImport_getImplementationName() throw()
+{
+ return OUString( "xmloff::AnimationsImport" );
+}
+
namespace xmloff
{
@@ -1256,17 +1268,12 @@ public:
// XAnimationNodeSupplier
Reference< XAnimationNode > SAL_CALL getAnimationNode() throw (RuntimeException);
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
- virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
-
private:
Reference< XAnimationNode > mxRootNode;
};
AnimationsImport::AnimationsImport( const Reference< XComponentContext > & rxContext )
-: SvXMLImport( rxContext , true )
+: SvXMLImport( rxContext, AnimationsImport_getImplementationName(), true )
{
// add namespaces
GetNamespaceMap().Add(
@@ -1416,41 +1423,9 @@ void AnimationNodeContext::postProcessRootNode( SvXMLImport& /*rImport*/, const
} // namespace xmloff
-Sequence< OUString > SAL_CALL AnimationsImport_getSupportedServiceNames() throw()
-{
- const OUString aServiceName( "com.sun.star.comp.Xmloff.AnimationsImport" );
- const Sequence< OUString > aSeq( &aServiceName, 1 );
- return aSeq;
-}
-
-OUString SAL_CALL AnimationsImport_getImplementationName() throw()
-{
- return OUString( "xmloff::AnimationsImport" );
-}
-
Reference< XInterface > SAL_CALL AnimationsImport_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception )
{
return (cppu::OWeakObject*)new xmloff::AnimationsImport( comphelper::getComponentContext(rSMgr) );
}
-namespace xmloff
-{
-
-OUString SAL_CALL AnimationsImport::getImplementationName() throw(RuntimeException)
-{
- return AnimationsImport_getImplementationName();
-}
-
-sal_Bool SAL_CALL AnimationsImport::supportsService( const OUString& ServiceName ) throw(RuntimeException)
-{
- return ServiceName == "com.sun.star.comp.Xmloff.AnimationsImport";
-}
-
-Sequence< OUString > SAL_CALL AnimationsImport::getSupportedServiceNames() throw(RuntimeException)
-{
- return AnimationsImport_getSupportedServiceNames();
-}
-
-} // namespace xmloff
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index 6b1dd4a795da..c48cb5f79e37 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -266,7 +266,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 SdXMLImport( comphelper::getComponentContext(rSMgr), draw, flags );\
+ return (cppu::OWeakObject*)new SdXMLImport( comphelper::getComponentContext(rSMgr), implementationname, draw, flags ); \
}
SERVICE( XMLImpressImportOasis, "com.sun.star.comp.Impress.XMLOasisImporter", "XMLImpressImportOasis", sal_False, IMPORT_ALL )
@@ -287,8 +287,9 @@ SERVICE( XMLDrawSettingsImportOasis, "com.sun.star.comp.Draw.XMLOasisSettingsImp
// #110680#
SdXMLImport::SdXMLImport(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
+ OUString const & implementationName,
sal_Bool bIsDraw, sal_uInt16 nImportFlags )
-: SvXMLImport( xContext, nImportFlags ),
+: SvXMLImport( xContext, implementationName, nImportFlags ),
mpMasterStylesContext(0L),
mpDocElemTokenMap(0L),
mpBodyElemTokenMap(0L),
@@ -893,51 +894,6 @@ void SdXMLImport::SetStatistics(
}
}
-// XServiceInfo
-OUString SAL_CALL SdXMLImport::getImplementationName() throw( uno::RuntimeException )
-{
- if( IsDraw())
- {
- // Draw
-
- switch( getImportFlags())
- {
- case IMPORT_ALL:
- return XMLDrawImportOasis_getImplementationName();
- case (IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES):
- return XMLDrawStylesImportOasis_getImplementationName();
- case (IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS):
- return XMLDrawContentImportOasis_getImplementationName();
- case IMPORT_META:
- return XMLDrawMetaImportOasis_getImplementationName();
- case IMPORT_SETTINGS:
- return XMLDrawSettingsImportOasis_getImplementationName();
- default:
- return XMLDrawImportOasis_getImplementationName();
- }
- }
- else
- {
- // Impress
-
- switch( getImportFlags())
- {
- case IMPORT_ALL:
- return XMLImpressImportOasis_getImplementationName();
- case (IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES):
- return XMLImpressStylesImportOasis_getImplementationName();
- case (IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS):
- return XMLImpressContentImportOasis_getImplementationName();
- case IMPORT_META:
- return XMLImpressMetaImportOasis_getImplementationName();
- case IMPORT_SETTINGS:
- return XMLImpressSettingsImportOasis_getImplementationName();
- default:
- return XMLImpressImportOasis_getImplementationName();
- }
- }
-}
-
void SdXMLImport::AddHeaderDecl( const OUString& rName, const OUString& rText )
{
if( !rName.isEmpty() && !rText.isEmpty() )
diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx
index 884ca77e16f5..302ba12ace44 100644
--- a/xmloff/source/draw/sdxmlimp_impl.hxx
+++ b/xmloff/source/draw/sdxmlimp_impl.hxx
@@ -220,7 +220,8 @@ protected:
public:
SdXMLImport(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
- sal_Bool bIsDraw, sal_uInt16 nImportFlags = IMPORT_ALL );
+ OUString const & implementationName,
+ sal_Bool bIsDraw, sal_uInt16 nImportFlags );
~SdXMLImport() throw ();
// XImporter
@@ -290,9 +291,6 @@ public:
sal_Bool IsPreview() const { return mbPreview; }
- // XServiceInfo ( : SvXMLExport )
- virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
-
void AddHeaderDecl( const OUString& rName, const OUString& rText );
void AddFooterDecl( const OUString& rName, const OUString& rText );
void AddDateTimeDecl( const OUString& rName, const OUString& rText, sal_Bool bFixed, const OUString& rDateTimeFormat );
diff --git a/xmloff/source/meta/MetaImportComponent.cxx b/xmloff/source/meta/MetaImportComponent.cxx
index c4d8e4f3b548..3b85e7eecb99 100644
--- a/xmloff/source/meta/MetaImportComponent.cxx
+++ b/xmloff/source/meta/MetaImportComponent.cxx
@@ -31,7 +31,7 @@ using namespace ::xmloff::token;
// #110680#
XMLMetaImportComponent::XMLMetaImportComponent(
const uno::Reference< uno::XComponentContext >& xContext) throw()
- : SvXMLImport(xContext), mxDocProps()
+ : SvXMLImport(xContext, ""), mxDocProps()
{
}
diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx
index 111abc1d7e2a..98fda5d9e74d 100644
--- a/xmloff/source/meta/xmlversion.cxx
+++ b/xmloff/source/meta/xmlversion.cxx
@@ -102,7 +102,7 @@ sal_uInt32 XMLVersionListExport::exportDoc( enum ::xmloff::token::XMLTokenEnum )
XMLVersionListImport::XMLVersionListImport(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions )
-: SvXMLImport(xContext),
+: SvXMLImport(xContext, ""),
maVersions( rVersions )
{
GetNamespaceMap().AddAtIndex( XML_NAMESPACE_FRAMEWORK_IDX, xmloff::token::GetXMLToken(xmloff::token::XML_NP_VERSIONS_LIST),
diff --git a/xmloff/source/text/XMLAutoTextEventImport.cxx b/xmloff/source/text/XMLAutoTextEventImport.cxx
index 4dbf1defb4fe..e96e4209d35f 100644
--- a/xmloff/source/text/XMLAutoTextEventImport.cxx
+++ b/xmloff/source/text/XMLAutoTextEventImport.cxx
@@ -47,7 +47,7 @@ using ::xmloff::token::XML_AUTO_TEXT_EVENTS;
XMLAutoTextEventImport::XMLAutoTextEventImport(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext) throw()
-: SvXMLImport(xContext)
+: SvXMLImport(xContext, "")
{
}