summaryrefslogtreecommitdiff
path: root/svx/source/xml/xmlgrhlp.cxx
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2013-12-20 22:41:38 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2013-12-20 22:58:29 +0100
commit09af884e7b5712e0311a4c122a5213e7c89f626e (patch)
treef4291ccbae836111fa05ff6404f1b53d1ca94450 /svx/source/xml/xmlgrhlp.cxx
parentbe053c9a80ad237afc6da0b4174e1c7afc94ed92 (diff)
Revert "svx: split into direct implementation getFactories"
Also reverts "These services are in fact implemented in svxcore library." This reverts commit 090674dcb085cd41f4628e4f07c9a2268a18e862 and commit 4a969ac35174520f1ffeb4f919f5d7bb6d99a628. This is embarrassing; needs more work.
Diffstat (limited to 'svx/source/xml/xmlgrhlp.cxx')
-rw-r--r--svx/source/xml/xmlgrhlp.cxx95
1 files changed, 41 insertions, 54 deletions
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 4cd46118933e..0509b7c8309e 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <cppuhelper/compbase4.hxx>
#include <cppuhelper/supportsservice.hxx>
+
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/streamwrap.hxx>
#include <unotools/tempfile.hxx>
@@ -53,8 +54,6 @@ using ::com::sun::star::lang::XMultiServiceFactory;
#define XML_GRAPHICSTORAGE_NAME "Pictures"
#define XML_GRAPHICOBJECT_URL_BASE "vnd.sun.star.GraphicObject:"
-namespace {
-
const MetaCommentAction* ImplCheckForEPS( GDIMetaFile& rMtf )
{
const MetaCommentAction* pComment = NULL;
@@ -347,8 +346,6 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
return maGrfObj;
}
-}
-
SvXMLGraphicHelper::SvXMLGraphicHelper( SvXMLGraphicHelperMode eCreateMode ) :
::cppu::WeakComponentImplHelper2< ::com::sun::star::document::XGraphicObjectResolver,
::com::sun::star::document::XBinaryStreamResolver >( maMutex )
@@ -887,9 +884,9 @@ OUString SAL_CALL SvXMLGraphicHelper::resolveOutputStream( const Reference< XOut
return aRet;
}
-namespace {
-
// for instantiation via service manager
+namespace svx
+{
namespace impl
{
@@ -1017,8 +1014,8 @@ OUString SAL_CALL SvXMLGraphicImportExportHelper::getImplementationName()
throw (uno::RuntimeException)
{
if( m_eGraphicHelperMode == GRAPHICHELPER_MODE_READ )
- return OUString("com.sun.star.comp.Svx.GraphicImportHelper");
- return OUString("com.sun.star.comp.Svx.GraphicExportHelper");
+ return SvXMLGraphicImportHelper_getImplementationName();
+ return SvXMLGraphicExportHelper_getImplementationName();
}
::sal_Bool SAL_CALL SvXMLGraphicImportExportHelper::supportsService( const OUString& ServiceName )
@@ -1030,6 +1027,25 @@ OUString SAL_CALL SvXMLGraphicImportExportHelper::getImplementationName()
Sequence< OUString > SAL_CALL SvXMLGraphicImportExportHelper::getSupportedServiceNames()
throw (uno::RuntimeException)
{
+ if( m_eGraphicHelperMode == GRAPHICHELPER_MODE_READ )
+ return SvXMLGraphicImportHelper_getSupportedServiceNames();
+ return SvXMLGraphicExportHelper_getSupportedServiceNames();
+}
+
+// import
+Reference< XInterface > SAL_CALL SvXMLGraphicImportHelper_createInstance(const Reference< XMultiServiceFactory > & /* rSMgr */ )
+ throw( Exception )
+{
+ return static_cast< XWeak* >( new SvXMLGraphicImportExportHelper( GRAPHICHELPER_MODE_READ ));
+}
+OUString SAL_CALL SvXMLGraphicImportHelper_getImplementationName()
+ throw()
+{
+ return OUString( "com.sun.star.comp.Svx.GraphicImportHelper" );
+}
+Sequence< OUString > SAL_CALL SvXMLGraphicImportHelper_getSupportedServiceNames()
+ throw()
+{
// XGraphicObjectResolver and XBinaryStreamResolver are not part of any service
Sequence< OUString > aSupportedServiceNames( 2 );
aSupportedServiceNames[0] = "com.sun.star.document.GraphicObjectResolver";
@@ -1037,56 +1053,27 @@ Sequence< OUString > SAL_CALL SvXMLGraphicImportExportHelper::getSupportedServic
return aSupportedServiceNames;
}
+// export
+Reference< XInterface > SAL_CALL SvXMLGraphicExportHelper_createInstance(const Reference< XMultiServiceFactory > & /* rSMgr */ )
+ throw( Exception )
+{
+ return static_cast< XWeak* >( new SvXMLGraphicImportExportHelper( GRAPHICHELPER_MODE_WRITE ));
}
-
-/** Create this with createInstanceWithArguments. service name
- "com.sun.star.comp.Svx.GraphicImportHelper", one argument which is the
- XStorage. Without arguments no helper class is created. With an empty
- argument the helper class is created and initialized like in the CTOR to
- SvXMLGraphicHelper that only gets the create mode.
-
- You should call dispose after you no longer need this component.
-
- uses eCreateMode == GRAPHICHELPER_MODE_READ, bDirect == sal_True in
- SvXMLGraphicHelper
- */
-extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
-com_sun_star_comp_Svx_GraphicImportHelper_implementation_getFactory(
- SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
- uno_Sequence * arguments)
+OUString SAL_CALL SvXMLGraphicExportHelper_getImplementationName()
+ throw()
{
- assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
- css::uno::Reference<css::uno::XInterface> x(
- static_cast<cppu::OWeakObject *>(new SvXMLGraphicImportExportHelper(
- GRAPHICHELPER_MODE_READ )));
- x->acquire();
- return x.get();
+ return OUString( "com.sun.star.comp.Svx.GraphicExportHelper" );
}
-
-/** Create this with createInstanceWithArguments. service name
- "com.sun.star.comp.Svx.GraphicExportHelper", one argument which is the
- XStorage. Without arguments no helper class is created. With an empty
- argument the helper class is created and initialized like in the CTOR to
- SvXMLGraphicHelper that only gets the create mode
-
- To write the Pictures stream, you have to call dispose at this component.
- Make sure you call dipose before you commit the parent storage.
-
- uses eCreateMode == GRAPHICHELPER_MODE_WRITE, bDirect == sal_True in
- SvXMLGraphicHelper
- */
-
-extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
-com_sun_star_comp_Svx_GraphicExportHelper_implementation_getFactory(
- SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
- uno_Sequence * arguments)
+Sequence< OUString > SAL_CALL SvXMLGraphicExportHelper_getSupportedServiceNames()
+ throw()
{
- assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
- css::uno::Reference<css::uno::XInterface> x(
- static_cast<cppu::OWeakObject *>(new SvXMLGraphicImportExportHelper(
- GRAPHICHELPER_MODE_WRITE )));
- x->acquire();
- return x.get();
+ // XGraphicObjectResolver and XBinaryStreamResolver are not part of any service
+ Sequence< OUString > aSupportedServiceNames( 2 );
+ aSupportedServiceNames[0] = "com.sun.star.document.GraphicObjectResolver";
+ aSupportedServiceNames[1] = "com.sun.star.document.BinaryStreamResolver";
+ return aSupportedServiceNames;
}
+} // namespace svx
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */