Kaydet (Commit) b010e407 authored tarafından László Németh's avatar László Németh

tdf#92241 fix crashes and rendering of symbol set previews

Change-Id: I43397f2b0caa31c334f87acf11fc96df2e051ad8
üst 4802bf32
...@@ -58,6 +58,7 @@ public: ...@@ -58,6 +58,7 @@ public:
Link<> GetPreSelectHdl() const { return aHighHdl; } Link<> GetPreSelectHdl() const { return aHighHdl; }
void SetPreSelectHdl( const Link<>& rHdl ) { aPreSelectHdl = rHdl; } void SetPreSelectHdl( const Link<>& rHdl ) { aPreSelectHdl = rHdl; }
static sal_uInt32& getSelectedChar(); static sal_uInt32& getSelectedChar();
void SetFont( const vcl::Font& rFont );
svx::SvxShowCharSetItem* ImplGetItem( int _nPos ); svx::SvxShowCharSetItem* ImplGetItem( int _nPos );
int FirstInView() const; int FirstInView() const;
...@@ -108,12 +109,14 @@ private: ...@@ -108,12 +109,14 @@ private:
sal_Int32 nSelectedIndex; sal_Int32 nSelectedIndex;
FontCharMapPtr mpFontCharMap; FontCharMapPtr mpFontCharMap;
Size maFontSize;
VclPtr<ScrollBar> aVscrollSB; VclPtr<ScrollBar> aVscrollSB;
bool mbRecalculateFont : 1; bool mbRecalculateFont : 1;
bool mbUpdateForeground : 1; bool mbUpdateForeground : 1;
bool mbUpdateBackground : 1; bool mbUpdateBackground : 1;
private: private:
void DrawChars_Impl(vcl::RenderContext& rRenderContext, int n1, int n2); void DrawChars_Impl(vcl::RenderContext& rRenderContext, int n1, int n2);
void InitSettings(vcl::RenderContext& rRenderContext); void InitSettings(vcl::RenderContext& rRenderContext);
......
...@@ -41,6 +41,8 @@ protected: ...@@ -41,6 +41,8 @@ protected:
private: private:
bool mbHasControlFocus; bool mbHasControlFocus;
bool mbFont;
bool mbForeground;
Link<> maGetFocusHdl; Link<> maGetFocusHdl;
Link<> maLoseFocusHdl; Link<> maLoseFocusHdl;
......
...@@ -57,6 +57,7 @@ sal_uInt32& SvxShowCharSet::getSelectedChar() ...@@ -57,6 +57,7 @@ sal_uInt32& SvxShowCharSet::getSelectedChar()
SvxShowCharSet::SvxShowCharSet(vcl::Window* pParent) SvxShowCharSet::SvxShowCharSet(vcl::Window* pParent)
: Control(pParent, WB_TABSTOP | WB_BORDER) : Control(pParent, WB_TABSTOP | WB_BORDER)
, m_pAccessible(nullptr) , m_pAccessible(nullptr)
, maFontSize(0, 0)
, aVscrollSB( VclPtr<ScrollBar>::Create(this, WB_VERT) ) , aVscrollSB( VclPtr<ScrollBar>::Create(this, WB_VERT) )
, mbRecalculateFont(true) , mbRecalculateFont(true)
, mbUpdateForeground(true) , mbUpdateForeground(true)
...@@ -114,6 +115,7 @@ void SvxShowCharSet::StateChanged(StateChangedType nType) ...@@ -114,6 +115,7 @@ void SvxShowCharSet::StateChanged(StateChangedType nType)
Invalidate(); Invalidate();
Control::StateChanged( nType ); Control::StateChanged( nType );
} }
...@@ -331,6 +333,12 @@ void SvxShowCharSet::Paint( vcl::RenderContext& rRenderContext, const Rectangle& ...@@ -331,6 +333,12 @@ void SvxShowCharSet::Paint( vcl::RenderContext& rRenderContext, const Rectangle&
DrawChars_Impl(rRenderContext, FirstInView(), LastInView()); DrawChars_Impl(rRenderContext, FirstInView(), LastInView());
} }
void SvxShowCharSet::SetFont( const vcl::Font& rFont )
{
Control::SetFont(rFont);
Invalidate();
}
void SvxShowCharSet::DeSelect() void SvxShowCharSet::DeSelect()
{ {
Invalidate(); Invalidate();
...@@ -506,6 +514,14 @@ void SvxShowCharSet::InitSettings(vcl::RenderContext& rRenderContext) ...@@ -506,6 +514,14 @@ void SvxShowCharSet::InitSettings(vcl::RenderContext& rRenderContext)
mbUpdateBackground = false; 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) ...@@ -536,7 +552,8 @@ void SvxShowCharSet::RecalculateFont(vcl::RenderContext& rRenderContext)
aFont.SetWeight(WEIGHT_LIGHT); aFont.SetWeight(WEIGHT_LIGHT);
aFont.SetAlign(ALIGN_TOP); aFont.SetAlign(ALIGN_TOP);
int nFontHeight = (aSize.Height() - 5) * 2 / (3 * ROW_COUNT); 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); aFont.SetTransparent(true);
rRenderContext.SetFont(aFont); rRenderContext.SetFont(aFont);
rRenderContext.GetFontCharMap(mpFontCharMap); rRenderContext.GetFontCharMap(mpFontCharMap);
......
...@@ -36,6 +36,8 @@ using namespace vcl; ...@@ -36,6 +36,8 @@ using namespace vcl;
void Control::ImplInitControlData() void Control::ImplInitControlData()
{ {
mbHasControlFocus = false; mbHasControlFocus = false;
mbFont = false;
mbForeground = false;
mpControlData = new ImplControlData; mpControlData = new ImplControlData;
} }
...@@ -417,16 +419,23 @@ void Control::ApplySettings(vcl::RenderContext& rRenderContext) ...@@ -417,16 +419,23 @@ void Control::ApplySettings(vcl::RenderContext& rRenderContext)
{ {
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
vcl::Font rFont(GetCanonicalFont(rStyleSettings)); if (mbFont)
ApplyControlFont(rRenderContext, rFont); {
vcl::Font rFont(GetCanonicalFont(rStyleSettings));
ApplyControlForeground(rRenderContext, GetCanonicalTextColor(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); ApplySettings(*this);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment