diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-14 09:11:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-15 08:45:07 +0100 |
commit | 8f6a170e4bbb5d0a0bf06d26560189e4ca7ecfb0 (patch) | |
tree | 936461ded988c8105845dd7035744d878375fe1d /sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx | |
parent | 298284f4a6578aefc4268b7f4b5de6c2e4203465 (diff) |
loplugin:flatten in sd/source/ui/slidesorter
Change-Id: I001e0957dafee168bb997a0673be64b2e92cb658
Reviewed-on: https://gerrit.libreoffice.org/67830
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx')
-rw-r--r-- | sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx index c0b1bfa16c8e..60a4182afe3b 100644 --- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx +++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx @@ -244,38 +244,38 @@ void InsertionIndicatorOverlay::PaintPageCount ( // Paint the number of slides. std::shared_ptr<view::Theme> pTheme (mrSlideSorter.GetTheme()); std::shared_ptr<vcl::Font> pFont(Theme::GetFont(Theme::Font_PageCount, rDevice)); - if (pFont) - { - OUString sNumber (OUString::number(nSelectionCount)); - - // Determine the size of the (painted) text and create a bounding - // box that centers the text on the first preview. - rDevice.SetFont(*pFont); - ::tools::Rectangle aTextBox; - rDevice.GetTextBoundRect(aTextBox, sNumber); - Point aTextOffset (aTextBox.TopLeft()); - Size aTextSize (aTextBox.GetSize()); - // Place text inside the first page preview. - Point aTextLocation(rFirstPageOffset); - // Center the text. - aTextLocation += Point( - (rPreviewSize.Width()-aTextBox.GetWidth())/2, - (rPreviewSize.Height()-aTextBox.GetHeight())/2); - aTextBox = ::tools::Rectangle(aTextLocation, aTextSize); - - // Paint background, border and text. - static const sal_Int32 nBorder = 5; - rDevice.SetFillColor(pTheme->GetColor(Theme::Color_Selection)); - rDevice.SetLineColor(pTheme->GetColor(Theme::Color_Selection)); - rDevice.DrawRect(GrowRectangle(aTextBox, nBorder)); - - rDevice.SetFillColor(); - rDevice.SetLineColor(pTheme->GetColor(Theme::Color_PageCountFontColor)); - rDevice.DrawRect(GrowRectangle(aTextBox, nBorder-1)); - - rDevice.SetTextColor(pTheme->GetColor(Theme::Color_PageCountFontColor)); - rDevice.DrawText(aTextBox.TopLeft()-aTextOffset, sNumber); - } + if (!pFont) + return; + + OUString sNumber (OUString::number(nSelectionCount)); + + // Determine the size of the (painted) text and create a bounding + // box that centers the text on the first preview. + rDevice.SetFont(*pFont); + ::tools::Rectangle aTextBox; + rDevice.GetTextBoundRect(aTextBox, sNumber); + Point aTextOffset (aTextBox.TopLeft()); + Size aTextSize (aTextBox.GetSize()); + // Place text inside the first page preview. + Point aTextLocation(rFirstPageOffset); + // Center the text. + aTextLocation += Point( + (rPreviewSize.Width()-aTextBox.GetWidth())/2, + (rPreviewSize.Height()-aTextBox.GetHeight())/2); + aTextBox = ::tools::Rectangle(aTextLocation, aTextSize); + + // Paint background, border and text. + static const sal_Int32 nBorder = 5; + rDevice.SetFillColor(pTheme->GetColor(Theme::Color_Selection)); + rDevice.SetLineColor(pTheme->GetColor(Theme::Color_Selection)); + rDevice.DrawRect(GrowRectangle(aTextBox, nBorder)); + + rDevice.SetFillColor(); + rDevice.SetLineColor(pTheme->GetColor(Theme::Color_PageCountFontColor)); + rDevice.DrawRect(GrowRectangle(aTextBox, nBorder-1)); + + rDevice.SetTextColor(pTheme->GetColor(Theme::Color_PageCountFontColor)); + rDevice.DrawText(aTextBox.TopLeft()-aTextOffset, sNumber); } void InsertionIndicatorOverlay::SetLocation (const Point& rLocation) @@ -318,35 +318,35 @@ void InsertionIndicatorOverlay::SetLayerInvalidator (const SharedILayerInvalidat void InsertionIndicatorOverlay::Show() { - if ( ! mbIsVisible) - { - mbIsVisible = true; + if ( mbIsVisible) + return; - std::shared_ptr<LayeredDevice> pLayeredDevice ( - mrSlideSorter.GetView().GetLayeredDevice()); - if (pLayeredDevice) - { - pLayeredDevice->RegisterPainter(shared_from_this(), gnLayerIndex); - if (mpLayerInvalidator) - mpLayerInvalidator->Invalidate(GetBoundingBox()); - } + mbIsVisible = true; + + std::shared_ptr<LayeredDevice> pLayeredDevice ( + mrSlideSorter.GetView().GetLayeredDevice()); + if (pLayeredDevice) + { + pLayeredDevice->RegisterPainter(shared_from_this(), gnLayerIndex); + if (mpLayerInvalidator) + mpLayerInvalidator->Invalidate(GetBoundingBox()); } } void InsertionIndicatorOverlay::Hide() { - if (mbIsVisible) - { - mbIsVisible = false; + if (!mbIsVisible) + return; - std::shared_ptr<LayeredDevice> pLayeredDevice ( - mrSlideSorter.GetView().GetLayeredDevice()); - if (pLayeredDevice) - { - if (mpLayerInvalidator) - mpLayerInvalidator->Invalidate(GetBoundingBox()); - pLayeredDevice->RemovePainter(shared_from_this(), gnLayerIndex); - } + mbIsVisible = false; + + std::shared_ptr<LayeredDevice> pLayeredDevice ( + mrSlideSorter.GetView().GetLayeredDevice()); + if (pLayeredDevice) + { + if (mpLayerInvalidator) + mpLayerInvalidator->Invalidate(GetBoundingBox()); + pLayeredDevice->RemovePainter(shared_from_this(), gnLayerIndex); } } |