[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sfx2/source
László Németh
laszlo.nemeth at collabora.com
Sat Jun 27 18:22:49 PDT 2015
sfx2/source/dialog/templdlg.cxx | 58 ++++++++++++++++++++--------------------
1 file changed, 30 insertions(+), 28 deletions(-)
New commits:
commit fb14fc5c95c70751fb2047bdc3bdb40c8131ae98
Author: László Németh <laszlo.nemeth at collabora.com>
Date: Fri Jun 26 17:36:07 2015 +0200
fix style preview rendering
(cherry-picked from 1ebe3004d6e9372ef5419d456b3c29059b539bc9)
Change-Id: I9ea9cf895f3d608bd3289c1847eea2f6d47a910c
Reviewed-on: https://gerrit.libreoffice.org/16521
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 833a8af..8747856 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -79,7 +79,7 @@ namespace
class StyleLBoxString : public SvLBoxString
{
SfxStyleFamily meStyleFamily;
- std::unique_ptr<sfx2::StylePreviewRenderer> mpStylePreviewRenderer;
+ SvViewDataItem* mpViewData;
public:
StyleLBoxString(SvTreeListEntry* pEntry,
@@ -115,6 +115,19 @@ void StyleLBoxString::InitViewData(SvTreeListBox* pView, SvTreeListEntry* pEntry
{
pViewData = pView->GetViewDataItem(pEntry, this);
}
+ mpViewData = pViewData;
+}
+
+void StyleLBoxString::Paint(
+ const Point& aPos, SvTreeListBox& rDevice, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry)
+{
+ std::unique_ptr<sfx2::StylePreviewRenderer> pStylePreviewRenderer;
+
+ if (!pEntry)
+ return;
+
+ bool bResult = false;
SfxObjectShell* pShell = SfxObjectShell::Current();
if (!pShell)
@@ -122,40 +135,29 @@ void StyleLBoxString::InitViewData(SvTreeListBox* pView, SvTreeListEntry* pEntry
sfx2::StyleManager* pStyleManager = pShell->GetStyleManager();
- if (!pStyleManager)
+ if (pStyleManager)
{
- return;
- }
- mpStylePreviewRenderer.reset(pStyleManager->CreateStylePreviewRenderer(*pView, GetText(), meStyleFamily, 32 * pView->GetDPIScaleFactor()));
+ bool bInit = (!pStylePreviewRenderer);
- if (!mpStylePreviewRenderer)
- {
- return;
- }
+ pStylePreviewRenderer.reset(pStyleManager->CreateStylePreviewRenderer(rRenderContext, GetText(), meStyleFamily, 32 * rRenderContext.GetDPIScaleFactor()));
- if (mpStylePreviewRenderer->recalculate())
- {
- pViewData->maSize = mpStylePreviewRenderer->getRenderSize();
- }
- else
- {
- SvLBoxString::InitViewData(pView, pEntry, pViewData);
+ if (pStylePreviewRenderer)
+ {
+ if (pStylePreviewRenderer->recalculate())
+ {
+ mpViewData->maSize = pStylePreviewRenderer->getRenderSize();
+ }
+ else if (bInit)
+ {
+ SvLBoxString::InitViewData( const_cast<SvTreeListBox*>(&rDevice), const_cast<SvTreeListEntry*>(pEntry), mpViewData);
+ }
+ }
}
-}
-
-void StyleLBoxString::Paint(
- const Point& aPos, SvTreeListBox& /*rDevice*/, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* pView, const SvTreeListEntry* pEntry)
-{
- if (!pEntry)
- return;
-
- bool bResult = false;
- if (mpStylePreviewRenderer)
+ if (pStylePreviewRenderer)
{
Rectangle aPaintRectangle = pView->GetPaintRectangle();
- bResult = mpStylePreviewRenderer->render(aPaintRectangle);
+ bResult = pStylePreviewRenderer->render(aPaintRectangle);
}
if (!bResult)
More information about the Libreoffice-commits
mailing list