diff options
author | Heiko Tietze <tietze.heiko@gmail.com> | 2021-02-09 12:03:08 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-05-01 20:59:07 +0200 |
commit | 1ca94b11dc2ce07202045456189b30939e93b363 (patch) | |
tree | e0a5dab8fd9a69f1c82726e0dfba25b28d508ca9 | |
parent | eaf775e715a97b237c0c6c3f3a8e2bd6e411af0e (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>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114821
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 27 | ||||
-rw-r--r-- | vcl/inc/printdlg.hxx | 3 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 39 |
3 files changed, 51 insertions, 18 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 579c66c5e018..49018a07ca17 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -3495,6 +3495,33 @@ </prop> </group> </group> + <group oor:name="Dialog"> + <info> + <desc>User-settings on the printer dialog</desc> + </info> + <prop oor:name="RangeSectionExpanded" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Determines whether the range section should be expanded.</desc> + </info> + <value>false</value> + </prop> + <prop oor:name="LayoutSectionExpanded" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Determines whether the layout section should be expanded.</desc> + </info> + <value>false</value> + </prop> + <prop oor:name="Width" oor:type="xs:int"> + <info> + <desc>Stores the width of the print dialog.</desc> + </info> + </prop> + <prop oor:name="Height" oor:type="xs:int"> + <info> + <desc>Stores the height of the print dialog.</desc> + </info> + </prop> + </group> </group> <group oor:name="AddXMLToStorage"> <info> diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx index 60839b07382f..db1e6a73bcfc 100644 --- a/vcl/inc/printdlg.hxx +++ b/vcl/inc/printdlg.hxx @@ -60,7 +60,6 @@ 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; @@ -226,8 +225,6 @@ namespace vcl DECL_LINK( UIOption_SpinModifyHdl, weld::SpinButton&, void ); DECL_LINK( UIOption_EntryModifyHdl, weld::Entry&, void ); - DECL_LINK( ExpandHdl, weld::Expander&, void ); - css::beans::PropertyValue* getValueForWindow(weld::Widget*) const; void preparePreview( bool i_bMayUseCache ); diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 2d5ebf2a49a8..6583e1891e52 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_vscroll_width(), - 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() |