[Libreoffice-commits] core.git: include/vcl vcl/source

Adrien Ollier (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 8 11:03:39 UTC 2019


 include/vcl/outdev.hxx             |    4 +++-
 include/vcl/window.hxx             |    1 +
 vcl/source/gdi/pdfwriter_impl.hxx  |    1 +
 vcl/source/gdi/pdfwriter_impl2.cxx |   10 ++++++++++
 vcl/source/outdev/font.cxx         |   31 ++++++++++---------------------
 vcl/source/window/window3.cxx      |    8 ++++++++
 6 files changed, 33 insertions(+), 22 deletions(-)

New commits:
commit 7e88bc73030c7708f1a8b47491070aae5b73aac1
Author:     Adrien Ollier <adr.ollier at hotmail.fr>
AuthorDate: Thu Jul 4 05:06:10 2019 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Aug 8 13:02:38 2019 +0200

    tdf#74702: removes GetOutDevType() from OutputDevice::ImplRefreshFontData
    
    Change-Id: I8a51afe0979d83862bbe384e6d67702f4687072d
    Signed-off-by: Adrien Ollier <adr.ollier at hotmail.fr>
    Reviewed-on: https://gerrit.libreoffice.org/75068
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 3151abbe1e9c..8d385e003dd2 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1289,8 +1289,11 @@ protected:
     virtual long                GetFontExtLeading() const;
 
     virtual void ImplClearFontData(bool bNewFontLists);
+    virtual void ImplRefreshFontData(bool bNewFontLists);
     void ReleaseFontCache();
     void ReleaseFontCollection();
+    void SetFontCollectionFromSVData();
+    void ResetNewFontCache();
 
 private:
 
@@ -1298,7 +1301,6 @@ private:
 
     SAL_DLLPRIVATE bool         ImplNewFont() const;
 
-    SAL_DLLPRIVATE void         ImplRefreshFontData( bool bNewFontLists );
     SAL_DLLPRIVATE static void  ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl, bool bNewFontLists );
 
     static
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index bdc4ea3d0019..ce8669895fe5 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -742,6 +742,7 @@ protected:
     virtual void                        InitClipRegion() override;
 
     void ImplClearFontData(bool bNewFontLists) override;
+    void ImplRefreshFontData(bool bNewFontLists) override;
 
     // FIXME: this is a hack to workaround missing layout functionality
     SAL_DLLPRIVATE void                 ImplAdjustNWFSizes();
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index cd8f5eac31bb..7dd40d96e039 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -594,6 +594,7 @@ public:
 
 protected:
     void ImplClearFontData(bool bNewFontLists) override;
+    void ImplRefreshFontData(bool bNewFontLists) override;
     vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const override;
     void DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint) override;
 
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index a060cd580fe0..4dbc13bc6079 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -2027,9 +2027,19 @@ void PDFWriterImpl::ImplClearFontData(bool bNewFontLists)
     }
 }
 
+void PDFWriterImpl::ImplRefreshFontData(bool bNewFontLists)
+{
+    if (bNewFontLists && AcquireGraphics())
+    {
+        SetFontCollectionFromSVData();
+        ResetNewFontCache();
+    }
+}
+
 vcl::Region PDFWriterImpl::ClipToDeviceBounds(vcl::Region aRegion) const
 {
     return aRegion;
 }
 
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index dbecc1d550fe..a306d1a2ae98 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -523,29 +523,8 @@ void OutputDevice::RefreshFontData( const bool bNewFontLists )
 
 void OutputDevice::ImplRefreshFontData( const bool bNewFontLists )
 {
-    ImplSVData* pSVData = ImplGetSVData();
-
     if (bNewFontLists && AcquireGraphics())
-    {
-        if (GetOutDevType() == OUTDEV_PDF)
-        {
-            mxFontCollection = pSVData->maGDIData.mxScreenFontList->Clone();
-            mxFontCache.reset(new ImplFontCache);
-        }
-        else
             mpGraphics->GetDevFontList( mxFontCollection.get() );
-    }
-
-    // also update child windows if needed
-    if ( GetOutDevType() == OUTDEV_WINDOW )
-    {
-        vcl::Window* pChild = static_cast<vcl::Window*>(this)->mpWindowImpl->mpFirstChild;
-        while ( pChild )
-        {
-            pChild->ImplRefreshFontData( true );
-            pChild = pChild->mpWindowImpl->mpNext;
-        }
-    }
 }
 
 void OutputDevice::ImplUpdateFontData()
@@ -1486,4 +1465,14 @@ sal_Int32 OutputDevice::HasGlyphs( const vcl::Font& rTempFont, const OUString& r
     return -1;
 }
 
+void OutputDevice::SetFontCollectionFromSVData()
+{
+    mxFontCollection = ImplGetSVData()->maGDIData.mxScreenFontList->Clone();
+}
+
+void OutputDevice::ResetNewFontCache()
+{
+    mxFontCache.reset(new ImplFontCache{});
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx
index 492839f05415..c3412e0dda46 100644
--- a/vcl/source/window/window3.cxx
+++ b/vcl/source/window/window3.cxx
@@ -65,6 +65,14 @@ void Window::ImplClearFontData(bool bNewFontLists)
     for (Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext)
         pChild->ImplClearFontData(bNewFontLists);
 }
+
+void Window::ImplRefreshFontData(bool bNewFontLists)
+{
+    OutputDevice::ImplRefreshFontData(bNewFontLists);
+    for (Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext)
+        pChild->ImplRefreshFontData(bNewFontLists);
+}
+
 } /* namespace vcl */
 
 


More information about the Libreoffice-commits mailing list