[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 332 commits - avmedia/source basctl/qa basctl/source basctl/uiconfig basic/qa basic/source bin/find-can-be-private-symbols.classes.results bin/lint-ui.py bridges/source chart2/qa chart2/source chart2/uiconfig compilerplugins/clang config_host.mk.in configure.ac connectivity/source cui/qa cui/source cui/uiconfig dbaccess/qa dbaccess/source dbaccess/uiconfig desktop/qa desktop/source desktop/test desktop/uiconfig dictionaries drawinglayer/CppunitTest_drawinglayer_border.mk drawinglayer/inc drawinglayer/Library_drawinglayercore.mk drawinglayer/Library_drawinglayer.mk drawinglayer/Module_drawinglayer.mk drawinglayer/source editeng/inc editeng/source embeddedobj/source embedserv/source emfio/CppunitTest_emfio_emf.mk emfio/Library_emfio.mk emfio/source extensions/source extensions/uiconfig external/nss external/pdfium filter/Library_pdffilter.mk filter/Library_svgfilter.mk filter/qa filter/source filter/uiconfig formula/qa formula/uico nfig fpicker/qa fpicker/uiconfig framework/source .git-hooks/pre-commit helpcontent2 i18npool/source icon-themes/colibre icon-themes/elementary icon-themes/elementary_svg idlc/inc idlc/source idl/inc idl/source include/basegfx include/basic include/drawinglayer include/editeng include/o3tl include/oox include/rtl include/sal include/sax include/sfx2 include/sot include/svl include/svx include/tools include/vcl include/xmloff instsetoo_native/ooenv ios/CustomTarget_iOS_link.mk ios/DISCLAIMER_WARNING ios/.gitignore ios/LibreOfficeLight ios/Module_ios.mk ios/README ios/source lotuswordpro/inc lotuswordpro/source Makefile.in o3tl/qa officecfg/registry onlineupdate/source oox/qa oox/source pyuno/source reportdesign/qa reportdesign/source reportdesign/uiconfig Repository.mk RepositoryModule_build.mk sal/qa sal/rtl sax/qa sax/source sc/CppunitTest_sc_parallelism.mk sc/CppunitTest_sc_ucalc.mk sc/inc sc/Library_sc.mk scp2/source sc/qa sc/source sc/uiconfig sc/UIConfig_scalc.mk sd/CppunitTest _sd_uimpress.mk sdext/source sd/inc sd/Library_sd.mk sd/qa sd/source sd/uiconfig setup_native/source sfx2/Library_sfx.mk sfx2/qa sfx2/source sfx2/uiconfig solenv/bin solenv/clang-format solenv/gbuild sot/source starmath/qa starmath/source svgio/CppunitTest_svgio.mk svgio/Library_svgio.mk svl/source svtools/qa svtools/source svtools/uiconfig svx/CppunitTest_svx_unit.mk svx/Executable_gengal.mk svx/Library_svxcore.mk svx/Library_svx.mk svx/Module_svx.mk svx/qa svx/source svx/uiconfig sw/CppunitTest_sw_uiwriter2.mk sw/CppunitTest_sw_uiwriter3.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_uwriter.mk sw/inc sw/Library_sw.mk sw/Library_swui.mk sw/Module_sw.mk sw/qa sw/source sw/uiconfig sysui/desktop tools/qa tools/source translations uitest/impress_tests uitest/uitest unotest/source unotools/qa uui/qa uui/uiconfig vcl/CppunitTest_vcl_filter_igif.mk vcl/inc vcl/ios vcl/jsdialog vcl/Library_vcl.mk vcl/Library_vclplug_gtk3_kde5.mk vcl/Library_vclplug_gtk3.mk vcl/Module_vcl.mk vcl/qa vc l/quartz vcl/source vcl/uiconfig vcl/unx vcl/win wizards/Package_sfdocuments.mk wizards/source writerfilter/qa writerfilter/source writerperfect/qa writerperfect/source writerperfect/uiconfig xmloff/inc xmloff/source xmlsecurity/qa xmlsecurity/source xmlsecurity/uiconfig
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Dec 24 02:25:25 UTC 2020
Rebased ref, commits from common ancestor:
commit ab49589656d4a9cec79ab521661eb738bb1ef7e9
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Dec 24 11:18:47 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:18:47 2020 +0900
Same SvStream reading fix as in commit [1] but for TypeSerializer
[1] 8c9a4ff511a3b1d84a7a6d08a1b153c07f164abb
Explanation from the commit:
"to avoid chasing weird problems where we read past the end
of file, which leads to random data in the variable we read into.
I expect a couple of possible regressions from this change
(1) memory leaks caused by non-exception-safe memory handling.
Of which there should not be much because we're pretty good
about using smart pointer classes these days.
(2) Broken files which used to load, will no longer do so.
These will have to be debugged by putting a breakpoint
on the SvStreamEOFException constructor, and examining
the backtrace to see where we should be catching and ignoring
the exception to make the code continue to handle such broken
files."
Change-Id: I6f9ba7599c208b4340e86014e326e9a0693cd528
diff --git a/vcl/source/gdi/TypeSerializer.cxx b/vcl/source/gdi/TypeSerializer.cxx
index 6e1e504ee670..e501c58c6be7 100644
--- a/vcl/source/gdi/TypeSerializer.cxx
+++ b/vcl/source/gdi/TypeSerializer.cxx
@@ -170,16 +170,15 @@ void TypeSerializer::readGraphic(Graphic& rGraphic)
const sal_uLong nInitialStreamPosition = mrStream.Tell();
sal_uInt32 nType;
- // read Id
- mrStream.ReadUInt32(nType);
-
// if there is no more data, avoid further expensive
// reading which will create VDevs and other stuff, just to
- // read nothing. CAUTION: Eof is only true AFTER reading another
- // byte, a speciality of SvMemoryStream (!)
- if (!mrStream.good())
+ // read nothing.
+ if (mrStream.remainingSize() < 4)
return;
+ // read Id
+ mrStream.ReadUInt32(nType);
+
if (NATIVE_FORMAT_50 == nType)
{
Graphic aGraphic;
commit 8ee6d91c8e6359a15fa481a661819f81d4064022
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Dec 24 09:22:35 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:09:01 2020 +0900
vcl: remove {Read,Write}ImpGraphic and ImplExportNative from Graphic
ReadImpGraphic and WriteImpGraphic have been reimplemented in the
TypeSerializer some time ago, but the code has not yet been moved
to use that class. This commits does that and changes all the code
using those 2 methods and removes them. With this implemented in
the TypeSerializer, it is easier to handle
In addition it also removes ImplExportNative (and the method on
the Graphic interface). This was really used only in one method,
and it could be implemented in the mthod itself.
Change-Id: I0982429d1c1d5ed7ef07627d87ed9a08df43f040
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 84d51c760f1e..d8c0c3f9a583 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -101,6 +101,7 @@ using namespace com::sun::star::uno;
#include <com/sun/star/i18n/XCharacterClassification.hpp>
#include <vcl/unohelp.hxx>
+#include <vcl/TypeSerializer.hxx>
#if HAVE_FEATURE_SCRIPTING
@@ -4332,7 +4333,8 @@ void SbRtl_SavePicture(StarBASIC *, SbxArray & rPar, bool)
{
SvFileStream aOStream( rPar.Get32(2)->GetOUString(), StreamMode::WRITE | StreamMode::TRUNC );
const Graphic& aGraphic = pPicture->GetGraphic();
- WriteGraphic( aOStream, aGraphic );
+ TypeSerializer aSerializer(aOStream);
+ aSerializer.writeGraphic(aGraphic);
}
}
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 8d78185159d9..6a6b7269b893 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -57,6 +57,7 @@
#include <vcl/transfer.hxx>
#include <sot/storage.hxx>
#include <vcl/graph.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <svx/unomodel.hxx>
#include <svx/svdmodel.hxx>
#include <unotools/streamwrap.hxx>
@@ -290,7 +291,10 @@ void ChartController::executeDispatch_Paste()
// graphic exchange format (graphic manager bitmap format?)
tools::SvRef<SotTempStream> xStm;
if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm ))
- ReadGraphic( *xStm, aGraphic );
+ {
+ TypeSerializer aSerializer(*xStm);
+ aSerializer.readGraphic(aGraphic);
+ }
}
else if( aDataHelper.HasFormat( SotClipboardFormatId::GDIMETAFILE ))
{
diff --git a/editeng/source/items/legacyitem.cxx b/editeng/source/items/legacyitem.cxx
index af41980b2d2c..fd4334aed245 100644
--- a/editeng/source/items/legacyitem.cxx
+++ b/editeng/source/items/legacyitem.cxx
@@ -24,6 +24,7 @@
#include <comphelper/fileformat.h>
#include <vcl/graph.hxx>
#include <vcl/GraphicObject.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <osl/diagnose.h>
#include <tools/urlobj.hxx>
#include <editeng/fontitem.hxx>
@@ -493,7 +494,7 @@ namespace legacy
sal_Int8 nStyle;
rStrm.ReadCharAsBool( bTrans );
- tools::GenericTypeSerializer aSerializer(rStrm);
+ TypeSerializer aSerializer(rStrm);
aSerializer.readColor(aTempColor);
aSerializer.readColor(aTempFillColor);
rStrm.ReadSChar( nStyle );
@@ -555,8 +556,7 @@ namespace legacy
if ( nDoLoad & LOAD_GRAPHIC )
{
Graphic aGraphic;
-
- ReadGraphic( rStrm, aGraphic );
+ aSerializer.readGraphic(aGraphic);
rItem.SetGraphicObject(GraphicObject(aGraphic));
if( SVSTREAM_FILEFORMAT_ERROR == rStrm.GetError() )
@@ -592,7 +592,7 @@ namespace legacy
SvStream& Store(const SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16)
{
rStrm.WriteBool( false );
- tools::GenericTypeSerializer aSerializer(rStrm);
+ TypeSerializer aSerializer(rStrm);
aSerializer.writeColor(rItem.GetColor());
aSerializer.writeColor(rItem.GetColor());
rStrm.WriteSChar( rItem.GetColor().GetTransparency() > 0 ? 0 : 1 ); //BRUSH_NULL : BRUSH_SOLID
@@ -609,7 +609,9 @@ namespace legacy
rStrm.WriteUInt16( nDoLoad );
if (nullptr != pGraphicObject && rItem.GetGraphicLink().isEmpty())
- WriteGraphic(rStrm, pGraphicObject->GetGraphic());
+ {
+ aSerializer.writeGraphic(pGraphicObject->GetGraphic());
+ }
if ( !rItem.GetGraphicLink().isEmpty() )
{
OSL_FAIL("No BaseURL!");
diff --git a/vcl/inc/TypeSerializer.hxx b/include/vcl/TypeSerializer.hxx
similarity index 100%
rename from vcl/inc/TypeSerializer.hxx
rename to include/vcl/TypeSerializer.hxx
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index 983330a89745..86d885a326ac 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -185,11 +185,6 @@ public:
GfxLink GetGfxLink() const;
bool IsGfxLink() const;
- bool ExportNative( SvStream& rOStream ) const;
-
- friend VCL_DLLPUBLIC void WriteGraphic(SvStream& rOStream, const Graphic& rGraphic);
- friend VCL_DLLPUBLIC void ReadGraphic(SvStream& rIStream, Graphic& rGraphic);
-
const std::shared_ptr<VectorGraphicData>& getVectorGraphicData() const;
/// Get the page number of the multi-page source this Graphic is rendered from.
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 95b6bd3d7cde..11f03b0b92fd 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -31,6 +31,7 @@
#include <memory>
#include <vcl/uitest/logger.hxx>
#include <vcl/uitest/eventdescription.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <attrib.hxx>
#include <patattr.hxx>
@@ -783,8 +784,8 @@ bool ScViewFunc::PasteOnDrawObjectLinked(
if( pScDrawView && aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm ) )
{
Graphic aGraphic;
-
- ReadGraphic( *xStm, aGraphic );
+ TypeSerializer aSerializer(*xStm);
+ aSerializer.readGraphic(aGraphic);
const OUString aBeginUndo(ScResId(STR_UNDO_DRAGDROP));
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index e5d52fabfe83..1773c2fb4474 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -40,6 +40,7 @@
#include <svl/stritem.hxx>
#include <vcl/transfer.hxx>
#include <vcl/graph.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <osl/thread.h>
#include <comphelper/automationinvokedzone.hxx>
@@ -501,7 +502,8 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm ) )
{
Graphic aGraphic;
- ReadGraphic( *xStm, aGraphic );
+ TypeSerializer aSerializer(*xStm);
+ aSerializer.readGraphic(aGraphic);
bRet = PasteGraphic( aPos, aGraphic, EMPTY_OUSTRING );
}
}
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 9657e76fc492..d334cb7a2254 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -41,6 +41,7 @@
#include <svx/ImageMapInfo.hxx>
#include <unotools/streamwrap.hxx>
#include <vcl/metaact.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <svx/svxids.hrc>
#include <toolkit/helper/vclunohelper.hxx>
#include <svtools/embedhlp.hxx>
@@ -1200,7 +1201,8 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
Point aInsertPos( rPos );
Graphic aGraphic;
- ReadGraphic( *xStm, aGraphic );
+ TypeSerializer aSerializer(*xStm);
+ aSerializer.readGraphic(aGraphic);
if( pOwnData && pOwnData->GetWorkDocument() )
{
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index befb7510f82a..0bdfd7b3788e 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -42,6 +42,7 @@
#include <unotools/charclass.hxx>
#include <unotools/securityoptions.hxx>
#include <vcl/GraphicLoader.hxx>
+#include <vcl/TypeSerializer.hxx>
#include "fileobj.hxx"
#include "impldde.hxx"
@@ -543,7 +544,8 @@ bool LinkManager::GetGraphicFromAny(const OUString& rMimeType,
{
case SotClipboardFormatId::SVXB:
{
- ReadGraphic( aMemStm, rGraphic );
+ TypeSerializer aSerializer(aMemStm);
+ aSerializer.readGraphic(rGraphic);
bRet = true;
}
break;
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 27a9703fdc7f..6536747f1b3a 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -22,6 +22,8 @@
#include <vcl/graphicfilter.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/outdev.hxx>
+#include <vcl/gfxlink.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <bitmaps.hlst>
#include <sal/log.hxx>
@@ -770,15 +772,32 @@ void EmbeddedObjectRef::SetGraphicToContainer( const Graphic& rGraphic,
{
SvMemoryStream aStream;
aStream.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
- if ( rGraphic.ExportNative( aStream ) )
- {
- aStream.Seek( 0 );
- uno::Reference < io::XInputStream > xStream = new ::utl::OSeekableInputStreamWrapper( aStream );
- aContainer.InsertGraphicStream( xStream, aName, aMediaType );
+ auto pGfxLink = rGraphic.GetSharedGfxLink();
+ if (pGfxLink && pGfxLink->IsNative())
+ {
+ if (pGfxLink->ExportNative(aStream))
+ {
+ aStream.Seek(0);
+ uno::Reference <io::XInputStream> xStream = new ::utl::OSeekableInputStreamWrapper(aStream);
+ aContainer.InsertGraphicStream(xStream, aName, aMediaType);
+ }
+ else
+ OSL_FAIL("Export of graphic is failed!");
}
else
- OSL_FAIL( "Export of graphic is failed!" );
+ {
+ TypeSerializer aSerializer(aStream);
+ aSerializer.writeGraphic(rGraphic);
+ if (aStream.GetError() == ERRCODE_NONE)
+ {
+ aStream.Seek(0);
+ uno::Reference <io::XInputStream> xStream = new ::utl::OSeekableInputStreamWrapper(aStream);
+ aContainer.InsertGraphicStream(xStream, aName, aMediaType);
+ }
+ else
+ OSL_FAIL("Export of graphic is failed!");
+ }
}
uno::Reference< io::XInputStream > EmbeddedObjectRef::GetGraphicReplacementStream(
diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx
index 856dd7a08149..1c32e8de0606 100644
--- a/svx/source/dialog/compressgraphicdialog.cxx
+++ b/svx/source/dialog/compressgraphicdialog.cxx
@@ -121,40 +121,41 @@ void CompressGraphicsDialog::Initialize()
void CompressGraphicsDialog::Update()
{
- GfxLinkType aLinkType = m_aGraphic.GetGfxLink().GetType();
- OUString aGraphicTypeString;
- switch(aLinkType)
+ OUString aGraphicTypeString = SvxResId(STR_IMAGE_UNKNOWN);
+
+ auto pGfxLink = m_aGraphic.GetSharedGfxLink();
+ if (pGfxLink)
{
- case GfxLinkType::NativeGif:
- aGraphicTypeString = SvxResId(STR_IMAGE_GIF);
- break;
- case GfxLinkType::NativeJpg:
- aGraphicTypeString = SvxResId(STR_IMAGE_JPEG);
- break;
- case GfxLinkType::NativePng:
- aGraphicTypeString = SvxResId(STR_IMAGE_PNG);
- break;
- case GfxLinkType::NativeTif:
- aGraphicTypeString = SvxResId(STR_IMAGE_TIFF);
- break;
- case GfxLinkType::NativeWmf:
- aGraphicTypeString = SvxResId(STR_IMAGE_WMF);
- break;
- case GfxLinkType::NativeMet:
- aGraphicTypeString = SvxResId(STR_IMAGE_MET);
- break;
- case GfxLinkType::NativePct:
- aGraphicTypeString = SvxResId(STR_IMAGE_PCT);
- break;
- case GfxLinkType::NativeSvg:
- aGraphicTypeString = SvxResId(STR_IMAGE_SVG);
- break;
- case GfxLinkType::NativeBmp:
- aGraphicTypeString = SvxResId(STR_IMAGE_BMP);
- break;
- default:
- aGraphicTypeString = SvxResId(STR_IMAGE_UNKNOWN);
- break;
+ switch (pGfxLink->GetType())
+ {
+ case GfxLinkType::NativeGif:
+ aGraphicTypeString = SvxResId(STR_IMAGE_GIF);
+ break;
+ case GfxLinkType::NativeJpg:
+ aGraphicTypeString = SvxResId(STR_IMAGE_JPEG);
+ break;
+ case GfxLinkType::NativePng:
+ aGraphicTypeString = SvxResId(STR_IMAGE_PNG);
+ break;
+ case GfxLinkType::NativeTif:
+ aGraphicTypeString = SvxResId(STR_IMAGE_TIFF);
+ break;
+ case GfxLinkType::NativeWmf:
+ aGraphicTypeString = SvxResId(STR_IMAGE_WMF);
+ break;
+ case GfxLinkType::NativeMet:
+ aGraphicTypeString = SvxResId(STR_IMAGE_MET);
+ break;
+ case GfxLinkType::NativePct:
+ aGraphicTypeString = SvxResId(STR_IMAGE_PCT);
+ break;
+ case GfxLinkType::NativeSvg:
+ aGraphicTypeString = SvxResId(STR_IMAGE_SVG);
+ break;
+ case GfxLinkType::NativeBmp:
+ aGraphicTypeString = SvxResId(STR_IMAGE_BMP);
+ break;
+ }
}
m_xLabelGraphicType->set_label(aGraphicTypeString);
@@ -189,10 +190,7 @@ void CompressGraphicsDialog::Update()
aViewSizeString = aViewSizeString.replaceAll("$(DPI)", OUString::number(aValX));
m_xFixedText3->set_label(aViewSizeString);
- SvMemoryStream aMemStream;
- aMemStream.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
- m_aGraphic.ExportNative(aMemStream);
- m_aNativeSize = aMemStream.TellEnd();
+ m_aNativeSize = pGfxLink ? pGfxLink->GetDataSize() : 0;
OUString aNativeSizeString = SvxResId(STR_IMAGE_CAPACITY);
aNativeSizeString = aNativeSizeString.replaceAll("$(CAPACITY)", OUString::number( m_aNativeSize / 1024 ));
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e39d475d8718..3d185a72afb9 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -64,6 +64,8 @@
#include <comphelper/propertysequence.hxx>
#include <osl/time.h>
#include <comphelper/processfactory.hxx>
+#include <vcl/TypeSerializer.hxx>
+
class Test : public SwModelTestBase
{
@@ -1554,7 +1556,8 @@ DECLARE_OOXMLIMPORT_TEST(testTdf100072, "tdf100072.docx")
// Read it back and dump it as an XML file.
Graphic aGraphic;
- ReadGraphic(aStream, aGraphic);
+ TypeSerializer aSerializer(aStream);
+ aSerializer.readGraphic(aGraphic);
const GDIMetaFile& rMetaFile = aGraphic.GetGDIMetaFile();
MetafileXmlDump dumper;
xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, rMetaFile);
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index fec30772d5dd..c651fd8859f3 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -46,6 +46,7 @@
#include <AnnotationWin.hxx>
#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
#include <com/sun/star/awt/FontUnderline.hpp>
+#include <vcl/TypeSerializer.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdview.hxx>
@@ -2151,7 +2152,8 @@ void SwUiWriterTest::testFdo87448()
// Read it back and dump it as an XML file.
Graphic aGraphic;
- ReadGraphic(aStream, aGraphic);
+ TypeSerializer aSerializer(aStream);
+ aSerializer.readGraphic(aGraphic);
const GDIMetaFile& rMetaFile = aGraphic.GetGDIMetaFile();
MetafileXmlDump dumper;
xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, rMetaFile);
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index a598386ede3d..0e4ca6203a71 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -10,6 +10,7 @@
#include <swmodeltestbase.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <vcl/scheduler.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <com/sun/star/drawing/GraphicExportFilter.hpp>
#include <IDocumentDrawModelAccess.hxx>
#include <com/sun/star/text/TextContentAnchorType.hpp>
@@ -2084,7 +2085,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133477)
// Read it back and check the color of the first pixel.
Graphic aGraphic;
- ReadGraphic(aStream, aGraphic);
+ TypeSerializer aSerializer(aStream);
+ aSerializer.readGraphic(aGraphic);
+
BitmapEx aBitmap = aGraphic.GetBitmapEx();
CPPUNIT_ASSERT_EQUAL(Color(0, 102, 204), aBitmap.GetPixelColor(0, 0));
}
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index e5312d2be203..c6f8091daebc 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -124,6 +124,7 @@
#include <vcl/GraphicNativeTransform.hxx>
#include <vcl/GraphicNativeMetadata.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <comphelper/lok.hxx>
#include <sfx2/classificationhelper.hxx>
#include <sfx2/sfxdlg.hxx>
@@ -2770,7 +2771,8 @@ bool SwTransferable::PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
if(rData.GetSotStorageStream(SotClipboardFormatId::SVXB, xStm))
{
- ReadGraphic( *xStm, aGraphic );
+ TypeSerializer aSerializer(*xStm);
+ aSerializer.readGraphic(aGraphic);
bRet = (GraphicType::NONE != aGraphic.GetType() && GraphicType::Default != aGraphic.GetType());
}
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index f4417a262d1c..1b80f0f452f1 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -197,11 +197,6 @@ private:
BitmapChecksum ImplGetChecksum() const;
- bool ImplExportNative( SvStream& rOStm ) const;
-
- friend void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic);
- friend void ReadImpGraphic(SvStream& rIStm, ImpGraphic& rImpGraphic);
-
const std::shared_ptr<VectorGraphicData>& getVectorGraphicData() const;
/// Gets the bitmap replacement for a vector graphic.
diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx
index a816716d3ab6..2410dd92b4b0 100644
--- a/vcl/inc/pch/precompiled_vcl.hxx
+++ b/vcl/inc/pch/precompiled_vcl.hxx
@@ -247,7 +247,6 @@
#if PCH_LEVEL >= 4
#include <PhysicalFontCollection.hxx>
#include <PhysicalFontFace.hxx>
-#include <TypeSerializer.hxx>
#include <bitmapwriteaccess.hxx>
#include <brdwin.hxx>
#include <configsettings.hxx>
@@ -274,6 +273,7 @@
#include <vcl/AccessibleBrowseBoxObjType.hxx>
#include <vcl/BitmapFilter.hxx>
#include <vcl/BitmapTools.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <vcl/QueueInfo.hxx>
#include <vcl/accel.hxx>
#include <vcl/alpha.hxx>
diff --git a/vcl/qa/cppunit/TypeSerializerTest.cxx b/vcl/qa/cppunit/TypeSerializerTest.cxx
index fd45662bdf20..265b7f760496 100644
--- a/vcl/qa/cppunit/TypeSerializerTest.cxx
+++ b/vcl/qa/cppunit/TypeSerializerTest.cxx
@@ -25,7 +25,7 @@
#include <tools/vcompat.hxx>
#include <comphelper/fileformat.h>
-#include <TypeSerializer.hxx>
+#include <vcl/TypeSerializer.hxx>
#if USE_TLS_NSS
#include <nss.h>
@@ -124,56 +124,6 @@ void TypeSerializerTest::testGraphic_Vector()
aGraphic.makeAvailable();
BitmapChecksum aChecksum = aGraphic.getVectorGraphicData()->GetChecksum();
- // Test WriteGraphic - Native Format 5
- {
- SvMemoryStream aMemoryStream;
- aMemoryStream.SetVersion(SOFFICE_FILEFORMAT_50);
- aMemoryStream.SetCompressMode(SvStreamCompressFlags::NATIVE);
- WriteGraphic(aMemoryStream, aGraphic);
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
-
- CPPUNIT_ASSERT_EQUAL(sal_uInt64(290), aMemoryStream.remainingSize());
- std::vector<unsigned char> aHash = calculateHash(aMemoryStream);
- CPPUNIT_ASSERT_EQUAL(std::string("ee55ab6faa73b61b68bc3d5628d95f0d3c528e2a"),
- toHexString(aHash));
-
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- sal_uInt32 nType;
- aMemoryStream.ReadUInt32(nType);
- CPPUNIT_ASSERT_EQUAL(COMPAT_FORMAT('N', 'A', 'T', '5'), nType);
-
- // Read it back
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- Graphic aNewGraphic;
- ReadGraphic(aMemoryStream, aNewGraphic);
- CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aNewGraphic.GetType());
- CPPUNIT_ASSERT_EQUAL(aChecksum, aNewGraphic.getVectorGraphicData()->GetChecksum());
- }
-
- // Test WriteGraphic - Normal
- {
- SvMemoryStream aMemoryStream;
- WriteGraphic(aMemoryStream, aGraphic);
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
-
- CPPUNIT_ASSERT_EQUAL(sal_uInt64(233), aMemoryStream.remainingSize());
- std::vector<unsigned char> aHash = calculateHash(aMemoryStream);
- CPPUNIT_ASSERT_EQUAL(std::string("c2bed2099ce617f1cc035701de5186f0d43e3064"),
- toHexString(aHash));
-
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- sal_uInt32 nType;
- aMemoryStream.ReadUInt32(nType);
- CPPUNIT_ASSERT_EQUAL(createMagic('s', 'v', 'g', '0'), nType);
-
- // Read it back
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- Graphic aNewGraphic;
- ReadGraphic(aMemoryStream, aNewGraphic);
- CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aNewGraphic.GetType());
- CPPUNIT_ASSERT_EQUAL(aChecksum, aNewGraphic.getVectorGraphicData()->GetChecksum());
- }
-
// Test TypeSerializer - Native Format 5
{
SvMemoryStream aMemoryStream;
@@ -244,30 +194,6 @@ void TypeSerializerTest::testGraphic_Bitmap_NoGfxLink()
BitmapEx aBitmapEx(aBitmap);
Graphic aGraphic(aBitmapEx);
- // Test WriteGraphic
- {
- SvMemoryStream aMemoryStream;
- WriteGraphic(aMemoryStream, aGraphic);
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
-
- CPPUNIT_ASSERT_EQUAL(sal_uInt64(383), aMemoryStream.remainingSize());
- std::vector<unsigned char> aHash = calculateHash(aMemoryStream);
- CPPUNIT_ASSERT_EQUAL(std::string("da831418499146d51bf245fadf60b9111faa76c2"),
- toHexString(aHash));
-
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- sal_uInt16 nType;
- aMemoryStream.ReadUInt16(nType);
- CPPUNIT_ASSERT_EQUAL(sal_uInt16(0x4D42), nType); // Magic written with WriteDIBBitmapEx
-
- // Read it back
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- Graphic aNewGraphic;
- ReadGraphic(aMemoryStream, aNewGraphic);
- CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aNewGraphic.GetType());
- CPPUNIT_ASSERT_EQUAL(aBitmapEx.GetChecksum(), aNewGraphic.GetBitmapExRef().GetChecksum());
- }
-
// Test TypeSerializer
{
SvMemoryStream aMemoryStream;
@@ -310,56 +236,6 @@ void TypeSerializerTest::testGraphic_Animation()
CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aGraphic.GetType());
CPPUNIT_ASSERT_EQUAL(true, aGraphic.IsAnimated());
- // Test WriteGraphic
- {
- SvMemoryStream aMemoryStream;
- WriteGraphic(aMemoryStream, aGraphic);
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
-
- CPPUNIT_ASSERT_EQUAL(sal_uInt64(15167), aMemoryStream.remainingSize());
- std::vector<unsigned char> aHash = calculateHash(aMemoryStream);
- CPPUNIT_ASSERT_EQUAL(std::string("69d0f80832a0aebcbda7ad43ecadf85e99fc1057"),
- toHexString(aHash));
-
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- sal_uInt16 nType;
- aMemoryStream.ReadUInt16(nType);
- CPPUNIT_ASSERT_EQUAL(sal_uInt16(0x4D42), nType);
-
- // Read it back
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- Graphic aNewGraphic;
- ReadGraphic(aMemoryStream, aNewGraphic);
- CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aNewGraphic.GetType());
- CPPUNIT_ASSERT_EQUAL(true, aNewGraphic.IsAnimated());
- }
-
- // Test WriteGraphic - Native Format 5
- {
- SvMemoryStream aMemoryStream;
- aMemoryStream.SetVersion(SOFFICE_FILEFORMAT_50);
- aMemoryStream.SetCompressMode(SvStreamCompressFlags::NATIVE);
- WriteGraphic(aMemoryStream, aGraphic);
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
-
- CPPUNIT_ASSERT_EQUAL(sal_uInt64(1582), aMemoryStream.remainingSize());
- std::vector<unsigned char> aHash = calculateHash(aMemoryStream);
- CPPUNIT_ASSERT_EQUAL(std::string("da3b9600340fa80a895f2107357e4ab65a9292eb"),
- toHexString(aHash));
-
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- sal_uInt32 nType;
- aMemoryStream.ReadUInt32(nType);
- CPPUNIT_ASSERT_EQUAL(COMPAT_FORMAT('N', 'A', 'T', '5'), nType);
-
- // Read it back
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- Graphic aNewGraphic;
- ReadGraphic(aMemoryStream, aNewGraphic);
- CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aNewGraphic.GetType());
- CPPUNIT_ASSERT_EQUAL(true, aNewGraphic.IsAnimated());
- }
-
// Test TypeSerializer
{
SvMemoryStream aMemoryStream;
@@ -438,30 +314,6 @@ void TypeSerializerTest::testGraphic_GDIMetaFile()
Graphic aGraphic(aGDIMetaFile);
CPPUNIT_ASSERT_EQUAL(GraphicType::GdiMetafile, aGraphic.GetType());
- // Test WriteGraphic
- {
- SvMemoryStream aMemoryStream;
- WriteGraphic(aMemoryStream, aGraphic);
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
-
- CPPUNIT_ASSERT_EQUAL(sal_uInt64(229), aMemoryStream.remainingSize());
- std::vector<unsigned char> aHash = calculateHash(aMemoryStream);
- CPPUNIT_ASSERT_EQUAL(std::string("144c518e5149d61ab4bc34643df820372405d61d"),
- toHexString(aHash));
-
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- char aIdCharArray[7] = { 0, 0, 0, 0, 0, 0, 0 };
- aMemoryStream.ReadBytes(aIdCharArray, 6);
- OString sID(aIdCharArray);
- CPPUNIT_ASSERT_EQUAL(OString("VCLMTF"), sID);
-
- // Read it back
- aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
- Graphic aNewGraphic;
- ReadGraphic(aMemoryStream, aNewGraphic);
- CPPUNIT_ASSERT_EQUAL(GraphicType::GdiMetafile, aNewGraphic.GetType());
- }
-
// Test TypeSerializer
{
SvMemoryStream aMemoryStream;
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 65ae12a65931..2a708336d233 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -65,6 +65,7 @@
#include <vector>
#include <memory>
#include <string_view>
+#include <vcl/TypeSerializer.hxx>
#include "FilterConfigCache.hxx"
#include "graphicfilter_internal.hxx"
@@ -1662,7 +1663,9 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
aFilterName.equalsIgnoreAsciiCase( IMP_SVMETAFILE ) )
{
// SV internal filters for import bitmaps and MetaFiles
- ReadGraphic( rIStream, rGraphic );
+ TypeSerializer aSerializer(rIStream);
+ aSerializer.readGraphic(rGraphic);
+
if( rIStream.GetError() )
{
nStatus = ERRCODE_GRFILTER_FORMATERROR;
@@ -1675,7 +1678,9 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
}
else if( aFilterName.equalsIgnoreAsciiCase( IMP_MOV ) )
{
- ReadGraphic( rIStream, rGraphic );
+ TypeSerializer aSerializer(rIStream);
+ aSerializer.readGraphic(rGraphic);
+
if( rIStream.GetError() )
nStatus = ERRCODE_GRFILTER_FORMATERROR;
else
diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx
index 382ee0777d96..987948917536 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -21,7 +21,7 @@
#include <tools/stream.hxx>
#include <tools/fract.hxx>
#include <tools/urlobj.hxx>
-#include <TypeSerializer.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <vcl/outdev.hxx>
#include <vcl/graphicfilter.hxx>
#include <unotools/ucbstreamhelper.hxx>
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index e3fced8fc158..fdd9ef68413e 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -33,7 +33,7 @@
#include <string_view>
#include <rtl/instance.hxx>
-#include <TypeSerializer.hxx>
+#include <vcl/TypeSerializer.hxx>
using namespace vcl;
diff --git a/vcl/source/gdi/TypeSerializer.cxx b/vcl/source/gdi/TypeSerializer.cxx
index ac06a0d3bcb3..6e1e504ee670 100644
--- a/vcl/source/gdi/TypeSerializer.cxx
+++ b/vcl/source/gdi/TypeSerializer.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <TypeSerializer.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <tools/vcompat.hxx>
#include <sal/log.hxx>
#include <comphelper/fileformat.h>
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 89390752d185..2da133abb35d 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -39,7 +39,7 @@
#include <vcl/mtfxmldump.hxx>
#include <svmconverter.hxx>
-#include <TypeSerializer.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <com/sun/star/rendering/MtfRenderer.hpp>
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 61f0dc3de354..bd59be143d5a 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -515,22 +515,6 @@ BitmapChecksum Graphic::GetChecksum() const
return mxImpGraphic->ImplGetChecksum();
}
-bool Graphic::ExportNative( SvStream& rOStream ) const
-{
- return mxImpGraphic->ImplExportNative( rOStream );
-}
-
-void ReadGraphic(SvStream& rIStream, Graphic& rGraphic)
-{
- rGraphic.ImplTestRefCount();
- ReadImpGraphic(rIStream, *rGraphic.mxImpGraphic);
-}
-
-void WriteGraphic( SvStream& rOStream, const Graphic& rGraphic )
-{
- WriteImpGraphic(rOStream, *rGraphic.mxImpGraphic);
-}
-
const std::shared_ptr<VectorGraphicData>& Graphic::getVectorGraphicData() const
{
return mxImpGraphic->getVectorGraphicData();
diff --git a/vcl/source/gdi/graphictools.cxx b/vcl/source/gdi/graphictools.cxx
index 4be1b43fadb7..7ec3d7d36588 100644
--- a/vcl/source/gdi/graphictools.cxx
+++ b/vcl/source/gdi/graphictools.cxx
@@ -19,8 +19,7 @@
#include <tools/stream.hxx>
#include <tools/vcompat.hxx>
-#include <tools/GenericTypeSerializer.hxx>
-
+#include <vcl/TypeSerializer.hxx>
#include <vcl/graphictools.hxx>
SvtGraphicFill::Transform::Transform()
@@ -237,7 +236,7 @@ SvStream& WriteSvtGraphicFill( SvStream& rOStm, const SvtGraphicFill& rClass )
VersionCompat aCompat( rOStm, StreamMode::WRITE, 1 );
rClass.maPath.Write( rOStm );
- tools::GenericTypeSerializer aSerializer(rOStm);
+ TypeSerializer aSerializer(rOStm);
aSerializer.writeColor(rClass.maFillColor);
rOStm.WriteDouble( rClass.mfTransparency );
sal_uInt16 nTmp = sal::static_int_cast<sal_uInt16>( rClass.maFillRule );
@@ -257,7 +256,7 @@ SvStream& WriteSvtGraphicFill( SvStream& rOStm, const SvtGraphicFill& rClass )
aSerializer.writeColor(rClass.maGradient1stColor);
aSerializer.writeColor(rClass.maGradient2ndColor);
rOStm.WriteInt32( rClass.maGradientStepCount );
- WriteGraphic( rOStm, rClass.maFillGraphic );
+ aSerializer.writeGraphic(rClass.maFillGraphic);
return rOStm;
}
@@ -268,7 +267,7 @@ SvStream& ReadSvtGraphicFill( SvStream& rIStm, SvtGraphicFill& rClass )
rClass.maPath.Read( rIStm );
- tools::GenericTypeSerializer aSerializer(rIStm);
+ TypeSerializer aSerializer(rIStm);
aSerializer.readColor(rClass.maFillColor);
rIStm.ReadDouble( rClass.mfTransparency );
sal_uInt16 nTmp;
@@ -288,7 +287,7 @@ SvStream& ReadSvtGraphicFill( SvStream& rIStm, SvtGraphicFill& rClass )
aSerializer.readColor(rClass.maGradient1stColor);
aSerializer.readColor(rClass.maGradient2ndColor);
rIStm.ReadInt32( rClass.maGradientStepCount );
- ReadGraphic( rIStm, rClass.maFillGraphic );
+ aSerializer.readGraphic(rClass.maFillGraphic);
return rIStm;
}
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index f40500b44519..6e444e3712ef 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -44,14 +44,13 @@
#include <map>
#include <memory>
#include <vcl/gdimetafiletools.hxx>
-#include <TypeSerializer.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <vcl/pdfread.hxx>
#define GRAPHIC_MTFTOBMP_MAXEXT 2048
#define GRAPHIC_STREAMBUFSIZE 8192UL
#define SWAP_FORMAT_ID COMPAT_FORMAT( 'S', 'W', 'A', 'P' )
-#define NATIVE_FORMAT_50 COMPAT_FORMAT( 'N', 'A', 'T', '5' )
using namespace com::sun::star;
@@ -1667,31 +1666,6 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
return mnChecksum;
}
-bool ImpGraphic::ImplExportNative( SvStream& rOStm ) const
-{
- ensureAvailable();
-
- if( rOStm.GetError() )
- return false;
-
- bool bResult = false;
-
- if( !isSwappedOut() )
- {
- if( mpGfxLink && mpGfxLink->IsNative() )
- bResult = mpGfxLink->ExportNative( rOStm );
- else
- {
- WriteImpGraphic( rOStm, *this );
- bResult = ( rOStm.GetError() == ERRCODE_NONE );
- }
- }
- else
- rOStm.SetError( SVSTREAM_GENERALERROR );
-
- return bResult;
-}
-
sal_Int32 ImpGraphic::getPageNumber() const
{
if (isSwappedOut())
@@ -1701,268 +1675,4 @@ sal_Int32 ImpGraphic::getPageNumber() const
return maVectorGraphicData->getPageIndex();
return -1;
}
-
-void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic )
-{
- if (rIStm.GetError())
- return;
-
- const sal_uLong nStmPos1 = rIStm.Tell();
- sal_uInt32 nTmp;
-
- rImpGraphic.ImplClear();
-
- // if there is no more data, avoid further expensive
- // reading which will create VDevs and other stuff, just to
- // read nothing.
- if (rIStm.remainingSize() < 4)
- return;
-
- // read Id
- rIStm.ReadUInt32( nTmp );
-
- if (NATIVE_FORMAT_50 == nTmp)
- {
- Graphic aGraphic;
- GfxLink aLink;
-
- // read compat info, destructor writes stuff into the header
- {
- VersionCompat aCompat( rIStm, StreamMode::READ );
- }
-
- TypeSerializer aSerializer(rIStm);
- aSerializer.readGfxLink(aLink);
-
- // set dummy link to avoid creation of additional link after filtering;
- // we set a default link to avoid unnecessary swapping of native data
- aGraphic.SetGfxLink(std::make_shared<GfxLink>());
-
- if( !rIStm.GetError() && aLink.LoadNative( aGraphic ) )
- {
- // set link only, if no other link was set
- const bool bSetLink = !rImpGraphic.mpGfxLink;
-
- // assign graphic
- rImpGraphic = *aGraphic.ImplGetImpGraphic();
-
- if( aLink.IsPrefMapModeValid() )
- rImpGraphic.ImplSetPrefMapMode( aLink.GetPrefMapMode() );
-
- if( aLink.IsPrefSizeValid() )
- rImpGraphic.ImplSetPrefSize( aLink.GetPrefSize() );
-
- if( bSetLink )
- rImpGraphic.ImplSetLink(std::make_shared<GfxLink>(aLink));
- }
- else
- {
- rIStm.Seek( nStmPos1 );
- rIStm.SetError( ERRCODE_IO_WRONGFORMAT );
- }
- return;
- }
-
- BitmapEx aBmpEx;
- const SvStreamEndian nOldFormat = rIStm.GetEndian();
-
- rIStm.SeekRel( -4 );
- rIStm.SetEndian( SvStreamEndian::LITTLE );
- ReadDIBBitmapEx(aBmpEx, rIStm);
-
- if( !rIStm.GetError() )
- {
- sal_uInt32 nMagic1(0), nMagic2(0);
- sal_uLong nActPos = rIStm.Tell();
-
- if (rIStm.remainingSize() >= 8)
- {
- rIStm.ReadUInt32( nMagic1 ).ReadUInt32( nMagic2 );
- rIStm.Seek( nActPos );
- }
-
- rImpGraphic = ImpGraphic( aBmpEx );
-
- if( !rIStm.GetError() && ( 0x5344414e == nMagic1 ) && ( 0x494d4931 == nMagic2 ) )
- {
- rImpGraphic.mpAnimation = std::make_unique<Animation>();
- ReadAnimation( rIStm, *rImpGraphic.mpAnimation );
-
- // #108077# manually set loaded BmpEx to Animation
- // (which skips loading its BmpEx if already done)
- rImpGraphic.mpAnimation->SetBitmapEx(aBmpEx);
- }
- else
- rIStm.ResetError();
- }
- else
- {
- GDIMetaFile aMtf;
-
- rIStm.Seek( nStmPos1 );
- rIStm.ResetError();
- ReadGDIMetaFile( rIStm, aMtf );
-
- if( !rIStm.GetError() )
- {
- rImpGraphic = aMtf;
- }
- else
- {
- ErrCode nOrigError = rIStm.GetErrorCode();
- // try to stream in Svg defining data (length, byte array and evtl. path)
- // See below (operator<<) for more information
- sal_uInt32 nMagic;
- rIStm.Seek(nStmPos1);
- rIStm.ResetError();
- rIStm.ReadUInt32( nMagic );
-
- if (constSvgMagic == nMagic || constWmfMagic == nMagic || constEmfMagic == nMagic || constPdfMagic == nMagic)
- {
- sal_uInt32 nVectorGraphicDataArrayLength(0);
- rIStm.ReadUInt32(nVectorGraphicDataArrayLength);
-
- if (nVectorGraphicDataArrayLength)
- {
- VectorGraphicDataArray aNewData(nVectorGraphicDataArrayLength);
-
- rIStm.ReadBytes(aNewData.getArray(), nVectorGraphicDataArrayLength);
- OUString aPath = rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet());
-
- if (!rIStm.GetError())
- {
- VectorGraphicDataType aDataType(VectorGraphicDataType::Svg);
-
- if (constWmfMagic == nMagic)
- {
- aDataType = VectorGraphicDataType::Wmf;
- }
- else if (constEmfMagic == nMagic)
- {
- aDataType = VectorGraphicDataType::Emf;
- }
- else if (constPdfMagic == nMagic)
- {
- aDataType = VectorGraphicDataType::Pdf;
- }
-
- auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, aPath, aDataType);
- rImpGraphic = aVectorGraphicDataPtr;
- }
- }
- }
- else
- {
- rIStm.SetError(nOrigError);
- }
-
- rIStm.Seek(nStmPos1);
- }
- }
-
- rIStm.SetEndian( nOldFormat );
-}
-
-void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
-{
- if (rOStm.GetError())
- return;
-
- rImpGraphic.ensureAvailable();
-
- if (rImpGraphic.isSwappedOut())
- {
- rOStm.SetError( SVSTREAM_GENERALERROR );
- return;
- }
-
- if( ( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_50 ) &&
- ( rOStm.GetCompressMode() & SvStreamCompressFlags::NATIVE ) &&
- rImpGraphic.mpGfxLink && rImpGraphic.mpGfxLink->IsNative())
- {
- // native format
- rOStm.WriteUInt32( NATIVE_FORMAT_50 );
-
- // write compat info, destructor writes stuff into the header
- {
- VersionCompat aCompat( rOStm, StreamMode::WRITE, 1 );
- }
- rImpGraphic.mpGfxLink->SetPrefMapMode( rImpGraphic.ImplGetPrefMapMode() );
- rImpGraphic.mpGfxLink->SetPrefSize( rImpGraphic.ImplGetPrefSize() );
- TypeSerializer aSerializer(rOStm);
- aSerializer.writeGfxLink(*rImpGraphic.mpGfxLink);
- }
- else
- {
- // own format
- const SvStreamEndian nOldFormat = rOStm.GetEndian();
- rOStm.SetEndian( SvStreamEndian::LITTLE );
-
- switch( rImpGraphic.ImplGetType() )
- {
- case GraphicType::NONE:
- case GraphicType::Default:
- break;
-
- case GraphicType::Bitmap:
- {
- if(rImpGraphic.getVectorGraphicData())
- {
- // stream out Vector Graphic defining data (length, byte array and evtl. path)
- // this is used e.g. in swapping out graphic data and in transporting it over UNO API
- // as sequence of bytes, but AFAIK not written anywhere to any kind of file, so it should be
- // no problem to extend it; only used at runtime
- switch (rImpGraphic.getVectorGraphicData()->getVectorGraphicDataType())
- {
- case VectorGraphicDataType::Wmf:
- {
- rOStm.WriteUInt32(constWmfMagic);
- break;
- }
- case VectorGraphicDataType::Emf:
- {
- rOStm.WriteUInt32(constEmfMagic);
- break;
- }
- case VectorGraphicDataType::Svg:
- {
- rOStm.WriteUInt32(constSvgMagic);
- break;
- }
- case VectorGraphicDataType::Pdf:
- {
- rOStm.WriteUInt32(constPdfMagic);
- break;
- }
- }
-
- rOStm.WriteUInt32( rImpGraphic.getVectorGraphicData()->getVectorGraphicDataArrayLength() );
- rOStm.WriteBytes(rImpGraphic.getVectorGraphicData()->getVectorGraphicDataArray().getConstArray(),
- rImpGraphic.getVectorGraphicData()->getVectorGraphicDataArrayLength());
- rOStm.WriteUniOrByteString(rImpGraphic.getVectorGraphicData()->getPath(),
- rOStm.GetStreamCharSet());
- }
- else if( rImpGraphic.ImplIsAnimated())
- {
- WriteAnimation( rOStm, *rImpGraphic.mpAnimation );
- }
- else
- {
- WriteDIBBitmapEx(rImpGraphic.maBitmapEx, rOStm);
- }
- }
- break;
-
- default:
- {
- if( rImpGraphic.ImplIsSupportedGraphic() )
- WriteGDIMetaFile( rOStm, rImpGraphic.maMetaFile );
- }
- break;
- }
-
- rOStm.SetEndian( nOldFormat );
- }
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx
index 5103da66153e..41a3beeb0b06 100644
--- a/vcl/source/gdi/mapmod.cxx
+++ b/vcl/source/gdi/mapmod.cxx
@@ -24,7 +24,7 @@
#include <tools/stream.hxx>
#include <tools/vcompat.hxx>
#include <rtl/instance.hxx>
-#include <TypeSerializer.hxx>
+#include <vcl/TypeSerializer.hxx>
struct MapMode::ImplMapMode
{
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index c966a68309e9..235fd30a356d 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -29,7 +29,7 @@
#include <vcl/metaact.hxx>
#include <vcl/graphictools.hxx>
#include <unotools/fontdefs.hxx>
-#include <TypeSerializer.hxx>
+#include <vcl/TypeSerializer.hxx>
namespace
{
diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 6912654a6164..75f9482b1208 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -31,7 +31,7 @@
#include <sal/log.hxx>
#include <osl/diagnose.h>
-#include <TypeSerializer.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <svmconverter.hxx>
#include <memory>
#include <stack>
diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx
index 6b332e5c74fe..fb6e84896158 100644
--- a/vcl/source/gdi/wall.cxx
+++ b/vcl/source/gdi/wall.cxx
@@ -26,8 +26,7 @@
#include <wall2.hxx>
#include <vcl/dibtools.hxx>
#include <vcl/settings.hxx>
-
-#include <TypeSerializer.hxx>
+#include <vcl/TypeSerializer.hxx>
ImplWallpaper::ImplWallpaper() :
maColor( COL_TRANSPARENT ), meStyle( WallpaperStyle::NONE )
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx
index d8c6e774d363..636293e9957d 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -46,6 +46,8 @@
#include <comphelper/sequence.hxx>
#include <memory>
+#include <vcl/TypeSerializer.hxx>
+
using namespace com::sun::star;
namespace {
@@ -812,7 +814,10 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG
SvMemoryStream aMemStrm;
aMemStrm.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
if( 0 == strcmp( pFilterShortName, MIMETYPE_VCLGRAPHIC ) )
- WriteGraphic( aMemStrm, aGraphic );
+ {
+ TypeSerializer aSerializer(aMemStrm);
+ aSerializer.writeGraphic(aGraphic);
+ }
else
{
rFilter.ExportGraphic( aGraphic, aPath, aMemStrm,
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 874bc4b9e7d8..4ba56bc9aece 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -65,6 +65,7 @@
#include <vcl/graphicfilter.hxx>
#include <memory>
#include <utility>
+#include <vcl/TypeSerializer.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -735,7 +736,10 @@ bool TransferableHelper::SetGraphic( const Graphic& rGraphic )
aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 );
aMemStm.SetCompressMode( SvStreamCompressFlags::NATIVE );
- WriteGraphic( aMemStm, rGraphic );
+
+ TypeSerializer aSerializer(aMemStm);
+ aSerializer.writeGraphic(rGraphic);
+
maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) );
}
@@ -1797,7 +1801,8 @@ bool TransferableDataHelper::GetGraphic( const css::datatransfer::DataFlavor& rF
if( GetSotStorageStream( rFlavor, xStm ) )
{
- ReadGraphic( *xStm, rGraphic );
+ TypeSerializer aSerializer(*xStm);
+ aSerializer.readGraphic(rGraphic);
bRet = ( xStm->GetError() == ERRCODE_NONE );
}
}
commit f1c8a2b5022f94f266ae531b3f0beb29bba59b56
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Dec 21 21:47:39 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:05:08 2020 +0900
vcl: add BinaryDataContainer and change GfxLink to use it
Add a wrapper for shared_ptr<sal_uInt8> called BinaryDataContainer,
which is used to easily manage the binary data - mainly for a
better reuse, control and to prevent duplication.
Change-Id: I68140ec379dba4a5ab1b624a334129bba2401998
diff --git a/include/vcl/BinaryDataContainer.hxx b/include/vcl/BinaryDataContainer.hxx
new file mode 100644
index 000000000000..7ec9926b245c
--- /dev/null
+++ b/include/vcl/BinaryDataContainer.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <vector>
+#include <memory>
+#include <boost/functional/hash.hpp>
+
+class VCL_DLLPUBLIC BinaryDataContainer final
+{
+private:
+ // the binary data
+ std::shared_ptr<std::vector<sal_uInt8>> mpData;
+
+public:
+ explicit BinaryDataContainer() {}
+
+ explicit BinaryDataContainer(size_t nSize)
+ : mpData(std::make_shared<std::vector<sal_uInt8>>(nSize))
+ {
+ }
+
+ explicit BinaryDataContainer(const sal_uInt8* pData, size_t nSize)
+ : mpData(std::make_shared<std::vector<sal_uInt8>>(nSize))
+ {
+ std::copy(pData, pData + nSize, mpData->data());
+ }
+
+ explicit BinaryDataContainer(const BinaryDataContainer& rBinaryDataContainer) = default;
+ explicit BinaryDataContainer(BinaryDataContainer&& rBinaryDataContainer) = default;
+ BinaryDataContainer& operator=(const BinaryDataContainer& rBinaryDataContainer) = default;
+ BinaryDataContainer& operator=(BinaryDataContainer&& rBinaryDataContainer) = default;
+
+ size_t getSize() const { return mpData ? mpData->size() : 0; }
+
+ bool isEmpty() const { return mpData ? mpData->empty() : true; }
+
+ const sal_uInt8* getData() const { return mpData ? mpData->data() : nullptr; }
+
+ size_t calculateHash() const
+ {
+ size_t nSeed = 0;
+ boost::hash_combine(nSeed, getSize());
+ for (sal_uInt8 const& rByte : *mpData)
+ boost::hash_combine(nSeed, rByte);
+ return nSeed;
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx
index 72352f6902a1..85bb85cb53f2 100644
--- a/include/vcl/gfxlink.hxx
+++ b/include/vcl/gfxlink.hxx
@@ -23,6 +23,7 @@
#include <tools/gen.hxx>
#include <vcl/dllapi.h>
#include <vcl/mapmod.hxx>
+#include <vcl/BinaryDataContainer.hxx>
#include <memory>
class SvStream;
@@ -61,20 +62,17 @@ class VCL_DLLPUBLIC GfxLink
private:
GfxLinkType meType;
sal_uInt32 mnUserId;
- mutable std::shared_ptr<sal_uInt8> mpSwapInData;
+ BinaryDataContainer maDataContainer;
mutable size_t maHash;
- sal_uInt32 mnSwapInDataSize;
MapMode maPrefMapMode;
Size maPrefSize;
bool mbPrefMapModeValid;
bool mbPrefSizeValid;
- SAL_DLLPRIVATE std::shared_ptr<sal_uInt8> GetSwapInData() const;
public:
- GfxLink();
-
- // pBuff = The Graphic data. This class takes ownership of this
- GfxLink( std::unique_ptr<sal_uInt8[]> pBuf, sal_uInt32 nBufSize, GfxLinkType nType );
+ GfxLink();
+ explicit GfxLink(std::unique_ptr<sal_uInt8[]> pBuf, sal_uInt32 nBufSize, GfxLinkType nType);
+ explicit GfxLink(BinaryDataContainer const & rDataConainer, GfxLinkType nType);
bool operator==( const GfxLink& ) const;
@@ -85,7 +83,7 @@ public:
void SetUserId( sal_uInt32 nUserId ) { mnUserId = nUserId; }
sal_uInt32 GetUserId() const { return mnUserId; }
- sal_uInt32 GetDataSize() const { return mnSwapInDataSize;}
+ sal_uInt32 GetDataSize() const { return maDataContainer.getSize(); }
const sal_uInt8* GetData() const;
const Size& GetPrefSize() const { return maPrefSize;}
diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx
index 83936c277ead..82b37fe4e668 100644
--- a/vcl/source/gdi/gfxlink.cxx
+++ b/vcl/source/gdi/gfxlink.cxx
@@ -30,60 +30,61 @@ GfxLink::GfxLink()
: meType(GfxLinkType::NONE)
, mnUserId(0)
, maHash(0)
- , mnSwapInDataSize(0)
, mbPrefMapModeValid(false)
, mbPrefSizeValid(false)
{
}
-
-
GfxLink::GfxLink(std::unique_ptr<sal_uInt8[]> pBuf, sal_uInt32 nSize, GfxLinkType nType)
: meType(nType)
, mnUserId(0)
- , mpSwapInData(std::shared_ptr<sal_uInt8>(pBuf.release(), pBuf.get_deleter())) // std::move(pBuf) does not compile on Jenkins MacOSX (24 May 2016)
+ , maDataContainer(pBuf.get(), nSize)
+ , maHash(0)
+ , mbPrefMapModeValid(false)
+ , mbPrefSizeValid(false)
+{
+}
+
+GfxLink::GfxLink(BinaryDataContainer const & rDataConainer, GfxLinkType nType)
+ : meType(nType)
+ , mnUserId(0)
+ , maDataContainer(rDataConainer)
, maHash(0)
- , mnSwapInDataSize(nSize)
, mbPrefMapModeValid(false)
, mbPrefSizeValid(false)
{
- SAL_WARN_IF(mpSwapInData == nullptr || mnSwapInDataSize <= 0, "vcl",
- "GfxLink::GfxLink(): empty/NULL buffer given");
}
size_t GfxLink::GetHash() const
{
if (!maHash)
{
- std::size_t seed = 0;
- boost::hash_combine(seed, mnSwapInDataSize);
+ std::size_t seed = maDataContainer.calculateHash();
boost::hash_combine(seed, meType);
- const sal_uInt8* pData = GetData();
- if (pData)
- seed += boost::hash_range(pData, pData + GetDataSize());
maHash = seed;
-
}
return maHash;
}
bool GfxLink::operator==( const GfxLink& rGfxLink ) const
{
- if (GetHash() != rGfxLink.GetHash())
- return false;
-
- if ( mnSwapInDataSize != rGfxLink.mnSwapInDataSize ||
- meType != rGfxLink.meType )
+ if (GetDataSize() != rGfxLink.GetDataSize()
+ || meType != rGfxLink.meType
+ || GetHash() != rGfxLink.GetHash())
return false;
const sal_uInt8* pSource = GetData();
- const sal_uInt8* pDest = rGfxLink.GetData();
- if ( pSource == pDest )
+ const sal_uInt8* pDestination = rGfxLink.GetData();
+
+ if (pSource == pDestination)
return true;
+
sal_uInt32 nSourceSize = GetDataSize();
sal_uInt32 nDestSize = rGfxLink.GetDataSize();
- if ( pSource && pDest && ( nSourceSize == nDestSize ) )
- return (memcmp( pSource, pDest, nSourceSize ) == 0);
+
+ if (pSource && pDestination && (nSourceSize == nDestSize))
+ return memcmp(pSource, pDestination, nSourceSize) == 0;
+
return false;
}
@@ -92,37 +93,33 @@ bool GfxLink::IsNative() const
return meType >= GfxLinkType::NativeFirst && meType <= GfxLinkType::NativeLast;
}
-
const sal_uInt8* GfxLink::GetData() const
{
- return mpSwapInData.get();
+ return maDataContainer.getData();
}
-
void GfxLink::SetPrefSize( const Size& rPrefSize )
{
maPrefSize = rPrefSize;
mbPrefSizeValid = true;
}
-
void GfxLink::SetPrefMapMode( const MapMode& rPrefMapMode )
{
maPrefMapMode = rPrefMapMode;
mbPrefMapModeValid = true;
}
-
bool GfxLink::LoadNative( Graphic& rGraphic )
{
bool bRet = false;
- if( IsNative() && mnSwapInDataSize )
+ if (IsNative() && !maDataContainer.isEmpty())
{
const sal_uInt8* pData = GetData();
if (pData)
{
- SvMemoryStream aMemoryStream(const_cast<sal_uInt8*>(pData), mnSwapInDataSize, StreamMode::READ | StreamMode::WRITE);
+ SvMemoryStream aMemoryStream(const_cast<sal_uInt8*>(pData), GetDataSize(), StreamMode::READ | StreamMode::WRITE);
OUString aShortName;
switch (meType)
@@ -157,19 +154,14 @@ bool GfxLink::ExportNative( SvStream& rOStream ) const
{
if( GetDataSize() )
{
- auto pData = GetSwapInData();
+ auto pData = GetData();
if (pData)
- rOStream.WriteBytes( pData.get(), mnSwapInDataSize );
+ rOStream.WriteBytes(pData, GetDataSize());
}
return ( rOStream.GetError() == ERRCODE_NONE );
}
-std::shared_ptr<sal_uInt8> GfxLink::GetSwapInData() const
-{
- return mpSwapInData;
-}
-
bool GfxLink::IsEMF() const
{
const sal_uInt8* pGraphicAry = GetData();
commit a0ebc4512d1733a275c5f27c9b092fc2a72b0466
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Dec 21 14:19:38 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:05:07 2020 +0900
ImpGraphic: inline loadPrepared as it is used only in one place
Change-Id: Id3753522f016d3c619e6ef8c68b3172768b5ca90
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 86fa80606b8f..f4417a262d1c 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -209,8 +209,6 @@ private:
bool ensureAvailable () const;
- bool loadPrepared();
-
sal_Int32 getPageNumber() const;
// Set the pref size, but don't force swap-in
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index e55c148a5df0..f40500b44519 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1350,15 +1350,6 @@ bool ImpGraphic::ensureAvailable() const
return bResult;
}
-bool ImpGraphic::loadPrepared()
-{
- Graphic aGraphic;
- if (!mpGfxLink->LoadNative(aGraphic))
- return false;
- updateFromLoadedGraphic(aGraphic.ImplGetImpGraphic());
- return true;
-}
-
void ImpGraphic::updateFromLoadedGraphic(ImpGraphic* graphic)
{
GraphicExternalLink aLink = maGraphicExternalLink;
@@ -1394,7 +1385,14 @@ bool ImpGraphic::swapIn()
if (mbPrepared)
{
- bReturn = loadPrepared();
+ Graphic aGraphic;
+ if (!mpGfxLink->LoadNative(aGraphic))
+ return false;
+
+ updateFromLoadedGraphic(aGraphic.ImplGetImpGraphic());
+
+ maLastUsed = std::chrono::high_resolution_clock::now();
+ bReturn = true;
}
else if (mpGfxLink && mpGfxLink->IsNative())
{
commit 1f1470747604d66101be9f433e7263bde4da6d16
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Dec 21 13:04:18 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:05:07 2020 +0900
ImplGraphic: set PrefSize, PrefMapMode without forcing a swap-in
This adds methods to set the PrefSize, PrefMapMode directly with
no forced swap-in. Use this setters during a swap-in as it is now
safe to do so, otherwise it would cause an endless-loop.
Change-Id: I52b424ffc920c5a760891672c1ef961c1b1c1b64
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 6a312a76d58e..86fa80606b8f 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -213,6 +213,11 @@ private:
sal_Int32 getPageNumber() const;
+ // Set the pref size, but don't force swap-in
+ void setValuesForPrefSize(const Size& rPrefSize);
+ // Set the pref map mode, but don't force swap-in
+ void setValuesForPrefMapMod(const MapMode& rPrefMapMode);
+
public:
void resetChecksum() { mnChecksum = 0; }
bool swapIn();
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 70e4fafd09f0..e55c148a5df0 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -801,10 +801,8 @@ Size ImpGraphic::ImplGetPrefSize() const
return aSize;
}
-void ImpGraphic::ImplSetPrefSize(const Size& rPrefSize)
+void ImpGraphic::setValuesForPrefSize(const Size& rPrefSize)
{
- ensureAvailable();
-
switch (meType)
{
case GraphicType::Bitmap:
@@ -843,6 +841,12 @@ void ImpGraphic::ImplSetPrefSize(const Size& rPrefSize)
}
}
+void ImpGraphic::ImplSetPrefSize(const Size& rPrefSize)
+{
+ ensureAvailable();
+ setValuesForPrefSize(rPrefSize);
+}
+
MapMode ImpGraphic::ImplGetPrefMapMode() const
{
MapMode aMapMode;
@@ -887,10 +891,8 @@ MapMode ImpGraphic::ImplGetPrefMapMode() const
return aMapMode;
}
-void ImpGraphic::ImplSetPrefMapMode(const MapMode& rPrefMapMode)
+void ImpGraphic::setValuesForPrefMapMod(const MapMode& rPrefMapMode)
{
- ensureAvailable();
-
switch (meType)
{
case GraphicType::Bitmap:
@@ -926,6 +928,12 @@ void ImpGraphic::ImplSetPrefMapMode(const MapMode& rPrefMapMode)
}
}
+void ImpGraphic::ImplSetPrefMapMode(const MapMode& rPrefMapMode)
+{
+ ensureAvailable();
+ setValuesForPrefMapMod(rPrefMapMode);
+}
+
sal_uLong ImpGraphic::ImplGetSizeBytes() const
{
if (mnSizeBytes > 0)
@@ -1368,29 +1376,11 @@ void ImpGraphic::updateFromLoadedGraphic(ImpGraphic* graphic)
void ImpGraphic::restoreFromSwapInfo()
{
- // Reset the parameters
- if (!maBitmapEx.IsEmpty())
- {
- maBitmapEx.SetPrefMapMode(maSwapInfo.maPrefMapMode);
- maBitmapEx.SetPrefSize(maSwapInfo.maPrefSize);
- }
-
- if (meType == GraphicType::GdiMetafile)
- {
- maMetaFile.SetPrefMapMode(maSwapInfo.maPrefMapMode);
- maMetaFile.SetPrefSize(maSwapInfo.maPrefSize);
- }
-
- if (ImplIsAnimated())
- {
- auto & rAnimationBitmap = const_cast<BitmapEx&>(mpAnimation->GetBitmapEx());
- rAnimationBitmap.SetPrefMapMode(maSwapInfo.maPrefMapMode);
- rAnimationBitmap.SetPrefSize(maSwapInfo.maPrefSize);
- }
+ setValuesForPrefMapMod(maSwapInfo.maPrefMapMode);
+ setValuesForPrefSize(maSwapInfo.maPrefSize);
if (maVectorGraphicData)
{
- maExPrefSize = maSwapInfo.maPrefSize;
maVectorGraphicData->setPageIndex(maSwapInfo.mnPageIndex);
}
}
commit 3fa5c773cf5fc13e10979891ccc8bf063bd4c77a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Jul 17 15:09:49 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:05:07 2020 +0900
Revert "hack for gradients split into adjacent polygons (tdf#133016)"
This reverts commit 777ac5456a1f24fea29931ede983b5b8ad9a063d.
diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 7c9eb8441306..9b9d258046cc 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -30,7 +30,7 @@
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <sal/log.hxx>
#include <cmath>
-#include <vcl/skia/SkiaHelper.hxx>
+
using namespace com::sun::star;
@@ -868,12 +868,6 @@ namespace drawinglayer::primitive2d
// use color distance and discrete lengths to calculate step count
const sal_uInt32 nSteps(calculateStepsForSvgGradient(getColorA(), getColorB(), fDelta, fDiscreteUnit));
- // HACK: Splitting a gradient into adjacent polygons with gradually changing color is silly.
- // If antialiasing is used to draw them, the AA-ed adjacent edges won't line up perfectly
- // because of the AA (see SkiaSalGraphicsImpl::mergePolyPolygonToPrevious()).
- // Make the polygons a bit wider, so they the partial overlap "fixes" this.
- const double fixup = SkiaHelper::isVCLSkiaEnabled() ? fDiscreteUnit / 2 : 0;
-
// tdf#117949 Use a small amount of discrete overlap at the edges. Usually this
// should be exactly 0.0 and 1.0, but there were cases when this gets clipped
// against the mask polygon which got numerically problematic.
@@ -887,7 +881,7 @@ namespace drawinglayer::primitive2d
basegfx::B2DRange(
getOffsetA() - fDiscreteUnit,
-0.0001, // TTTT -> should be 0.0, see comment above
- getOffsetA() + (fDelta / nSteps) + fDiscreteUnit + fixup,
+ getOffsetA() + (fDelta / nSteps) + fDiscreteUnit,
1.0001))); // TTTT -> should be 1.0, see comment above
// prepare loop (inside to outside, [0.0 .. 1.0[)
commit 9aa0931d617bd115ca61b4fef2b388a4deb2d330
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Jun 15 19:39:35 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:05:06 2020 +0900
vcl: add a Bitmap interface to basegfx, BitmapEx implementing it
Change-Id: I758f421d545191883e615f5016e9fc643459556e
diff --git a/include/basegfx/bitmap/Bitmap.hxx b/include/basegfx/bitmap/Bitmap.hxx
new file mode 100644
index 000000000000..b91b702aa212
--- /dev/null
+++ b/include/basegfx/bitmap/Bitmap.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+class BASEGFX_DLLPUBLIC IBitmap
+{
+};
+
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 14bbee535485..41e59a90f5e9 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -26,6 +26,8 @@
#include <tools/color.hxx>
#include <tools/degree.hxx>
+#include <basegfx/bitmap/Bitmap.hxx>
+
#include <sal/types.h>
namespace com::sun::star::rendering {
@@ -41,7 +43,7 @@ enum class TransparentType
Bitmap
};
-class SAL_WARN_UNUSED VCL_DLLPUBLIC BitmapEx
+class SAL_WARN_UNUSED VCL_DLLPUBLIC BitmapEx : basegfx::IBitmap
{
public:
commit 44d798a9cd867eb1703e302fcc579869a3a7a5fb
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed May 27 12:49:05 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:05:06 2020 +0900
add o3tl version of hash_combine to not depend on boost for this
Change-Id: I081f8d116ef811baa8aa5de35a6cb51fa4de7d56
diff --git a/include/o3tl/hash_combine.hxx b/include/o3tl/hash_combine.hxx
new file mode 100644
index 000000000000..17419b3e2c0f
--- /dev/null
+++ b/include/o3tl/hash_combine.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+namespace o3tl
+{
+template <typename T, typename N, std::enable_if_t<(sizeof(N) == 4), bool> = false>
+inline void hash_combine(N& nSeed, T const& nValue)
+{
+ static_assert(sizeof(nSeed) == 4);
+ nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B9u + (nSeed << 6) + (nSeed >> 2);
+}
+
+template <typename T, typename N, std::enable_if_t<(sizeof(N) == 8), bool> = false>
+inline void hash_combine(N& nSeed, T const& nValue)
+{
+ static_assert(sizeof(nSeed) == 8);
+ nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B97F4A7C15llu + (nSeed << 12) + (nSeed >> 4);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/o3tl/qa/test-lru_map.cxx b/o3tl/qa/test-lru_map.cxx
index ba9ee71835ce..ef46f44d17b9 100644
--- a/o3tl/qa/test-lru_map.cxx
+++ b/o3tl/qa/test-lru_map.cxx
@@ -15,7 +15,7 @@
#include <o3tl/lru_map.hxx>
-#include <boost/functional/hash.hpp>
+#include <o3tl/hash_combine.hxx>
using namespace ::o3tl;
@@ -202,8 +202,8 @@ struct TestClassKeyHashFunction
std::size_t operator()(TestClassKey const& aKey) const
{
std::size_t seed = 0;
- boost::hash_combine(seed, aKey.mA);
- boost::hash_combine(seed, aKey.mB);
+ o3tl::hash_combine(seed, aKey.mA);
+ o3tl::hash_combine(seed, aKey.mB);
return seed;
}
};
commit 551e6141b07c64a3ea141455d1471145e4295ea4
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue May 26 15:57:38 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:05:05 2020 +0900
GraphicAttributes: put const. and op. '=' into the header file
Change-Id: I1bc38f89457c3593673b445e7571a4fd82d5960b
diff --git a/include/vcl/GraphicAttributes.hxx b/include/vcl/GraphicAttributes.hxx
index 559e3f9fc36c..df937b898d3d 100644
--- a/include/vcl/GraphicAttributes.hxx
+++ b/include/vcl/GraphicAttributes.hxx
@@ -52,9 +52,37 @@ private:
GraphicDrawMode meDrawMode;
public:
- GraphicAttr();
+ GraphicAttr()
+ : mfGamma(1.0)
+ , mnMirrFlags(basegfx::MirrorDirectionFlags::NONE)
+ , mnLeftCrop(0)
+ , mnTopCrop(0)
+ , mnRightCrop(0)
+ , mnBottomCrop(0)
+ , mnRotate10(0)
+ , mnContPercent(0)
+ , mnLumPercent(0)
+ , mnRPercent(0)
+ , mnGPercent(0)
+ , mnBPercent(0)
+ , mbInvert(false)
+ , mcTransparency(0)
+ , meDrawMode(GraphicDrawMode::Standard)
+ {
+ }
+
+ bool operator==(const GraphicAttr& rAttr) const
+ {
+ return mfGamma == rAttr.mfGamma && mnMirrFlags == rAttr.mnMirrFlags
+ && mnLeftCrop == rAttr.mnLeftCrop && mnTopCrop == rAttr.mnTopCrop
+ && mnRightCrop == rAttr.mnRightCrop && mnBottomCrop == rAttr.mnBottomCrop
+ && mnRotate10 == rAttr.mnRotate10 && mnContPercent == rAttr.mnContPercent
+ && mnLumPercent == rAttr.mnLumPercent && mnRPercent == rAttr.mnRPercent
+ && mnGPercent == rAttr.mnGPercent && mnBPercent == rAttr.mnBPercent
+ && mbInvert == rAttr.mbInvert && mcTransparency == rAttr.mcTransparency
+ && meDrawMode == rAttr.meDrawMode;
+ }
- bool operator==(const GraphicAttr& rAttr) const;
bool operator!=(const GraphicAttr& rAttr) const { return !(*this == rAttr); }
void SetDrawMode(GraphicDrawMode eDrawMode) { meDrawMode = eDrawMode; }
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 6793c6268825..5798ce031c90 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -335,7 +335,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/graphic/GraphicObject \
vcl/source/graphic/GraphicObject2 \
vcl/source/graphic/GraphicReader \
- vcl/source/graphic/grfattr \
vcl/source/graphic/Manager \
vcl/source/graphic/UnoGraphic \
vcl/source/graphic/UnoGraphicMapper \
diff --git a/vcl/source/graphic/grfattr.cxx b/vcl/source/graphic/grfattr.cxx
deleted file mode 100644
index 36e8605b77de..000000000000
--- a/vcl/source/graphic/grfattr.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <vcl/GraphicAttributes.hxx>
-
-GraphicAttr::GraphicAttr() :
- mfGamma ( 1.0 ),
- mnMirrFlags ( basegfx::MirrorDirectionFlags::NONE ),
- mnLeftCrop ( 0 ),
- mnTopCrop ( 0 ),
- mnRightCrop ( 0 ),
- mnBottomCrop ( 0 ),
- mnRotate10 ( 0 ),
- mnContPercent ( 0 ),
- mnLumPercent ( 0 ),
- mnRPercent ( 0 ),
- mnGPercent ( 0 ),
- mnBPercent ( 0 ),
- mbInvert ( false ),
- mcTransparency ( 0 ),
- meDrawMode ( GraphicDrawMode::Standard )
-{
-}
-
-bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const
-{
- return( ( mfGamma == rAttr.mfGamma ) &&
- ( mnMirrFlags == rAttr.mnMirrFlags ) &&
- ( mnLeftCrop == rAttr.mnLeftCrop ) &&
- ( mnTopCrop == rAttr.mnTopCrop ) &&
- ( mnRightCrop == rAttr.mnRightCrop ) &&
- ( mnBottomCrop == rAttr.mnBottomCrop ) &&
- ( mnRotate10 == rAttr.mnRotate10 ) &&
- ( mnContPercent == rAttr.mnContPercent ) &&
- ( mnLumPercent == rAttr.mnLumPercent ) &&
- ( mnRPercent == rAttr.mnRPercent ) &&
- ( mnGPercent == rAttr.mnGPercent ) &&
- ( mnBPercent == rAttr.mnBPercent ) &&
- ( mbInvert == rAttr.mbInvert ) &&
- ( mcTransparency == rAttr.mcTransparency ) &&
- ( meDrawMode == rAttr.meDrawMode ) );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit dbccf5fc9d749c1e6365779730d9d8c779daa0da
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue May 26 13:39:45 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:05:05 2020 +0900
basegfx::MirrorDirectionFlags as replacement for BmpMirrorFlags
BmpMirrorFlags in Bitmap is an attribute for bitmap manipulation
(mirroring). This change creates a copy of the flags in basegfx
as MirrorDirectionFlags, which will be used in the fututre as a
general repalcement for the BmpMirrorFlags, that will be changed
step by step.
For now we only use the flags in GraphicAttr to make it independent
form vcl, and cast to/from BmpMirrorFLags and MirrorDirectionFlags
where needed.
Change-Id: I01a69a4d241caa22cff61bdbf87944af57684749
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index 9de4b8a80e64..8f801700ccf4 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -49,8 +49,10 @@ void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer,
if (getGraphicAttr().IsMirrored())
{
// content needs mirroring
- const bool bHMirr(getGraphicAttr().GetMirrorFlags() & BmpMirrorFlags::Horizontal);
- const bool bVMirr(getGraphicAttr().GetMirrorFlags() & BmpMirrorFlags::Vertical);
+ const bool bHMirr(getGraphicAttr().GetMirrorFlags()
+ & basegfx::MirrorDirectionFlags::Horizontal);
+ const bool bVMirr(getGraphicAttr().GetMirrorFlags()
+ & basegfx::MirrorDirectionFlags::Vertical);
// mirror by applying negative scale to the unit primitive and
// applying the object transformation on it.
@@ -69,7 +71,7 @@ void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer,
aSuppressGraphicAttr.SetCrop(0, 0, 0, 0);
aSuppressGraphicAttr.SetRotation(Degree10(0));
- aSuppressGraphicAttr.SetMirrorFlags(BmpMirrorFlags::NONE);
+ aSuppressGraphicAttr.SetMirrorFlags(basegfx::MirrorDirectionFlags::NONE);
aSuppressGraphicAttr.SetTransparency(0);
const GraphicObject& rGraphicObject = getGraphicObject();
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 505e43d91fc1..d5a5b63dc83e 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1674,7 +1674,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans
if(bMirrored)
{
- pGraphicAttr->SetMirrorFlags(BmpMirrorFlags::Horizontal);
+ pGraphicAttr->SetMirrorFlags(basegfx::MirrorDirectionFlags::Horizontal);
}
if(nTransparency)
diff --git a/include/basegfx/bitmap/BitmapAttributes.hxx b/include/basegfx/bitmap/BitmapAttributes.hxx
new file mode 100644
index 000000000000..d918d55faa99
--- /dev/null
+++ b/include/basegfx/bitmap/BitmapAttributes.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <basegfx/basegfxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace basegfx
+{
+enum class MirrorDirectionFlags
+{
+ NONE = 0x00,
+ Horizontal = 0x01,
+ Vertical = 0x02,
+};
+
+} // end of namespace basegfx
+
+namespace o3tl
+{
+template <>
+struct typed_flags<basegfx::MirrorDirectionFlags>
+ : is_typed_flags<basegfx::MirrorDirectionFlags, 0x03>
+{
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicAttributes.hxx b/include/vcl/GraphicAttributes.hxx
index 5216d2934166..559e3f9fc36c 100644
--- a/include/vcl/GraphicAttributes.hxx
+++ b/include/vcl/GraphicAttributes.hxx
@@ -22,6 +22,7 @@
#include <tools/degree.hxx>
#include <vcl/dllapi.h>
#include <vcl/bitmap.hxx>
+#include <basegfx/bitmap/BitmapAttributes.hxx>
enum class GraphicDrawMode
{
@@ -35,7 +36,7 @@ class VCL_DLLPUBLIC GraphicAttr
{
private:
double mfGamma;
- BmpMirrorFlags mnMirrFlags;
+ basegfx::MirrorDirectionFlags mnMirrFlags;
tools::Long mnLeftCrop;
tools::Long mnTopCrop;
tools::Long mnRightCrop;
@@ -59,8 +60,8 @@ public:
void SetDrawMode(GraphicDrawMode eDrawMode) { meDrawMode = eDrawMode; }
GraphicDrawMode GetDrawMode() const { return meDrawMode; }
- void SetMirrorFlags(BmpMirrorFlags nMirrFlags) { mnMirrFlags = nMirrFlags; }
- BmpMirrorFlags GetMirrorFlags() const { return mnMirrFlags; }
+ void SetMirrorFlags(basegfx::MirrorDirectionFlags nMirrFlags) { mnMirrFlags = nMirrFlags; }
+ basegfx::MirrorDirectionFlags GetMirrorFlags() const { return mnMirrFlags; }
void SetCrop(tools::Long nLeft_100TH_MM, tools::Long nTop_100TH_MM, tools::Long nRight_100TH_MM,
tools::Long nBottom_100TH_MM)
@@ -103,7 +104,7 @@ public:
sal_uInt8 GetTransparency() const { return mcTransparency; }
bool IsSpecialDrawMode() const { return (meDrawMode != GraphicDrawMode::Standard); }
- bool IsMirrored() const { return mnMirrFlags != BmpMirrorFlags::NONE; }
+ bool IsMirrored() const { return mnMirrFlags != basegfx::MirrorDirectionFlags::NONE; }
bool IsCropped() const
{
return (mnLeftCrop != 0 || mnTopCrop != 0 || mnRightCrop != 0 || mnBottomCrop != 0);
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 80140953d91b..c60be888b5f1 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -336,7 +336,9 @@ namespace sdr::contact
if(bHMirr || bVMirr)
{
- aLocalGrafInfo.SetMirrorFlags((bHMirr ? BmpMirrorFlags::Horizontal : BmpMirrorFlags::NONE)|(bVMirr ? BmpMirrorFlags::Vertical : BmpMirrorFlags::NONE));
+ basegfx::MirrorDirectionFlags eVertical = bVMirr ? basegfx::MirrorDirectionFlags::Vertical : basegfx::MirrorDirectionFlags::NONE;
+ basegfx::MirrorDirectionFlags eHorizontal = bHMirr ? basegfx::MirrorDirectionFlags::Horizontal : basegfx::MirrorDirectionFlags::NONE;
+ aLocalGrafInfo.SetMirrorFlags(eVertical | eHorizontal);
}
// fill object matrix
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 991b3b288f46..c0904bf1e1ce 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -377,7 +377,10 @@ GraphicAttr SdrGrafObj::GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlag
bool bHMirr = nMirrorCase == 2 || nMirrorCase == 4;
bool bVMirr = nMirrorCase == 3 || nMirrorCase == 4;
- aActAttr.SetMirrorFlags( ( bHMirr ? BmpMirrorFlags::Horizontal : BmpMirrorFlags::NONE ) | ( bVMirr ? BmpMirrorFlags::Vertical : BmpMirrorFlags::NONE ) );
+ basegfx::MirrorDirectionFlags eVertical = bVMirr ? basegfx::MirrorDirectionFlags::Vertical : basegfx::MirrorDirectionFlags::NONE;
+ basegfx::MirrorDirectionFlags eHorizontal = bHMirr ? basegfx::MirrorDirectionFlags::Horizontal : basegfx::MirrorDirectionFlags::NONE;
+
+ aActAttr.SetMirrorFlags(eVertical | eHorizontal);
}
if( bRotate )
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 5446ba6eed00..00561b6be1f0 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -733,22 +733,22 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA,
rGA.SetDrawMode( rSet.GetDrawModeGrf().GetValue() );
const SwMirrorGrf & rMirror = rSet.GetMirrorGrf();
- BmpMirrorFlags nMirror = BmpMirrorFlags::NONE;
+ basegfx::MirrorDirectionFlags nMirror = basegfx::MirrorDirectionFlags::NONE;
if( rMirror.IsGrfToggle() && pFrame && !pFrame->FindPageFrame()->OnRightPage() )
{
switch( rMirror.GetValue() )
{
case MirrorGraph::Dont:
- nMirror = BmpMirrorFlags::Horizontal;
+ nMirror = basegfx::MirrorDirectionFlags::Horizontal;
break;
case MirrorGraph::Vertical:
- nMirror = BmpMirrorFlags::NONE;
+ nMirror = basegfx::MirrorDirectionFlags::NONE;
break;
case MirrorGraph::Horizontal:
- nMirror = BmpMirrorFlags::Horizontal|BmpMirrorFlags::Vertical;
+ nMirror = basegfx::MirrorDirectionFlags::Horizontal | basegfx::MirrorDirectionFlags::Vertical;
break;
default:
- nMirror = BmpMirrorFlags::Vertical;
+ nMirror = basegfx::MirrorDirectionFlags::Vertical;
break;
}
}
@@ -756,13 +756,13 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA,
switch( rMirror.GetValue() )
{
case MirrorGraph::Both:
- nMirror = BmpMirrorFlags::Horizontal|BmpMirrorFlags::Vertical;
+ nMirror = basegfx::MirrorDirectionFlags::Horizontal | basegfx::MirrorDirectionFlags::Vertical;
break;
case MirrorGraph::Vertical:
- nMirror = BmpMirrorFlags::Horizontal;
+ nMirror = basegfx::MirrorDirectionFlags::Horizontal;
break;
case MirrorGraph::Horizontal:
- nMirror = BmpMirrorFlags::Vertical;
+ nMirror = basegfx::MirrorDirectionFlags::Vertical;
break;
default: break;
}
diff --git a/vcl/source/graphic/GraphicObject.cxx b/vcl/source/graphic/GraphicObject.cxx
index aa5435d3ad50..c60d325547b1 100644
--- a/vcl/source/graphic/GraphicObject.cxx
+++ b/vcl/source/graphic/GraphicObject.cxx
@@ -168,7 +168,7 @@ void lclImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, GraphicAdjustmen
if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() )
{
- rBmpEx.Mirror( aAttr.GetMirrorFlags() );
+ rBmpEx.Mirror(BmpMirrorFlags(aAttr.GetMirrorFlags()) );
}
if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() )
@@ -219,7 +219,7 @@ void lclImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, GraphicAdjustme
if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() )
{
- rMtf.Mirror( aAttr.GetMirrorFlags() );
+ rMtf.Mirror(BmpMirrorFlags(aAttr.GetMirrorFlags()));
}
if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() )
@@ -270,7 +270,7 @@ void lclImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr, GraphicAdju
if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() )
{
- rAnimation.Mirror( aAttr.GetMirrorFlags() );
+ rAnimation.Mirror(BmpMirrorFlags(aAttr.GetMirrorFlags()));
}
if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() )
@@ -383,7 +383,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice const * pOut, Point& rPt, Si
if( !aSize100.IsEmpty() && nTotalWidth > 0 && nTotalHeight > 0 )
{
double fScale = static_cast<double>(aSize100.Width()) / nTotalWidth;
- const tools::Long nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Horizontal ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale );
+ const tools::Long nNewLeft = -FRound( ( ( BmpMirrorFlags(pAttr->GetMirrorFlags()) & BmpMirrorFlags::Horizontal ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale );
const tools::Long nNewRight = nNewLeft + FRound( aSize100.Width() * fScale ) - 1;
fScale = static_cast<double>(rSz.Width()) / aSize100.Width();
@@ -391,7 +391,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice const * pOut, Point& rPt, Si
rSz.setWidth( FRound( ( nNewRight - nNewLeft + 1 ) * fScale ) );
fScale = static_cast<double>(aSize100.Height()) / nTotalHeight;
- const tools::Long nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Vertical ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale );
+ const tools::Long nNewTop = -FRound( ( ( BmpMirrorFlags(pAttr->GetMirrorFlags()) & BmpMirrorFlags::Vertical ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale );
const tools::Long nNewBottom = nNewTop + FRound( aSize100.Height() * fScale ) - 1;
fScale = static_cast<double>(rSz.Height()) / aSize100.Height();
@@ -473,7 +473,8 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
{
aPt.AdjustX(aSz.Width() + 1 );
aSz.setWidth( -aSz.Width() );
- aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BmpMirrorFlags::Horizontal );
+ BmpMirrorFlags eFlags = BmpMirrorFlags(aAttr.GetMirrorFlags()) ^ BmpMirrorFlags::Horizontal;
+ aAttr.SetMirrorFlags(basegfx::MirrorDirectionFlags(eFlags));
}
// mirrored vertically
@@ -481,7 +482,8 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
{
aPt.AdjustY(aSz.Height() + 1 );
aSz.setHeight( -aSz.Height() );
- aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BmpMirrorFlags::Vertical );
+ BmpMirrorFlags eFlags = BmpMirrorFlags(aAttr.GetMirrorFlags()) ^ BmpMirrorFlags::Vertical;
+ aAttr.SetMirrorFlags(basegfx::MirrorDirectionFlags(eFlags));
}
if( bCropped )
diff --git a/vcl/source/graphic/grfattr.cxx b/vcl/source/graphic/grfattr.cxx
index 35acaf50b841..36e8605b77de 100644
--- a/vcl/source/graphic/grfattr.cxx
+++ b/vcl/source/graphic/grfattr.cxx
@@ -21,7 +21,7 @@
GraphicAttr::GraphicAttr() :
mfGamma ( 1.0 ),
- mnMirrFlags ( BmpMirrorFlags::NONE ),
+ mnMirrFlags ( basegfx::MirrorDirectionFlags::NONE ),
mnLeftCrop ( 0 ),
mnTopCrop ( 0 ),
mnRightCrop ( 0 ),
commit 37c34741987145473daa87a59d7f4f2201249185
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri May 8 22:28:35 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:05:04 2020 +0900
Move some basic primitives to drawinglayer CORE
Mostly which are easy to move and used in VclProcessor2D
Change-Id: Ie1559e13a2a7cdb5225421def2f9145026ff9121
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index 4896c0ad0759..451a9b1e55d3 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -50,11 +50,6 @@ $(eval $(call gb_Library_use_libraries,drawinglayer,\
$(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/animation/animationtiming \
drawinglayer/source/attribute/fillgraphicattribute \
- drawinglayer/source/attribute/fillgradientattribute \
- drawinglayer/source/attribute/fillhatchattribute \
- drawinglayer/source/attribute/fontattribute \
- drawinglayer/source/attribute/lineattribute \
- drawinglayer/source/attribute/linestartendattribute \
drawinglayer/source/attribute/materialattribute3d \
drawinglayer/source/attribute/sdrallattribute3d \
drawinglayer/source/attribute/sdrfillattribute \
@@ -67,11 +62,9 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/attribute/sdrobjectattribute3d \
drawinglayer/source/attribute/sdrsceneattribute3d \
drawinglayer/source/attribute/sdrshadowattribute \
- drawinglayer/source/attribute/strokeattribute \
drawinglayer/source/geometry/viewinformation3d \
drawinglayer/source/primitive2d/animatedprimitive2d \
drawinglayer/source/primitive2d/backgroundcolorprimitive2d \
- drawinglayer/source/primitive2d/bitmapprimitive2d \
drawinglayer/source/primitive2d/borderlineprimitive2d \
drawinglayer/source/primitive2d/controlprimitive2d \
drawinglayer/source/primitive2d/cropprimitive2d \
@@ -80,54 +73,32 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/primitive2d/embedded3dprimitive2d \
drawinglayer/source/primitive2d/epsprimitive2d \
drawinglayer/source/primitive2d/fillgraphicprimitive2d \
- drawinglayer/source/primitive2d/fillgradientprimitive2d \
- drawinglayer/source/primitive2d/fillhatchprimitive2d \
drawinglayer/source/primitive2d/glowprimitive2d \
drawinglayer/source/primitive2d/graphicprimitivehelper2d \
drawinglayer/source/primitive2d/graphicprimitive2d \
drawinglayer/source/primitive2d/gridprimitive2d \
- drawinglayer/source/primitive2d/groupprimitive2d \
drawinglayer/source/primitive2d/helplineprimitive2d \
drawinglayer/source/primitive2d/hiddengeometryprimitive2d \
drawinglayer/source/primitive2d/invertprimitive2d \
drawinglayer/source/primitive2d/markerarrayprimitive2d \
- drawinglayer/source/primitive2d/maskprimitive2d \
drawinglayer/source/primitive2d/mediaprimitive2d \
drawinglayer/source/primitive2d/metafileprimitive2d \
- drawinglayer/source/primitive2d/modifiedcolorprimitive2d \
- drawinglayer/source/primitive2d/objectinfoprimitive2d \
drawinglayer/source/primitive2d/pagehierarchyprimitive2d \
- drawinglayer/source/primitive2d/pagepreviewprimitive2d \
drawinglayer/source/primitive2d/patternfillprimitive2d \
- drawinglayer/source/primitive2d/pointarrayprimitive2d \
- drawinglayer/source/primitive2d/polygonprimitive2d \
- drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D \
drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D \
- drawinglayer/source/primitive2d/primitivetools2d \
drawinglayer/source/primitive2d/sceneprimitive2d \
drawinglayer/source/primitive2d/sdrdecompositiontools2d \
drawinglayer/source/primitive2d/shadowprimitive2d \
drawinglayer/source/primitive2d/softedgeprimitive2d \
drawinglayer/source/primitive2d/structuretagprimitive2d \
- drawinglayer/source/primitive2d/svggradientprimitive2d \
drawinglayer/source/primitive2d/textbreakuphelper \
drawinglayer/source/primitive2d/textdecoratedprimitive2d \
drawinglayer/source/primitive2d/texteffectprimitive2d \
- drawinglayer/source/primitive2d/textenumsprimitive2d \
drawinglayer/source/primitive2d/texthierarchyprimitive2d \
drawinglayer/source/primitive2d/textlayoutdevice \
drawinglayer/source/primitive2d/textlineprimitive2d \
drawinglayer/source/primitive2d/textprimitive2d \
drawinglayer/source/primitive2d/textstrikeoutprimitive2d \
- drawinglayer/source/primitive2d/transformprimitive2d \
- drawinglayer/source/primitive2d/transparenceprimitive2d \
- drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d \
drawinglayer/source/primitive2d/wallpaperprimitive2d \
drawinglayer/source/primitive2d/wrongspellprimitive2d \
drawinglayer/source/primitive3d/baseprimitive3d \
@@ -185,7 +156,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/tools/wmfemfhelper \
drawinglayer/source/tools/primitive2dxmldump \
drawinglayer/source/drawinglayeruno/xprimitive2drenderer \
- drawinglayer/source/texture/texture \
drawinglayer/source/dumper/XShapeDumper \
drawinglayer/source/dumper/EnhancedShapeDumper \
))
diff --git a/drawinglayer/Library_drawinglayercore.mk b/drawinglayer/Library_drawinglayercore.mk
index f1643d27014d..972ac32f5388 100644
--- a/drawinglayer/Library_drawinglayercore.mk
+++ b/drawinglayer/Library_drawinglayercore.mk
@@ -40,10 +40,47 @@ $(eval $(call gb_Library_use_libraries,drawinglayercore,\
))
$(eval $(call gb_Library_add_exception_objects,drawinglayercore,\
+ drawinglayer/source/attribute/lineattribute \
+ drawinglayer/source/attribute/strokeattribute \
+ drawinglayer/source/attribute/linestartendattribute \
+ drawinglayer/source/attribute/fillgradientattribute \
+ drawinglayer/source/attribute/fillhatchattribute \
+ drawinglayer/source/attribute/fontattribute \
+ drawinglayer/source/geometry/viewinformation2d \
+ drawinglayer/source/texture/texture \
drawinglayer/source/primitive2d/baseprimitive2d \
drawinglayer/source/primitive2d/Primitive2DContainer \
drawinglayer/source/primitive2d/Tools \
- drawinglayer/source/geometry/viewinformation2d \
+ drawinglayer/source/primitive2d/polygonprimitive2d \
+ drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D \
+ drawinglayer/source/primitive2d/fillgradientprimitive2d \
+ drawinglayer/source/primitive2d/maskprimitive2d \
+ drawinglayer/source/primitive2d/groupprimitive2d \
+ drawinglayer/source/primitive2d/fillhatchprimitive2d \
+ drawinglayer/source/primitive2d/primitivetools2d \
+ drawinglayer/source/primitive2d/pointarrayprimitive2d \
+ drawinglayer/source/primitive2d/modifiedcolorprimitive2d \
+ drawinglayer/source/primitive2d/bitmapprimitive2d \
+ drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d \
+ drawinglayer/source/primitive2d/transparenceprimitive2d \
+ drawinglayer/source/primitive2d/pagepreviewprimitive2d \
+ drawinglayer/source/primitive2d/transformprimitive2d \
+ drawinglayer/source/primitive2d/svggradientprimitive2d \
+ drawinglayer/source/primitive2d/objectinfoprimitive2d \
+ drawinglayer/source/primitive2d/textenumsprimitive2d \
))
+# drawinglayer/source/primitive2d/epsprimitive2d \
+# drawinglayer/source/primitive2d/markerarrayprimitive2d \
+# drawinglayer/source/primitive2d/fillgraphicprimitive2d \
+# drawinglayer/source/primitive2d/textdecoratedprimitive2d \
+# drawinglayer/source/primitive2d/textprimitive2d \
+
+
# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_pdffilter.mk b/filter/Library_pdffilter.mk
index a7cb47a65231..349883578482 100644
--- a/filter/Library_pdffilter.mk
+++ b/filter/Library_pdffilter.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_Library_use_libraries,pdffilter,\
cppuhelper \
cppu \
sal \
+ drawinglayercore \
drawinglayer \
))
commit 8e1220407c7e19bec17767bc36e53168a1537e0a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Aug 13 10:16:35 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Dec 24 11:05:04 2020 +0900
drawinglayer: externalize PolygonWavePrimitive2D class
Change-Id: I20a702c838ec68686b9c7e407be31ae9158cbef6
diff --git a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
index ac56461e35b0..57a37b60814f 100644
--- a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
@@ -39,7 +39,7 @@ namespace drawinglayer::primitive2d
This is one of the non-decomposable primitives, so a renderer
should process it.
*/
-class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive2D final : public BasePrimitive2D
+class DRAWINGLAYERCORE_DLLPUBLIC PolygonHairlinePrimitive2D final : public BasePrimitive2D
{
private:
/// the hairline geometry
@@ -76,7 +76,7 @@ public:
It will be decomposed to the needed PolygonHairlinePrimitive2D if
not handled directly by a renderer.
*/
-class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D final
+class DRAWINGLAYERCORE_DLLPUBLIC PolygonMarkerPrimitive2D final
: public BufferedDecompositionPrimitive2D
{
private:
@@ -131,7 +131,7 @@ public:
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list