[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 203 commits - accessibility/source animations/source avmedia/source basctl/source basegfx/source basic/source bin/check-missing-unittests.py bin/gla11y bridges/source canvas/source chart2/qa chart2/source codemaker/source comphelper/source compilerplugins/clang config_host/config_global.h.in config_host.mk.in configure.ac connectivity/source cppcanvas/source cppuhelper/source cppu/source cui/inc cui/source cui/uiconfig dbaccess/IwyuFilter_dbaccess.yaml dbaccess/source dbaccess/uiconfig desktop/source download.lst drawinglayer/CppunitTest_drawinglayer_border.mk drawinglayer/inc drawinglayer/Library_drawinglayercore.mk drawinglayer/Library_drawinglayer.mk drawinglayer/Module_drawinglayer.mk drawinglayer/source editeng/source emfio/CppunitTest_emfio_emf_test.mk emfio/Library_emfio.mk emfio/source extensions/source external/libmwaw external/libstaroffice external/libwps external/neon external/python3 external/skia extras/CustomTarget _tplpresnt.mk extras/source filter/Library_svgfilter.mk filter/source formula/source framework/source helpcontent2 hwpfilter/source i18npool/source i18nutil/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_dark_svg icon-themes/breeze_svg icon-themes/colibre icon-themes/elementary icon-themes/elementary_svg icon-themes/karasa_jaga icon-themes/karasa_jaga_svg icon-themes/sifr icon-themes/sifr_dark icon-themes/sifr_dark_svg icon-themes/sifr_svg icon-themes/sukapura icon-themes/sukapura_svg icon-themes/tango idlc/source include/canvas include/drawinglayer include/editeng include/osl include/rtl include/sal include/sfx2 include/svl include/svtools include/svx include/tools include/vcl include/xmloff instsetoo_native/CustomTarget_setup.mk l10ntools/source linguistic/source officecfg/registry oox/source package/source reportdesign/source reportdesign/uiconfig Repository.mk sal/osl sal/rtl scaddins/source sc/CppunitTest_sc_ucalc.mk sc/Library_sc.mk sc/qa sc/source sc/uic onfig sd/CppunitTest_sd_uimpress.mk sdext/source sd/Library_sd.mk sd/qa sd/source setup_native/scripts sfx2/inc sfx2/Library_sfx.mk sfx2/source slideshow/source solenv/bin solenv/clang-format solenv/flatpak-manifest.in solenv/gbuild solenv/sanitizers soltools/cpp sot/source starmath/inc starmath/source stoc/source svgio/CppunitTest_svgio.mk svgio/Library_svgio.mk svl/source svtools/source svx/CppunitTest_svx_unit.mk svx/Library_svxcore.mk svx/Library_svx.mk svx/source svx/uiconfig sw/CppunitTest_sw_uwriter.mk sw/inc sw/Library_sw.mk sw/Library_swui.mk sw/qa sw/source sw/uiconfig testtools/source tools/source translations ucb/source uitest/calc_tests uitest/demo_ui unotools/source unoxml/source vcl/headless vcl/inc vcl/Library_vcl.mk vcl/qa vcl/skia vcl/source vcl/uiconfig vcl/UIConfig_vcl.mk vcl/unx vcl/win winaccessibility/source writerfilter/source xmlhelp/source xmloff/inc xmloff/source xmloff/util

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 21 05:09:08 UTC 2020


Rebased ref, commits from common ancestor:
commit e7d4d022e65fc9cf25082642db8556db61d28a22
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Apr 20 22:29:04 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Apr 20 22:55:06 2020 +0200

    ImpGraphic: clean-up and simplify swapOut()
    
    Change-Id: I3e578c3172fcea341a218798843cd750971a5af1

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index f96aacc23b8d..3db2a3fa68a8 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1320,44 +1320,46 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
 
 bool ImpGraphic::swapOut()
 {
-
-    if( isSwappedOut() )
+    if (isSwappedOut())
         return false;
 
-    ::utl::TempFile     aTempFile;
-    const INetURLObject aTmpURL( aTempFile.GetURL() );
+    utl::TempFile aTempFile;
+    const INetURLObject aTempFileURL(aTempFile.GetURL());
+    OUString sTempFileURLString = aTempFileURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
 
-    if( aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ).isEmpty() )
+    if (sTempFileURLString.isEmpty())
         return false;
+    std::unique_ptr<SvStream> xOutputStream;
 
-    std::unique_ptr<SvStream> xOStm;
     try
     {
-        xOStm = ::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE );
+        xOutputStream = utl::UcbStreamHelper::CreateStream(sTempFileURLString, StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE);
     }
-    catch( const css::uno::Exception& )
+    catch (const css::uno::Exception&)
     {
     }
-    if( !xOStm )
+
+    if (!xOutputStream)
         return false;
+    xOutputStream->SetVersion(SOFFICE_FILEFORMAT_50);
+    xOutputStream->SetCompressMode(SvStreamCompressFlags::NATIVE);
 
-    xOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
-    xOStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
+    bool bResult = swapOutToStream(xOutputStream.get());
 
-    bool bRet = swapOutToStream( xOStm.get() );
-    if( bRet )
+    if (bResult)
     {
-        mpSwapFile = std::make_shared<ImpSwapFile>(aTmpURL, getOriginURL());
+        mpSwapFile = std::make_unique<ImpSwapFile>(aTempFileURL, getOriginURL());
     }
     else
     {
-        xOStm.reset();
-        utl::UCBContentHelper::Kill(aTmpURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+        xOutputStream.reset();
+        utl::UCBContentHelper::Kill(sTempFileURLString);
     }
 
-    if (bRet)
+    if (bResult)
         vcl::graphic::Manager::get().swappedOut(this);
-    return bRet;
+
+    return bResult;
 }
 
 bool ImpGraphic::swapOutToStream(SvStream* xOStm)
commit 625542c592f2bbad0dd43049f75ef4130f7e4d5a
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Apr 20 22:17:01 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Apr 20 22:48:28 2020 +0200

    ImpGraphic: encapsulate members of ImpSwapFile
    
    Change-Id: I882d30f2f27149c865160b3fa68fa974701cea71

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 92dd0c078519..fd9ae31d358c 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -42,7 +42,7 @@ struct ImpSwapInfo
 
 class OutputDevice;
 class GfxLink;
-struct ImpSwapFile;
+class ImpSwapFile;
 class GraphicConversionParameters;
 class ImpGraphic;
 
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 1cd351b0a7a4..f96aacc23b8d 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -66,15 +66,26 @@ constexpr sal_uInt32 constPdfMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') <<
 
 using namespace com::sun::star;
 
-struct ImpSwapFile
+class ImpSwapFile
 {
-    INetURLObject aSwapURL;
+private:
+    INetURLObject maSwapURL;
     OUString maOriginURL;
 
+public:
+    ImpSwapFile(INetURLObject const & aSwapURL, OUString const & rOriginURL) 
+        : maSwapURL(aSwapURL)
+        , maOriginURL(rOriginURL)
+    {
+    }
+
     ~ImpSwapFile() COVERITY_NOEXCEPT_FALSE
     {
-        utl::UCBContentHelper::Kill(aSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+        utl::UCBContentHelper::Kill(maSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
     }
+
+    INetURLObject getSwapURL() { return maSwapURL; }
+    OUString const & getOriginURL() { return maOriginURL; }
 };
 
 ImpGraphic::ImpGraphic() :
@@ -1336,9 +1347,7 @@ bool ImpGraphic::swapOut()
     bool bRet = swapOutToStream( xOStm.get() );
     if( bRet )
     {
-        mpSwapFile = std::make_shared<ImpSwapFile>();
-        mpSwapFile->aSwapURL = aTmpURL;
-        mpSwapFile->maOriginURL = getOriginURL();
+        mpSwapFile = std::make_shared<ImpSwapFile>(aTmpURL, getOriginURL());
     }
     else
     {
@@ -1428,7 +1437,7 @@ bool ImpGraphic::swapIn()
         OUString aSwapURL;
 
         if( mpSwapFile )
-            aSwapURL = mpSwapFile->aSwapURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
+            aSwapURL = mpSwapFile->getSwapURL().GetMainURL( INetURLObject::DecodeMechanism::NONE );
 
         if( !aSwapURL.isEmpty() )
         {
@@ -1449,7 +1458,7 @@ bool ImpGraphic::swapIn()
                 bRet = swapInFromStream(xIStm.get());
                 xIStm.reset();
                 if (mpSwapFile)
-                    setOriginURL(mpSwapFile->maOriginURL);
+                    setOriginURL(mpSwapFile->getOriginURL());
                 mpSwapFile.reset();
             }
         }
commit 335fc86948943ee3578951d180a1d968d5eabc74
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Apr 20 22:07:58 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Apr 20 22:44:29 2020 +0200

    ImpGraphic: put ImpSwapFile destructor into the class body
    
    Change-Id: Ia3f7c29bf7b84dfa8d5cc044269ed51e09c9f1a3

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index b02caf0b3d38..1cd351b0a7a4 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -70,7 +70,11 @@ struct ImpSwapFile
 {
     INetURLObject aSwapURL;
     OUString maOriginURL;
-    ~ImpSwapFile() COVERITY_NOEXCEPT_FALSE;
+
+    ~ImpSwapFile() COVERITY_NOEXCEPT_FALSE
+    {
+        utl::UCBContentHelper::Kill(aSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+    }
 };
 
 ImpGraphic::ImpGraphic() :
@@ -359,11 +363,6 @@ void ImpGraphic::ImplClearGraphics()
     maVectorGraphicData.reset();
 }
 
-ImpSwapFile::~ImpSwapFile() COVERITY_NOEXCEPT_FALSE
-{
-    utl::UCBContentHelper::Kill(aSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
-}
-
 void ImpGraphic::ImplSetPrepared(bool bAnimated, const Size* pSizeHint)
 {
     mbPrepared = true;
commit 16d5540216da2a61e57046ae72b928f274d5d481
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Apr 19 10:45:11 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Apr 20 22:43:06 2020 +0200

    ImpGraphic: rename maEx to maBitmapEx
    
    Change-Id: I49dd552010d008cc486c6aaf51e226cc5bf4a1cb

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 8dc3e21de640..92dd0c078519 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -55,7 +55,7 @@ class ImpGraphic final
 private:
 
     GDIMetaFile                  maMetaFile;
-    BitmapEx                     maEx;
+    BitmapEx                     maBitmapEx;
     /// If maEx is empty, this preferred size will be set on it when it gets initialized.
     Size                         maExPrefSize;
     ImpSwapInfo                  maSwapInfo;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 7485622e4897..b02caf0b3d38 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -85,7 +85,7 @@ ImpGraphic::ImpGraphic() :
 
 ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic)
     : maMetaFile(rImpGraphic.maMetaFile)
-    , maEx(rImpGraphic.maEx)
+    , maBitmapEx(rImpGraphic.maBitmapEx)
     , maSwapInfo(rImpGraphic.maSwapInfo)
     , mpContext(rImpGraphic.mpContext)
     , mpSwapFile(rImpGraphic.mpSwapFile)
@@ -102,13 +102,13 @@ ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic)
     if( rImpGraphic.mpAnimation )
     {
         mpAnimation = std::make_unique<Animation>( *rImpGraphic.mpAnimation );
-        maEx = mpAnimation->GetBitmapEx();
+        maBitmapEx = mpAnimation->GetBitmapEx();
     }
 }
 
 ImpGraphic::ImpGraphic(ImpGraphic&& rImpGraphic) noexcept
     : maMetaFile(std::move(rImpGraphic.maMetaFile))
-    , maEx(std::move(rImpGraphic.maEx))
+    , maBitmapEx(std::move(rImpGraphic.maBitmapEx))
     , maSwapInfo(std::move(rImpGraphic.maSwapInfo))
     , mpAnimation(std::move(rImpGraphic.mpAnimation))
     , mpContext(std::move(rImpGraphic.mpContext))
@@ -139,7 +139,7 @@ ImpGraphic::ImpGraphic(GraphicExternalLink const & rGraphicExternalLink) :
 }
 
 ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
-        maEx            ( rBitmap ),
+        maBitmapEx            ( rBitmap ),
         meType          ( !rBitmap.IsEmpty() ? GraphicType::Bitmap : GraphicType::NONE ),
         mnSizeBytes     ( 0 ),
         mbSwapOut       ( false ),
@@ -150,7 +150,7 @@ ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
 }
 
 ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
-        maEx            ( rBitmapEx ),
+        maBitmapEx            ( rBitmapEx ),
         meType          ( !rBitmapEx.IsEmpty() ? GraphicType::Bitmap : GraphicType::NONE ),
         mnSizeBytes     ( 0 ),
         mbSwapOut       ( false ),
@@ -172,7 +172,7 @@ ImpGraphic::ImpGraphic(const std::shared_ptr<VectorGraphicData>& rVectorGraphicD
 }
 
 ImpGraphic::ImpGraphic( const Animation& rAnimation ) :
-        maEx            ( rAnimation.GetBitmapEx() ),
+        maBitmapEx      ( rAnimation.GetBitmapEx() ),
         mpAnimation     ( std::make_unique<Animation>( rAnimation ) ),
         meType          ( GraphicType::Bitmap ),
         mnSizeBytes     ( 0 ),
@@ -219,11 +219,11 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic )
         if ( rImpGraphic.mpAnimation )
         {
             mpAnimation = std::make_unique<Animation>( *rImpGraphic.mpAnimation );
-            maEx = mpAnimation->GetBitmapEx();
+            maBitmapEx = mpAnimation->GetBitmapEx();
         }
         else
         {
-            maEx = rImpGraphic.maEx;
+            maBitmapEx = rImpGraphic.maBitmapEx;
         }
 
         mbSwapOut = rImpGraphic.mbSwapOut;
@@ -252,7 +252,7 @@ ImpGraphic& ImpGraphic::operator=(ImpGraphic&& rImpGraphic)
     mpContext = std::move(rImpGraphic.mpContext);
     mbDummyContext = rImpGraphic.mbDummyContext;
     mpAnimation = std::move(rImpGraphic.mpAnimation);
-    maEx = std::move(rImpGraphic.maEx);
+    maBitmapEx = std::move(rImpGraphic.maBitmapEx);
     mbSwapOut = rImpGraphic.mbSwapOut;
     mpSwapFile = std::move(rImpGraphic.mpSwapFile);
     mpGfxLink = std::move(rImpGraphic.mpGfxLink);
@@ -314,7 +314,7 @@ bool ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const
                     if( rImpGraphic.mpAnimation && ( *rImpGraphic.mpAnimation == *mpAnimation ) )
                         bRet = true;
                 }
-                else if( !rImpGraphic.mpAnimation && ( rImpGraphic.maEx == maEx ) )
+                else if( !rImpGraphic.mpAnimation && ( rImpGraphic.maBitmapEx == maBitmapEx ) )
                 {
                     bRet = true;
                 }
@@ -352,7 +352,7 @@ void ImpGraphic::ImplCreateSwapInfo()
 
 void ImpGraphic::ImplClearGraphics()
 {
-    maEx.Clear();
+    maBitmapEx.Clear();
     maMetaFile.Clear();
     mpAnimation.reset();
     mpGfxLink.reset();
@@ -448,7 +448,7 @@ bool ImpGraphic::ImplIsTransparent() const
     }
     else if (meType == GraphicType::Bitmap && !maVectorGraphicData.get())
     {
-        bRet = mpAnimation ? mpAnimation->IsTransparent() : maEx.IsTransparent();
+        bRet = mpAnimation ? mpAnimation->IsTransparent() : maBitmapEx.IsTransparent();
     }
 
     return bRet;
@@ -468,7 +468,7 @@ bool ImpGraphic::ImplIsAlpha() const
     }
     else if (meType == GraphicType::Bitmap)
     {
-        bRet = (nullptr == mpAnimation && maEx.IsAlpha());
+        bRet = (nullptr == mpAnimation && maBitmapEx.IsAlpha());
     }
 
     return bRet;
@@ -519,13 +519,13 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
 
     if( meType == GraphicType::Bitmap )
     {
-        if(maVectorGraphicData.get() && maEx.IsEmpty())
+        if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
         {
-            // use maEx as local buffer for rendered svg
-            const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
+            // use maBitmapEx as local buffer for rendered svg
+            const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
         }
 
-        const BitmapEx& rRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx );
+        const BitmapEx& rRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maBitmapEx );
 
         aRetBmp = rRetBmpEx.GetBitmap( COL_WHITE );
 
@@ -534,7 +534,7 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
     }
     else if( ( meType != GraphicType::Default ) && ImplIsSupportedGraphic() )
     {
-        if(maEx.IsEmpty())
+        if(maBitmapEx.IsEmpty())
         {
             // calculate size
             ScopedVclPtrInstance< VirtualDevice > aVDev;
@@ -603,12 +603,12 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
 
                 ImplDraw( aVDev.get(), Point(), aDrawSize );
 
-                // use maEx as local buffer for rendered metafile
-                const_cast< ImpGraphic* >(this)->maEx = aVDev->GetBitmapEx( Point(), aVDev->GetOutputSizePixel() );
+                // use maBitmapEx as local buffer for rendered metafile
+                const_cast< ImpGraphic* >(this)->maBitmapEx = aVDev->GetBitmapEx( Point(), aVDev->GetOutputSizePixel() );
             }
         }
 
-        aRetBmp = maEx.GetBitmap();
+        aRetBmp = maBitmapEx.GetBitmap();
     }
 
     if( !!aRetBmp )
@@ -628,13 +628,13 @@ BitmapEx ImpGraphic::ImplGetBitmapEx(const GraphicConversionParameters& rParamet
 
     if( meType == GraphicType::Bitmap )
     {
-        if(maVectorGraphicData.get() && maEx.IsEmpty())
+        if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
         {
-            // use maEx as local buffer for rendered svg
-            const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
+            // use maBitmapEx as local buffer for rendered svg
+            const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
         }
 
-        aRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx );
+        aRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maBitmapEx );
 
         if(rParameters.getSizePixel().Width() || rParameters.getSizePixel().Height())
         {
@@ -645,15 +645,15 @@ BitmapEx ImpGraphic::ImplGetBitmapEx(const GraphicConversionParameters& rParamet
     }
     else if( ( meType != GraphicType::Default ) && ImplIsSupportedGraphic() )
     {
-        if(maEx.IsEmpty())
+        if(maBitmapEx.IsEmpty())
         {
             const ImpGraphic aMonoMask( maMetaFile.GetMonochromeMtf( COL_BLACK ) );
 
-            // use maEx as local buffer for rendered metafile
-            const_cast< ImpGraphic* >(this)->maEx = BitmapEx(ImplGetBitmap(rParameters), aMonoMask.ImplGetBitmap(rParameters));
+            // use maBitmapEx as local buffer for rendered metafile
+            const_cast< ImpGraphic* >(this)->maBitmapEx = BitmapEx(ImplGetBitmap(rParameters), aMonoMask.ImplGetBitmap(rParameters));
         }
 
-        aRetBmpEx = maEx;
+        aRetBmpEx = maBitmapEx;
     }
 
     return aRetBmpEx;
@@ -673,7 +673,7 @@ Animation ImpGraphic::ImplGetAnimation() const
 const BitmapEx& ImpGraphic::ImplGetBitmapExRef() const
 {
     ensureAvailable();
-    return maEx;
+    return maBitmapEx;
 }
 
 const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
@@ -715,27 +715,27 @@ const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
         // survive copying (change this if not wanted)
         ImpGraphic* pThat = const_cast< ImpGraphic* >(this);
 
-        if(maVectorGraphicData.get() && !maEx)
+        if(maVectorGraphicData.get() && !maBitmapEx)
         {
-            // use maEx as local buffer for rendered svg
-            pThat->maEx = getVectorGraphicReplacement();
+            // use maBitmapEx as local buffer for rendered svg
+            pThat->maBitmapEx = getVectorGraphicReplacement();
         }
 
         // #123983# directly create a metafile with the same PrefSize and PrefMapMode
         // the bitmap has, this will be an always correct metafile
-        if(maEx.IsTransparent())
+        if(maBitmapEx.IsTransparent())
         {
-            pThat->maMetaFile.AddAction(new MetaBmpExScaleAction(Point(), maEx.GetPrefSize(), maEx));
+            pThat->maMetaFile.AddAction(new MetaBmpExScaleAction(Point(), maBitmapEx.GetPrefSize(), maBitmapEx));
         }
         else
         {
-            pThat->maMetaFile.AddAction(new MetaBmpScaleAction(Point(), maEx.GetPrefSize(), maEx.GetBitmap()));
+            pThat->maMetaFile.AddAction(new MetaBmpScaleAction(Point(), maBitmapEx.GetPrefSize(), maBitmapEx.GetBitmap()));
         }
 
         pThat->maMetaFile.Stop();
         pThat->maMetaFile.WindStart();
-        pThat->maMetaFile.SetPrefSize(maEx.GetPrefSize());
-        pThat->maMetaFile.SetPrefMapMode(maEx.GetPrefMapMode());
+        pThat->maMetaFile.SetPrefSize(maBitmapEx.GetPrefSize());
+        pThat->maMetaFile.SetPrefMapMode(maBitmapEx.GetPrefMapMode());
     }
 
     return maMetaFile;
@@ -771,11 +771,11 @@ Size ImpGraphic::ImplGetPrefSize() const
 
             case GraphicType::Bitmap:
             {
-                if(maVectorGraphicData.get() && maEx.IsEmpty())
+                if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
                 {
                     if (!maExPrefSize.getWidth() || !maExPrefSize.getHeight())
                     {
-                        // svg not yet buffered in maEx, return size derived from range
+                        // svg not yet buffered in maBitmapEx, return size derived from range
                         const basegfx::B2DRange& rRange = maVectorGraphicData->getRange();
 
                         aSize = Size(basegfx::fround(rRange.getWidth()), basegfx::fround(rRange.getHeight()));
@@ -787,11 +787,11 @@ Size ImpGraphic::ImplGetPrefSize() const
                 }
                 else
                 {
-                    aSize = maEx.GetPrefSize();
+                    aSize = maBitmapEx.GetPrefSize();
 
                     if( !aSize.Width() || !aSize.Height() )
                     {
-                        aSize = maEx.GetSizePixel();
+                        aSize = maBitmapEx.GetSizePixel();
                     }
                 }
             }
@@ -823,7 +823,7 @@ void ImpGraphic::ImplSetPrefSize( const Size& rPrefSize )
         {
             // used when importing a writer FlyFrame with SVG as graphic, added conversion
             // to allow setting the PrefSize at the BitmapEx to hold it
-            if(maVectorGraphicData.get() && maEx.IsEmpty())
+            if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
             {
                 maExPrefSize = rPrefSize;
             }
@@ -837,7 +837,7 @@ void ImpGraphic::ImplSetPrefSize( const Size& rPrefSize )
 
             if (!maExPrefSize.getWidth() || !maExPrefSize.getHeight())
             {
-                maEx.SetPrefSize( rPrefSize );
+                maBitmapEx.SetPrefSize( rPrefSize );
             }
         }
         break;
@@ -869,17 +869,17 @@ MapMode ImpGraphic::ImplGetPrefMapMode() const
 
             case GraphicType::Bitmap:
             {
-                if(maVectorGraphicData.get() && maEx.IsEmpty())
+                if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
                 {
-                    // svg not yet buffered in maEx, return default PrefMapMode
+                    // svg not yet buffered in maBitmapEx, return default PrefMapMode
                     aMapMode = MapMode(MapUnit::Map100thMM);
                 }
                 else
                 {
-                    const Size aSize( maEx.GetPrefSize() );
+                    const Size aSize( maBitmapEx.GetPrefSize() );
 
                     if ( aSize.Width() && aSize.Height() )
-                        aMapMode = maEx.GetPrefMapMode();
+                        aMapMode = maBitmapEx.GetPrefMapMode();
                 }
             }
             break;
@@ -911,7 +911,7 @@ void ImpGraphic::ImplSetPrefMapMode( const MapMode& rPrefMapMode )
             if(maVectorGraphicData.get())
             {
                 // ignore for Vector Graphic Data. If this is really used (except the grfcache)
-                // it can be extended by using maEx as buffer for getVectorGraphicReplacement()
+                // it can be extended by using maBitmapEx as buffer for getVectorGraphicReplacement()
             }
             else
             {
@@ -922,7 +922,7 @@ void ImpGraphic::ImplSetPrefMapMode( const MapMode& rPrefMapMode )
                     const_cast< BitmapEx& >(mpAnimation->GetBitmapEx()).SetPrefMapMode( rPrefMapMode );
                 }
 
-                maEx.SetPrefMapMode( rPrefMapMode );
+                maBitmapEx.SetPrefMapMode( rPrefMapMode );
             }
         }
         break;
@@ -957,7 +957,7 @@ sal_uLong ImpGraphic::ImplGetSizeBytes() const
         }
         else
         {
-            mnSizeBytes = mpAnimation ? mpAnimation->GetSizeBytes() : maEx.GetSizeBytes();
+            mnSizeBytes = mpAnimation ? mpAnimation->GetSizeBytes() : maBitmapEx.GetSizeBytes();
         }
     }
     else if( meType == GraphicType::GdiMetafile )
@@ -981,10 +981,10 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev, const Point& rDestPt ) const
 
         case GraphicType::Bitmap:
         {
-            if(maVectorGraphicData.get() && !maEx)
+            if(maVectorGraphicData.get() && !maBitmapEx)
             {
                 // use maEx as local buffer for rendered svg
-                const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
+                const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
             }
 
             if ( mpAnimation )
@@ -993,7 +993,7 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev, const Point& rDestPt ) const
             }
             else
             {
-                maEx.Draw( pOutDev, rDestPt );
+                maBitmapEx.Draw( pOutDev, rDestPt );
             }
         }
         break;
@@ -1018,10 +1018,10 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
 
         case GraphicType::Bitmap:
         {
-            if(maVectorGraphicData.get() && maEx.IsEmpty())
+            if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
             {
                 // use maEx as local buffer for rendered svg
-                const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
+                const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
             }
 
             if( mpAnimation )
@@ -1030,7 +1030,7 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
             }
             else
             {
-                maEx.Draw( pOutDev, rDestPt, rDestSize );
+                maBitmapEx.Draw( pOutDev, rDestPt, rDestSize );
             }
         }
         break;
@@ -1165,18 +1165,18 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
     {
         if( meType == GraphicType::Bitmap )
         {
-            if(maVectorGraphicData.get() && maEx.IsEmpty())
+            if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
             {
-                // use maEx as local buffer for rendered svg
-                maEx = getVectorGraphicReplacement();
+                // use maBitmapEx as local buffer for rendered svg
+                maBitmapEx = getVectorGraphicReplacement();
             }
 
-            maEx.SetSizePixel(aSize);
+            maBitmapEx.SetSizePixel(aSize);
 
             if( aMapMode != MapMode() )
             {
-                maEx.SetPrefMapMode( aMapMode );
-                maEx.SetPrefSize( aSize );
+                maBitmapEx.SetPrefMapMode( aMapMode );
+                maBitmapEx.SetPrefSize( aSize );
             }
         }
         else
@@ -1550,7 +1550,7 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
                 else if( mpAnimation )
                     nRet = mpAnimation->GetChecksum();
                 else
-                    nRet = maEx.GetChecksum();
+                    nRet = maBitmapEx.GetChecksum();
             }
             break;
 
@@ -1840,7 +1840,7 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
                 }
                 else
                 {
-                    WriteDIBBitmapEx(rImpGraphic.maEx, rOStm);
+                    WriteDIBBitmapEx(rImpGraphic.maBitmapEx, rOStm);
                 }
             }
             break;
commit 2a3f31061748d7cd55d0ef6542693c016d04e909
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Apr 19 10:37:35 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Apr 20 22:41:13 2020 +0200

    ImpGraphic: make magic bits for vector formats as constexpr
    
    Change-Id: If0caaf76feebbdc0fb9b16a3adeecf0e3e9dc295

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 2095d0c8ef71..7485622e4897 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -55,6 +55,15 @@
 #define GRAPHIC_FORMAT_50           COMPAT_FORMAT( 'G', 'R', 'F', '5' )
 #define NATIVE_FORMAT_50            COMPAT_FORMAT( 'N', 'A', 'T', '5' )
 
+namespace {
+
+constexpr sal_uInt32 constSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
+constexpr sal_uInt32 constWmfMagic((sal_uInt32('w') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
+constexpr sal_uInt32 constEmfMagic((sal_uInt32('e') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
+constexpr sal_uInt32 constPdfMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
+
+}
+
 using namespace com::sun::star;
 
 struct ImpSwapFile
@@ -1695,16 +1704,12 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic )
             ErrCode nOrigError = rIStm.GetErrorCode();
             // try to stream in Svg defining data (length, byte array and evtl. path)
             // See below (operator<<) for more information
-            const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
-            const sal_uInt32 nWmfMagic((sal_uInt32('w') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
-            const sal_uInt32 nEmfMagic((sal_uInt32('e') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
-            const sal_uInt32 nPdfMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
             sal_uInt32 nMagic;
             rIStm.Seek(nStmPos1);
             rIStm.ResetError();
             rIStm.ReadUInt32( nMagic );
 
-            if (nSvgMagic == nMagic || nWmfMagic == nMagic || nEmfMagic == nMagic || nPdfMagic == nMagic)
+            if (constSvgMagic == nMagic || constWmfMagic == nMagic || constEmfMagic == nMagic || constPdfMagic == nMagic)
             {
                 sal_uInt32 nVectorGraphicDataArrayLength(0);
                 rIStm.ReadUInt32(nVectorGraphicDataArrayLength);
@@ -1720,15 +1725,15 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic )
                     {
                         VectorGraphicDataType aDataType(VectorGraphicDataType::Svg);
 
-                        if (nWmfMagic == nMagic)
+                        if (constWmfMagic == nMagic)
                         {
                             aDataType = VectorGraphicDataType::Wmf;
                         }
-                        else if (nEmfMagic == nMagic)
+                        else if (constEmfMagic == nMagic)
                         {
                             aDataType = VectorGraphicDataType::Emf;
                         }
-                        else if (nPdfMagic == nMagic)
+                        else if (constPdfMagic == nMagic)
                         {
                             aDataType = VectorGraphicDataType::Pdf;
                         }
@@ -1803,26 +1808,22 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
                     {
                         case VectorGraphicDataType::Wmf:
                         {
-                            const sal_uInt32 nWmfMagic((sal_uInt32('w') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
-                            rOStm.WriteUInt32(nWmfMagic);
+                            rOStm.WriteUInt32(constWmfMagic);
                             break;
                         }
                         case VectorGraphicDataType::Emf:
                         {
-                            const sal_uInt32 nEmfMagic((sal_uInt32('e') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
-                            rOStm.WriteUInt32(nEmfMagic);
+                            rOStm.WriteUInt32(constEmfMagic);
                             break;
                         }
                         case VectorGraphicDataType::Svg:
                         {
-                            const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
-                            rOStm.WriteUInt32(nSvgMagic);
+                            rOStm.WriteUInt32(constSvgMagic);
                             break;
                         }
                         case VectorGraphicDataType::Pdf:
                         {
-                            const sal_uInt32 nSvgMagic((sal_uInt32('p') << 24) | (sal_uInt32('d') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
-                            rOStm.WriteUInt32(nSvgMagic);
+                            rOStm.WriteUInt32(constPdfMagic);
                             break;
                         }
                     }
commit 9b08834f5f1f4f026632e658ad25594df4ac8617
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Apr 18 21:40:12 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Apr 20 22:41:12 2020 +0200

    remove Impl from swap method names in ImpGraphic
    
    Change-Id: Ie235b6d02582d4d5ee3dc3d9d2be7f022bcb13c4

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 8fa1df9b82fc..8dc3e21de640 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -175,13 +175,14 @@ private:
     bool                ImplReadEmbedded( SvStream& rIStream );
     bool                ImplWriteEmbedded( SvStream& rOStream );
 
-    bool                ImplSwapIn();
-    bool                ImplSwapIn( SvStream* pIStm );
+    bool                swapIn();
+    bool                swapInFromStream(SvStream* pIStm);
 
-    bool                ImplSwapOut();
-    bool                ImplSwapOut( SvStream* pOStm );
+    bool                swapOut();
+    bool                swapOutToStream(SvStream* pOStm);
+
+    bool                isSwappedOut() const { return mbSwapOut;}
 
-    bool                ImplIsSwapOut() const { return mbSwapOut;}
     bool                ImplIsDummyContext() const { return mbDummyContext; }
     void                ImplSetLink( const std::shared_ptr<GfxLink>& );
     std::shared_ptr<GfxLink> ImplGetSharedGfxLink() const;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 9deb69a836e4..2095d0c8ef71 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -329,7 +329,7 @@ const std::shared_ptr<VectorGraphicData>& ImpGraphic::getVectorGraphicData() con
 
 void ImpGraphic::ImplCreateSwapInfo()
 {
-    if (!ImplIsSwapOut())
+    if (!isSwappedOut())
     {
         maSwapInfo.maPrefMapMode = ImplGetPrefMapMode();
         maSwapInfo.maPrefSize = ImplGetPrefSize();
@@ -736,7 +736,7 @@ Size ImpGraphic::ImplGetSizePixel() const
 {
     Size aSize;
 
-    if (ImplIsSwapOut())
+    if (isSwappedOut())
         aSize = maSwapInfo.maSizePixel;
     else
         aSize = ImplGetBitmapEx(GraphicConversionParameters()).GetSizePixel();
@@ -748,7 +748,7 @@ Size ImpGraphic::ImplGetPrefSize() const
 {
     Size aSize;
 
-    if (ImplIsSwapOut())
+    if (isSwappedOut())
     {
         aSize = maSwapInfo.maPrefSize;
     }
@@ -846,7 +846,7 @@ MapMode ImpGraphic::ImplGetPrefMapMode() const
 {
     MapMode aMapMode;
 
-    if (ImplIsSwapOut())
+    if (isSwappedOut())
     {
         aMapMode = maSwapInfo.maPrefMapMode;
     }
@@ -962,7 +962,7 @@ sal_uLong ImpGraphic::ImplGetSizeBytes() const
 void ImpGraphic::ImplDraw( OutputDevice* pOutDev, const Point& rDestPt ) const
 {
     ensureAvailable();
-    if( !ImplIsSupportedGraphic() || ImplIsSwapOut() )
+    if( !ImplIsSupportedGraphic() || isSwappedOut() )
         return;
 
     switch( meType )
@@ -999,7 +999,7 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
                            const Point& rDestPt, const Size& rDestSize ) const
 {
     ensureAvailable();
-    if( !ImplIsSupportedGraphic() || ImplIsSwapOut() )
+    if( !ImplIsSupportedGraphic() || isSwappedOut() )
         return;
 
     switch( meType )
@@ -1042,7 +1042,7 @@ void ImpGraphic::ImplStartAnimation( OutputDevice* pOutDev, const Point& rDestPt
 {
     ensureAvailable();
 
-    if( ImplIsSupportedGraphic() && !ImplIsSwapOut() && mpAnimation )
+    if( ImplIsSupportedGraphic() && !isSwappedOut() && mpAnimation )
         mpAnimation->Start( pOutDev, rDestPt, rDestSize, nExtraData, pFirstFrameOutDev );
 }
 
@@ -1050,7 +1050,7 @@ void ImpGraphic::ImplStopAnimation( OutputDevice* pOutDev, long nExtraData )
 {
     ensureAvailable();
 
-    if( ImplIsSupportedGraphic() && !ImplIsSwapOut() && mpAnimation )
+    if( ImplIsSupportedGraphic() && !isSwappedOut() && mpAnimation )
         mpAnimation->Stop( pOutDev, nExtraData );
 }
 
@@ -1226,7 +1226,7 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
 {
     ensureAvailable();
 
-    if( ( meType == GraphicType::NONE ) || ( meType == GraphicType::Default ) || ImplIsSwapOut() )
+    if( ( meType == GraphicType::NONE ) || ( meType == GraphicType::Default ) || isSwappedOut() )
         return false;
 
     const MapMode   aMapMode( ImplGetPrefMapMode() );
@@ -1299,10 +1299,10 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
     return bRet;
 }
 
-bool ImpGraphic::ImplSwapOut()
+bool ImpGraphic::swapOut()
 {
 
-    if( ImplIsSwapOut() )
+    if( isSwappedOut() )
         return false;
 
     ::utl::TempFile     aTempFile;
@@ -1325,7 +1325,7 @@ bool ImpGraphic::ImplSwapOut()
     xOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
     xOStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
 
-    bool bRet = ImplSwapOut( xOStm.get() );
+    bool bRet = swapOutToStream( xOStm.get() );
     if( bRet )
     {
         mpSwapFile = std::make_shared<ImpSwapFile>();
@@ -1343,7 +1343,7 @@ bool ImpGraphic::ImplSwapOut()
     return bRet;
 }
 
-bool ImpGraphic::ImplSwapOut( SvStream* xOStm )
+bool ImpGraphic::swapOutToStream(SvStream* xOStm)
 {
     if( !xOStm )
     {
@@ -1374,8 +1374,8 @@ bool ImpGraphic::ensureAvailable() const
 {
     auto pThis = const_cast<ImpGraphic*>(this);
 
-    if (ImplIsSwapOut())
-        return pThis->ImplSwapIn();
+    if (isSwappedOut())
+        return pThis->swapIn();
 
     pThis->maLastUsed = std::chrono::high_resolution_clock::now();
     return true;
@@ -1404,11 +1404,11 @@ bool ImpGraphic::loadPrepared()
     return true;
 }
 
-bool ImpGraphic::ImplSwapIn()
+bool ImpGraphic::swapIn()
 {
     bool bRet = false;
 
-    if (!ImplIsSwapOut())
+    if (!isSwappedOut())
         return bRet;
 
     if (mbPrepared)
@@ -1438,7 +1438,7 @@ bool ImpGraphic::ImplSwapIn()
                 xIStm->SetVersion( SOFFICE_FILEFORMAT_50 );
                 xIStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
 
-                bRet = ImplSwapIn( xIStm.get() );
+                bRet = swapInFromStream(xIStm.get());
                 xIStm.reset();
                 if (mpSwapFile)
                     setOriginURL(mpSwapFile->maOriginURL);
@@ -1453,7 +1453,7 @@ bool ImpGraphic::ImplSwapIn()
     return bRet;
 }
 
-bool ImpGraphic::ImplSwapIn( SvStream* xIStm )
+bool ImpGraphic::swapInFromStream(SvStream* xIStm)
 {
     bool bRet = false;
 
@@ -1527,7 +1527,7 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
 
     ensureAvailable();
 
-    if( ImplIsSupportedGraphic() && !ImplIsSwapOut() )
+    if( ImplIsSupportedGraphic() && !isSwappedOut() )
     {
         switch( meType )
         {
@@ -1564,7 +1564,7 @@ bool ImpGraphic::ImplExportNative( SvStream& rOStm ) const
 
     bool bResult = false;
 
-    if( !ImplIsSwapOut() )
+    if( !isSwappedOut() )
     {
         if( mpGfxLink && mpGfxLink->IsNative() )
             bResult = mpGfxLink->ExportNative( rOStm );
@@ -1757,7 +1757,7 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
 
     rImpGraphic.ensureAvailable();
 
-    if (rImpGraphic.ImplIsSwapOut())
+    if (rImpGraphic.isSwappedOut())
     {
         rOStm.SetError( SVSTREAM_GENERALERROR );
         return;
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index b019d5adceaa..65e81fc1e605 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -93,7 +93,7 @@ void Manager::reduceGraphicMemory()
             return;
 
         sal_Int64 nCurrentGraphicSize = getGraphicSizeBytes(pEachImpGraphic);
-        if (!pEachImpGraphic->ImplIsSwapOut() && nCurrentGraphicSize > 1000000)
+        if (!pEachImpGraphic->isSwappedOut() && nCurrentGraphicSize > 1000000)
         {
             if (!pEachImpGraphic->mpContext)
             {
@@ -102,7 +102,7 @@ void Manager::reduceGraphicMemory()
                 auto aSeconds = std::chrono::duration_cast<std::chrono::seconds>(aDeltaTime);
 
                 if (aSeconds > mnAllowedIdleTime)
-                    pEachImpGraphic->ImplSwapOut();
+                    pEachImpGraphic->swapOut();
             }
         }
     }
@@ -141,7 +141,7 @@ void Manager::registerGraphic(const std::shared_ptr<ImpGraphic>& pImpGraphic,
     sal_Int64 calculatedSize = 0;
     for (ImpGraphic* pEachImpGraphic : m_pImpGraphicList)
     {
-        if (!pEachImpGraphic->ImplIsSwapOut())
+        if (!pEachImpGraphic->isSwappedOut())
         {
             calculatedSize += getGraphicSizeBytes(pEachImpGraphic);
         }
commit 02d41c204efb33625dac1389fb71c9ea6b1b0733
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Apr 15 22:05:33 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Apr 20 22:39:09 2020 +0200

    remove GraphicNative{Metadata,Transform} from clang-f. blacklist
    
    Change-Id: Ib60485e5d35e9d3ec2b0028d38fb8d5eaa72421c

diff --git a/include/vcl/GraphicNativeMetadata.hxx b/include/vcl/GraphicNativeMetadata.hxx
index 118efa480df8..318fb724bf25 100644
--- a/include/vcl/GraphicNativeMetadata.hxx
+++ b/include/vcl/GraphicNativeMetadata.hxx
@@ -29,8 +29,8 @@ public:
     GraphicNativeMetadata();
     ~GraphicNativeMetadata();
 
-    bool read(Graphic const & rGraphic);
-    sal_uInt16 getRotation() const { return mRotation;}
+    bool read(Graphic const& rGraphic);
+    sal_uInt16 getRotation() const { return mRotation; }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx
index 318327bf5b66..b4d71f2d53d0 100644
--- a/include/vcl/GraphicNativeTransform.hxx
+++ b/include/vcl/GraphicNativeTransform.hxx
@@ -29,9 +29,9 @@ class VCL_DLLPUBLIC GraphicNativeTransform final
 {
     Graphic& mrGraphic;
 
-    bool rotateBitmapOnly (sal_uInt16 aRotation);
-    void rotateJPEG       (sal_uInt16 aRotation);
-    bool rotateGeneric    (sal_uInt16 aRotation, const OUString& aType);
+    bool rotateBitmapOnly(sal_uInt16 aRotation);
+    void rotateJPEG(sal_uInt16 aRotation);
+    bool rotateGeneric(sal_uInt16 aRotation, const OUString& aType);
 
 public:
     GraphicNativeTransform(Graphic& rGraphic);
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index d92622eb77a1..92094ca31d95 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -7333,8 +7333,6 @@ include/vcl/BitmapTools.hxx
 include/vcl/ColorMask.hxx
 include/vcl/EnumContext.hxx
 include/vcl/FilterConfigItem.hxx
-include/vcl/GraphicNativeMetadata.hxx
-include/vcl/GraphicNativeTransform.hxx
 include/vcl/GraphicObject.hxx
 include/vcl/IContext.hxx
 include/vcl/IDialogRenderable.hxx
@@ -17165,8 +17163,6 @@ vcl/source/edit/xtextedt.cxx
 vcl/source/filter/FilterConfigCache.cxx
 vcl/source/filter/FilterConfigCache.hxx
 vcl/source/filter/FilterConfigItem.cxx
-vcl/source/filter/GraphicNativeMetadata.cxx
-vcl/source/filter/GraphicNativeTransform.cxx
 vcl/source/filter/graphicfilter.cxx
 vcl/source/filter/graphicfilter2.cxx
 vcl/source/filter/graphicfilter_internal.hxx
diff --git a/vcl/source/filter/GraphicNativeMetadata.cxx b/vcl/source/filter/GraphicNativeMetadata.cxx
index e42669d3c4aa..132a51a52391 100644
--- a/vcl/source/filter/GraphicNativeMetadata.cxx
+++ b/vcl/source/filter/GraphicNativeMetadata.cxx
@@ -25,18 +25,17 @@
 #include "jpeg/Exif.hxx"
 #include <memory>
 
-GraphicNativeMetadata::GraphicNativeMetadata() :
-    mRotation(0)
-{}
-
-GraphicNativeMetadata::~GraphicNativeMetadata()
-{}
+GraphicNativeMetadata::GraphicNativeMetadata()
+    : mRotation(0)
+{
+}
 
+GraphicNativeMetadata::~GraphicNativeMetadata() {}
 
-bool GraphicNativeMetadata::read(Graphic const & rGraphic)
+bool GraphicNativeMetadata::read(Graphic const& rGraphic)
 {
     GfxLink aLink = rGraphic.GetGfxLink();
-    if ( aLink.GetType() != GfxLinkType::NativeJpg )
+    if (aLink.GetType() != GfxLinkType::NativeJpg)
         return false;
 
     sal_uInt32 aDataSize = aLink.GetDataSize();
diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx
index ba6e6a194f63..8083dd4c2e77 100644
--- a/vcl/source/filter/GraphicNativeTransform.cxx
+++ b/vcl/source/filter/GraphicNativeTransform.cxx
@@ -30,12 +30,12 @@
 
 using namespace ::exif;
 
-GraphicNativeTransform::GraphicNativeTransform(Graphic& rGraphic) :
-    mrGraphic(rGraphic)
-{}
+GraphicNativeTransform::GraphicNativeTransform(Graphic& rGraphic)
+    : mrGraphic(rGraphic)
+{
+}
 
-GraphicNativeTransform::~GraphicNativeTransform()
-{}
+GraphicNativeTransform::~GraphicNativeTransform() {}
 
 void GraphicNativeTransform::rotate(sal_uInt16 aInputRotation)
 {
@@ -52,19 +52,19 @@ void GraphicNativeTransform::rotate(sal_uInt16 aInputRotation)
     }
 
     GfxLink aLink = mrGraphic.GetGfxLink();
-    if ( aLink.GetType() == GfxLinkType::NativeJpg )
+    if (aLink.GetType() == GfxLinkType::NativeJpg)
     {
         rotateJPEG(aRotation);
     }
-    else if ( aLink.GetType() == GfxLinkType::NativePng )
+    else if (aLink.GetType() == GfxLinkType::NativePng)
     {
         rotateGeneric(aRotation, "png");
     }
-    else if ( aLink.GetType() == GfxLinkType::NativeGif )
+    else if (aLink.GetType() == GfxLinkType::NativeGif)
     {
         rotateGeneric(aRotation, "gif");
     }
-    else if ( aLink.GetType() == GfxLinkType::NONE )
+    else if (aLink.GetType() == GfxLinkType::NONE)
     {
         rotateBitmapOnly(aRotation);
     }
@@ -96,24 +96,24 @@ bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, const OUString&
 
     GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
 
-    css::uno::Sequence< css::beans::PropertyValue > aFilterData( 3 );
-    aFilterData[ 0 ].Name = "Interlaced";
-    aFilterData[ 0 ].Value <<= sal_Int32(0);
-    aFilterData[ 1 ].Name = "Compression";
-    aFilterData[ 1 ].Value <<= sal_Int32(9);
-    aFilterData[ 2 ].Name = "Quality";
-    aFilterData[ 2 ].Value <<= sal_Int32(90);
+    css::uno::Sequence<css::beans::PropertyValue> aFilterData(3);
+    aFilterData[0].Name = "Interlaced";
+    aFilterData[0].Value <<= sal_Int32(0);
+    aFilterData[1].Name = "Compression";
+    aFilterData[1].Value <<= sal_Int32(9);
+    aFilterData[2].Name = "Quality";
+    aFilterData[2].Value <<= sal_Int32(90);
 
-    sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( aType );
+    sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName(aType);
 
     BitmapEx aBitmap = mrGraphic.GetBitmapEx();
     aBitmap.Rotate(aRotation, COL_BLACK);
-    rFilter.ExportGraphic( aBitmap, "none", aStream, nFilterFormat, &aFilterData );
+    rFilter.ExportGraphic(aBitmap, "none", aStream, nFilterFormat, &aFilterData);
 
-    aStream.Seek( STREAM_SEEK_TO_BEGIN );
+    aStream.Seek(STREAM_SEEK_TO_BEGIN);
 
     Graphic aGraphic;
-    rFilter.ImportGraphic( aGraphic, "import", aStream );
+    rFilter.ImportGraphic(aGraphic, "import", aStream);
 
     mrGraphic = aGraphic;
     return true;
@@ -123,8 +123,7 @@ void GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation)
 {
     BitmapEx aBitmap = mrGraphic.GetBitmapEx();
 
-    if (aBitmap.GetSizePixel().Width()  % 16 != 0 ||
-        aBitmap.GetSizePixel().Height() % 16 != 0 )
+    if (aBitmap.GetSizePixel().Width() % 16 != 0 || aBitmap.GetSizePixel().Height() % 16 != 0)
     {
         rotateGeneric(aRotation, "png");
     }
@@ -134,12 +133,12 @@ void GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation)
 
         SvMemoryStream aSourceStream;
         aSourceStream.WriteBytes(aLink.GetData(), aLink.GetDataSize());
-        aSourceStream.Seek( STREAM_SEEK_TO_BEGIN );
+        aSourceStream.Seek(STREAM_SEEK_TO_BEGIN);
 
         Orientation aOrientation = TOP_LEFT;
 
         Exif exif;
-        if ( exif.read(aSourceStream) )
+        if (exif.read(aSourceStream))
         {
             aOrientation = exif.getOrientation();
         }
@@ -149,20 +148,20 @@ void GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation)
         transform.setRotate(aRotation);
         transform.perform();
 
-        aTargetStream.Seek( STREAM_SEEK_TO_BEGIN );
+        aTargetStream.Seek(STREAM_SEEK_TO_BEGIN);
 
         // Reset orientation in exif if needed
-        if ( exif.hasExif() && aOrientation != TOP_LEFT)
+        if (exif.hasExif() && aOrientation != TOP_LEFT)
         {
             exif.setOrientation(TOP_LEFT);
             exif.write(aTargetStream);
         }
 
-        aTargetStream.Seek( STREAM_SEEK_TO_BEGIN );
+        aTargetStream.Seek(STREAM_SEEK_TO_BEGIN);
 
         Graphic aGraphic;
         GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
-        rFilter.ImportGraphic( aGraphic, "import", aTargetStream );
+        rFilter.ImportGraphic(aGraphic, "import", aTargetStream);
         mrGraphic = aGraphic;
     }
 }
commit a90aa420a2f44d13a81c2a2425ab85caa0f74b01
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Apr 14 20:48:56 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Apr 20 22:39:09 2020 +0200

    use pragma once
    
    Change-Id: Ia78cc4ee565a5f39835499764b1f2d0a2a72c5ba

diff --git a/include/vcl/GraphicNativeMetadata.hxx b/include/vcl/GraphicNativeMetadata.hxx
index b6b162556e76..118efa480df8 100644
--- a/include/vcl/GraphicNativeMetadata.hxx
+++ b/include/vcl/GraphicNativeMetadata.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_GRAPHICNATIVEMETADATA_HXX
-#define INCLUDED_VCL_GRAPHICNATIVEMETADATA_HXX
+#pragma once
 
 #include <vcl/graph.hxx>
 
@@ -34,6 +33,4 @@ public:
     sal_uInt16 getRotation() const { return mRotation;}
 };
 
-#endif // INCLUDED_VCL_GRAPHICNATIVEMETADATA_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx
index c8203377dc55..318327bf5b66 100644
--- a/include/vcl/GraphicNativeTransform.hxx
+++ b/include/vcl/GraphicNativeTransform.hxx
@@ -17,12 +17,12 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_GRAPHICNATIVETRANSFORM_HXX
-#define INCLUDED_VCL_GRAPHICNATIVETRANSFORM_HXX
+#pragma once
 
 #include <rtl/ustring.hxx>
 #include <sal/types.h>
 #include <vcl/dllapi.h>
+
 class Graphic;
 
 class VCL_DLLPUBLIC GraphicNativeTransform final
@@ -40,6 +40,4 @@ public:
     void rotate(sal_uInt16 aRotation);
 };
 
-#endif // INCLUDED_VCL_GRAPHICNATIVETRANSFORM_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/filter/jpeg/Exif.hxx b/vcl/source/filter/jpeg/Exif.hxx
index 47c34e427810..6052a44842da 100644
--- a/vcl/source/filter/jpeg/Exif.hxx
+++ b/vcl/source/filter/jpeg/Exif.hxx
@@ -17,12 +17,12 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_SOURCE_FILTER_JPEG_EXIF_HXX
-#define INCLUDED_VCL_SOURCE_FILTER_JPEG_EXIF_HXX
+#pragma once
 
 #include <tools/stream.hxx>
 
 namespace exif {
+
 enum Orientation {
     TOP_LEFT        = 1,
     TOP_RIGHT       = 2,
@@ -80,6 +80,4 @@ public:
 
 };
 
-#endif // INCLUDED_VCL_SOURCE_FILTER_JPEG_EXIF_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1f5e104fc22c88da94420e3a12798779679cf4c8
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Apr 1 13:00:25 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Apr 20 22:39:09 2020 +0200

    Add OutputDevice::drawPrimitive2D to OutputDevice
    
    Change-Id: Ifc22eca62df72bddd247ba097054f34756520614

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index e4430b2415f3..44aa8f821dae 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -49,6 +49,8 @@
 #include <com/sun/star/drawing/LineCap.hpp>
 #include <com/sun/star/uno/Reference.h>
 
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+
 #include <memory>
 #include <vector>
 
@@ -1955,6 +1957,9 @@ public:
     ///@}
 
 
+    bool drawPrimitive2D(drawinglayer::primitive2d::Primitive2DContainer & rPrimitive2D);
+
+
     /** @name Native Widget Rendering functions
 
         These all just call through to the private mpGraphics functions of the same name.
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 64812f920d47..e70f96684c6d 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_Library_use_libraries,vcl,\
     basegfx \
     comphelper \
     cppuhelper \
+    drawinglayercore \
     i18nlangtag \
     i18nutil \
     $(if $(filter OPENCL,$(BUILD_TYPE)),opencl) \
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 0dcdd84a5d0a..52f31234caa3 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -713,4 +713,9 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
     return bDrawn;
 }
 
+bool OutputDevice::drawPrimitive2D(drawinglayer::primitive2d::Primitive2DContainer & rPrimitive2D)
+{
+    return false;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 89fb8603fdbbf97f0220cd8e3c30ee09435060b4
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Mar 7 14:33:43 2020 +0100
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Apr 20 22:39:09 2020 +0200

    Separate core drawinglayer func. into drawinglayercore library
    
    This separates the drawinglayer core functionallity into a
    separate library, to keep a strict separation what is backend
    dependent and what is not. More strict separation can be done
    at a later date.
    
    This will make it possible to push part of drawinglayer
    (part of processor2d) directly into VCL.
    
    Change-Id: Ibc26580067e50bf20d7cdd37fa0e44eb10200878

diff --git a/Repository.mk b/Repository.mk
index 83e8ffa6d885..52b4db88e46e 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -351,6 +351,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	$(call gb_Helper_optional,SCRIPTING,dlgprov) \
 	$(if $(filter WNT,$(OS)),directx9canvas) \
 	$(if $(ENABLE_OPENGL_CANVAS),oglcanvas) \
+	drawinglayercore \
 	drawinglayer \
 	editeng \
 	$(if $(filter WNT,$(OS)),emser) \
diff --git a/drawinglayer/CppunitTest_drawinglayer_border.mk b/drawinglayer/CppunitTest_drawinglayer_border.mk
index fa2f715590cd..e00006c18dba 100644
--- a/drawinglayer/CppunitTest_drawinglayer_border.mk
+++ b/drawinglayer/CppunitTest_drawinglayer_border.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,drawinglayer_border, \
 	sal \
 	salhelper \
 	drawinglayer \
+	drawinglayercore \
 	vcl \
 	test \
 	tl \
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index 2a0f1030a789..46f21f56b6b6 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_Library_use_externals,drawinglayer,\
 ))
 
 $(eval $(call gb_Library_use_libraries,drawinglayer,\
+    drawinglayercore \
     basegfx \
     canvastools \
     comphelper \
@@ -67,11 +68,9 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/attribute/sdrsceneattribute3d \
     drawinglayer/source/attribute/sdrshadowattribute \
     drawinglayer/source/attribute/strokeattribute \
-    drawinglayer/source/geometry/viewinformation2d \
     drawinglayer/source/geometry/viewinformation3d \
     drawinglayer/source/primitive2d/animatedprimitive2d \
     drawinglayer/source/primitive2d/backgroundcolorprimitive2d \
-    drawinglayer/source/primitive2d/baseprimitive2d \
     drawinglayer/source/primitive2d/bitmapprimitive2d \
     drawinglayer/source/primitive2d/borderlineprimitive2d \
     drawinglayer/source/primitive2d/controlprimitive2d \
@@ -111,7 +110,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D \
     drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D \
     drawinglayer/source/primitive2d/primitivetools2d \
-    drawinglayer/source/primitive2d/Primitive2DContainer \
     drawinglayer/source/primitive2d/sceneprimitive2d \
     drawinglayer/source/primitive2d/sdrdecompositiontools2d \
     drawinglayer/source/primitive2d/shadowprimitive2d \
@@ -126,7 +124,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/primitive2d/textlineprimitive2d \
     drawinglayer/source/primitive2d/textprimitive2d \
     drawinglayer/source/primitive2d/textstrikeoutprimitive2d \
-    drawinglayer/source/primitive2d/Tools \
     drawinglayer/source/primitive2d/transformprimitive2d \
     drawinglayer/source/primitive2d/transparenceprimitive2d \
     drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d \
diff --git a/drawinglayer/Library_drawinglayercore.mk b/drawinglayer/Library_drawinglayercore.mk
new file mode 100644
index 000000000000..f1643d27014d
--- /dev/null
+++ b/drawinglayer/Library_drawinglayercore.mk
@@ -0,0 +1,49 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_Library_Library,drawinglayercore))
+
+$(eval $(call gb_Library_set_include,drawinglayercore,\
+    $$(INCLUDE) \
+    -I$(SRCDIR)/drawinglayer/inc \
+))
+
+$(eval $(call gb_Library_add_defs,drawinglayercore,\
+    -DDRAWINGLAYERCORE_DLLIMPLEMENTATION \
+))
+
+$(eval $(call gb_Library_set_precompiled_header,drawinglayercore,drawinglayer/inc/pch/precompiled_drawinglayercore))
+
+$(eval $(call gb_Library_use_sdk_api,drawinglayercore))
+
+$(eval $(call gb_Library_use_externals,drawinglayercore,\
+    boost_headers \
+    libxml2 \
+))
+
+$(eval $(call gb_Library_use_libraries,drawinglayercore,\
+    basegfx \
+    comphelper \
+    cppu \
+    cppuhelper \
+    i18nlangtag \
+    sal \
+    salhelper \
+    svl \
+    tl \
+))
+
+$(eval $(call gb_Library_add_exception_objects,drawinglayercore,\
+    drawinglayer/source/primitive2d/baseprimitive2d \
+    drawinglayer/source/primitive2d/Primitive2DContainer \
+    drawinglayer/source/primitive2d/Tools \
+    drawinglayer/source/geometry/viewinformation2d \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/drawinglayer/Module_drawinglayer.mk b/drawinglayer/Module_drawinglayer.mk
index 6d329e95c60a..687cd9c2671f 100644
--- a/drawinglayer/Module_drawinglayer.mk
+++ b/drawinglayer/Module_drawinglayer.mk
@@ -10,6 +10,7 @@
 $(eval $(call gb_Module_Module,drawinglayer))
 
 $(eval $(call gb_Module_add_targets,drawinglayer,\
+    Library_drawinglayercore \
     Library_drawinglayer \
 ))
 
diff --git a/drawinglayer/inc/pch/precompiled_drawinglayer.hxx b/drawinglayer/inc/pch/precompiled_drawinglayer.hxx
index 25a23a7d3a9e..df6a684135ed 100644
--- a/drawinglayer/inc/pch/precompiled_drawinglayer.hxx
+++ b/drawinglayer/inc/pch/precompiled_drawinglayer.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2020-04-02 22:28:40 using:
+ Generated on 2020-04-03 17:41:44 using:
  ./bin/update_pch drawinglayer drawinglayer --cutoff=4 --exclude:system --exclude:module --exclude:local
 
  If after updating build fails, use the following command to locate conflicting headers:
@@ -92,7 +92,6 @@
 #include <basegfx/range/basicrange.hxx>
 #include <basegfx/tuple/b2dtuple.hxx>
 #include <basegfx/tuple/b3dtuple.hxx>
-#include <basegfx/utils/canvastools.hxx>
 #include <basegfx/vector/b2dvector.hxx>
 #include <basegfx/vector/b2enums.hxx>
 #include <basegfx/vector/b2ivector.hxx>
@@ -104,7 +103,7 @@
 #include <com/sun/star/drawing/TextureMode.hpp>
 #include <com/sun/star/drawing/TextureProjectionMode.hpp>
 #include <com/sun/star/graphic/XPrimitive3D.hpp>
-#include <com/sun/star/util/XAccounting.hpp>
+#include <com/sun/star/uno/Reference.hxx>
 #include <comphelper/comphelperdllapi.h>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequence.hxx>
@@ -137,7 +136,6 @@
 #include <drawinglayer/drawinglayerdllapi.h>
 #include <drawinglayer/geometry/viewinformation2d.hxx>
 #include <drawinglayer/geometry/viewinformation3d.hxx>
-#include <drawinglayer/primitive2d/CommonTypes.hxx>
 #include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx>
 #include <drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx>
 #include <drawinglayer/primitive2d/PolyPolygonGraphicPrimitive2D.hxx>
@@ -145,9 +143,6 @@
 #include <drawinglayer/primitive2d/PolyPolygonHatchPrimitive2D.hxx>
 #include <drawinglayer/primitive2d/PolyPolygonMarkerPrimitive2D.hxx>
 #include <drawinglayer/primitive2d/PolyPolygonStrokePrimitive2D.hxx>
-#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
-#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
-#include <drawinglayer/primitive2d/Tools.hxx>
 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
 #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
 #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
diff --git a/drawinglayer/inc/pch/precompiled_drawinglayercore.cxx b/drawinglayer/inc/pch/precompiled_drawinglayercore.cxx
new file mode 100644
index 000000000000..4a8c23ea8e65
--- /dev/null
+++ b/drawinglayer/inc/pch/precompiled_drawinglayercore.cxx
@@ -0,0 +1,12 @@
+/* -*- 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/.
+ */
+
+#include "precompiled_drawinglayercore.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/inc/pch/precompiled_drawinglayercore.hxx b/drawinglayer/inc/pch/precompiled_drawinglayercore.hxx
new file mode 100644
index 000000000000..4cc5ca4612c9
--- /dev/null
+++ b/drawinglayer/inc/pch/precompiled_drawinglayercore.hxx
@@ -0,0 +1,46 @@
+/* -*- 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 has been autogenerated by update_pch.sh. It is possible to edit it
+ manually (such as when an include file has been moved/renamed/removed). All such
+ manual changes will be rewritten by the next run of update_pch.sh (which presumably
+ also fixes all possible problems, so it's usually better to use it).
+
+ Generated on 2020-03-07 12:37:18 using:
+ ./bin/update_pch drawinglayer drawinglayercore --cutoff=4 --exclude:system --exclude:module --exclude:local
+
+ If after updating build fails, use the following command to locate conflicting headers:
+ ./bin/update_pch_bisect ./drawinglayer/inc/pch/precompiled_drawinglayercore.hxx "make drawinglayer.build" --find-conflicts
+*/
+
+#if PCH_LEVEL >= 1
+#include <ostream>
+#include <vector>
+#endif // PCH_LEVEL >= 1
+#if PCH_LEVEL >= 2
+#include <osl/diagnose.h>
+#include <osl/interlck.h>
+#include <sal/config.h>
+#include <sal/types.h>
+#endif // PCH_LEVEL >= 2
+#if PCH_LEVEL >= 3
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/utils/canvastools.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#endif // PCH_LEVEL >= 3
+#if PCH_LEVEL >= 4
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#endif // PCH_LEVEL >= 4
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/emfio/CppunitTest_emfio_emf_test.mk b/emfio/CppunitTest_emfio_emf_test.mk
index 123e4b3549bd..2679c0a604d9 100644
--- a/emfio/CppunitTest_emfio_emf_test.mk
+++ b/emfio/CppunitTest_emfio_emf_test.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_sdk_api,emfio_emf))
 $(eval $(call gb_CppunitTest_use_libraries,emfio_emf,\
     basegfx \
     drawinglayer \
+    drawinglayercore \
     cppu \
     cppuhelper \
     comphelper \
diff --git a/emfio/Library_emfio.mk b/emfio/Library_emfio.mk
index 52fde14885b3..89add50b781a 100644
--- a/emfio/Library_emfio.mk
+++ b/emfio/Library_emfio.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_use_sdk_api,emfio))
 
 $(eval $(call gb_Library_use_libraries,emfio,\
     basegfx \
+    drawinglayercore \
     drawinglayer \
     cppu \
     cppuhelper \
diff --git a/filter/Library_svgfilter.mk b/filter/Library_svgfilter.mk
index 21318aa1fd03..1f0caf11758c 100644
--- a/filter/Library_svgfilter.mk
+++ b/filter/Library_svgfilter.mk
@@ -56,6 +56,7 @@ $(eval $(call gb_Library_use_libraries,svgfilter,\
 	sax \
 	salhelper \
 	comphelper \
+	drawinglayercore \
 	drawinglayer \
 	basegfx \
 	cppuhelper \
diff --git a/include/drawinglayer/drawinglayerdllapi.h b/include/drawinglayer/drawinglayerdllapi.h
index 0b3983504919..36a0d8abfea2 100644
--- a/include/drawinglayer/drawinglayerdllapi.h
+++ b/include/drawinglayer/drawinglayerdllapi.h
@@ -19,6 +19,12 @@
 #endif
 #define DRAWINGLAYER_DLLPRIVATE SAL_DLLPRIVATE
 
+#if defined(DRAWINGLAYERCORE_DLLIMPLEMENTATION)
+#define DRAWINGLAYERCORE_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define DRAWINGLAYERCORE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx
index 95be29a72bda..06b17248d213 100644
--- a/include/drawinglayer/geometry/viewinformation2d.hxx
+++ b/include/drawinglayer/geometry/viewinformation2d.hxx
@@ -63,7 +63,7 @@ namespace drawinglayer::geometry
     It is an implementation to support the sequence of PropertyValues used in a
     css::graphic::XPrimitive2D for C++ implementations working with those
 */
-class DRAWINGLAYER_DLLPUBLIC ViewInformation2D
+class DRAWINGLAYERCORE_DLLPUBLIC ViewInformation2D
 {
 public:
     typedef o3tl::cow_wrapper<ImpViewInformation2D, o3tl::ThreadSafeRefCountingPolicy> ImplType;
diff --git a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
index cca3a0a91485..c096e9a8cc2f 100644
--- a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
+++ b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
@@ -34,7 +34,7 @@ class ViewInformation2D;
 
 namespace drawinglayer::primitive2d
 {
-class SAL_WARN_UNUSED DRAWINGLAYER_DLLPUBLIC Primitive2DContainer
+class SAL_WARN_UNUSED DRAWINGLAYERCORE_DLLPUBLIC Primitive2DContainer
     : public std::deque<Primitive2DReference>,
       public Primitive2DDecompositionVisitor
 {
diff --git a/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx b/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
index dfe04b32a320..e174d1e0878d 100644
--- a/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
+++ b/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
@@ -27,7 +27,7 @@ namespace drawinglayer::primitive2d
 class Primitive2DContainer;
 
 // Visitor class for walking a tree of Primitive2DReference
-class DRAWINGLAYER_DLLPUBLIC Primitive2DDecompositionVisitor
+class DRAWINGLAYERCORE_DLLPUBLIC Primitive2DDecompositionVisitor
 {
 public:
     virtual void append(const Primitive2DReference&) = 0;
diff --git a/include/drawinglayer/primitive2d/Tools.hxx b/include/drawinglayer/primitive2d/Tools.hxx
index fbb6f5717c01..1c30565c8c1b 100644
--- a/include/drawinglayer/primitive2d/Tools.hxx
+++ b/include/drawinglayer/primitive2d/Tools.hxx
@@ -31,16 +31,16 @@ class ViewInformation2D;
 namespace drawinglayer::primitive2d
 {
 /// get B2DRange from a given Primitive2DReference
-basegfx::B2DRange DRAWINGLAYER_DLLPUBLIC getB2DRangeFromPrimitive2DReference(
+basegfx::B2DRange DRAWINGLAYERCORE_DLLPUBLIC getB2DRangeFromPrimitive2DReference(
     const Primitive2DReference& rCandidate, const geometry::ViewInformation2D& aViewInformation);
 
 /** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
     and using compare operator
  */
-bool DRAWINGLAYER_DLLPUBLIC arePrimitive2DReferencesEqual(const Primitive2DReference& rA,
-                                                          const Primitive2DReference& rB);
+bool DRAWINGLAYERCORE_DLLPUBLIC arePrimitive2DReferencesEqual(const Primitive2DReference& rA,
+                                                              const Primitive2DReference& rB);
 
-OUString DRAWINGLAYER_DLLPUBLIC idToString(sal_uInt32 nId);
+OUString DRAWINGLAYERCORE_DLLPUBLIC idToString(sal_uInt32 nId);
 
 } // end of namespace drawinglayer::primitive2d
 
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
index 5e1a96429ff3..8818cdd0bcde 100644
--- a/include/drawinglayer/primitive2d/baseprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
@@ -121,8 +121,8 @@ typedef cppu::WeakComponentImplHelper<css::graphic::XPrimitive2D, css::util::XAc
     for view-independent primitives which are defined by not using ViewInformation2D
     in their get2DDecomposition/getB2DRange implementations.
 */
-class DRAWINGLAYER_DLLPUBLIC BasePrimitive2D : protected cppu::BaseMutex,
-                                               public BasePrimitive2DImplBase
+class DRAWINGLAYERCORE_DLLPUBLIC BasePrimitive2D : protected cppu::BaseMutex,
+                                                   public BasePrimitive2DImplBase
 {
     BasePrimitive2D(const BasePrimitive2D&) = delete;
     BasePrimitive2D& operator=(const BasePrimitive2D&) = delete;
@@ -200,7 +200,7 @@ public:
         to identify if a new decomposition is needed at the next call
     (f) return maBuffered2DDecomposition
  */
-class DRAWINGLAYER_DLLPUBLIC BufferedDecompositionPrimitive2D : public BasePrimitive2D
+class DRAWINGLAYERCORE_DLLPUBLIC BufferedDecompositionPrimitive2D : public BasePrimitive2D
 {
 private:
     /// a sequence used for buffering the last create2DDecomposition() result
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index 8943de7ab4c3..60fb6676dab9 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_ucalc, \
     cppuhelper \
     dbtools \
     drawinglayer \
+    drawinglayercore \
     editeng \
     for \
     forui \
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 997b14c0add9..b540b27c9834 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -70,6 +70,7 @@ $(eval $(call gb_Library_use_libraries,sc,\
     cppu \
     cppuhelper \
     dbtools \
+    drawinglayercore \
     drawinglayer \
     editeng \
     for \
diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk
index 93426dfc3a55..63f143978231 100644
--- a/sd/CppunitTest_sd_uimpress.mk
+++ b/sd/CppunitTest_sd_uimpress.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_uimpress,\
     cppu \
     cppuhelper \
     drawinglayer \
+    drawinglayercore \
     editeng \
     i18nlangtag \
     i18nutil \
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index 43b168be8d8c..24520633e77f 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -74,6 +74,7 @@ $(eval $(call gb_Library_use_libraries,sd,\
 	cppcanvas \
 	cppu \
 	cppuhelper \
+	drawinglayercore \
 	drawinglayer \
 	editeng \
 	i18nlangtag \
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index e04cad7e6667..d6e445744152 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_Library_use_libraries,sfx,\
     comphelper \
     cppu \
     cppuhelper \
+    drawinglayercore \
     drawinglayer \
     fwe \
     i18nlangtag \
diff --git a/svgio/CppunitTest_svgio.mk b/svgio/CppunitTest_svgio.mk
index c6f4db91fc60..24fb7a39af32 100644
--- a/svgio/CppunitTest_svgio.mk
+++ b/svgio/CppunitTest_svgio.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_library_objects,svgio,\
 $(eval $(call gb_CppunitTest_use_libraries,svgio,\
     basegfx \
     drawinglayer \
+    drawinglayercore \
     cppu \
     cppuhelper \
     comphelper \
diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index 449c17f61196..7ef1aeb19513 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_Library_use_sdk_api,svgio))
 
 $(eval $(call gb_Library_use_libraries,svgio,\
     basegfx \
+    drawinglayercore \
     drawinglayer \
     comphelper \
     cppu \
diff --git a/svx/CppunitTest_svx_unit.mk b/svx/CppunitTest_svx_unit.mk
index 92feb45d6578..c78b8d7769eb 100644
--- a/svx/CppunitTest_svx_unit.mk
+++ b/svx/CppunitTest_svx_unit.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,svx_unit, \
 $(eval $(call gb_CppunitTest_use_libraries,svx_unit, \
 	basegfx \
 	drawinglayer \
+	drawinglayercore \
 	sal \
 	sfx \
 	svxcore \
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index d3eff20b6769..9ccba33a748c 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -50,6 +50,7 @@ $(eval $(call gb_Library_use_libraries,svx,\
 		crashreport) \
     $(call gb_Helper_optional,DBCONNECTIVITY, \
         dbtools) \
+    drawinglayercore \
     drawinglayer \
     editeng \
     fwe \
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 80fcdae920f3..fdf5f0165249 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -57,6 +57,7 @@ $(eval $(call gb_Library_use_libraries,svxcore,\
     cppu \
     $(call gb_Helper_optional,DBCONNECTIVITY, \
         dbtools) \
+    drawinglayercore \
     drawinglayer \
     editeng \
     fwe \
diff --git a/sw/CppunitTest_sw_uwriter.mk b/sw/CppunitTest_sw_uwriter.mk
index 6b9ffa4ba683..a881587735e4 100644
--- a/sw/CppunitTest_sw_uwriter.mk
+++ b/sw/CppunitTest_sw_uwriter.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uwriter, \
     $(call gb_Helper_optional,DBCONNECTIVITY, \
         dbtools) \
     drawinglayer \
+    drawinglayercore \
     editeng \
     i18nlangtag \
     i18nutil \
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index b6d75fd890bf..d99c59a58a4b 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -58,6 +58,7 @@ $(eval $(call gb_Library_use_libraries,sw,\
     cppuhelper \
     $(call gb_Helper_optional,DBCONNECTIVITY, \
         dbtools) \
+    drawinglayercore \
     drawinglayer \
     editeng \
     i18nlangtag \
diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk
index 99f1dd20ae3d..4c09d1cc4bda 100644
--- a/sw/Library_swui.mk
+++ b/sw/Library_swui.mk
@@ -75,6 +75,7 @@ $(eval $(call gb_Library_use_libraries,swui,\
     ucbhelper \
     utl \
     vcl \
+    drawinglayercore \
     drawinglayer \
 ))
 
commit 912217285b3058efa54c2336f91fda4efdad6ff0
Author:     Serge Krot <Serge.Krot at cib.de>
AuthorDate: Fri Apr 10 20:08:37 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Mon Apr 20 22:17:42 2020 +0200

    tdf#119187 fix: Top-aligned text in PPTX becomes bottom-aligned
    
    Change-Id: Ic6c03e512ce3f6e240d86186fb16e24c86942343
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92051
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 335e37335879..a781aa5e4a6e 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -425,65 +425,102 @@ namespace
 oox::drawingml::ShapePtr PPTShape::findPlaceholder( sal_Int32 nFirstSubType, sal_Int32 nSecondSubType,
     const OptValue< sal_Int32 >& oSubTypeIndex, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
 {
-    oox::drawingml::ShapePtr aShapePtr;
-    oox::drawingml::ShapePtr aChoiceShapePtr1;
-    oox::drawingml::ShapePtr aChoiceShapePtr2;
-    oox::drawingml::ShapePtr aChoiceShapePtr3;
-    oox::drawingml::ShapePtr aChoiceShapePtr4;
-    std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() );
-    while (aRevIter != rShapes.rend())
+    class Placeholders
     {
-        if (!bMasterOnly || ShapeLocationIsMaster((*aRevIter).get()))
+    public:
+        Placeholders()
+            : aChoice(5) // resize to 5
         {
-            if ((*aRevIter)->getSubTypeIndex() == oSubTypeIndex)
+        }
+
+        void add(const oox::drawingml::ShapePtr& aShape, sal_Int32 nFirstSubType, sal_Int32 nSecondSubType, const OptValue< sal_Int32 >& oSubTypeIndex)
+        {
+            if (!aShape.get())
+                return;
+
+            // get flags
+            const bool bSameFirstSubType = aShape->getSubType() == nFirstSubType;
+            const bool bSameSecondSubType = aShape->getSubType() == nSecondSubType;
+            const bool bSameIndex = aShape->getSubTypeIndex() == oSubTypeIndex;
+
+            // get prio
+            int aPrioIndex = -1;
+            if (bSameIndex && bSameFirstSubType)
+                aPrioIndex = 0;
+            else if (!bSameIndex && bSameFirstSubType)
+                aPrioIndex = 1;
+            else if (bSameIndex && bSameSecondSubType)
+                aPrioIndex = 2;
+            else if (!bSameIndex && bSameSecondSubType)
+                aPrioIndex = 3;
+            else if (bSameIndex)
+                aPrioIndex = 4;
+
+            // add
+            if (aPrioIndex != -1)
             {
-                if ((*aRevIter)->getSubType() == nFirstSubType)
+                if (!aChoice.at(aPrioIndex).get())
                 {
-                    aShapePtr = *aRevIter;
-                    break;
+                    aChoice.at(aPrioIndex) = aShape;
                 }
-                else if ((*aRevIter)->getSubType() == nSecondSubType && !aChoiceShapePtr2.get())
-                    aChoiceShapePtr2 = *aRevIter;
-                else if (!aChoiceShapePtr4.get())
-                    aChoiceShapePtr4 = *aRevIter;
             }
-            else if ((*aRevIter)->getSubType() == nFirstSubType && !aChoiceShapePtr1.get())
-                aChoiceShapePtr1 = *aRevIter;
-            else if ((*aRevIter)->getSubType() == nSecondSubType && !aChoiceShapePtr3.get())
-                aChoiceShapePtr3 = *aRevIter;
         }
-        std::vector< oox::drawingml::ShapePtr >& rChildren = (*aRevIter)->getChildren();
-        aChoiceShapePtr4 = findPlaceholder( nFirstSubType, nSecondSubType, oSubTypeIndex, rChildren, bMasterOnly );
-        if (aChoiceShapePtr4.get())
+
+        // return according to prio
+        oox::drawingml::ShapePtr getByPrio() const
         {
-            if (aChoiceShapePtr4->getSubType() == nFirstSubType)
+            for (const oox::drawingml::ShapePtr& aShape : aChoice)
             {
-                if (aChoiceShapePtr4->getSubTypeIndex() == oSubTypeIndex)
-                    aShapePtr = aChoiceShapePtr4;
-                else
-                    aChoiceShapePtr1 = aChoiceShapePtr4;
+                if (aShape.get())
+                {
+                    return aShape;
+                }
             }
-            else if (aChoiceShapePtr4->getSubType() == nSecondSubType)
+
+            return oox::drawingml::ShapePtr();
+        }
+
+        bool hasByPrio(size_t aIndex) const
+        {
+            return aChoice.at(aIndex).get();
+        }
+
+    private:
+        std::vector< oox::drawingml::ShapePtr > aChoice;
+
+    } aPlaceholders;
+
+    // check all shapes
+    std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() );
+    for (; aRevIter != rShapes.rend(); ++aRevIter)
+    {
+        // check shape
+        if (!bMasterOnly || ShapeLocationIsMaster((*aRevIter).get()))
+        {
+            const oox::drawingml::ShapePtr& aShape = *aRevIter;
+            aPlaceholders.add(aShape, nFirstSubType, nSecondSubType, oSubTypeIndex);
+        }
+
+        // check children
+        std::vector< oox::drawingml::ShapePtr >& rChildren = (*aRevIter)->getChildren();
+        if (!rChildren.empty())
+        {
+            const oox::drawingml::ShapePtr aShape = findPlaceholder( nFirstSubType, nSecondSubType, oSubTypeIndex, rChildren, bMasterOnly );
+            if (aShape.get())
             {
-                if (aChoiceShapePtr4->getSubTypeIndex() == oSubTypeIndex)
-                    aChoiceShapePtr2 = aChoiceShapePtr4;
-                else
-                    aChoiceShapePtr3 = aChoiceShapePtr4;
+                aPlaceholders.add(aShape, nFirstSubType, nSecondSubType, oSubTypeIndex);
             }
         }
-        if (aShapePtr.get() || aChoiceShapePtr2.get())
+
+        if (aPlaceholders.hasByPrio(0) ||
+            aPlaceholders.hasByPrio(2))
+        {
             break;
-        ++aRevIter;
+        }
     }
-    if (aShapePtr.get())
-        return aShapePtr;
-    if (aChoiceShapePtr1.get())
-        return aChoiceShapePtr1;
-    if (aChoiceShapePtr2.get())
-        return aChoiceShapePtr2;
-    if (aChoiceShapePtr3.get())
-        return aChoiceShapePtr3;
-    return aChoiceShapePtr4;
+
+    // return something according to prio
+    return aPlaceholders.getByPrio();
 }
 
 oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
diff --git a/sd/qa/unit/data/pptx/tdf119187.pptx b/sd/qa/unit/data/pptx/tdf119187.pptx
new file mode 100644
index 000000000000..0c4501abbc30
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf119187.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index bccfc56dc392..ef032087e4ac 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -208,6 +208,7 @@ public:
     void testTdf77747();
     void testTdf116266();
     void testTdf128684();
+    void testTdf119187();
     void testShapeGlowEffectPPTXImpoer();
 
     bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
@@ -327,6 +328,7 @@ public:
     CPPUNIT_TEST(testTdf106638);
     CPPUNIT_TEST(testTdf128684);
     CPPUNIT_TEST(testTdf113198);
+    CPPUNIT_TEST(testTdf119187);
     CPPUNIT_TEST(testShapeGlowEffectPPTXImpoer);
 
     CPPUNIT_TEST_SUITE_END();
@@ -3080,6 +3082,31 @@ void SdImportTest::testTdf113198()
     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(nParaAdjust));
 }
 
+void SdImportTest::testTdf119187()
+{
+    std::vector< sd::DrawDocShellRef > xDocShRef;
+    // load document
+    xDocShRef.push_back(loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf119187.pptx"), PPTX));
+    // load resaved document
+    xDocShRef.push_back(saveAndReload( xDocShRef.at(0).get(), PPTX ));
+
+    // check documents
+    for (const sd::DrawDocShellRef& xDoc : xDocShRef)
+    {
+        // get shape properties
+        const SdrPage* pPage = GetPage(1, xDoc);
+        CPPUNIT_ASSERT(pPage);
+        SdrObject* pObj = pPage->GetObj(0);
+        CPPUNIT_ASSERT(pObj);
+        const sdr::properties::BaseProperties & rProperties = pObj->GetProperties();
+
+        // chcek text vertical alignment
+        const SdrTextVertAdjustItem& rSdrTextVertAdjustItem = rProperties.GetItem(SDRATTR_TEXT_VERTADJUST);
+        const SdrTextVertAdjust eTVA = rSdrTextVertAdjustItem.GetValue();
+        CPPUNIT_ASSERT_EQUAL(SDRTEXTVERTADJUST_TOP, eTVA);
+    }
+}
+
 void SdImportTest::testShapeGlowEffectPPTXImpoer()
 {
     sd::DrawDocShellRef xDocShRef
commit 43f0452e174d21c5d71dbb26e1243326eb9ed22e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Apr 20 10:57:01 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Apr 20 21:59:25 2020 +0200

    flatten some code in ImpGraph
    
    Change-Id: Iee30822dd977ff380e01c7564a2d211d9a3542cc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92566
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 573e4292ab0c..9deb69a836e4 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -929,32 +929,32 @@ void ImpGraphic::ImplSetPrefMapMode( const MapMode& rPrefMapMode )
 
 sal_uLong ImpGraphic::ImplGetSizeBytes() const
 {
-    if( 0 == mnSizeBytes )
-    {
-        if (mbPrepared)
-            ensureAvailable();
+    if( mnSizeBytes )
+        return mnSizeBytes;
 
-        if( meType == GraphicType::Bitmap )
+    if (mbPrepared)
+        ensureAvailable();
+
+    if( meType == GraphicType::Bitmap )
+    {
+        if(maVectorGraphicData.get())
         {
-            if(maVectorGraphicData.get())
-            {
-                std::pair<VectorGraphicData::State, size_t> tmp(maVectorGraphicData->getSizeBytes());
-                if (VectorGraphicData::State::UNPARSED == tmp.first)
-                {
-                    return tmp.second; // don't cache it until Vector Graphic Data is parsed
-                }
-                mnSizeBytes = tmp.second;
-            }
-            else
+            std::pair<VectorGraphicData::State, size_t> tmp(maVectorGraphicData->getSizeBytes());
+            if (VectorGraphicData::State::UNPARSED == tmp.first)
             {
-                mnSizeBytes = mpAnimation ? mpAnimation->GetSizeBytes() : maEx.GetSizeBytes();
+                return tmp.second; // don't cache it until Vector Graphic Data is parsed
             }
+            mnSizeBytes = tmp.second;
         }
-        else if( meType == GraphicType::GdiMetafile )
+        else
         {
-            mnSizeBytes = maMetaFile.GetSizeBytes();
+            mnSizeBytes = mpAnimation ? mpAnimation->GetSizeBytes() : maEx.GetSizeBytes();
         }
     }
+    else if( meType == GraphicType::GdiMetafile )
+    {
+        mnSizeBytes = maMetaFile.GetSizeBytes();
+    }
 
     return mnSizeBytes;
 }
@@ -962,36 +962,36 @@ sal_uLong ImpGraphic::ImplGetSizeBytes() const
 void ImpGraphic::ImplDraw( OutputDevice* pOutDev, const Point& rDestPt ) const
 {
     ensureAvailable();
-    if( ImplIsSupportedGraphic() && !ImplIsSwapOut() )
+    if( !ImplIsSupportedGraphic() || ImplIsSwapOut() )
+        return;
+
+    switch( meType )
     {
-        switch( meType )
-        {
-            case GraphicType::Default:
-            break;
+        case GraphicType::Default:
+        break;
 
-            case GraphicType::Bitmap:
+        case GraphicType::Bitmap:
+        {
+            if(maVectorGraphicData.get() && !maEx)
             {
-                if(maVectorGraphicData.get() && !maEx)
-                {
-                    // use maEx as local buffer for rendered svg
-                    const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
-                }
-
-                if ( mpAnimation )
-                {
-                    mpAnimation->Draw( pOutDev, rDestPt );
-                }
-                else
-                {
-                    maEx.Draw( pOutDev, rDestPt );
-                }
+                // use maEx as local buffer for rendered svg
+                const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
             }
-            break;
 
-            default:
-                ImplDraw( pOutDev, rDestPt, maMetaFile.GetPrefSize() );
-            break;
+            if ( mpAnimation )
+            {
+                mpAnimation->Draw( pOutDev, rDestPt );
+            }
+            else
+            {
+                maEx.Draw( pOutDev, rDestPt );
+            }
         }
+        break;
+
+        default:
+            ImplDraw( pOutDev, rDestPt, maMetaFile.GetPrefSize() );
+        break;
     }
 }
 
@@ -999,40 +999,40 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
                            const Point& rDestPt, const Size& rDestSize ) const
 {
     ensureAvailable();
-    if( ImplIsSupportedGraphic() && !ImplIsSwapOut() )
+    if( !ImplIsSupportedGraphic() || ImplIsSwapOut() )
+        return;
+
+    switch( meType )
     {
-        switch( meType )
-        {
-            case GraphicType::Default:
-            break;
+        case GraphicType::Default:
+        break;
 
-            case GraphicType::Bitmap:
+        case GraphicType::Bitmap:
+        {
+            if(maVectorGraphicData.get() && maEx.IsEmpty())
             {
-                if(maVectorGraphicData.get() && maEx.IsEmpty())
-                {
-                    // use maEx as local buffer for rendered svg
-                    const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
-                }
-
-                if( mpAnimation )
-                {
-                    mpAnimation->Draw( pOutDev, rDestPt, rDestSize );
-                }
-                else
-                {
-                    maEx.Draw( pOutDev, rDestPt, rDestSize );
-                }
+                // use maEx as local buffer for rendered svg
+                const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
             }
-            break;
 
-            default:
+            if( mpAnimation )
             {
-                const_cast<ImpGraphic*>(this)->maMetaFile.WindStart();
-                const_cast<ImpGraphic*>(this)->maMetaFile.Play( pOutDev, rDestPt, rDestSize );
-                const_cast<ImpGraphic*>(this)->maMetaFile.WindStart();
+                mpAnimation->Draw( pOutDev, rDestPt, rDestSize );
+            }
+            else
+            {
+                maEx.Draw( pOutDev, rDestPt, rDestSize );
             }
-            break;
         }
+        break;
+
+        default:
+        {
+            const_cast<ImpGraphic*>(this)->maMetaFile.WindStart();
+            const_cast<ImpGraphic*>(this)->maMetaFile.Play( pOutDev, rDestPt, rDestSize );
+            const_cast<ImpGraphic*>(this)->maMetaFile.WindStart();
+        }
+        break;
     }
 }
 
@@ -1224,120 +1224,118 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
 
 bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
 {
-    bool bRet = false;
-
     ensureAvailable();
 
-    if( ( meType != GraphicType::NONE ) && ( meType != GraphicType::Default ) && !ImplIsSwapOut() )
+    if( ( meType == GraphicType::NONE ) || ( meType == GraphicType::Default ) || ImplIsSwapOut() )
+        return false;
+
+    const MapMode   aMapMode( ImplGetPrefMapMode() );
+    const Size      aSize( ImplGetPrefSize() );
+    const SvStreamEndian nOldFormat = rOStm.GetEndian();
+    sal_uLong           nDataFieldPos;
+
+    rOStm.SetEndian( SvStreamEndian::LITTLE );
+
+    // write correct version ( old style/new style header )
+    if( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_50 )
     {
-        const MapMode   aMapMode( ImplGetPrefMapMode() );
-        const Size      aSize( ImplGetPrefSize() );
-        const SvStreamEndian nOldFormat = rOStm.GetEndian();
-        sal_uLong           nDataFieldPos;
+        // write ID for new format (5.0)
+        rOStm.WriteUInt32( GRAPHIC_FORMAT_50 );
 
-        rOStm.SetEndian( SvStreamEndian::LITTLE );
+        // write new style header
+        VersionCompat aCompat( rOStm, StreamMode::WRITE, 1 );
 
-        // write correct version ( old style/new style header )
-        if( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_50 )
-        {
-            // write ID for new format (5.0)
-            rOStm.WriteUInt32( GRAPHIC_FORMAT_50 );
+        rOStm.WriteInt32( static_cast<sal_Int32>(meType) );
 
-            // write new style header
-            VersionCompat aCompat( rOStm, StreamMode::WRITE, 1 );
+        // data size is updated later
+        nDataFieldPos = rOStm.Tell();
+        rOStm.WriteInt32( 0 );
 
-            rOStm.WriteInt32( static_cast<sal_Int32>(meType) );
+        TypeSerializer aSerializer(rOStm);
+        aSerializer.writeSize(aSize);
 
-            // data size is updated later
-            nDataFieldPos = rOStm.Tell();
-            rOStm.WriteInt32( 0 );
+        WriteMapMode( rOStm, aMapMode );
+    }
+    else
+    {
+        // write old style (<=4.0) header
+        rOStm.WriteInt32( static_cast<sal_Int32>(meType) );
+
+        // data size is updated later
+        nDataFieldPos = rOStm.Tell();
+        rOStm.WriteInt32( 0 );
+        rOStm.WriteInt32( aSize.Width() );
+        rOStm.WriteInt32( aSize.Height() );
+        rOStm.WriteInt32( static_cast<sal_uInt16>(aMapMode.GetMapUnit()) );
+        rOStm.WriteInt32( aMapMode.GetScaleX().GetNumerator() );
+        rOStm.WriteInt32( aMapMode.GetScaleX().GetDenominator() );
+        rOStm.WriteInt32( aMapMode.GetScaleY().GetNumerator() );
+        rOStm.WriteInt32( aMapMode.GetScaleY().GetDenominator() );
+        rOStm.WriteInt32( aMapMode.GetOrigin().X() );
+        rOStm.WriteInt32( aMapMode.GetOrigin().Y() );
+    }
 
-            TypeSerializer aSerializer(rOStm);
-            aSerializer.writeSize(aSize);
+    bool bRet = false;
+    // write data block
+    if( !rOStm.GetError() )
+    {
+        const sal_uLong nDataStart = rOStm.Tell();
 
-            WriteMapMode( rOStm, aMapMode );
-        }
-        else
-        {
-            // write old style (<=4.0) header
-            rOStm.WriteInt32( static_cast<sal_Int32>(meType) );
-
-            // data size is updated later
-            nDataFieldPos = rOStm.Tell();
-            rOStm.WriteInt32( 0 );
-            rOStm.WriteInt32( aSize.Width() );
-            rOStm.WriteInt32( aSize.Height() );
-            rOStm.WriteInt32( static_cast<sal_uInt16>(aMapMode.GetMapUnit()) );
-            rOStm.WriteInt32( aMapMode.GetScaleX().GetNumerator() );
-            rOStm.WriteInt32( aMapMode.GetScaleX().GetDenominator() );
-            rOStm.WriteInt32( aMapMode.GetScaleY().GetNumerator() );
-            rOStm.WriteInt32( aMapMode.GetScaleY().GetDenominator() );
-            rOStm.WriteInt32( aMapMode.GetOrigin().X() );
-            rOStm.WriteInt32( aMapMode.GetOrigin().Y() );
-        }
+        if( ImplIsSupportedGraphic() )
+            WriteImpGraphic( rOStm, *this );
 
-        // write data block
         if( !rOStm.GetError() )
         {
-            const sal_uLong nDataStart = rOStm.Tell();
-
-            if( ImplIsSupportedGraphic() )
-                WriteImpGraphic( rOStm, *this );
-
-            if( !rOStm.GetError() )
-            {
-                const sal_uLong nStmPos2 = rOStm.Tell();
-                rOStm.Seek( nDataFieldPos );
-                rOStm.WriteInt32( nStmPos2 - nDataStart );
-                rOStm.Seek( nStmPos2 );
-                bRet = true;
-            }
+            const sal_uLong nStmPos2 = rOStm.Tell();
+            rOStm.Seek( nDataFieldPos );
+            rOStm.WriteInt32( nStmPos2 - nDataStart );
+            rOStm.Seek( nStmPos2 );
+            bRet = true;
         }
-
-        rOStm.SetEndian( nOldFormat );
     }
 
+    rOStm.SetEndian( nOldFormat );
+
     return bRet;
 }
 
 bool ImpGraphic::ImplSwapOut()
 {
-    bool bRet = false;
 
-    if( !ImplIsSwapOut() )
+    if( ImplIsSwapOut() )
+        return false;
+
+    ::utl::TempFile     aTempFile;
+    const INetURLObject aTmpURL( aTempFile.GetURL() );
+
+    if( aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ).isEmpty() )
+        return false;
+
+    std::unique_ptr<SvStream> xOStm;
+    try
+    {
+        xOStm = ::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE );
+    }
+    catch( const css::uno::Exception& )
     {
-        ::utl::TempFile     aTempFile;
-        const INetURLObject aTmpURL( aTempFile.GetURL() );
+    }
+    if( !xOStm )
+        return false;
 
-        if( !aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ).isEmpty() )
-        {
-            std::unique_ptr<SvStream> xOStm;
-            try
-            {
-                xOStm = ::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE );
-            }
-            catch( const css::uno::Exception& )
-            {
-            }
-            if( xOStm )
-            {
-                xOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
-                xOStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
+    xOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
+    xOStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
 
-                bRet = ImplSwapOut( xOStm.get() );
-                if( bRet )
-                {
-                    mpSwapFile = std::make_shared<ImpSwapFile>();
-                    mpSwapFile->aSwapURL = aTmpURL;
-                    mpSwapFile->maOriginURL = getOriginURL();
-                }
-                else
-                {
-                    xOStm.reset();
-                    utl::UCBContentHelper::Kill(aTmpURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
-                }
-            }
-        }
+    bool bRet = ImplSwapOut( xOStm.get() );
+    if( bRet )
+    {
+        mpSwapFile = std::make_shared<ImpSwapFile>();
+        mpSwapFile->aSwapURL = aTmpURL;
+        mpSwapFile->maOriginURL = getOriginURL();
+    }
+    else
+    {
+        xOStm.reset();
+        utl::UCBContentHelper::Kill(aTmpURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
     }
 
     if (bRet)
@@ -1347,28 +1345,27 @@ bool ImpGraphic::ImplSwapOut()
 
 bool ImpGraphic::ImplSwapOut( SvStream* xOStm )
 {
+    if( !xOStm )
+    {
+        SAL_WARN("vcl.gdi", "Graphic SwapOut: No stream for swap out!");
+        return false;
+    }
+
+    xOStm->SetBufferSize( GRAPHIC_STREAMBUFSIZE );
+
     bool bRet = false;
 
-    if( xOStm )
+    if( !xOStm->GetError() && ImplWriteEmbedded( *xOStm ) )
     {
-        xOStm->SetBufferSize( GRAPHIC_STREAMBUFSIZE );
+        xOStm->Flush();
 
-        if( !xOStm->GetError() && ImplWriteEmbedded( *xOStm ) )
+        if( !xOStm->GetError() )
         {
-            xOStm->Flush();
-
-            if( !xOStm->GetError() )
-            {
-                ImplCreateSwapInfo();
-                ImplClearGraphics();
-                bRet = mbSwapOut = true;
-            }
+            ImplCreateSwapInfo();
+            ImplClearGraphics();
+            bRet = mbSwapOut = true;
         }
     }
-    else
-    {
-        SAL_WARN("vcl.gdi", "Graphic SwapOut: No stream for swap out!");
-    }
 
     return bRet;
 }
@@ -1387,25 +1384,24 @@ bool ImpGraphic::ensureAvailable() const
 bool ImpGraphic::loadPrepared()
 {
     Graphic aGraphic;
-    if (mpGfxLink->LoadNative(aGraphic))
-    {
-        GraphicExternalLink aLink = maGraphicExternalLink;
+    if (!mpGfxLink->LoadNative(aGraphic))
+        return false;
 
-        Size aPrefSize = maSwapInfo.maPrefSize;
-        MapMode aPrefMapMode = maSwapInfo.maPrefMapMode;
-        *this = *aGraphic.ImplGetImpGraphic();
-        if (aPrefSize.getWidth() && aPrefSize.getHeight() && aPrefMapMode == ImplGetPrefMapMode())
-        {
-            // Use custom preferred size if it was set when the graphic was still unloaded.
-            // Only set the size in case the unloaded and loaded unit matches.
-            ImplSetPrefSize(aPrefSize);
-        }
+    GraphicExternalLink aLink = maGraphicExternalLink;
 
-        maGraphicExternalLink = aLink;
-
-        return true;
+    Size aPrefSize = maSwapInfo.maPrefSize;
+    MapMode aPrefMapMode = maSwapInfo.maPrefMapMode;
+    *this = *aGraphic.ImplGetImpGraphic();
+    if (aPrefSize.getWidth() && aPrefSize.getHeight() && aPrefMapMode == ImplGetPrefMapMode())
+    {
+        // Use custom preferred size if it was set when the graphic was still unloaded.
+        // Only set the size in case the unloaded and loaded unit matches.
+        ImplSetPrefSize(aPrefSize);
     }
-    return false;
+
+    maGraphicExternalLink = aLink;
+
+    return true;
 }
 
 bool ImpGraphic::ImplSwapIn()
@@ -1461,40 +1457,40 @@ bool ImpGraphic::ImplSwapIn( SvStream* xIStm )
 {
     bool bRet = false;
 
-    if( xIStm )
-    {
-        xIStm->SetBufferSize( GRAPHIC_STREAMBUFSIZE );
+    if( !xIStm )
+        return false;
 
-        if( !xIStm->GetError() )
-        {
-            //keep the swap file alive, because its quite possibly the backing storage
-            //for xIStm
-            std::shared_ptr<ImpSwapFile> xSwapFile(std::move(mpSwapFile));
-            assert(!mpSwapFile);
+    xIStm->SetBufferSize( GRAPHIC_STREAMBUFSIZE );
 
-            std::shared_ptr<GraphicReader> xContext(std::move(mpContext));
-            assert(!mpContext);
+    if( xIStm->GetError() )
+        return false;
 
-            bool bDummyContext = mbDummyContext;
-            mbDummyContext = false;
+    //keep the swap file alive, because its quite possibly the backing storage
+    //for xIStm
+    std::shared_ptr<ImpSwapFile> xSwapFile(std::move(mpSwapFile));
+    assert(!mpSwapFile);
 
-            bRet = ImplReadEmbedded( *xIStm );
+    std::shared_ptr<GraphicReader> xContext(std::move(mpContext));
+    assert(!mpContext);
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list