Kaydet (Commit) 7b8f23c1 authored tarafından Caolán McNamara's avatar Caolán McNamara

drop unused SwCaptionPreview

an rename CaptionPreview back to SwCaptionPreview

Change-Id: I24d6f2c66f1c2b152b7d625501ea6fe39d2161ae
Reviewed-on: https://gerrit.libreoffice.org/65015
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 72ebf150
...@@ -402,14 +402,11 @@ SwCaptionOptDlg::SwCaptionOptDlg(weld::Window* pParent, const SfxItemSet& rSet) ...@@ -402,14 +402,11 @@ SwCaptionOptDlg::SwCaptionOptDlg(weld::Window* pParent, const SfxItemSet& rSet)
SetTabPage(SwCaptionOptPage::Create(aParent, &rSet)); SetTabPage(SwCaptionOptPage::Create(aParent, &rSet));
} }
SwCaptionPreview::SwCaptionPreview(vcl::Window* pParent, WinBits nStyle) SwCaptionPreview::SwCaptionPreview()
: Window(pParent, nStyle) : mbFontInitialized(false)
, mbFontInitialized(false)
{ {
} }
VCL_BUILDER_FACTORY_CONSTRUCTOR(SwCaptionPreview, 0)
void SwCaptionPreview::ApplySettings(vcl::RenderContext& rRenderContext) void SwCaptionPreview::ApplySettings(vcl::RenderContext& rRenderContext)
{ {
Wallpaper aBack(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor()); Wallpaper aBack(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor());
...@@ -424,8 +421,6 @@ void SwCaptionPreview::ApplySettings(vcl::RenderContext& rRenderContext) ...@@ -424,8 +421,6 @@ void SwCaptionPreview::ApplySettings(vcl::RenderContext& rRenderContext)
mbFontInitialized = true; mbFontInitialized = true;
} }
rRenderContext.SetFont(maFont); rRenderContext.SetFont(maFont);
SetBorderStyle(WindowBorderStyle::MONO);
} }
void SwCaptionPreview::SetPreviewText(const OUString& rText) void SwCaptionPreview::SetPreviewText(const OUString& rText)
...@@ -437,57 +432,14 @@ void SwCaptionPreview::SetPreviewText(const OUString& rText) ...@@ -437,57 +432,14 @@ void SwCaptionPreview::SetPreviewText(const OUString& rText)
} }
} }
Size SwCaptionPreview::GetOptimalSize() const void SwCaptionPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea)
{
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)
{ {
CustomWidgetController::SetDrawingArea(pDrawingArea); CustomWidgetController::SetDrawingArea(pDrawingArea);
Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(106 , 20), MapMode(MapUnit::MapAppFont))); Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(106 , 20), MapMode(MapUnit::MapAppFont)));
pDrawingArea->set_size_request(aSize.Width(), aSize.Height()); 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); ApplySettings(rRenderContext);
......
...@@ -43,7 +43,7 @@ class SwCaptionDialog : public SfxDialogController ...@@ -43,7 +43,7 @@ class SwCaptionDialog : public SfxDialogController
css::uno::Reference< css::container::XNameAccess > xNameAccess; css::uno::Reference< css::container::XNameAccess > xNameAccess;
CaptionPreview m_aPreview; SwCaptionPreview m_aPreview;
std::unique_ptr<weld::Entry> m_xTextEdit; std::unique_ptr<weld::Entry> m_xTextEdit;
std::unique_ptr<weld::ComboBox> m_xCategoryBox; std::unique_ptr<weld::ComboBox> m_xCategoryBox;
std::unique_ptr<weld::Label> m_xFormatText; std::unique_ptr<weld::Label> m_xFormatText;
......
...@@ -101,21 +101,7 @@ public: ...@@ -101,21 +101,7 @@ public:
SwCaptionOptDlg(weld::Window* pParent, const SfxItemSet& rSet); SwCaptionOptDlg(weld::Window* pParent, const SfxItemSet& rSet);
}; };
class SwCaptionPreview : public vcl::Window class SwCaptionPreview : public weld::CustomWidgetController
{
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
{ {
private: private:
OUString maText; OUString maText;
...@@ -125,7 +111,7 @@ private: ...@@ -125,7 +111,7 @@ private:
void ApplySettings(vcl::RenderContext& rRenderContext); void ApplySettings(vcl::RenderContext& rRenderContext);
public: public:
CaptionPreview(); SwCaptionPreview();
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
void SetPreviewText(const OUString& rText); void SetPreviewText(const OUString& rText);
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
...@@ -158,7 +144,7 @@ private: ...@@ -158,7 +144,7 @@ private:
TextFilterAutoConvert m_aTextFilter; TextFilterAutoConvert m_aTextFilter;
CaptionPreview m_aPreview; SwCaptionPreview m_aPreview;
std::unique_ptr<weld::TreeView> m_xCheckLB; std::unique_ptr<weld::TreeView> m_xCheckLB;
std::unique_ptr<weld::ComboBox> m_xLbCaptionOrder; std::unique_ptr<weld::ComboBox> m_xLbCaptionOrder;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment