[Libreoffice-commits] core.git: sfx2/source
Jan Holesovsky
kendy at collabora.com
Mon Jun 29 01:48:59 PDT 2015
sfx2/source/dialog/templdlg.cxx | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
New commits:
commit fe2ba8574f349b6fcc956136992310ef8a3aa332
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon Jun 29 10:46:18 2015 +0200
rendercontext: Simplify.
Change-Id: I1dced1263a114d8d30b66da8974d075c83a8414f
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 1a2dc49..9510ed3 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -122,21 +122,14 @@ 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;
+ bool bPainted = false;
SfxObjectShell* pShell = SfxObjectShell::Current();
- if (!pShell)
- return;
-
- sfx2::StyleManager* pStyleManager = pShell->GetStyleManager();
+ sfx2::StyleManager* pStyleManager = pShell? pShell->GetStyleManager(): nullptr;
if (pStyleManager)
{
- bool bInit = (!pStylePreviewRenderer);
-
- pStylePreviewRenderer.reset(pStyleManager->CreateStylePreviewRenderer(rRenderContext, GetText(), meStyleFamily, 32 * rRenderContext.GetDPIScaleFactor()));
+ std::unique_ptr<sfx2::StylePreviewRenderer> pStylePreviewRenderer(pStyleManager->CreateStylePreviewRenderer(rRenderContext, GetText(), meStyleFamily, 32 * rRenderContext.GetDPIScaleFactor()));
if (pStylePreviewRenderer)
{
@@ -144,20 +137,17 @@ void StyleLBoxString::Paint(
{
mpViewData->maSize = pStylePreviewRenderer->getRenderSize();
}
- else if (bInit)
+ else
{
SvLBoxString::InitViewData( &rDevice, const_cast<SvTreeListEntry*>(&rEntry), mpViewData);
}
- }
- }
- if (pStylePreviewRenderer)
- {
- Rectangle aPaintRectangle = pView->GetPaintRectangle();
- bResult = pStylePreviewRenderer->render(aPaintRectangle);
+ Rectangle aPaintRectangle = pView->GetPaintRectangle();
+ bPainted = pStylePreviewRenderer->render(aPaintRectangle);
+ }
}
- if (!bResult)
+ if (!bPainted)
{
rRenderContext.DrawText(aPos, GetText());
}
More information about the Libreoffice-commits
mailing list