[Libreoffice-commits] core.git: sfx2/source
László Németh
laszlo.nemeth at collabora.com
Fri Jun 26 08:33:37 PDT 2015
sfx2/source/dialog/templdlg.cxx | 52 ++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 25 deletions(-)
New commits:
commit 1ebe3004d6e9372ef5419d456b3c29059b539bc9
Author: László Németh <laszlo.nemeth at collabora.com>
Date: Fri Jun 26 17:28:01 2015 +0200
fix style preview rendering
Change-Id: I10d3791a8d95b5db94af33690de57f3c443bc8fb
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 308f581..6bc67fb 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,16 @@ 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& rEntry)
+{
+ std::unique_ptr<sfx2::StylePreviewRenderer> pStylePreviewRenderer;
+
+ bool bResult = false;
SfxObjectShell* pShell = SfxObjectShell::Current();
if (!pShell)
@@ -122,37 +132,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*>(&rEntry), mpViewData);
+ }
+ }
}
-}
-
-void StyleLBoxString::Paint(
- const Point& aPos, SvTreeListBox& /*rDevice*/, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* pView, const SvTreeListEntry& /*rEntry*/)
-{
- 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