summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-15 13:25:02 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-11-15 20:36:15 +0100
commit1a137ef35d67a4aff7b2a6f1d3aa3c944c7a0b41 (patch)
treea58438c531649ae9fb513e57bb6e7612b5df7eb0 /vcl
parent9dceb75ec9af78df6f683443c7f4008076412903 (diff)
tdf#128495 measure preferred size of print preview relative to UI font
Change-Id: If04f50818fc94dd62263daaebc1c386b2d85c987 Reviewed-on: https://gerrit.libreoffice.org/82790 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/printdlg.hxx1
-rw-r--r--vcl/source/window/printdlg.cxx7
-rw-r--r--vcl/uiconfig/ui/printdialog.ui2
3 files changed, 8 insertions, 2 deletions
diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 33f9a7be94f4..5e8289d6b4d1 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -74,6 +74,7 @@ namespace vcl
PrintPreviewWindow(PrintDialog* pDialog);
virtual ~PrintPreviewWindow() override;
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
virtual bool Command( const CommandEvent& ) override;
virtual void Resize() override;
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 7750baf5039d..4a7105a777c9 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -145,6 +145,13 @@ void PrintDialog::PrintPreviewWindow::Resize()
preparePreviewBitmap();
}
+void PrintDialog::PrintPreviewWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
+{
+ pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 55,
+ pDrawingArea->get_text_height() * 40);
+ CustomWidgetController::SetDrawingArea(pDrawingArea);
+}
+
void PrintDialog::PrintPreviewWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
{
rRenderContext.Push();
diff --git a/vcl/uiconfig/ui/printdialog.ui b/vcl/uiconfig/ui/printdialog.ui
index d346bee170e9..1822f688a1c9 100644
--- a/vcl/uiconfig/ui/printdialog.ui
+++ b/vcl/uiconfig/ui/printdialog.ui
@@ -166,8 +166,6 @@
<property name="orientation">vertical</property>
<child>
<object class="GtkDrawingArea" id="preview">
- <property name="width_request">500</property>
- <property name="height_request">700</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_STRUCTURE_MASK | GDK_SCROLL_MASK</property>