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>
This commit is contained in:
parent
28e022c258
commit
149807eb61
3 changed files with 51 additions and 18 deletions
|
@ -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>
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue