[Libreoffice-commits] core.git: officecfg/registry vcl/inc vcl/source

Heiko Tietze (via logerrit) logerrit at kemper.freedesktop.org
Sat Feb 27 19:19:53 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 149807eb6100090e178505ba4a264bb38eba1e0c
Author:     Heiko Tietze <tietze.heiko at gmail.com>
AuthorDate: Tue Feb 9 12:03:08 2021 +0100
Commit:     Heiko Tietze <heiko.tietze at documentfoundation.org>
CommitDate: Sat Feb 27 20:19:17 2021 +0100

    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>

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index be60d3d19ec3..0739d3289518 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -3486,6 +3486,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:long">
+          <info>
+            <desc>Stores the width of the print dialog.</desc>
+          </info>
+        </prop>
+        <prop oor:name="Height" oor:type="xs:long">
+          <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 ee3c1896672e..847ac8b62164 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 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()


More information about the Libreoffice-commits mailing list