diff options
author | Heiko Tietze <tietze.heiko@gmail.com> | 2021-02-09 12:03:08 +0100 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2021-02-27 20:19:17 +0100 |
commit | 149807eb6100090e178505ba4a264bb38eba1e0c (patch) | |
tree | b37315820a1632644be4655780d2964502a21963 /vcl/source/window | |
parent | 28e022c258682dc030668fed7879d9d3f078b720 (diff) |
Resolves tdf#127782 - Print dialog height
* Expander status remembered
* Fix default size for scrollwindow
* Window size remembered
* Window position center on parent
* Size doesn't depend on preview anymore
Change-Id: If14376ecd190f5d73e7cfad6f5f136d287778478
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110631
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/printdlg.cxx | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index a6352f16384a..e104f79fc81b 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -21,6 +21,8 @@ #include <svdata.hxx> #include <strings.hrc> #include <bitmaps.hlst> +#include <officecfg/Office/Common.hxx> +#include <vcl/windowstate.hxx> #include <vcl/QueueInfo.hxx> #include <vcl/commandevent.hxx> @@ -117,13 +119,6 @@ void PrintDialog::PrintPreviewWindow::Resize() preparePreviewBitmap(); } -void PrintDialog::PrintPreviewWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) -{ - pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 45, - pDrawingArea->get_text_height() * 30); - CustomWidgetController::SetDrawingArea(pDrawingArea); -} - void PrintDialog::PrintPreviewWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { rRenderContext.Push(); @@ -672,28 +667,42 @@ PrintDialog::PrintDialog(weld::Window* i_pWindow, const std::shared_ptr<PrinterC mxPageMarginEdt->connect_value_changed( LINK( this, PrintDialog, MetricSpinModifyHdl ) ); mxSheetMarginEdt->connect_value_changed( LINK( this, PrintDialog, MetricSpinModifyHdl ) ); - mxRangeExpander->connect_expanded(LINK( this, PrintDialog, ExpandHdl)); - mxLayoutExpander->connect_expanded(LINK( this, PrintDialog, ExpandHdl)); - updateNupFromPages(); // tdf#129180 Delay setting the default value in the Paper Size list // set paper sizes listbox setPaperSizes(); + mxRangeExpander->set_expanded( + officecfg::Office::Common::Print::Dialog::RangeSectionExpanded::get()); + mxLayoutExpander->set_expanded( + officecfg::Office::Common::Print::Dialog::LayoutSectionExpanded::get()); + // lock the dialog height, regardless of later expander state mxScrolledWindow->set_size_request( mxScrolledWindow->get_preferred_size().Width() + mxScrolledWindow->get_scroll_thickness(), - mxScrolledWindow->get_preferred_size().Height()); -} + 450); -IMPL_LINK_NOARG(PrintDialog, ExpandHdl, weld::Expander&, void) -{ - m_xDialog->resize_to_request(); + // restore dialog size + std::optional<long> aWidth = officecfg::Office::Common::Print::Dialog::Width::get(); + std::optional<long> aHeight = officecfg::Office::Common::Print::Dialog::Height::get(); + WindowStateData aState; + if (aWidth) aState.SetWidth(*aWidth); else aWidth = -1; + if (aHeight) aState.SetHeight(*aHeight); else aHeight = -1; + aState.SetMask(WindowStateMask::Width | WindowStateMask::Height); + m_xDialog->set_window_state(aState.ToStr()); + + m_xDialog->set_centered_on_parent(true); } PrintDialog::~PrintDialog() { + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Print::Dialog::RangeSectionExpanded::set(mxRangeExpander->get_expanded(), batch); + officecfg::Office::Common::Print::Dialog::LayoutSectionExpanded::set(mxLayoutExpander->get_expanded(), batch); + officecfg::Office::Common::Print::Dialog::Width::set(m_xDialog->get_size().getWidth(), batch); + officecfg::Office::Common::Print::Dialog::Height::set(m_xDialog->get_size().getHeight(), batch); + batch->commit(); } void PrintDialog::setupPaperSidesBox() |