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

László Németh laszlo.nemeth at collabora.com
Fri Jul 3 09:57:16 PDT 2015


 include/svx/charmap.hxx       |    3 +++
 include/vcl/ctrl.hxx          |    2 ++
 svx/source/dialog/charmap.cxx |   19 ++++++++++++++++++-
 vcl/source/control/ctrl.cxx   |   21 +++++++++++++++------
 4 files changed, 38 insertions(+), 7 deletions(-)

New commits:
commit b010e4074e5d5ee3a3905f1351f04efafe937c2a
Author: László Németh <laszlo.nemeth at collabora.com>
Date:   Fri Jul 3 18:50:05 2015 +0200

    tdf#92241 fix crashes and rendering of symbol set previews
    
    Change-Id: I43397f2b0caa31c334f87acf11fc96df2e051ad8

diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
index d50382e..e56fe98 100644
--- a/include/svx/charmap.hxx
+++ b/include/svx/charmap.hxx
@@ -58,6 +58,7 @@ public:
     Link<>          GetPreSelectHdl() const { return aHighHdl; }
     void            SetPreSelectHdl( const Link<>& rHdl ) { aPreSelectHdl = rHdl; }
     static sal_uInt32& getSelectedChar();
+    void            SetFont( const vcl::Font& rFont );
 
     svx::SvxShowCharSetItem*  ImplGetItem( int _nPos );
     int                         FirstInView() const;
@@ -108,12 +109,14 @@ private:
     sal_Int32       nSelectedIndex;
 
     FontCharMapPtr  mpFontCharMap;
+    Size            maFontSize;
     VclPtr<ScrollBar>  aVscrollSB;
 
     bool mbRecalculateFont  : 1;
     bool mbUpdateForeground : 1;
     bool mbUpdateBackground : 1;
 
+
 private:
     void            DrawChars_Impl(vcl::RenderContext& rRenderContext, int n1, int n2);
     void            InitSettings(vcl::RenderContext& rRenderContext);
diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
index 6741a22..69a3569 100644
--- a/include/vcl/ctrl.hxx
+++ b/include/vcl/ctrl.hxx
@@ -41,6 +41,8 @@ protected:
 
 private:
     bool                    mbHasControlFocus;
+    bool                    mbFont;
+    bool                    mbForeground;
     Link<>                  maGetFocusHdl;
     Link<>                  maLoseFocusHdl;
 
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 9d0c9a5..f5e9595 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -57,6 +57,7 @@ sal_uInt32& SvxShowCharSet::getSelectedChar()
 SvxShowCharSet::SvxShowCharSet(vcl::Window* pParent)
     : Control(pParent, WB_TABSTOP | WB_BORDER)
     , m_pAccessible(nullptr)
+    , maFontSize(0, 0)
     , aVscrollSB( VclPtr<ScrollBar>::Create(this, WB_VERT) )
     , mbRecalculateFont(true)
     , mbUpdateForeground(true)
@@ -114,6 +115,7 @@ void SvxShowCharSet::StateChanged(StateChangedType nType)
     Invalidate();
 
     Control::StateChanged( nType );
+
 }
 
 
@@ -331,6 +333,12 @@ void SvxShowCharSet::Paint( vcl::RenderContext& rRenderContext, const Rectangle&
     DrawChars_Impl(rRenderContext, FirstInView(), LastInView());
 }
 
+void SvxShowCharSet::SetFont( const vcl::Font& rFont )
+{
+    Control::SetFont(rFont);
+    Invalidate();
+}
+
 void SvxShowCharSet::DeSelect()
 {
     Invalidate();
@@ -506,6 +514,14 @@ void SvxShowCharSet::InitSettings(vcl::RenderContext& rRenderContext)
 
         mbUpdateBackground = false;
     }
+
+    vcl::Font aFont(rRenderContext.GetFont());
+    aFont.SetWeight(WEIGHT_LIGHT);
+    aFont.SetAlign(ALIGN_TOP);
+    aFont.SetSize(maFontSize);
+    aFont.SetTransparent(true);
+    rRenderContext.SetFont(aFont);
+
 }
 
 
@@ -536,7 +552,8 @@ void SvxShowCharSet::RecalculateFont(vcl::RenderContext& rRenderContext)
     aFont.SetWeight(WEIGHT_LIGHT);
     aFont.SetAlign(ALIGN_TOP);
     int nFontHeight = (aSize.Height() - 5) * 2 / (3 * ROW_COUNT);
-    aFont.SetSize(rRenderContext.PixelToLogic(Size(0, nFontHeight)));
+    maFontSize = rRenderContext.PixelToLogic(Size(0, nFontHeight));
+    aFont.SetSize(maFontSize);
     aFont.SetTransparent(true);
     rRenderContext.SetFont(aFont);
     rRenderContext.GetFontCharMap(mpFontCharMap);
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 0c40a34..21056db 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -36,6 +36,8 @@ using namespace vcl;
 void Control::ImplInitControlData()
 {
     mbHasControlFocus       = false;
+    mbFont                  = false;
+    mbForeground            = false;
     mpControlData   = new ImplControlData;
 }
 
@@ -417,16 +419,23 @@ void Control::ApplySettings(vcl::RenderContext& rRenderContext)
 {
     const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
 
-    vcl::Font rFont(GetCanonicalFont(rStyleSettings));
-    ApplyControlFont(rRenderContext, rFont);
-
-    ApplyControlForeground(rRenderContext, GetCanonicalTextColor(rStyleSettings));
+    if (mbFont)
+    {
+        vcl::Font rFont(GetCanonicalFont(rStyleSettings));
+        ApplyControlFont(rRenderContext, rFont);
+    }
 
-    rRenderContext.SetTextFillColor();
+    if (mbFont || mbForeground)
+    {
+        ApplyControlForeground(rRenderContext, GetCanonicalTextColor(rStyleSettings));
+        rRenderContext.SetTextFillColor();
+    }
 }
 
-void Control::ImplInitSettings(const bool, const bool)
+void Control::ImplInitSettings(const bool _bFont, const bool _bForeground)
 {
+    mbFont = _bFont;
+    mbForeground = _bForeground;
     ApplySettings(*this);
 }
 


More information about the Libreoffice-commits mailing list