[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - officecfg/registry vcl/inc vcl/source
Heiko Tietze (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 29 03:49:12 UTC 2021
officecfg/registry/schema/org/openoffice/Office/Common.xcs | 27 +++++++++
vcl/inc/printdlg.hxx | 3 -
vcl/source/window/printdlg.cxx | 39 ++++++++-----
3 files changed, 51 insertions(+), 18 deletions(-)
New commits:
commit 252bdaaf85466cc97cbd9e79390e24b68bc3ecb6
Author: Heiko Tietze <tietze.heiko at gmail.com>
AuthorDate: Tue Feb 9 12:03:08 2021 +0100
Commit: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Thu Apr 29 05:48:33 2021 +0200
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 at documentfoundation.org>
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114821
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 99b4104f6499..cf1695b2cc2a 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()
More information about the Libreoffice-commits
mailing list