move GraphicImportHelper/GraphicExportHelper into xmloff
Change-Id: If0e9d7b2d9fee0ff4307f35ae82074031b0b0015 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193210 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -112,13 +112,12 @@ public:
|
||||
// XNameAccess
|
||||
virtual css::uno::Type SAL_CALL getElementType( ) override;
|
||||
virtual sal_Bool SAL_CALL hasElements( ) override;
|
||||
|
||||
|
||||
static void splitObjectURL(const OUString& aURLNoPar,
|
||||
OUString& rContainerStorageName,
|
||||
OUString& rObjectStorageName);
|
||||
};
|
||||
|
||||
namespace svx {
|
||||
SVXCORE_DLLPUBLIC void DropUnusedNamedItems(css::uno::Reference<css::uno::XInterface> const& xModel);
|
||||
}
|
||||
|
||||
#endif // INCLUDED_SVX_XMLEOHLP_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -99,7 +99,12 @@ public:
|
||||
|
||||
//= OOutputStreamWrapper
|
||||
|
||||
class UNOTOOLS_DLLPUBLIC OOutputStreamWrapper : public cppu::WeakImplHelper<css::io::XOutputStream>
|
||||
// avoid LNK2005 duplicate WeakImplHelper definitions with MSVC
|
||||
class SAL_DLLPUBLIC_TEMPLATE OOutputStreamWrapper_Base : public cppu::WeakImplHelper<css::io::XOutputStream>
|
||||
{
|
||||
};
|
||||
|
||||
class UNOTOOLS_DLLPUBLIC OOutputStreamWrapper : public OOutputStreamWrapper_Base
|
||||
{
|
||||
public:
|
||||
OOutputStreamWrapper(SvStream& _rStream);
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_SVX_XMLGRHLP_HXX
|
||||
#define INCLUDED_SVX_XMLGRHLP_HXX
|
||||
#pragma once
|
||||
|
||||
#include <comphelper/compbase.hxx>
|
||||
#include <vcl/graph.hxx>
|
||||
@@ -32,7 +31,7 @@
|
||||
#include <com/sun/star/document/XGraphicStorageHandler.hpp>
|
||||
#include <com/sun/star/document/XBinaryStreamResolver.hpp>
|
||||
#include <com/sun/star/embed/XStorage.hpp>
|
||||
#include <svx/svxdllapi.h>
|
||||
#include <xmloff/dllapi.h>
|
||||
|
||||
enum class SvXMLGraphicHelperMode
|
||||
{
|
||||
@@ -45,7 +44,7 @@ struct SvxGraphicHelperStream_Impl
|
||||
css::uno::Reference < css::io::XStream > xStream;
|
||||
};
|
||||
|
||||
class SVXCORE_DLLPUBLIC SvXMLGraphicHelper final :
|
||||
class XMLOFF_DLLPUBLIC SvXMLGraphicHelper final :
|
||||
public comphelper::WeakComponentImplHelper<css::document::XGraphicObjectResolver,
|
||||
css::document::XGraphicStorageHandler,
|
||||
css::document::XBinaryStreamResolver>
|
||||
@@ -63,16 +62,16 @@ private:
|
||||
SvXMLGraphicHelperMode meCreateMode;
|
||||
OUString maOutputMimeType;
|
||||
|
||||
SVX_DLLPRIVATE static bool ImplGetStreamNames( const OUString& rURLStr,
|
||||
SAL_DLLPRIVATE static bool ImplGetStreamNames( const OUString& rURLStr,
|
||||
OUString& rPictureStorageName,
|
||||
OUString& rPictureStreamName );
|
||||
SVX_DLLPRIVATE css::uno::Reference < css::embed::XStorage >
|
||||
SAL_DLLPRIVATE css::uno::Reference < css::embed::XStorage >
|
||||
ImplGetGraphicStorage( const OUString& rPictureStorageName );
|
||||
SVX_DLLPRIVATE SvxGraphicHelperStream_Impl
|
||||
SAL_DLLPRIVATE SvxGraphicHelperStream_Impl
|
||||
ImplGetGraphicStream( const OUString& rPictureStorageName,
|
||||
const OUString& rPictureStreamName );
|
||||
SVX_DLLPRIVATE static OUString ImplGetGraphicMimeType( std::u16string_view rFileName );
|
||||
SVX_DLLPRIVATE Graphic ImplReadGraphic(const OUString& rPictureStorageName,
|
||||
SAL_DLLPRIVATE static OUString ImplGetGraphicMimeType( std::u16string_view rFileName );
|
||||
SAL_DLLPRIVATE Graphic ImplReadGraphic(const OUString& rPictureStorageName,
|
||||
const OUString& rPictureStreamName,
|
||||
sal_Int32 nPage = -1);
|
||||
|
||||
@@ -82,7 +81,7 @@ private:
|
||||
SvXMLGraphicHelperMode eCreateMode,
|
||||
const OUString& rGraphicMimeType = OUString() );
|
||||
|
||||
SVX_DLLPRIVATE OUString implSaveGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic,
|
||||
SAL_DLLPRIVATE OUString implSaveGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic,
|
||||
OUString & rOutMimeType,
|
||||
std::u16string_view rRequestName);
|
||||
|
||||
@@ -94,6 +93,10 @@ public:
|
||||
static rtl::Reference<SvXMLGraphicHelper> Create( SvXMLGraphicHelperMode eCreateMode,
|
||||
const OUString& rMimeType = OUString() );
|
||||
|
||||
static void splitObjectURL(const OUString& aURLNoPar,
|
||||
OUString& rContainerStorageName,
|
||||
OUString& rObjectStorageName);
|
||||
|
||||
public:
|
||||
|
||||
// XGraphicObjectResolver
|
||||
@@ -128,10 +131,4 @@ public:
|
||||
virtual OUString SAL_CALL resolveOutputStream( const css::uno::Reference< css::io::XOutputStream >& rxBinaryStream ) override;
|
||||
};
|
||||
|
||||
namespace svx {
|
||||
SVXCORE_DLLPUBLIC void DropUnusedNamedItems(css::uno::Reference<css::uno::XInterface> const& xModel);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -110,7 +110,7 @@
|
||||
#include <svx/svdlayer.hxx>
|
||||
#include <svx/unofill.hxx>
|
||||
#include <svx/xmleohlp.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <comphelper/diagnose_ex.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <comphelper/propertysequence.hxx>
|
||||
#include <svx/dialmgr.hxx>
|
||||
#include <svx/strings.hrc>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <svtools/sfxecode.hxx>
|
||||
#include <sfx2/frame.hxx>
|
||||
#include <svl/itemset.hxx>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
// Support creation of GraphicStorageHandler and EmbeddedObjectResolver
|
||||
#include <svx/xmleohlp.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
|
||||
#include <com/sun/star/document/XCodeNameQuery.hpp>
|
||||
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <unotools/streamwrap.hxx>
|
||||
#include <svx/dialmgr.hxx>
|
||||
#include <svx/strings.hrc>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlexp.hxx>
|
||||
|
||||
#include <DrawDocShell.hxx>
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
|
||||
// Support creation of GraphicStorageHandler and EmbeddedObjectResolver
|
||||
#include <svx/xmleohlp.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <DrawDocShell.hxx>
|
||||
#include <ViewShellBase.hxx>
|
||||
#include "UnoDocumentSettings.hxx"
|
||||
|
||||
@@ -390,8 +390,6 @@ core_constructor_list = [
|
||||
"com_sun_star_comp_svx_ColorToolBoxControl_get_implementation",
|
||||
"com_sun_star_comp_svx_FontNameToolBoxControl_get_implementation",
|
||||
"com_sun_star_comp_svx_FrameToolBoxControl_get_implementation",
|
||||
"com_sun_star_comp_Svx_GraphicExportHelper_get_implementation",
|
||||
"com_sun_star_comp_Svx_GraphicImportHelper_get_implementation",
|
||||
"com_sun_star_comp_svx_LineEndToolBoxControl_get_implementation",
|
||||
"com_sun_star_comp_svx_LineStyleToolBoxControl_get_implementation",
|
||||
"com_sun_star_comp_svx_StyleToolBoxControl_get_implementation",
|
||||
@@ -539,6 +537,8 @@ core_constructor_list = [
|
||||
"com_sun_star_comp_Writer_XMLOasisAutotextEventsExporter_get_implementation",
|
||||
"com_sun_star_comp_Writer_XMLAutotextEventsExporter_get_implementation",
|
||||
"com_sun_star_comp_Writer_XMLOasisAutotextEventsImporter_get_implementation",
|
||||
"com_sun_star_comp_Svx_GraphicExportHelper_get_implementation",
|
||||
"com_sun_star_comp_Svx_GraphicImportHelper_get_implementation",
|
||||
# xmlscript/util/xmlscript.component
|
||||
"com_sun_star_comp_xml_input_SaxDocumentHandler_get_implementation",
|
||||
"com_sun_star_comp_xmlscript_XMLBasicExporter",
|
||||
|
||||
@@ -5854,7 +5854,6 @@ include/svx/xlntrit.hxx
|
||||
include/svx/xlnwtit.hxx
|
||||
include/svx/xmleohlp.hxx
|
||||
include/svx/xmlexchg.hxx
|
||||
include/svx/xmlgrhlp.hxx
|
||||
include/svx/xmlsecctrl.hxx
|
||||
include/svx/xoutbmp.hxx
|
||||
include/svx/xpoly.hxx
|
||||
@@ -6282,6 +6281,7 @@ include/xmloff/xmlerror.hxx
|
||||
include/xmloff/xmlevent.hxx
|
||||
include/xmloff/xmlexp.hxx
|
||||
include/xmloff/xmlexppr.hxx
|
||||
include/xmloff/xmlgrhlp.hxx
|
||||
include/xmloff/xmlictxt.hxx
|
||||
include/xmloff/xmlimp.hxx
|
||||
include/xmloff/xmlimppr.hxx
|
||||
@@ -11654,7 +11654,6 @@ svx/source/unogallery/unogaltheme.hxx
|
||||
svx/source/unogallery/unogalthemeprovider.cxx
|
||||
svx/source/xml/xmleohlp.cxx
|
||||
svx/source/xml/xmlexport.cxx
|
||||
svx/source/xml/xmlgrhlp.cxx
|
||||
svx/source/xml/xmlxtexp.cxx
|
||||
svx/source/xml/xmlxtimp.cxx
|
||||
svx/source/xoutdev/_xoutbmp.cxx
|
||||
@@ -15199,6 +15198,7 @@ xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
|
||||
xmloff/source/core/xmlcnimp.cxx
|
||||
xmloff/source/core/xmlerror.cxx
|
||||
xmloff/source/core/xmlexp.cxx
|
||||
xmloff/source/core/xmlgrhlp.cxx
|
||||
xmloff/source/core/xmlictxt.cxx
|
||||
xmloff/source/core/xmlimp.cxx
|
||||
xmloff/source/core/xmlmultiimagehelper.cxx
|
||||
|
||||
@@ -32,6 +32,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svx_core, \
|
||||
unotest \
|
||||
utl \
|
||||
vcl \
|
||||
xo \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_sdk_api,svx_core))
|
||||
|
||||
@@ -468,7 +468,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
|
||||
svx/source/unodraw/XPropertyTable \
|
||||
svx/source/xml/xmleohlp \
|
||||
svx/source/xml/xmlexport \
|
||||
svx/source/xml/xmlgrhlp \
|
||||
svx/source/xml/xmlxtexp \
|
||||
svx/source/xml/xmlxtimp \
|
||||
svx/source/xoutdev/xattr \
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <comphelper/storagehelper.hxx>
|
||||
|
||||
#include <svx/graphichelper.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <unotools/tempfile.hxx>
|
||||
#include <vcl/filter/PDFiumLibrary.hxx>
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <svx/svdpage.hxx>
|
||||
#include <svx/SvxXTextColumns.hxx>
|
||||
#include <svx/unoshape.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
|
||||
#include <com/sun/star/text/textfield/Type.hpp>
|
||||
|
||||
|
||||
+69
-43
@@ -27,6 +27,8 @@
|
||||
#include <com/sun/star/embed/EmbedStates.hpp>
|
||||
#include <com/sun/star/embed/Aspects.hpp>
|
||||
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#include <com/sun/star/util/XCancellable.hpp>
|
||||
#include <osl/diagnose.h>
|
||||
#include <sot/storage.hxx>
|
||||
#include <tools/debug.hxx>
|
||||
@@ -36,6 +38,7 @@
|
||||
|
||||
#include <svtools/embedhlp.hxx>
|
||||
#include <unotools/ucbstreamhelper.hxx>
|
||||
#include <comphelper/diagnose_ex.hxx>
|
||||
#include <comphelper/propertyvalue.hxx>
|
||||
#include <comphelper/storagehelper.hxx>
|
||||
#include <comphelper/embeddedobjectcontainer.hxx>
|
||||
@@ -44,6 +47,7 @@
|
||||
#include <cppuhelper/exc_hlp.hxx>
|
||||
#include <cppuhelper/implbase.hxx>
|
||||
#include <svx/xmleohlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
@@ -143,48 +147,6 @@ void SvXMLEmbeddedObjectHelper::disposing(std::unique_lock<std::mutex>&)
|
||||
}
|
||||
}
|
||||
|
||||
void SvXMLEmbeddedObjectHelper::splitObjectURL(const OUString& _aURLNoPar,
|
||||
OUString& rContainerStorageName,
|
||||
OUString& rObjectStorageName)
|
||||
{
|
||||
DBG_ASSERT(_aURLNoPar.isEmpty() || '#' != _aURLNoPar[0], "invalid object URL" );
|
||||
OUString aURLNoPar = _aURLNoPar;
|
||||
|
||||
sal_Int32 _nPos = aURLNoPar.lastIndexOf( '/' );
|
||||
if( -1 == _nPos )
|
||||
{
|
||||
rContainerStorageName.clear();
|
||||
rObjectStorageName = aURLNoPar;
|
||||
}
|
||||
else
|
||||
{
|
||||
//eliminate 'superfluous' slashes at start and end
|
||||
//#i103076# load objects with all allowed xlink:href syntaxes
|
||||
{
|
||||
//eliminate './' at start
|
||||
sal_Int32 nStart = 0;
|
||||
sal_Int32 nCount = aURLNoPar.getLength();
|
||||
if( aURLNoPar.startsWith( "./" ) )
|
||||
{
|
||||
nStart = 2;
|
||||
nCount -= 2;
|
||||
}
|
||||
|
||||
//eliminate '/' at end
|
||||
sal_Int32 nEnd = aURLNoPar.lastIndexOf( '/' );
|
||||
if( nEnd == aURLNoPar.getLength()-1 && nEnd != (nStart-1) )
|
||||
nCount--;
|
||||
|
||||
aURLNoPar = aURLNoPar.copy( nStart, nCount );
|
||||
}
|
||||
|
||||
_nPos = aURLNoPar.lastIndexOf( '/' );
|
||||
if( _nPos >= 0 )
|
||||
rContainerStorageName = aURLNoPar.copy( 0, _nPos );
|
||||
rObjectStorageName = aURLNoPar.copy( _nPos+1 );
|
||||
}
|
||||
}
|
||||
|
||||
bool SvXMLEmbeddedObjectHelper::ImplGetStorageNames(
|
||||
const OUString& rURLStr,
|
||||
OUString& rContainerStorageName,
|
||||
@@ -283,7 +245,7 @@ bool SvXMLEmbeddedObjectHelper::ImplGetStorageNames(
|
||||
}
|
||||
else
|
||||
{
|
||||
splitObjectURL(aURLNoPar, rContainerStorageName, rObjectStorageName);
|
||||
SvXMLGraphicHelper::splitObjectURL(aURLNoPar, rContainerStorageName, rObjectStorageName);
|
||||
}
|
||||
|
||||
if( -1 != rContainerStorageName.indexOf( '/' ) )
|
||||
@@ -716,4 +678,68 @@ sal_Bool SAL_CALL SvXMLEmbeddedObjectHelper::hasElements()
|
||||
}
|
||||
}
|
||||
|
||||
namespace svx {
|
||||
|
||||
void DropUnusedNamedItems(css::uno::Reference<css::uno::XInterface> const& xModel)
|
||||
{
|
||||
uno::Reference<lang::XMultiServiceFactory> const xModelFactory(xModel, uno::UNO_QUERY);
|
||||
assert(xModelFactory.is());
|
||||
try
|
||||
{
|
||||
uno::Reference<util::XCancellable> const xGradient(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.GradientTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xGradient.is())
|
||||
{
|
||||
xGradient->cancel();
|
||||
}
|
||||
|
||||
uno::Reference<util::XCancellable> const xHatch(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.HatchTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xHatch.is())
|
||||
{
|
||||
xHatch->cancel();
|
||||
}
|
||||
|
||||
uno::Reference<util::XCancellable> const xBitmap(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.BitmapTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xBitmap.is())
|
||||
{
|
||||
xBitmap->cancel();
|
||||
}
|
||||
|
||||
uno::Reference<util::XCancellable> const xTransGradient(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.TransparencyGradientTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xTransGradient.is())
|
||||
{
|
||||
xTransGradient->cancel();
|
||||
}
|
||||
|
||||
uno::Reference<util::XCancellable> const xMarker(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.MarkerTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xMarker.is())
|
||||
{
|
||||
xMarker->cancel();
|
||||
}
|
||||
|
||||
uno::Reference<util::XCancellable> const xDashes(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.DashTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xDashes.is())
|
||||
{
|
||||
xDashes->cancel();
|
||||
}
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
TOOLS_WARN_EXCEPTION("svx", "dropUnusedNamedItems(): exception during clearing of unused named items");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace svx
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <svx/svdmodel.hxx>
|
||||
#include <svx/xmleohlp.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
|
||||
#include <svx/unomodel.hxx>
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <com/sun/star/embed/XTransactedObject.hpp>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <unotools/streamwrap.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
|
||||
#include <xmlxtexp.hxx>
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <xmloff/ImageStyle.hxx>
|
||||
#include <xmloff/MarkerStyle.hxx>
|
||||
#include <xmloff/xmlictxt.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
|
||||
#include <xmlxtimp.hxx>
|
||||
#include <comphelper/sequence.hxx>
|
||||
|
||||
@@ -75,16 +75,6 @@
|
||||
constructor="com_sun_star_comp_svx_LineStyleToolBoxControl_get_implementation">
|
||||
<service name="com.sun.star.frame.ToolbarController"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.Svx.GraphicExportHelper"
|
||||
constructor="com_sun_star_comp_Svx_GraphicExportHelper_get_implementation">
|
||||
<service name="com.sun.star.document.BinaryStreamResolver"/>
|
||||
<service name="com.sun.star.document.GraphicStorageHandler"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.Svx.GraphicImportHelper"
|
||||
constructor="com_sun_star_comp_Svx_GraphicImportHelper_get_implementation">
|
||||
<service name="com.sun.star.document.BinaryStreamResolver"/>
|
||||
<service name="com.sun.star.document.GraphicStorageHandler"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.graphic.PrimitiveFactory2D"
|
||||
constructor="com_sun_star_comp_graphic_PrimitiveFactory2D_get_implementation">
|
||||
<service name="com.sun.star.graphic.PrimitiveFactory2D"/>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <svl/stritem.hxx>
|
||||
#include <svx/dialmgr.hxx>
|
||||
#include <svx/strings.hrc>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <svx/xmleohlp.hxx>
|
||||
#include <comphelper/fileformat.h>
|
||||
#include <comphelper/genericpropertyset.hxx>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <vcl/errinf.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
#include <sal/log.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <svx/xmleohlp.hxx>
|
||||
#include <svl/stritem.hxx>
|
||||
#include <sfx2/frame.hxx>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <sax/tools/converter.hxx>
|
||||
#include <svx/svdpage.hxx>
|
||||
#include <svx/xmleohlp.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <editeng/eeitem.hxx>
|
||||
#include <svx/svddef.hxx>
|
||||
#include <tools/UnitConversion.hxx>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#include <swdll.hxx>
|
||||
#include <xmloff/DocumentSettingsContext.hxx>
|
||||
#include <docsh.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <svx/xmleohlp.hxx>
|
||||
#include <sfx2/printer.hxx>
|
||||
#include <sfx2/sfxmodelfactory.hxx>
|
||||
|
||||
@@ -130,6 +130,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
|
||||
xmloff/source/core/xmlcnimp \
|
||||
xmloff/source/core/xmlerror \
|
||||
xmloff/source/core/xmlexp \
|
||||
xmloff/source/core/xmlgrhlp \
|
||||
xmloff/source/core/xmlictxt \
|
||||
xmloff/source/core/xmlimp \
|
||||
xmloff/source/core/xmltkmap \
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include <com/sun/star/io/NotConnectedException.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/lang/XInitialization.hpp>
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#include <com/sun/star/util/XCancellable.hpp>
|
||||
#include <com/sun/star/embed/XHierarchicalStorageAccess.hpp>
|
||||
#include <comphelper/fileformat.h>
|
||||
#include <comphelper/graphicmimetype.hxx>
|
||||
@@ -43,12 +41,13 @@
|
||||
#include <vcl/filter/SvmWriter.hxx>
|
||||
#include <vcl/gfxlink.hxx>
|
||||
#include <vcl/metaact.hxx>
|
||||
#include <tools/debug.hxx>
|
||||
#include <tools/zcodec.hxx>
|
||||
#include <comphelper/diagnose_ex.hxx>
|
||||
|
||||
#include <vcl/GraphicObject.hxx>
|
||||
#include <vcl/graphicfilter.hxx>
|
||||
#include <svx/xmlgrhlp.hxx>
|
||||
#include <xmloff/xmlgrhlp.hxx>
|
||||
#include <svx/xmleohlp.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -376,6 +375,48 @@ SvXMLGraphicHelper::~SvXMLGraphicHelper()
|
||||
{
|
||||
}
|
||||
|
||||
void SvXMLGraphicHelper::splitObjectURL(const OUString& _aURLNoPar,
|
||||
OUString& rContainerStorageName,
|
||||
OUString& rObjectStorageName)
|
||||
{
|
||||
DBG_ASSERT(_aURLNoPar.isEmpty() || '#' != _aURLNoPar[0], "invalid object URL" );
|
||||
OUString aURLNoPar = _aURLNoPar;
|
||||
|
||||
sal_Int32 _nPos = aURLNoPar.lastIndexOf( '/' );
|
||||
if( -1 == _nPos )
|
||||
{
|
||||
rContainerStorageName.clear();
|
||||
rObjectStorageName = aURLNoPar;
|
||||
}
|
||||
else
|
||||
{
|
||||
//eliminate 'superfluous' slashes at start and end
|
||||
//#i103076# load objects with all allowed xlink:href syntaxes
|
||||
{
|
||||
//eliminate './' at start
|
||||
sal_Int32 nStart = 0;
|
||||
sal_Int32 nCount = aURLNoPar.getLength();
|
||||
if( aURLNoPar.startsWith( "./" ) )
|
||||
{
|
||||
nStart = 2;
|
||||
nCount -= 2;
|
||||
}
|
||||
|
||||
//eliminate '/' at end
|
||||
sal_Int32 nEnd = aURLNoPar.lastIndexOf( '/' );
|
||||
if( nEnd == aURLNoPar.getLength()-1 && nEnd != (nStart-1) )
|
||||
nCount--;
|
||||
|
||||
aURLNoPar = aURLNoPar.copy( nStart, nCount );
|
||||
}
|
||||
|
||||
_nPos = aURLNoPar.lastIndexOf( '/' );
|
||||
if( _nPos >= 0 )
|
||||
rContainerStorageName = aURLNoPar.copy( 0, _nPos );
|
||||
rObjectStorageName = aURLNoPar.copy( _nPos+1 );
|
||||
}
|
||||
}
|
||||
|
||||
bool SvXMLGraphicHelper::ImplGetStreamNames( const OUString& rURLStr,
|
||||
OUString& rPictureStorageName,
|
||||
OUString& rPictureStreamName )
|
||||
@@ -391,7 +432,7 @@ bool SvXMLGraphicHelper::ImplGetStreamNames( const OUString& rURLStr,
|
||||
rPictureStreamName = aURLStr;
|
||||
}
|
||||
else
|
||||
SvXMLEmbeddedObjectHelper::splitObjectURL(aURLStr, rPictureStorageName, rPictureStreamName);
|
||||
SvXMLGraphicHelper::splitObjectURL(aURLStr, rPictureStorageName, rPictureStreamName);
|
||||
|
||||
SAL_WARN_IF(rPictureStreamName.isEmpty(), "svx", "SvXMLGraphicHelper::ImplInsertGraphicURL: invalid scheme: " << rURLStr);
|
||||
|
||||
@@ -1176,68 +1217,4 @@ com_sun_star_comp_Svx_GraphicExportHelper_get_implementation(
|
||||
return cppu::acquire(new SvXMLGraphicImportExportHelper(SvXMLGraphicHelperMode::Write));
|
||||
}
|
||||
|
||||
namespace svx {
|
||||
|
||||
void DropUnusedNamedItems(css::uno::Reference<css::uno::XInterface> const& xModel)
|
||||
{
|
||||
uno::Reference<lang::XMultiServiceFactory> const xModelFactory(xModel, uno::UNO_QUERY);
|
||||
assert(xModelFactory.is());
|
||||
try
|
||||
{
|
||||
uno::Reference<util::XCancellable> const xGradient(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.GradientTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xGradient.is())
|
||||
{
|
||||
xGradient->cancel();
|
||||
}
|
||||
|
||||
uno::Reference<util::XCancellable> const xHatch(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.HatchTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xHatch.is())
|
||||
{
|
||||
xHatch->cancel();
|
||||
}
|
||||
|
||||
uno::Reference<util::XCancellable> const xBitmap(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.BitmapTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xBitmap.is())
|
||||
{
|
||||
xBitmap->cancel();
|
||||
}
|
||||
|
||||
uno::Reference<util::XCancellable> const xTransGradient(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.TransparencyGradientTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xTransGradient.is())
|
||||
{
|
||||
xTransGradient->cancel();
|
||||
}
|
||||
|
||||
uno::Reference<util::XCancellable> const xMarker(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.MarkerTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xMarker.is())
|
||||
{
|
||||
xMarker->cancel();
|
||||
}
|
||||
|
||||
uno::Reference<util::XCancellable> const xDashes(
|
||||
xModelFactory->createInstance(u"com.sun.star.drawing.DashTable"_ustr),
|
||||
uno::UNO_QUERY );
|
||||
if (xDashes.is())
|
||||
{
|
||||
xDashes->cancel();
|
||||
}
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
TOOLS_WARN_EXCEPTION("svx", "dropUnusedNamedItems(): exception during clearing of unused named items");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace svx
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -229,4 +229,14 @@
|
||||
constructor="com_sun_star_comp_Xmloff_AnimationsImport">
|
||||
<service name="com.sun.star.comp.Xmloff.AnimationsImport"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.Svx.GraphicExportHelper"
|
||||
constructor="com_sun_star_comp_Svx_GraphicExportHelper_get_implementation">
|
||||
<service name="com.sun.star.document.BinaryStreamResolver"/>
|
||||
<service name="com.sun.star.document.GraphicStorageHandler"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.Svx.GraphicImportHelper"
|
||||
constructor="com_sun_star_comp_Svx_GraphicImportHelper_get_implementation">
|
||||
<service name="com.sun.star.document.BinaryStreamResolver"/>
|
||||
<service name="com.sun.star.document.GraphicStorageHandler"/>
|
||||
</implementation>
|
||||
</component>
|
||||
|
||||
Reference in New Issue
Block a user