include/svx/dlgctrl.hxx | 35 ---------- svx/source/dialog/dlgctrl.cxx | 140 ------------------------------------------ 2 files changed, 175 deletions(-)
New commits: commit a734dcdd10c7912ae2fbaef4062756f80a00814d Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Oct 1 13:58:46 2018 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Oct 1 20:36:44 2018 +0200 SvxPreviewBase is now unused Change-Id: If8b83b277b71307e87e155c544f6e295b1192f75 Reviewed-on: https://gerrit.libreoffice.org/61191 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 6238c4a3c21d..8193163b5905 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -335,41 +335,6 @@ class SdrObject; class SdrPathObj; class SdrModel; -class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI SvxPreviewBase : public Control -{ -private: - std::unique_ptr<SdrModel> mpModel; - VclPtr<VirtualDevice> mpBufferDevice; - -protected: - void InitSettings(bool bForeground, bool bBackground); - - // prepare buffered paint - void LocalPrePaint(vcl::RenderContext const & rRenderContext); - - // end and output buffered paint - void LocalPostPaint(vcl::RenderContext& rRenderContext); - -public: - SvxPreviewBase(vcl::Window* pParent); - virtual ~SvxPreviewBase() override; - virtual void dispose() override; - - // change support - virtual void StateChanged(StateChangedType nStateChange) override; - virtual void DataChanged(const DataChangedEvent& rDCEvt) override; - - // dada read access - SdrModel& getModel() const - { - return *mpModel; - } - OutputDevice& getBufferDevice() const - { - return *mpBufferDevice; - } -}; - class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI PreviewBase : public weld::CustomWidgetController { private: diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index dbf5be9a034f..4830da68e9c7 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1196,146 +1196,6 @@ void SvxLineEndLB::Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const Bi } } -void SvxPreviewBase::InitSettings(bool bForeground, bool bBackground) -{ - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - if(bForeground) - { - svtools::ColorConfig aColorConfig; - Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor); - - if(IsControlForeground()) - { - aTextColor = GetControlForeground(); - } - - getBufferDevice().SetTextColor(aTextColor); - } - - if(bBackground) - { - if(IsControlBackground()) - { - getBufferDevice().SetBackground(GetControlBackground()); - } - else - { - getBufferDevice().SetBackground(rStyleSettings.GetWindowColor()); - } - } - - // do not paint background self, it gets painted buffered - SetControlBackground(); - SetBackground(); - - Invalidate(); -} - -SvxPreviewBase::SvxPreviewBase(vcl::Window* pParent) - : Control(pParent, WB_BORDER) - , mpModel(new SdrModel(nullptr, nullptr, true)) - , mpBufferDevice(VclPtr<VirtualDevice>::Create(*this)) -{ - // Draw the control's border as a flat thin black line. - SetBorderStyle(WindowBorderStyle::MONO); - SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); - SetMapMode(MapMode(MapUnit::Map100thMM)); - - // init model - mpModel->GetItemPool().FreezeIdRanges(); -} - -SvxPreviewBase::~SvxPreviewBase() -{ - disposeOnce(); -} - -void SvxPreviewBase::dispose() -{ - mpModel.reset(); - mpBufferDevice.disposeAndClear(); - Control::dispose(); -} - -void SvxPreviewBase::LocalPrePaint(vcl::RenderContext const & rRenderContext) -{ - // init BufferDevice - if (mpBufferDevice->GetOutputSizePixel() != GetOutputSizePixel()) - { - mpBufferDevice->SetDrawMode(rRenderContext.GetDrawMode()); - mpBufferDevice->SetSettings(rRenderContext.GetSettings()); - mpBufferDevice->SetAntialiasing(rRenderContext.GetAntialiasing()); - mpBufferDevice->SetOutputSizePixel(GetOutputSizePixel()); - mpBufferDevice->SetMapMode(rRenderContext.GetMapMode()); - } - - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - if (rStyleSettings.GetPreviewUsesCheckeredBackground()) - { - const Point aNull(0, 0); - static const sal_uInt32 nLen(8); - static const Color aW(COL_WHITE); - static const Color aG(0xef, 0xef, 0xef); - const bool bWasEnabled(mpBufferDevice->IsMapModeEnabled()); - - mpBufferDevice->EnableMapMode(false); - mpBufferDevice->DrawCheckered(aNull, mpBufferDevice->GetOutputSizePixel(), nLen, aW, aG); - mpBufferDevice->EnableMapMode(bWasEnabled); - } - else - { - mpBufferDevice->Erase(); - } -} - -void SvxPreviewBase::LocalPostPaint(vcl::RenderContext& rRenderContext) -{ - // copy to front (in pixel mode) - const bool bWasEnabledSrc(mpBufferDevice->IsMapModeEnabled()); - const bool bWasEnabledDst(IsMapModeEnabled()); - const Point aEmptyPoint; - - mpBufferDevice->EnableMapMode(false); - rRenderContext.EnableMapMode(false); - - rRenderContext.DrawOutDev(aEmptyPoint, GetOutputSizePixel(), - aEmptyPoint, GetOutputSizePixel(), - *mpBufferDevice); - - mpBufferDevice->EnableMapMode(bWasEnabledSrc); - rRenderContext.EnableMapMode(bWasEnabledDst); -} - -void SvxPreviewBase::StateChanged(StateChangedType nType) -{ - Control::StateChanged(nType); - - if(StateChangedType::ControlForeground == nType) - { - InitSettings(true, false); - } - else if(StateChangedType::ControlBackground == nType) - { - InitSettings(false, true); - } -} - -void SvxPreviewBase::DataChanged(const DataChangedEvent& rDCEvt) -{ - SetDrawMode(GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR); - - if((DataChangedEventType::SETTINGS == rDCEvt.GetType()) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) - { - InitSettings(true, true); - } - else - { - Control::DataChanged(rDCEvt); - } -} - void SvxXLinePreview::Resize() { PreviewBase::Resize(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits