[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Dec 13 15:40:38 UTC 2018
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 f890035cf98cdd86d661dc3a6d29ac2f0308d2f4
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 12 11:52:48 2018 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Dec 13 16:40:13 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 <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 7b8f23c17cabbcb4910e8428d87aff2cac91f804)
Reviewed-on: https://gerrit.libreoffice.org/65101
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 1030d21c796a..b2d5d0673533 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;
More information about the Libreoffice-commits
mailing list