solenv/clang-format/excludelist | 2 svx/inc/tbxcolorupdate.hxx | 206 +++++------ svx/source/tbxctrls/tbxcolorupdate.cxx | 607 ++++++++++++++++----------------- 3 files changed, 403 insertions(+), 412 deletions(-)
New commits: commit 71486ad4f03ed0faa763b5e572094739bf8db71c Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jul 28 12:41:48 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Jul 30 06:42:14 2025 +0200 svx: Drop ToolboxButtonColorUpdaterBase::maBmpSize It's only used inside ToolboxButtonColorUpdaterBase::Update where `aItemSize` can be used directly, instead of assigning its value to a class member first. Change-Id: I468dd1a6f85b1edbe65aade95d8e56b975dccfdd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188484 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/svx/inc/tbxcolorupdate.hxx b/svx/inc/tbxcolorupdate.hxx index c377f4b5e0b5..d14ba4bd1ec7 100644 --- a/svx/inc/tbxcolorupdate.hxx +++ b/svx/inc/tbxcolorupdate.hxx @@ -71,7 +71,6 @@ protected: bool mbWasHiContrastMode; sal_uInt16 mnSlotId; Color maCurColor; - Size maBmpSize; vcl::ImageType meImageType; OUString maCommandLabel; OUString maCommandURL; diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index f95fa46d9fef..5ef2f8bf80d0 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -247,13 +247,12 @@ void ToolboxButtonColorUpdaterBase::Update(const Color& rColor, bool bForceUpdat = vcl::CommandInfoProvider::GetXGraphicForCommand(maCommandURL, mxFrame, meImageType); Image aImage(xImage); - Size aItemSize = GetItemSize(aImage.GetSizePixel()); + const Size aItemSize = GetItemSize(aImage.GetSizePixel()); if (!aItemSize.Width() || !aItemSize.Height()) return; ScopedVclPtr<VirtualDevice> pVirDev(CreateVirtualDevice()); pVirDev->SetOutputSizePixel(aItemSize, /*bErase*/ true, /*bAlphaMaskTransparent*/ true); - maBmpSize = aItemSize; std::unique_ptr<GDIMetaFile> xMetaFile; if (RecordVirtualDevice()) @@ -266,20 +265,20 @@ void ToolboxButtonColorUpdaterBase::Update(const Color& rColor, bool bForceUpdat } tools::Rectangle aUpdateRect; - if (maBmpSize.Width() == maBmpSize.Height()) + if (aItemSize.Width() == aItemSize.Height()) // tdf#84985 align color bar with icon bottom edge; integer arithmetic e.g. 26 - 26/4 <> 26 * 3/4 - aUpdateRect = tools::Rectangle(Point(0, maBmpSize.Height() - maBmpSize.Height() / 4), - Size(maBmpSize.Width(), maBmpSize.Height() / 4)); + aUpdateRect = tools::Rectangle(Point(0, aItemSize.Height() - aItemSize.Height() / 4), + Size(aItemSize.Width(), aItemSize.Height() / 4)); else - aUpdateRect = tools::Rectangle(Point(maBmpSize.Height() + 2, 2), - Point(maBmpSize.Width() - 3, maBmpSize.Height() - 3)); + aUpdateRect = tools::Rectangle(Point(aItemSize.Height() + 2, 2), + Point(aItemSize.Width() - 3, aItemSize.Height() - 3)); pVirDev->Push(vcl::PushFlags::CLIPREGION); // tdf#135121 don't include the part of the image which we will // overwrite with the target color so that for the transparent color // case the original background of the device is shown - vcl::Region aRegion(tools::Rectangle(Point(0, 0), maBmpSize)); + vcl::Region aRegion(tools::Rectangle(Point(0, 0), aItemSize)); aRegion.Exclude(aUpdateRect); pVirDev->SetClipRegion(aRegion); @@ -290,7 +289,7 @@ void ToolboxButtonColorUpdaterBase::Update(const Color& rColor, bool bForceUpdat const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); mbWasHiContrastMode = rStyleSettings.GetHighContrastMode(); - if ((COL_TRANSPARENT != aColor) && (maBmpSize.Width() == maBmpSize.Height())) + if ((COL_TRANSPARENT != aColor) && (aItemSize.Width() == aItemSize.Height())) pVirDev->SetLineColor(aColor); else pVirDev->SetLineColor(rStyleSettings.GetDisableColor()); commit ff38d2e59f6d050627b6091054b63b5d89240720 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jul 28 12:36:02 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Jul 30 06:42:08 2025 +0200 svx: clang-format tbxcolorupdate.{cxx,hxx} This in particular gets rid of an extra level of indentation. Change-Id: Ifa098e2729af6b5a527549c86434d272ace18ae2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188483 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 295b566c64ce..0f866aee3595 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -11138,7 +11138,6 @@ svx/inc/sxsalitm.hxx svx/inc/sxsiitm.hxx svx/inc/sxsoitm.hxx svx/inc/sxtraitm.hxx -svx/inc/tbxcolorupdate.hxx svx/inc/textchaincursor.hxx svx/inc/xpolyimp.hxx svx/source/accessibility/AccessibleControlShape.cxx @@ -11677,7 +11676,6 @@ svx/source/tbxctrls/tbcontrl.cxx svx/source/tbxctrls/tbunocontroller.cxx svx/source/tbxctrls/tbunosearchcontrollers.cxx svx/source/tbxctrls/tbxcolor.cxx -svx/source/tbxctrls/tbxcolorupdate.cxx svx/source/tbxctrls/tbxdrctl.cxx svx/source/toolbars/extrusionbar.cxx svx/source/toolbars/fontworkbar.cxx diff --git a/svx/inc/tbxcolorupdate.hxx b/svx/inc/tbxcolorupdate.hxx index cc07e3e0141d..c377f4b5e0b5 100644 --- a/svx/inc/tbxcolorupdate.hxx +++ b/svx/inc/tbxcolorupdate.hxx @@ -35,118 +35,112 @@ class VirtualDevice; namespace weld { - class Toolbar; +class Toolbar; } namespace svx { +//= ToolboxButtonColorUpdater +/** helper class to update a color in a toolbox button image - //= ToolboxButtonColorUpdater - - /** helper class to update a color in a toolbox button image - - formerly known as SvxTbxButtonColorUpdater_Impl, residing in svx/source/tbxctrls/colorwindow.hxx. - */ - class ToolboxButtonColorUpdaterBase : public SfxListener - { - public: - ToolboxButtonColorUpdaterBase(bool bWideButton, OUString aCommandLabel, - OUString aCommandURL, sal_uInt16 nSlotId, - css::uno::Reference<css::frame::XFrame> xFrame); - - virtual ~ToolboxButtonColorUpdaterBase(); - - void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; - void SetRecentColor(const NamedColor& rNamedColor, bool bBroadcast = true); - void Update( const NamedColor& rNamedColor ); - void Update( const Color& rColor, bool bForceUpdate = false ); - Color const & GetCurrentColor() const { return maCurColor; } - OUString GetCurrentColorName() const; - - private: - ToolboxButtonColorUpdaterBase(ToolboxButtonColorUpdaterBase const &) = delete; - ToolboxButtonColorUpdaterBase& operator =(ToolboxButtonColorUpdaterBase const &) = delete; - - protected: - bool mbWideButton; - bool mbWasHiContrastMode; - sal_uInt16 mnSlotId; - Color maCurColor; - Size maBmpSize; - vcl::ImageType meImageType; - OUString maCommandLabel; - OUString maCommandURL; - css::uno::Reference<css::frame::XFrame> mxFrame; - - void Init(sal_uInt16 nSlotId); - - virtual void SetQuickHelpText(const OUString& rText) = 0; - virtual OUString GetQuickHelpText() const = 0; - virtual void SetImage(VirtualDevice* pVirDev) = 0; - virtual VclPtr<VirtualDevice> CreateVirtualDevice() const = 0; - // true -> use Device to Record to Metafile, false -> Render to Device - virtual bool RecordVirtualDevice() const = 0; - virtual vcl::ImageType GetImageSize() const = 0; - virtual Size GetItemSize(const Size& rImageSize) const = 0; - }; - - class VclToolboxButtonColorUpdater final : public ToolboxButtonColorUpdaterBase - { - public: - VclToolboxButtonColorUpdater(sal_uInt16 nSlotId, ToolBoxItemId nTbxBtnId, ToolBox* ptrTbx, bool bWideButton, - const OUString& rCommandLabel, const OUString& rCommandURL, - const css::uno::Reference<css::frame::XFrame>& rFrame); - - - private: - ToolBoxItemId mnBtnId; - VclPtr<ToolBox> mpTbx; - - virtual void SetQuickHelpText(const OUString& rText) override; - virtual OUString GetQuickHelpText() const override; - virtual void SetImage(VirtualDevice* pVirDev) override; - virtual VclPtr<VirtualDevice> CreateVirtualDevice() const override; - virtual bool RecordVirtualDevice() const override - { - return true; - } - virtual vcl::ImageType GetImageSize() const override; - virtual Size GetItemSize(const Size& rImageSize) const override; - }; - - class ToolboxButtonColorUpdater final : public ToolboxButtonColorUpdaterBase - { - public: - ToolboxButtonColorUpdater(sal_uInt16 nSlotId, const OUString& rTbxBtnId, weld::Toolbar* ptrTbx, bool bWideButton, - const OUString& rCommandLabel, const css::uno::Reference<css::frame::XFrame>& rFrame); - - private: - OUString msBtnId; - weld::Toolbar* mpTbx; - - virtual void SetQuickHelpText(const OUString& rText) override; - virtual OUString GetQuickHelpText() const override; - virtual void SetImage(VirtualDevice* pVirDev) override; - virtual VclPtr<VirtualDevice> CreateVirtualDevice() const override; - virtual bool RecordVirtualDevice() const override - { - return false; - } - virtual vcl::ImageType GetImageSize() const override; - virtual Size GetItemSize(const Size& rImageSize) const override; - }; - - class ToolboxButtonLineStyleUpdater - { - private: - css::drawing::LineStyle m_eXLS; - int m_nDashStyleIndex; - public: - ToolboxButtonLineStyleUpdater(); - void Update(const css::frame::FeatureStateEvent& rEvent); - int GetStyleIndex() const; - }; + formerly known as SvxTbxButtonColorUpdater_Impl, residing in svx/source/tbxctrls/colorwindow.hxx. +*/ +class ToolboxButtonColorUpdaterBase : public SfxListener +{ +public: + ToolboxButtonColorUpdaterBase(bool bWideButton, OUString aCommandLabel, OUString aCommandURL, + sal_uInt16 nSlotId, + css::uno::Reference<css::frame::XFrame> xFrame); + + virtual ~ToolboxButtonColorUpdaterBase(); + + void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; + void SetRecentColor(const NamedColor& rNamedColor, bool bBroadcast = true); + void Update(const NamedColor& rNamedColor); + void Update(const Color& rColor, bool bForceUpdate = false); + Color const& GetCurrentColor() const { return maCurColor; } + OUString GetCurrentColorName() const; + +private: + ToolboxButtonColorUpdaterBase(ToolboxButtonColorUpdaterBase const&) = delete; + ToolboxButtonColorUpdaterBase& operator=(ToolboxButtonColorUpdaterBase const&) = delete; + +protected: + bool mbWideButton; + bool mbWasHiContrastMode; + sal_uInt16 mnSlotId; + Color maCurColor; + Size maBmpSize; + vcl::ImageType meImageType; + OUString maCommandLabel; + OUString maCommandURL; + css::uno::Reference<css::frame::XFrame> mxFrame; + + void Init(sal_uInt16 nSlotId); + + virtual void SetQuickHelpText(const OUString& rText) = 0; + virtual OUString GetQuickHelpText() const = 0; + virtual void SetImage(VirtualDevice* pVirDev) = 0; + virtual VclPtr<VirtualDevice> CreateVirtualDevice() const = 0; + // true -> use Device to Record to Metafile, false -> Render to Device + virtual bool RecordVirtualDevice() const = 0; + virtual vcl::ImageType GetImageSize() const = 0; + virtual Size GetItemSize(const Size& rImageSize) const = 0; +}; + +class VclToolboxButtonColorUpdater final : public ToolboxButtonColorUpdaterBase +{ +public: + VclToolboxButtonColorUpdater(sal_uInt16 nSlotId, ToolBoxItemId nTbxBtnId, ToolBox* ptrTbx, + bool bWideButton, const OUString& rCommandLabel, + const OUString& rCommandURL, + const css::uno::Reference<css::frame::XFrame>& rFrame); + +private: + ToolBoxItemId mnBtnId; + VclPtr<ToolBox> mpTbx; + + virtual void SetQuickHelpText(const OUString& rText) override; + virtual OUString GetQuickHelpText() const override; + virtual void SetImage(VirtualDevice* pVirDev) override; + virtual VclPtr<VirtualDevice> CreateVirtualDevice() const override; + virtual bool RecordVirtualDevice() const override { return true; } + virtual vcl::ImageType GetImageSize() const override; + virtual Size GetItemSize(const Size& rImageSize) const override; +}; + +class ToolboxButtonColorUpdater final : public ToolboxButtonColorUpdaterBase +{ +public: + ToolboxButtonColorUpdater(sal_uInt16 nSlotId, const OUString& rTbxBtnId, weld::Toolbar* ptrTbx, + bool bWideButton, const OUString& rCommandLabel, + const css::uno::Reference<css::frame::XFrame>& rFrame); + +private: + OUString msBtnId; + weld::Toolbar* mpTbx; + + virtual void SetQuickHelpText(const OUString& rText) override; + virtual OUString GetQuickHelpText() const override; + virtual void SetImage(VirtualDevice* pVirDev) override; + virtual VclPtr<VirtualDevice> CreateVirtualDevice() const override; + virtual bool RecordVirtualDevice() const override { return false; } + virtual vcl::ImageType GetImageSize() const override; + virtual Size GetItemSize(const Size& rImageSize) const override; +}; + +class ToolboxButtonLineStyleUpdater +{ +private: + css::drawing::LineStyle m_eXLS; + int m_nDashStyleIndex; + +public: + ToolboxButtonLineStyleUpdater(); + void Update(const css::frame::FeatureStateEvent& rEvent); + int GetStyleIndex() const; +}; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index 5aa5284eb9b6..f95fa46d9fef 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -46,387 +46,388 @@ namespace svx { - ToolboxButtonColorUpdaterBase::ToolboxButtonColorUpdaterBase(bool bWideButton, OUString aCommandLabel, - OUString aCommandURL, sal_uInt16 nSlotId, - css::uno::Reference<css::frame::XFrame> xFrame) - : mbWideButton(bWideButton) - , mbWasHiContrastMode(Application::GetSettings().GetStyleSettings().GetHighContrastMode()) - , mnSlotId(nSlotId) - , maCurColor(COL_TRANSPARENT) - , meImageType(vcl::ImageType::Size16) - , maCommandLabel(std::move(aCommandLabel)) - , maCommandURL(std::move(aCommandURL)) - , mxFrame(std::move(xFrame)) +ToolboxButtonColorUpdaterBase::ToolboxButtonColorUpdaterBase( + bool bWideButton, OUString aCommandLabel, OUString aCommandURL, sal_uInt16 nSlotId, + css::uno::Reference<css::frame::XFrame> xFrame) + : mbWideButton(bWideButton) + , mbWasHiContrastMode(Application::GetSettings().GetStyleSettings().GetHighContrastMode()) + , mnSlotId(nSlotId) + , maCurColor(COL_TRANSPARENT) + , meImageType(vcl::ImageType::Size16) + , maCommandLabel(std::move(aCommandLabel)) + , maCommandURL(std::move(aCommandURL)) + , mxFrame(std::move(xFrame)) +{ +} + +void ToolboxButtonColorUpdaterBase::Init(sal_uInt16 nSlotId) +{ + if (mbWideButton) { + Update(COL_TRANSPARENT, true); + return; } - void ToolboxButtonColorUpdaterBase::Init(sal_uInt16 nSlotId) + if (rtl::Reference xModel + = dynamic_cast<SfxBaseModel*>(mxFrame->getController()->getModel().get())) { - if (mbWideButton) + auto pDocSh = xModel->GetObjectShell(); + StartListening(*pDocSh); + if (auto oColor = pDocSh->GetRecentColor(nSlotId)) { - Update(COL_TRANSPARENT, true); + Update(*oColor); return; } - - if (rtl::Reference xModel = dynamic_cast<SfxBaseModel*>(mxFrame->getController()->getModel().get())) - { - auto pDocSh = xModel->GetObjectShell(); - StartListening(*pDocSh); - if (auto oColor = pDocSh->GetRecentColor(nSlotId)) - { - Update(*oColor); - return; - } - } - - // tdf#72991 - remember last used color depending on slot id - const auto aSlotNamedColorMap = frozen::make_unordered_map<sal_uInt16, NamedColor>( - { { SID_ATTR_CHAR_COLOR, - NamedColor(COL_DEFAULT_FONT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_FONT)) }, - { SID_ATTR_CHAR_COLOR2, - NamedColor(COL_DEFAULT_FONT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_FONT)) }, - { SID_FRAME_LINECOLOR, - NamedColor(COL_DEFAULT_FRAMELINE, SvxResId(RID_SVXSTR_COLOR_DEFAULT_FRAMELINE)) }, - { SID_ATTR_CHAR_COLOR_BACKGROUND, - NamedColor(COL_DEFAULT_HIGHLIGHT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT)) }, - { SID_ATTR_CHAR_BACK_COLOR, - NamedColor(COL_DEFAULT_HIGHLIGHT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT)) }, - { SID_BACKGROUND_COLOR, - NamedColor(COL_DEFAULT_HIGHLIGHT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT)) }, - { SID_TABLE_CELL_BACKGROUND_COLOR, - NamedColor(COL_DEFAULT_HIGHLIGHT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT)) }, - { SID_ATTR_LINE_COLOR, NamedColor(COL_DEFAULT_SHAPE_STROKE, - SvxResId(RID_SVXSTR_COLOR_DEFAULT_SHAPE_STROKE)) }, - { SID_ATTR_FILL_COLOR, NamedColor(COL_DEFAULT_SHAPE_FILLING, - SvxResId(RID_SVXSTR_COLOR_DEFAULT_SHAPE_FILLING)) } - - }); - - const auto aIterator = aSlotNamedColorMap.find(nSlotId); - if (aIterator != aSlotNamedColorMap.end()) - { - NamedColor aNamedColor(aIterator->second); - SvtViewOptions aViewOpt(EViewType::Dialog, u"ToolboxButtonColor"_ustr); - if (aViewOpt.Exists()) - { - css::uno::Any aUserItem = aViewOpt.GetUserItem(OUString::number(nSlotId)); - OUString aUserData; - if (aUserItem >>= aUserData) - { - sal_Int32 nIdx = 0; - aNamedColor.m_aName = o3tl::getToken(aUserData, 0, ';', nIdx); - aNamedColor.m_aColor - = Color(ColorTransparencyTag::ColorTransparency, - o3tl::toUInt32(o3tl::getToken(aUserData, 0, ';', nIdx))); - } - } - SetRecentColor(aNamedColor, /*Broadcast=*/false); - Update(aNamedColor); - } - else - Update(COL_TRANSPARENT); } - void ToolboxButtonColorUpdaterBase::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) + // tdf#72991 - remember last used color depending on slot id + const auto aSlotNamedColorMap = frozen::make_unordered_map<sal_uInt16, NamedColor>( + { { SID_ATTR_CHAR_COLOR, + NamedColor(COL_DEFAULT_FONT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_FONT)) }, + { SID_ATTR_CHAR_COLOR2, + NamedColor(COL_DEFAULT_FONT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_FONT)) }, + { SID_FRAME_LINECOLOR, + NamedColor(COL_DEFAULT_FRAMELINE, SvxResId(RID_SVXSTR_COLOR_DEFAULT_FRAMELINE)) }, + { SID_ATTR_CHAR_COLOR_BACKGROUND, + NamedColor(COL_DEFAULT_HIGHLIGHT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT)) }, + { SID_ATTR_CHAR_BACK_COLOR, + NamedColor(COL_DEFAULT_HIGHLIGHT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT)) }, + { SID_BACKGROUND_COLOR, + NamedColor(COL_DEFAULT_HIGHLIGHT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT)) }, + { SID_TABLE_CELL_BACKGROUND_COLOR, + NamedColor(COL_DEFAULT_HIGHLIGHT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT)) }, + { SID_ATTR_LINE_COLOR, + NamedColor(COL_DEFAULT_SHAPE_STROKE, SvxResId(RID_SVXSTR_COLOR_DEFAULT_SHAPE_STROKE)) }, + { SID_ATTR_FILL_COLOR, NamedColor(COL_DEFAULT_SHAPE_FILLING, + SvxResId(RID_SVXSTR_COLOR_DEFAULT_SHAPE_FILLING)) } + + }); + + const auto aIterator = aSlotNamedColorMap.find(nSlotId); + if (aIterator != aSlotNamedColorMap.end()) { - if (rHint.GetId() == SfxHintId::Dying) - { - EndListeningAll(); - } - else if (rHint.GetId() == SfxHintId::ColorsChanged) + NamedColor aNamedColor(aIterator->second); + SvtViewOptions aViewOpt(EViewType::Dialog, u"ToolboxButtonColor"_ustr); + if (aViewOpt.Exists()) { - if (auto oColor = static_cast<SfxObjectShell&>(rBC).GetRecentColor(mnSlotId)) + css::uno::Any aUserItem = aViewOpt.GetUserItem(OUString::number(nSlotId)); + OUString aUserData; + if (aUserItem >>= aUserData) { - Update(*oColor); - // tdf#72991 - remember last used color depending on slot id - const OUString aUserData - = oColor->m_aName + ";" - + OUString::number(static_cast<sal_uInt32>(oColor->m_aColor)); - SvtViewOptions(EViewType::Dialog, u"ToolboxButtonColor"_ustr) - .SetUserItem(OUString::number(mnSlotId), css::uno::Any(aUserData)); + sal_Int32 nIdx = 0; + aNamedColor.m_aName = o3tl::getToken(aUserData, 0, ';', nIdx); + aNamedColor.m_aColor + = Color(ColorTransparencyTag::ColorTransparency, + o3tl::toUInt32(o3tl::getToken(aUserData, 0, ';', nIdx))); } } + SetRecentColor(aNamedColor, /*Broadcast=*/false); + Update(aNamedColor); } + else + Update(COL_TRANSPARENT); +} - void ToolboxButtonColorUpdaterBase::SetRecentColor(const NamedColor &rNamedColor, bool bBroadcast) - { - if (rtl::Reference xModel = dynamic_cast<SfxBaseModel*>(mxFrame->getController()->getModel().get())) - xModel->GetObjectShell()->SetRecentColor(mnSlotId, rNamedColor, bBroadcast); - else if (!mbWideButton) - Update(rNamedColor); - } - - VclToolboxButtonColorUpdater::VclToolboxButtonColorUpdater( - sal_uInt16 nSlotId, ToolBoxItemId nTbxBtnId, ToolBox* pToolBox, bool bWideButton, - const OUString& rCommandLabel, const OUString& rCommandURL, - const css::uno::Reference<css::frame::XFrame>& rFrame) - : ToolboxButtonColorUpdaterBase(bWideButton, rCommandLabel, rCommandURL, nSlotId, rFrame) - , mnBtnId(nTbxBtnId) - , mpTbx(pToolBox) +void ToolboxButtonColorUpdaterBase::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) +{ + if (rHint.GetId() == SfxHintId::Dying) { - Init(nSlotId); + EndListeningAll(); } - - void VclToolboxButtonColorUpdater::SetQuickHelpText(const OUString& rText) + else if (rHint.GetId() == SfxHintId::ColorsChanged) { - mpTbx->SetQuickHelpText(mnBtnId, rText); + if (auto oColor = static_cast<SfxObjectShell&>(rBC).GetRecentColor(mnSlotId)) + { + Update(*oColor); + // tdf#72991 - remember last used color depending on slot id + const OUString aUserData + = oColor->m_aName + ";" + + OUString::number(static_cast<sal_uInt32>(oColor->m_aColor)); + SvtViewOptions(EViewType::Dialog, u"ToolboxButtonColor"_ustr) + .SetUserItem(OUString::number(mnSlotId), css::uno::Any(aUserData)); + } } +} - OUString VclToolboxButtonColorUpdater::GetQuickHelpText() const - { - return mpTbx->GetQuickHelpText(mnBtnId); - } +void ToolboxButtonColorUpdaterBase::SetRecentColor(const NamedColor& rNamedColor, bool bBroadcast) +{ + if (rtl::Reference xModel + = dynamic_cast<SfxBaseModel*>(mxFrame->getController()->getModel().get())) + xModel->GetObjectShell()->SetRecentColor(mnSlotId, rNamedColor, bBroadcast); + else if (!mbWideButton) + Update(rNamedColor); +} - void VclToolboxButtonColorUpdater::SetImage(VirtualDevice* pVirDev) - { - GDIMetaFile* pMtf = pVirDev->GetConnectMetaFile(); +VclToolboxButtonColorUpdater::VclToolboxButtonColorUpdater( + sal_uInt16 nSlotId, ToolBoxItemId nTbxBtnId, ToolBox* pToolBox, bool bWideButton, + const OUString& rCommandLabel, const OUString& rCommandURL, + const css::uno::Reference<css::frame::XFrame>& rFrame) + : ToolboxButtonColorUpdaterBase(bWideButton, rCommandLabel, rCommandURL, nSlotId, rFrame) + , mnBtnId(nTbxBtnId) + , mpTbx(pToolBox) +{ + Init(nSlotId); +} - assert(pMtf && "should have been set in ToolboxButtonColorUpdaterBase::Update"); +void VclToolboxButtonColorUpdater::SetQuickHelpText(const OUString& rText) +{ + mpTbx->SetQuickHelpText(mnBtnId, rText); +} - pMtf->Stop(); - pMtf->WindStart(); +OUString VclToolboxButtonColorUpdater::GetQuickHelpText() const +{ + return mpTbx->GetQuickHelpText(mnBtnId); +} - Graphic aGraphic(*pMtf); +void VclToolboxButtonColorUpdater::SetImage(VirtualDevice* pVirDev) +{ + GDIMetaFile* pMtf = pVirDev->GetConnectMetaFile(); - mpTbx->SetItemImage(mnBtnId, Image(aGraphic.GetXGraphic())); - } + assert(pMtf && "should have been set in ToolboxButtonColorUpdaterBase::Update"); - VclPtr<VirtualDevice> VclToolboxButtonColorUpdater::CreateVirtualDevice() const - { - auto xVD = VclPtr<VirtualDevice>::Create(*mpTbx->GetOutDev()); - xVD->SetBackground(Wallpaper(COL_WHITE)); - return xVD; - } + pMtf->Stop(); + pMtf->WindStart(); - vcl::ImageType VclToolboxButtonColorUpdater::GetImageSize() const - { - return mpTbx->GetImageSize(); - } + Graphic aGraphic(*pMtf); - Size VclToolboxButtonColorUpdater::GetItemSize(const Size& rImageSize) const - { - if (mbWideButton) - return mpTbx->GetItemContentSize(mnBtnId); - return rImageSize; - } + mpTbx->SetItemImage(mnBtnId, Image(aGraphic.GetXGraphic())); +} - ToolboxButtonColorUpdaterBase::~ToolboxButtonColorUpdaterBase() - {} +VclPtr<VirtualDevice> VclToolboxButtonColorUpdater::CreateVirtualDevice() const +{ + auto xVD = VclPtr<VirtualDevice>::Create(*mpTbx->GetOutDev()); + xVD->SetBackground(Wallpaper(COL_WHITE)); + return xVD; +} - void ToolboxButtonColorUpdaterBase::Update(const NamedColor &rNamedColor) - { - Update(rNamedColor.m_aColor); +vcl::ImageType VclToolboxButtonColorUpdater::GetImageSize() const { return mpTbx->GetImageSize(); } - // Also show the current color as QuickHelpText - OUString colorSuffix = u" (%1)"_ustr.replaceFirst("%1", rNamedColor.m_aName); - OUString colorHelpText = maCommandLabel + colorSuffix; - SetQuickHelpText(colorHelpText); - } +Size VclToolboxButtonColorUpdater::GetItemSize(const Size& rImageSize) const +{ + if (mbWideButton) + return mpTbx->GetItemContentSize(mnBtnId); + return rImageSize; +} - void ToolboxButtonColorUpdaterBase::Update(const Color& rColor, bool bForceUpdate) - { - vcl::ImageType eImageType = GetImageSize(); +ToolboxButtonColorUpdaterBase::~ToolboxButtonColorUpdaterBase() {} -#ifdef IOS // tdf#126966 - eImageType = vcl::ImageType::Size32; -#endif +void ToolboxButtonColorUpdaterBase::Update(const NamedColor& rNamedColor) +{ + Update(rNamedColor.m_aColor); - const bool bSizeChanged = (meImageType != eImageType); - meImageType = eImageType; - const bool bDisplayModeChanged = (mbWasHiContrastMode != Application::GetSettings().GetStyleSettings().GetHighContrastMode()); - Color aColor(rColor); + // Also show the current color as QuickHelpText + OUString colorSuffix = u" (%1)"_ustr.replaceFirst("%1", rNamedColor.m_aName); + OUString colorHelpText = maCommandLabel + colorSuffix; + SetQuickHelpText(colorHelpText); +} - // !!! #109290# Workaround for SetFillColor with COL_AUTO - if (aColor == COL_AUTO) - aColor = COL_TRANSPARENT; +void ToolboxButtonColorUpdaterBase::Update(const Color& rColor, bool bForceUpdate) +{ + vcl::ImageType eImageType = GetImageSize(); - if ((maCurColor == aColor) && !bSizeChanged && !bDisplayModeChanged && !bForceUpdate) - return; +#ifdef IOS // tdf#126966 + eImageType = vcl::ImageType::Size32; +#endif - auto xImage = vcl::CommandInfoProvider::GetXGraphicForCommand(maCommandURL, mxFrame, meImageType); - Image aImage(xImage); + const bool bSizeChanged = (meImageType != eImageType); + meImageType = eImageType; + const bool bDisplayModeChanged + = (mbWasHiContrastMode + != Application::GetSettings().GetStyleSettings().GetHighContrastMode()); + Color aColor(rColor); - Size aItemSize = GetItemSize(aImage.GetSizePixel()); - if (!aItemSize.Width() || !aItemSize.Height()) - return; + // !!! #109290# Workaround for SetFillColor with COL_AUTO + if (aColor == COL_AUTO) + aColor = COL_TRANSPARENT; - ScopedVclPtr<VirtualDevice> pVirDev(CreateVirtualDevice()); - pVirDev->SetOutputSizePixel(aItemSize, /*bErase*/true, /*bAlphaMaskTransparent*/true); - maBmpSize = aItemSize; + if ((maCurColor == aColor) && !bSizeChanged && !bDisplayModeChanged && !bForceUpdate) + return; - std::unique_ptr<GDIMetaFile> xMetaFile; - if (RecordVirtualDevice()) - { - xMetaFile.reset(new GDIMetaFile); - xMetaFile->SetPrefSize(pVirDev->GetOutputSize()); - xMetaFile->SetPrefMapMode(pVirDev->GetMapMode()); - xMetaFile->Record(pVirDev.get()); - pVirDev->EnableOutput(false); - } + auto xImage + = vcl::CommandInfoProvider::GetXGraphicForCommand(maCommandURL, mxFrame, meImageType); + Image aImage(xImage); - tools::Rectangle aUpdateRect; - if (maBmpSize.Width() == maBmpSize.Height()) - // tdf#84985 align color bar with icon bottom edge; integer arithmetic e.g. 26 - 26/4 <> 26 * 3/4 - aUpdateRect = tools::Rectangle(Point( 0, maBmpSize.Height() - maBmpSize.Height() / 4), Size(maBmpSize.Width(), maBmpSize.Height() / 4)); - else - aUpdateRect = tools::Rectangle(Point( maBmpSize.Height() + 2, 2), Point(maBmpSize.Width() - 3, maBmpSize.Height() - 3)); + Size aItemSize = GetItemSize(aImage.GetSizePixel()); + if (!aItemSize.Width() || !aItemSize.Height()) + return; - pVirDev->Push(vcl::PushFlags::CLIPREGION); + ScopedVclPtr<VirtualDevice> pVirDev(CreateVirtualDevice()); + pVirDev->SetOutputSizePixel(aItemSize, /*bErase*/ true, /*bAlphaMaskTransparent*/ true); + maBmpSize = aItemSize; - // tdf#135121 don't include the part of the image which we will - // overwrite with the target color so that for the transparent color - // case the original background of the device is shown - vcl::Region aRegion(tools::Rectangle(Point(0, 0), maBmpSize)); - aRegion.Exclude(aUpdateRect); - pVirDev->SetClipRegion(aRegion); + std::unique_ptr<GDIMetaFile> xMetaFile; + if (RecordVirtualDevice()) + { + xMetaFile.reset(new GDIMetaFile); + xMetaFile->SetPrefSize(pVirDev->GetOutputSize()); + xMetaFile->SetPrefMapMode(pVirDev->GetMapMode()); + xMetaFile->Record(pVirDev.get()); + pVirDev->EnableOutput(false); + } - pVirDev->DrawImage(Point(0, 0), aImage); + tools::Rectangle aUpdateRect; + if (maBmpSize.Width() == maBmpSize.Height()) + // tdf#84985 align color bar with icon bottom edge; integer arithmetic e.g. 26 - 26/4 <> 26 * 3/4 + aUpdateRect = tools::Rectangle(Point(0, maBmpSize.Height() - maBmpSize.Height() / 4), + Size(maBmpSize.Width(), maBmpSize.Height() / 4)); + else + aUpdateRect = tools::Rectangle(Point(maBmpSize.Height() + 2, 2), + Point(maBmpSize.Width() - 3, maBmpSize.Height() - 3)); - pVirDev->Pop(); + pVirDev->Push(vcl::PushFlags::CLIPREGION); - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - mbWasHiContrastMode = rStyleSettings.GetHighContrastMode(); + // tdf#135121 don't include the part of the image which we will + // overwrite with the target color so that for the transparent color + // case the original background of the device is shown + vcl::Region aRegion(tools::Rectangle(Point(0, 0), maBmpSize)); + aRegion.Exclude(aUpdateRect); + pVirDev->SetClipRegion(aRegion); - if ((COL_TRANSPARENT != aColor) && (maBmpSize.Width() == maBmpSize.Height())) - pVirDev->SetLineColor(aColor); - else - pVirDev->SetLineColor(rStyleSettings.GetDisableColor()); + pVirDev->DrawImage(Point(0, 0), aImage); - // use not only COL_TRANSPARENT for detection of transparence, - // but the method/way which is designed to do that - const bool bIsFullyTransparent(aColor.IsFullyTransparent()); - maCurColor = aColor; + pVirDev->Pop(); - if (bIsFullyTransparent) - { - pVirDev->SetFillColor(); - } - else - { - pVirDev->SetFillColor(maCurColor); - } + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + mbWasHiContrastMode = rStyleSettings.GetHighContrastMode(); - pVirDev->DrawRect(aUpdateRect); + if ((COL_TRANSPARENT != aColor) && (maBmpSize.Width() == maBmpSize.Height())) + pVirDev->SetLineColor(aColor); + else + pVirDev->SetLineColor(rStyleSettings.GetDisableColor()); - SetImage(pVirDev.get()); - } + // use not only COL_TRANSPARENT for detection of transparence, + // but the method/way which is designed to do that + const bool bIsFullyTransparent(aColor.IsFullyTransparent()); + maCurColor = aColor; - OUString ToolboxButtonColorUpdaterBase::GetCurrentColorName() const + if (bIsFullyTransparent) { - OUString sColorName = GetQuickHelpText(); - // The obtained string is of format: color context (color name) - // Generate a substring which contains only the color name - sal_Int32 nStart = sColorName.indexOf('('); - sColorName = sColorName.copy( nStart + 1 ); - sal_Int32 nLength = sColorName.getLength(); - if(nLength > 0) - sColorName = sColorName.copy( 0, nLength - 1); - return sColorName; + pVirDev->SetFillColor(); } - - ToolboxButtonColorUpdater::ToolboxButtonColorUpdater(sal_uInt16 nSlotId, const OUString& rTbxBtnId, weld::Toolbar* ptrTbx, bool bWideButton, - const OUString& rCommandLabel, const css::uno::Reference<css::frame::XFrame>& rFrame) - : ToolboxButtonColorUpdaterBase(bWideButton, rCommandLabel, rTbxBtnId, nSlotId, rFrame) - , msBtnId(rTbxBtnId) - , mpTbx(ptrTbx) + else { - Init(nSlotId); + pVirDev->SetFillColor(maCurColor); } - void ToolboxButtonColorUpdater::SetQuickHelpText(const OUString& rText) - { - mpTbx->set_item_tooltip_text(msBtnId, rText); - } + pVirDev->DrawRect(aUpdateRect); - OUString ToolboxButtonColorUpdater::GetQuickHelpText() const - { - return mpTbx->get_item_tooltip_text(msBtnId); - } + SetImage(pVirDev.get()); +} - void ToolboxButtonColorUpdater::SetImage(VirtualDevice* pVirDev) - { - mpTbx->set_item_image(msBtnId, pVirDev); - } +OUString ToolboxButtonColorUpdaterBase::GetCurrentColorName() const +{ + OUString sColorName = GetQuickHelpText(); + // The obtained string is of format: color context (color name) + // Generate a substring which contains only the color name + sal_Int32 nStart = sColorName.indexOf('('); + sColorName = sColorName.copy(nStart + 1); + sal_Int32 nLength = sColorName.getLength(); + if (nLength > 0) + sColorName = sColorName.copy(0, nLength - 1); + return sColorName; +} - VclPtr<VirtualDevice> ToolboxButtonColorUpdater::CreateVirtualDevice() const - { - return mpTbx->create_virtual_device(); - } +ToolboxButtonColorUpdater::ToolboxButtonColorUpdater( + sal_uInt16 nSlotId, const OUString& rTbxBtnId, weld::Toolbar* ptrTbx, bool bWideButton, + const OUString& rCommandLabel, const css::uno::Reference<css::frame::XFrame>& rFrame) + : ToolboxButtonColorUpdaterBase(bWideButton, rCommandLabel, rTbxBtnId, nSlotId, rFrame) + , msBtnId(rTbxBtnId) + , mpTbx(ptrTbx) +{ + Init(nSlotId); +} - vcl::ImageType ToolboxButtonColorUpdater::GetImageSize() const - { - return mpTbx->get_icon_size(); - } +void ToolboxButtonColorUpdater::SetQuickHelpText(const OUString& rText) +{ + mpTbx->set_item_tooltip_text(msBtnId, rText); +} - Size ToolboxButtonColorUpdater::GetItemSize(const Size& rImageSize) const - { - auto nWidth = rImageSize.Width(); - if (mbWideButton) - nWidth = nWidth * 5; - return Size(nWidth, rImageSize.Height()); - } +OUString ToolboxButtonColorUpdater::GetQuickHelpText() const +{ + return mpTbx->get_item_tooltip_text(msBtnId); +} - ToolboxButtonLineStyleUpdater::ToolboxButtonLineStyleUpdater() - : m_eXLS(css::drawing::LineStyle_NONE) - , m_nDashStyleIndex(-1) - { - } +void ToolboxButtonColorUpdater::SetImage(VirtualDevice* pVirDev) +{ + mpTbx->set_item_image(msBtnId, pVirDev); +} + +VclPtr<VirtualDevice> ToolboxButtonColorUpdater::CreateVirtualDevice() const +{ + return mpTbx->create_virtual_device(); +} + +vcl::ImageType ToolboxButtonColorUpdater::GetImageSize() const { return mpTbx->get_icon_size(); } + +Size ToolboxButtonColorUpdater::GetItemSize(const Size& rImageSize) const +{ + auto nWidth = rImageSize.Width(); + if (mbWideButton) + nWidth = nWidth * 5; + return Size(nWidth, rImageSize.Height()); +} + +ToolboxButtonLineStyleUpdater::ToolboxButtonLineStyleUpdater() + : m_eXLS(css::drawing::LineStyle_NONE) + , m_nDashStyleIndex(-1) +{ +} - void ToolboxButtonLineStyleUpdater::Update(const css::frame::FeatureStateEvent& rEvent) +void ToolboxButtonLineStyleUpdater::Update(const css::frame::FeatureStateEvent& rEvent) +{ + if (rEvent.FeatureURL.Complete == ".uno:LineDash") { - if (rEvent.FeatureURL.Complete == ".uno:LineDash") - { - m_nDashStyleIndex = -1; + m_nDashStyleIndex = -1; - SfxObjectShell* pSh = SfxObjectShell::Current(); - if (!pSh) - return; - const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST ); - if (!pItem) - return; + SfxObjectShell* pSh = SfxObjectShell::Current(); + if (!pSh) + return; + const SvxDashListItem* pItem = pSh->GetItem(SID_DASH_LIST); + if (!pItem) + return; - XLineDashItem aDashItem; - aDashItem.PutValue(rEvent.State, 0); - const XDash& rDash = aDashItem.GetDashValue(); + XLineDashItem aDashItem; + aDashItem.PutValue(rEvent.State, 0); + const XDash& rDash = aDashItem.GetDashValue(); - XDashListRef xLineStyleList = pItem->GetDashList(); - for (tools::Long i = 0; i < xLineStyleList->Count(); ++i) + XDashListRef xLineStyleList = pItem->GetDashList(); + for (tools::Long i = 0; i < xLineStyleList->Count(); ++i) + { + const XDashEntry* pEntry = xLineStyleList->GetDash(i); + const XDash& rEntry = pEntry->GetDash(); + if (rDash == rEntry) { - const XDashEntry* pEntry = xLineStyleList->GetDash(i); - const XDash& rEntry = pEntry->GetDash(); - if (rDash == rEntry) - { - m_nDashStyleIndex = i; - break; - } + m_nDashStyleIndex = i; + break; } } - else if (rEvent.FeatureURL.Complete == ".uno:XLineStyle") - { - XLineStyleItem aLineStyleItem; - aLineStyleItem.PutValue(rEvent.State, 0); + } + else if (rEvent.FeatureURL.Complete == ".uno:XLineStyle") + { + XLineStyleItem aLineStyleItem; + aLineStyleItem.PutValue(rEvent.State, 0); - m_eXLS = aLineStyleItem.GetValue(); - } + m_eXLS = aLineStyleItem.GetValue(); } +} - int ToolboxButtonLineStyleUpdater::GetStyleIndex() const +int ToolboxButtonLineStyleUpdater::GetStyleIndex() const +{ + int nRet; + switch (m_eXLS) { - int nRet; - switch (m_eXLS) - { - case css::drawing::LineStyle_NONE: - nRet = 0; - break; - case css::drawing::LineStyle_SOLID: - nRet = 1; - break; - default: - nRet = m_nDashStyleIndex + 2; - break; - } - return nRet; + case css::drawing::LineStyle_NONE: + nRet = 0; + break; + case css::drawing::LineStyle_SOLID: + nRet = 1; + break; + default: + nRet = m_nDashStyleIndex + 2; + break; } + return nRet; +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 9ef603d748b5d438ee42fba61b5c95fed68c8675 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jul 28 12:31:36 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Jul 30 06:42:01 2025 +0200 svx: Replace ToolboxButtonColorUpdaterBase::maUpdRect with local var It's only used in ToolboxButtonColorUpdaterBase::Update and always assigned a new value before getting used, so doesn't need to be a class member. Change-Id: Ifa2afd9b61077d582ec922ff5967980cba4a7bf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188482 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/svx/inc/tbxcolorupdate.hxx b/svx/inc/tbxcolorupdate.hxx index b5a8b92501d3..cc07e3e0141d 100644 --- a/svx/inc/tbxcolorupdate.hxx +++ b/svx/inc/tbxcolorupdate.hxx @@ -73,7 +73,6 @@ namespace svx bool mbWasHiContrastMode; sal_uInt16 mnSlotId; Color maCurColor; - tools::Rectangle maUpdRect; Size maBmpSize; vcl::ImageType meImageType; OUString maCommandLabel; diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index 7c0caa19ceda..5aa5284eb9b6 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -264,11 +264,12 @@ namespace svx pVirDev->EnableOutput(false); } + tools::Rectangle aUpdateRect; if (maBmpSize.Width() == maBmpSize.Height()) // tdf#84985 align color bar with icon bottom edge; integer arithmetic e.g. 26 - 26/4 <> 26 * 3/4 - maUpdRect = tools::Rectangle(Point( 0, maBmpSize.Height() - maBmpSize.Height() / 4), Size(maBmpSize.Width(), maBmpSize.Height() / 4)); + aUpdateRect = tools::Rectangle(Point( 0, maBmpSize.Height() - maBmpSize.Height() / 4), Size(maBmpSize.Width(), maBmpSize.Height() / 4)); else - maUpdRect = tools::Rectangle(Point( maBmpSize.Height() + 2, 2), Point(maBmpSize.Width() - 3, maBmpSize.Height() - 3)); + aUpdateRect = tools::Rectangle(Point( maBmpSize.Height() + 2, 2), Point(maBmpSize.Width() - 3, maBmpSize.Height() - 3)); pVirDev->Push(vcl::PushFlags::CLIPREGION); @@ -276,7 +277,7 @@ namespace svx // overwrite with the target color so that for the transparent color // case the original background of the device is shown vcl::Region aRegion(tools::Rectangle(Point(0, 0), maBmpSize)); - aRegion.Exclude(maUpdRect); + aRegion.Exclude(aUpdateRect); pVirDev->SetClipRegion(aRegion); pVirDev->DrawImage(Point(0, 0), aImage); @@ -305,7 +306,7 @@ namespace svx pVirDev->SetFillColor(maCurColor); } - pVirDev->DrawRect(maUpdRect); + pVirDev->DrawRect(aUpdateRect); SetImage(pVirDev.get()); }