sw/source/ui/config/optload.cxx | 56 ++------------------------------------- sw/source/uibase/inc/cption.hxx | 2 - sw/source/uibase/inc/optload.hxx | 20 ++----------- 3 files changed, 8 insertions(+), 70 deletions(-)
New commits: commit 7b8f23c17cabbcb4910e8428d87aff2cac91f804 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Dec 12 11:52:48 2018 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Dec 12 21:21:00 2018 +0100 drop unused SwCaptionPreview an rename CaptionPreview back to SwCaptionPreview Change-Id: I24d6f2c66f1c2b152b7d625501ea6fe39d2161ae Reviewed-on: https://gerrit.libreoffice.org/65015 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index f4c2edff172f..119d23825339 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -402,14 +402,11 @@ SwCaptionOptDlg::SwCaptionOptDlg(weld::Window* pParent, const SfxItemSet& rSet) SetTabPage(SwCaptionOptPage::Create(aParent, &rSet)); } -SwCaptionPreview::SwCaptionPreview(vcl::Window* pParent, WinBits nStyle) - : Window(pParent, nStyle) - , mbFontInitialized(false) +SwCaptionPreview::SwCaptionPreview() + : mbFontInitialized(false) { } -VCL_BUILDER_FACTORY_CONSTRUCTOR(SwCaptionPreview, 0) - void SwCaptionPreview::ApplySettings(vcl::RenderContext& rRenderContext) { Wallpaper aBack(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor()); @@ -424,8 +421,6 @@ void SwCaptionPreview::ApplySettings(vcl::RenderContext& rRenderContext) mbFontInitialized = true; } rRenderContext.SetFont(maFont); - - SetBorderStyle(WindowBorderStyle::MONO); } void SwCaptionPreview::SetPreviewText(const OUString& rText) @@ -437,57 +432,14 @@ void SwCaptionPreview::SetPreviewText(const OUString& rText) } } -Size SwCaptionPreview::GetOptimalSize() const -{ - return LogicToPixel(Size(106 , 20), MapMode(MapUnit::MapAppFont)); -} - -void SwCaptionPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) -{ - Window::Paint(rRenderContext, rRect); - - rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), GetSizePixel())); - rRenderContext.DrawText(Point(4, 6), maText); -} - -CaptionPreview::CaptionPreview() - : mbFontInitialized(false) -{ -} - -void CaptionPreview::ApplySettings(vcl::RenderContext& rRenderContext) -{ - Wallpaper aBack(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor()); - rRenderContext.SetBackground(aBack); - rRenderContext.SetFillColor(aBack.GetColor()); - rRenderContext.SetLineColor(aBack.GetColor()); - - if (!mbFontInitialized) - { - maFont = rRenderContext.GetFont(); - maFont.SetFontHeight(maFont.GetFontHeight() * 120 / 100); - mbFontInitialized = true; - } - rRenderContext.SetFont(maFont); -} - -void CaptionPreview::SetPreviewText(const OUString& rText) -{ - if (rText != maText) - { - maText = rText; - Invalidate(); - } -} - -void CaptionPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea) +void SwCaptionPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea) { CustomWidgetController::SetDrawingArea(pDrawingArea); Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(106 , 20), MapMode(MapUnit::MapAppFont))); pDrawingArea->set_size_request(aSize.Width(), aSize.Height()); } -void CaptionPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) +void SwCaptionPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { ApplySettings(rRenderContext); diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx index fc3be92a3adf..8f3de7db57ce 100644 --- a/sw/source/uibase/inc/cption.hxx +++ b/sw/source/uibase/inc/cption.hxx @@ -43,7 +43,7 @@ class SwCaptionDialog : public SfxDialogController css::uno::Reference< css::container::XNameAccess > xNameAccess; - CaptionPreview m_aPreview; + SwCaptionPreview m_aPreview; std::unique_ptr<weld::Entry> m_xTextEdit; std::unique_ptr<weld::ComboBox> m_xCategoryBox; std::unique_ptr<weld::Label> m_xFormatText; diff --git a/sw/source/uibase/inc/optload.hxx b/sw/source/uibase/inc/optload.hxx index 6f23242811b6..7f19f94f7536 100644 --- a/sw/source/uibase/inc/optload.hxx +++ b/sw/source/uibase/inc/optload.hxx @@ -101,21 +101,7 @@ public: SwCaptionOptDlg(weld::Window* pParent, const SfxItemSet& rSet); }; -class SwCaptionPreview : public vcl::Window -{ -private: - OUString maText; - bool mbFontInitialized; - vcl::Font maFont; -public: - SwCaptionPreview(vcl::Window* pParent, WinBits nStyle); - virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; - void SetPreviewText( const OUString& rText ); - virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; - virtual Size GetOptimalSize() const override; -}; - -class CaptionPreview : public weld::CustomWidgetController +class SwCaptionPreview : public weld::CustomWidgetController { private: OUString maText; @@ -125,7 +111,7 @@ private: void ApplySettings(vcl::RenderContext& rRenderContext); public: - CaptionPreview(); + SwCaptionPreview(); virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; void SetPreviewText(const OUString& rText); virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; @@ -158,7 +144,7 @@ private: TextFilterAutoConvert m_aTextFilter; - CaptionPreview m_aPreview; + SwCaptionPreview m_aPreview; std::unique_ptr<weld::TreeView> m_xCheckLB; std::unique_ptr<weld::ComboBox> m_xLbCaptionOrder; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits