extras/source/glade/libreoffice-catalog.xml.in | 6 include/vcl/ivctrl.hxx | 1 include/vcl/oldprintadaptor.hxx | 7 include/vcl/print.hxx | 4 include/vcl/weld.hxx | 2 sd/uiconfig/sdraw/ui/drawprinteroptions.ui | 8 sd/uiconfig/simpress/ui/impressprinteroptions.ui | 14 sfx2/source/view/viewprn.cxx | 2 solenv/bin/native-code.py | 2 solenv/sanitizers/ui/vcl.suppr | 5 starmath/uiconfig/smath/ui/printeroptions.ui | 13 sw/uiconfig/swriter/ui/printeroptions.ui | 2 vcl/inc/printdlg.hxx | 180 +- vcl/inc/strings.hrc | 1 vcl/source/app/salvtables.cxx | 20 vcl/source/control/ivctrl.cxx | 8 vcl/source/gdi/oldprintadaptor.cxx | 4 vcl/source/gdi/print3.cxx | 29 vcl/source/window/printdlg.cxx | 1169 ++++++++-------- vcl/uiconfig/ui/printdialog.ui | 1626 +++++++++++------------ vcl/unx/gtk3/gtk3gtkinst.cxx | 60 21 files changed, 1570 insertions(+), 1593 deletions(-)
New commits: commit bab77fcf8b80594fb49561254dfbaea381da8934 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Oct 1 10:20:29 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Oct 2 20:28:28 2019 +0200 weld PrintDialog Change-Id: Id4adbe484f88be74f45dab8e7ef426c66e5cbc8b Reviewed-on: https://gerrit.libreoffice.org/80002 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 7bd0c3fe56e7..be9027649209 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -131,12 +131,6 @@ <glade-widget-class title="Table Preview" name="swuilo-AutoFmtPreview" generic-name="Table Preview Window" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> - <glade-widget-class title="Print Preview" name="vcllo-PrintPreviewWindow" - generic-name="Print Preview" parent="GtkDrawingArea" - icon-name="widget-gtk-drawingarea"/> - <glade-widget-class title="NUP Preview" name="vcllo-ShowNupOrderWindow" - generic-name="NUP Preview" parent="GtkDrawingArea" - icon-name="widget-gtk-drawingarea"/> <glade-widget-class title="Content List Box" name="sfxlo-ContentListBox" generic-name="Content List Box" parent="GtkTreeView" diff --git a/include/vcl/ivctrl.hxx b/include/vcl/ivctrl.hxx index e7b89f1bc2f1..16bead7c913f 100644 --- a/include/vcl/ivctrl.hxx +++ b/include/vcl/ivctrl.hxx @@ -320,6 +320,7 @@ public: void SetDeactivatePageHdl( const Link<VerticalTabControl*, bool>& rLink ) { m_aDeactivateHdl = rLink; } OUString GetPageText(const OString& rPageId) const; + void SetPageText(const OString& rPageId, const OUString& rText); vcl::Window* GetPageParent() { return m_xBox.get(); } }; diff --git a/include/vcl/oldprintadaptor.hxx b/include/vcl/oldprintadaptor.hxx index 53e0d3d7bbfb..3e8e60bf82fb 100644 --- a/include/vcl/oldprintadaptor.hxx +++ b/include/vcl/oldprintadaptor.hxx @@ -23,6 +23,11 @@ #include <memory> #include <vcl/print.hxx> +namespace weld +{ + class Window; +} + namespace vcl { struct ImplOldStyleAdaptorData; @@ -30,7 +35,7 @@ namespace vcl { std::unique_ptr<ImplOldStyleAdaptorData> mpData; public: - OldStylePrintAdaptor(const VclPtr<Printer>&, const VclPtr<vcl::Window>&); + OldStylePrintAdaptor(const VclPtr<Printer>&, weld::Window*); virtual ~OldStylePrintAdaptor() override; void StartPage(); diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 86d65513829c..154ee694bd83 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -394,7 +394,7 @@ class VCL_DLLPUBLIC PrinterController std::unique_ptr<ImplPrinterControllerData> mpImplData; protected: - PrinterController( const VclPtr<Printer>&, const VclPtr<vcl::Window>& ); + PrinterController(const VclPtr<Printer>&, weld::Window*); public: struct MultiPageSetup { @@ -436,7 +436,7 @@ public: virtual ~PrinterController(); const VclPtr<Printer>& getPrinter() const; - const VclPtr<vcl::Window>& getWindow() const; + weld::Window* getWindow() const; /** For implementations: get current job properties as changed by e.g. print dialog diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index afd6266c377e..67050d3f30ce 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -334,11 +334,13 @@ protected: public: virtual int get_current_page() const = 0; + virtual OString get_page_ident(int nPage) const = 0; virtual OString get_current_page_ident() const = 0; virtual void set_current_page(int nPage) = 0; virtual void set_current_page(const OString& rIdent) = 0; virtual void remove_page(const OString& rIdent) = 0; virtual void append_page(const OString& rIdent, const OUString& rLabel) = 0; + virtual void set_tab_label_text(const OString& rIdent, const OUString& rLabel) = 0; virtual OUString get_tab_label_text(const OString& rIdent) const = 0; virtual int get_n_pages() const = 0; virtual weld::Container* get_page(const OString& rIdent) const = 0; diff --git a/sd/uiconfig/sdraw/ui/drawprinteroptions.ui b/sd/uiconfig/sdraw/ui/drawprinteroptions.ui index c8df16d0a8ce..605507f27ee8 100644 --- a/sd/uiconfig/sdraw/ui/drawprinteroptions.ui +++ b/sd/uiconfig/sdraw/ui/drawprinteroptions.ui @@ -108,7 +108,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">grayscale</property> </object> <packing> <property name="expand">False</property> @@ -126,7 +125,7 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">blackandwhite</property> + <property name="group">originalcolors</property> </object> <packing> <property name="expand">False</property> @@ -201,7 +200,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">fittoprintable</property> </object> <packing> <property name="expand">False</property> @@ -219,7 +217,7 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">distributeonmultiple</property> + <property name="group">originalsize</property> </object> <packing> <property name="expand">False</property> @@ -237,7 +235,7 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">tilesheet</property> + <property name="group">originalsize</property> </object> <packing> <property name="expand">False</property> diff --git a/sd/uiconfig/simpress/ui/impressprinteroptions.ui b/sd/uiconfig/simpress/ui/impressprinteroptions.ui index 15a90c45181c..8679a74ebf26 100644 --- a/sd/uiconfig/simpress/ui/impressprinteroptions.ui +++ b/sd/uiconfig/simpress/ui/impressprinteroptions.ui @@ -71,7 +71,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="impressdocument"> + <object class="GtkComboBoxText" id="impressdocument"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -81,7 +81,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="slidesperpage"> + <object class="GtkComboBoxText" id="slidesperpage"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -91,7 +91,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="slidesperpageorder"> + <object class="GtkComboBoxText" id="slidesperpageorder"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -236,7 +236,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">grayscale</property> </object> <packing> <property name="expand">False</property> @@ -254,7 +253,7 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">blackandwhite</property> + <property name="group">originalcolors</property> </object> <packing> <property name="expand">False</property> @@ -329,7 +328,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">fittoprintable</property> </object> <packing> <property name="expand">False</property> @@ -347,7 +345,7 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">distributeonmultiple</property> + <property name="group">originalsize</property> </object> <packing> <property name="expand">False</property> @@ -365,7 +363,7 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">tilesheet</property> + <property name="group">originalsize</property> </object> <packing> <property name="expand">False</property> diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 73f5e6e48546..608badc8ef16 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -107,7 +107,7 @@ SfxPrinterController::SfxPrinterController( const VclPtr<Printer>& i_rPrinter, SfxViewShell* pView, const uno::Sequence< beans::PropertyValue >& rProps ) - : PrinterController(i_rPrinter, pView ? pView->GetWindow() : nullptr) + : PrinterController(i_rPrinter, pView ? pView->GetFrameWeld() : nullptr) , maCompleteSelection( i_rComplete ) , maSelection( i_rSelection ) , mxRenderable( i_xRender ) diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 399b2f12d227..0991a93a4626 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -491,8 +491,6 @@ custom_widgets = [ 'SdPageObjsTLB', 'SearchBox', 'SearchResultsBox', - 'ShowNupOrderWindow', - 'ShowNupOrderWindow', 'SidebarDialControl', 'SidebarToolBox', 'SpacingListBox', diff --git a/solenv/sanitizers/ui/vcl.suppr b/solenv/sanitizers/ui/vcl.suppr index 32ada0b6a32f..e5ad013909f9 100644 --- a/solenv/sanitizers/ui/vcl.suppr +++ b/solenv/sanitizers/ui/vcl.suppr @@ -4,13 +4,12 @@ vcl/uiconfig/ui/aboutbox.ui://GtkTextView[@id='version'] no-labelled-by vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='description'] orphan-label vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='copyright'] orphan-label vcl/uiconfig/ui/cupspassworddialog.ui://GtkLabel[@id='text'] orphan-label -vcl/uiconfig/ui/printdialog.ui://GtkSpinButton[@id='pageedit-nospin'] no-labelled-by +vcl/uiconfig/ui/printdialog.ui://GtkEntry[@id='pageedit-nospin'] no-labelled-by vcl/uiconfig/ui/printdialog.ui://GtkLabel[@id='totalnumpages'] orphan-label vcl/uiconfig/ui/printdialog.ui://GtkImage[@id='collateimage'] no-labelled-by -vcl/uiconfig/ui/printdialog.ui://vcllo-ShowNupOrderWindow[@id='orderpreview'] no-labelled-by vcl/uiconfig/ui/printdialog.ui://GtkLabel[@id='pagemargintxt2'] orphan-label vcl/uiconfig/ui/printdialog.ui://GtkLabel[@id='sheetmargintxt2'] orphan-label -vcl/uiconfig/ui/printdialog.ui://GtkComboBox[@id='scriptdirection'] no-labelled-by +vcl/uiconfig/ui/printdialog.ui://GtkComboBoxText[@id='scriptdirection'] no-labelled-by vcl/uiconfig/ui/printerdevicepage.ui://GtkEntry[@id='custom'] no-labelled-by vcl/uiconfig/ui/printprogressdialog.ui://GtkLabel[@id='label'] orphan-label vcl/uiconfig/ui/printprogressdialog.ui://GtkProgressBar[@id='progressbar'] no-labelled-by diff --git a/starmath/uiconfig/smath/ui/printeroptions.ui b/starmath/uiconfig/smath/ui/printeroptions.ui index 24163dad42f6..9c500f953c87 100644 --- a/starmath/uiconfig/smath/ui/printeroptions.ui +++ b/starmath/uiconfig/smath/ui/printeroptions.ui @@ -1,7 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sm"> <requires lib="gtk+" version="3.18"/> + <object class="GtkAdjustment" id="adjustment1"> + <property name="lower">10</property> + <property name="upper">1000</property> + <property name="value">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkBox" id="box"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -124,7 +131,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">fittopage</property> </object> <packing> <property name="expand">False</property> @@ -141,7 +147,7 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">scaling</property> + <property name="group">originalsize</property> </object> <packing> <property name="expand">False</property> @@ -175,6 +181,7 @@ <object class="GtkSpinButton" id="scalingspin"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="adjustment">adjustment1</property> </object> <packing> <property name="expand">False</property> diff --git a/sw/uiconfig/swriter/ui/printeroptions.ui b/sw/uiconfig/swriter/ui/printeroptions.ui index 36f9d87bff2e..21e4ad669159 100644 --- a/sw/uiconfig/swriter/ui/printeroptions.ui +++ b/sw/uiconfig/swriter/ui/printeroptions.ui @@ -126,7 +126,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="writercomments"> + <object class="GtkComboBoxText" id="writercomments"> <property name="visible">True</property> <property name="can_focus">False</property> </object> diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx index 4aad50314fc4..8328b6315d73 100644 --- a/vcl/inc/printdlg.hxx +++ b/vcl/inc/printdlg.hxx @@ -20,15 +20,12 @@ #ifndef VCL_INC_NEWPRINTDLG_HXX #define VCL_INC_NEWPRINTDLG_HXX -#include <vcl/print.hxx> -#include <vcl/dialog.hxx> -#include <vcl/fixed.hxx> -#include <vcl/button.hxx> -#include <vcl/field.hxx> -#include <vcl/layout.hxx> -#include <vcl/tabctrl.hxx> +#include <vcl/bitmapex.hxx> #include <vcl/gdimtf.hxx> +#include <vcl/print.hxx> +#include <vcl/customweld.hxx> #include <vcl/weld.hxx> +#include <map> namespace vcl { class PrintDialog; @@ -38,7 +35,7 @@ namespace vcl { class MoreOptionsDialog : public weld::GenericDialogController { - VclPtr<PrintDialog> mpParent; + PrintDialog* mpParent; std::unique_ptr<weld::Button> mxOKButton; std::unique_ptr<weld::Button> mxCancelButton; std::unique_ptr<weld::CheckButton> mxSingleJobsBox; @@ -47,17 +44,18 @@ namespace vcl public: - MoreOptionsDialog( VclPtr<PrintDialog> i_pParent ); + MoreOptionsDialog(PrintDialog* i_pParent); virtual ~MoreOptionsDialog() override; }; - class PrintDialog : public ModalDialog + class PrintDialog : public weld::GenericDialogController { friend class MoreOptionsDialog; public: - class PrintPreviewWindow : public vcl::Window + class PrintPreviewWindow : public weld::CustomWidgetController { + PrintDialog* mpDialog; GDIMetaFile maMtf; Size maOrigSize; Size maPreviewSize; @@ -65,20 +63,19 @@ namespace vcl sal_Int32 mnDPIY; BitmapEx maPreviewBitmap; OUString maReplacementString; - OUString const maToolTipString; bool mbGreyscale; - VclPtr<FixedLine> maHorzDim; - VclPtr<FixedLine> maVertDim; + + OUString maHorzText; + OUString maVertText; void preparePreviewBitmap(); public: - PrintPreviewWindow( vcl::Window* pParent ); + PrintPreviewWindow(PrintDialog* pDialog); virtual ~PrintPreviewWindow() override; - virtual void dispose() override; virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; - virtual void Command( const CommandEvent& ) override; + virtual bool Command( const CommandEvent& ) override; virtual void Resize() override; void setPreview( const GDIMetaFile&, const Size& i_rPaperSize, @@ -89,15 +86,15 @@ namespace vcl ); }; - class ShowNupOrderWindow : public vcl::Window + class ShowNupOrderWindow : public weld::CustomWidgetController { NupOrderType mnOrderMode; int mnRows; int mnColumns; public: - ShowNupOrderWindow( vcl::Window* pParent ); + ShowNupOrderWindow(); - virtual Size GetOptimalSize() const override; + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override; @@ -110,9 +107,8 @@ namespace vcl } }; - PrintDialog( vcl::Window*, const std::shared_ptr< PrinterController >& ); + PrintDialog(weld::Window*, const std::shared_ptr<PrinterController>&); virtual ~PrintDialog() override; - virtual void dispose() override; bool isPrintToFile() const; bool isCollate() const; @@ -127,41 +123,71 @@ namespace vcl private: - std::unique_ptr<VclBuilder> mpCustomOptionsUIBuilder; + std::unique_ptr<weld::Builder> mxCustomOptionsUIBuilder; std::shared_ptr<PrinterController> maPController; std::unique_ptr<MoreOptionsDialog> mxMoreOptionsDlg; - VclPtr<TabControl> mpTabCtrl; - VclPtr<VclFrame> mpPageLayoutFrame; - VclPtr<ListBox> mpPrinters; - VclPtr<FixedText> mpStatusTxt; - VclPtr<PushButton> mpSetupButton; - OUString const maPrintToFileText; - OUString maPrintText; - OUString const maDefPrtText; + std::unique_ptr<weld::Notebook> mxTabCtrl; + std::unique_ptr<weld::Frame> mxPageLayoutFrame; + std::unique_ptr<weld::ComboBox> mxPrinters; + std::unique_ptr<weld::Label> mxStatusTxt; + std::unique_ptr<weld::Button> mxSetupButton; + + std::unique_ptr<weld::SpinButton> mxCopyCountField; + std::unique_ptr<weld::CheckButton> mxCollateBox; + std::unique_ptr<weld::Image> mxCollateImage; + std::unique_ptr<weld::ComboBox> mxPaperSidesBox; + std::unique_ptr<weld::CheckButton> mxReverseOrderBox; + + std::unique_ptr<weld::Button> mxOKButton; + std::unique_ptr<weld::Button> mxCancelButton; + std::unique_ptr<weld::Button> mxHelpButton; + std::unique_ptr<weld::Button> mxMoreOptionsBtn; + + std::unique_ptr<weld::Button> mxBackwardBtn; + std::unique_ptr<weld::Button> mxForwardBtn; + std::unique_ptr<weld::Button> mxFirstBtn; + std::unique_ptr<weld::Button> mxLastBtn; + + std::unique_ptr<weld::CheckButton> mxPreviewBox; + std::unique_ptr<weld::Label> mxNumPagesText; + std::unique_ptr<PrintPreviewWindow> mxPreview; + std::unique_ptr<weld::CustomWeld> mxPreviewWindow; + std::unique_ptr<weld::Entry> mxPageEdit; - VclPtr<NumericField> mpCopyCountField; - VclPtr<CheckBox> mpCollateBox; - VclPtr<FixedImage> mpCollateImage; - VclPtr<ListBox> mpPaperSidesBox; - VclPtr<CheckBox> mpReverseOrderBox; + std::unique_ptr<weld::RadioButton> mxPagesBtn; + std::unique_ptr<weld::RadioButton> mxBrochureBtn; + std::unique_ptr<weld::Label> mxPagesBoxTitleTxt; + std::unique_ptr<weld::ComboBox> mxNupPagesBox; - VclPtr<OKButton> mpOKButton; - VclPtr<CancelButton> mpCancelButton; - VclPtr<HelpButton> mpHelpButton; - VclPtr<PushButton> mpMoreOptionsBtn; + // controls for "Custom" page mode + std::unique_ptr<weld::Label> mxNupNumPagesTxt; + std::unique_ptr<weld::SpinButton> mxNupColEdt; + std::unique_ptr<weld::Label> mxNupTimesTxt; + std::unique_ptr<weld::SpinButton> mxNupRowsEdt; + std::unique_ptr<weld::Label> mxPageMarginTxt1; + std::unique_ptr<weld::MetricSpinButton> mxPageMarginEdt; + std::unique_ptr<weld::Label> mxPageMarginTxt2; + std::unique_ptr<weld::Label> mxSheetMarginTxt1; + std::unique_ptr<weld::MetricSpinButton> mxSheetMarginEdt; + std::unique_ptr<weld::Label> mxSheetMarginTxt2; + std::unique_ptr<weld::ComboBox> mxPaperSizeBox; + std::unique_ptr<weld::ComboBox> mxOrientationBox; - VclPtr<PushButton> mpBackwardBtn; - VclPtr<PushButton> mpForwardBtn; - VclPtr<PushButton> mpFirstBtn; - VclPtr<PushButton> mpLastBtn; + // page order ("left to right, then down") + std::unique_ptr<weld::Label> mxNupOrderTxt; + std::unique_ptr<weld::ComboBox> mxNupOrderBox; + std::unique_ptr<ShowNupOrderWindow> mxNupOrder; + std::unique_ptr<weld::CustomWeld> mxNupOrderWin; + /// border around each page + std::unique_ptr<weld::CheckButton> mxBorderCB; + std::unique_ptr<weld::Widget> mxCustom; - VclPtr<CheckBox> mpPreviewBox; - VclPtr<FixedText> mpNumPagesText; - VclPtr<PrintPreviewWindow> mpPreviewWindow; - VclPtr<NumericField> mpPageEdit; + OUString const maPrintToFileText; + OUString maPrintText; + OUString const maDefPrtText; OUString maPageStr; OUString const maNoPageStr; @@ -171,37 +197,14 @@ namespace vcl bool mbCollateAlwaysOff; - VclPtr<RadioButton> mpPagesBtn; - VclPtr<RadioButton> mpBrochureBtn; - VclPtr<FixedText> mpPagesBoxTitleTxt; - VclPtr<ListBox> mpNupPagesBox; + std::vector<std::unique_ptr<weld::Widget>> + maExtraControls; - // controls for "Custom" page mode - VclPtr<FixedText> mpNupNumPagesTxt; - VclPtr<NumericField> mpNupColEdt; - VclPtr<FixedText> mpNupTimesTxt; - VclPtr<NumericField> mpNupRowsEdt; - VclPtr<FixedText> mpPageMarginTxt1; - VclPtr<MetricField> mpPageMarginEdt; - VclPtr<FixedText> mpPageMarginTxt2; - VclPtr<FixedText> mpSheetMarginTxt1; - VclPtr<MetricField> mpSheetMarginEdt; - VclPtr<FixedText> mpSheetMarginTxt2; - VclPtr<ListBox> mpPaperSizeBox; - VclPtr<ListBox> mpOrientationBox; - - // page order ("left to right, then down") - VclPtr<FixedText> mpNupOrderTxt; - VclPtr<ListBox> mpNupOrderBox; - VclPtr<ShowNupOrderWindow> mpNupOrderWin; - /// border around each page - VclPtr<CheckBox> mpBorderCB; - - std::map< VclPtr<vcl::Window>, OUString > + std::map<weld::Widget*, OUString> maControlToPropertyMap; - std::map< OUString, std::vector< VclPtr<vcl::Window> > > + std::map<OUString, std::vector<weld::Widget*>> maPropertyToWindowMap; - std::map< VclPtr<vcl::Window>, sal_Int32 > + std::map<weld::Widget*, sal_Int32> maControlToNumValMap; Size maNupPortraitSize; @@ -214,18 +217,21 @@ namespace vcl Paper mePaper; - DECL_LINK( ClickHdl, Button*, void ); - DECL_LINK( SelectHdl, ListBox&, void ); - DECL_LINK( ModifyHdl, Edit&, void ); - DECL_LINK( ToggleHdl, CheckBox&, void ); - DECL_LINK( ToggleRadioHdl, RadioButton&, void ); + DECL_LINK( ClickHdl, weld::Button&, void ); + DECL_LINK( SelectHdl, weld::ComboBox&, void ); + DECL_LINK( ActivateHdl, weld::Entry&, bool ); + DECL_LINK( FocusOutHdl, weld::Widget&, void ); + DECL_LINK( SpinModifyHdl, weld::SpinButton&, void ); + DECL_LINK( MetricSpinModifyHdl, weld::MetricSpinButton&, void ); + DECL_LINK( ToggleHdl, weld::ToggleButton&, void ); - DECL_LINK( UIOption_CheckHdl, CheckBox&, void ); - DECL_LINK( UIOption_RadioHdl, RadioButton&, void ); - DECL_LINK( UIOption_SelectHdl, ListBox&, void ); - DECL_LINK( UIOption_ModifyHdl, Edit&, void ); + DECL_LINK( UIOption_CheckHdl, weld::ToggleButton&, void ); + DECL_LINK( UIOption_RadioHdl, weld::ToggleButton&, void ); + DECL_LINK( UIOption_SelectHdl, weld::ComboBox&, void ); + DECL_LINK( UIOption_SpinModifyHdl, weld::SpinButton&, void ); + DECL_LINK( UIOption_EntryModifyHdl, weld::Entry&, void ); - css::beans::PropertyValue* getValueForWindow( vcl::Window* ) const; + css::beans::PropertyValue* getValueForWindow(weld::Widget*) const; void preparePreview( bool i_bMayUseCache ); void setupPaperSidesBox(); @@ -239,7 +245,7 @@ namespace vcl void updatePrinterText(); void checkControlDependencies(); void checkOptionalControlDependencies(); - void makeEnabled( vcl::Window* ); + void makeEnabled( weld::Widget* ); void updateWindowFromProperty( const OUString& ); void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& ); void showAdvancedControls( bool ); diff --git a/vcl/inc/strings.hrc b/vcl/inc/strings.hrc index e00f3869dfda..c561de71c369 100644 --- a/vcl/inc/strings.hrc +++ b/vcl/inc/strings.hrc @@ -116,7 +116,6 @@ #define SV_PRINT_NOPREVIEW NC_("SV_PRINT_NOPREVIEW", "Preview is disabled") #define SV_PRINT_TOFILE_TXT NC_("SV_PRINT_TOFILE_TXT", "Print to File...") #define SV_PRINT_DEFPRT_TXT NC_("SV_PRINT_DEFPRT_TXT", "Default printer") -#define SV_PRINT_PRINTPREVIEW_TXT NC_("SV_PRINT_PRINTPREVIEW_TXT", "Print preview") #define SV_PRINT_QUERYFAXNUMBER_TXT NC_("SV_PRINT_QUERYFAXNUMBER_TXT", "Please enter the fax number") #define SV_PRINT_INVALID_TXT NC_("SV_PRINT_INVALID_TXT", "<ignore>") #define SV_PRINT_CUSTOM_TXT NC_("SV_PRINT_CUSTOM_TXT", "Custom") diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 0dabf4b94858..2d9193dddbfb 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -2020,6 +2020,11 @@ public: return m_xNotebook->GetPagePos(m_xNotebook->GetCurPageId()); } + virtual OString get_page_ident(int nPage) const override + { + return m_xNotebook->GetPageName(m_xNotebook->GetPageId(nPage)); + } + virtual OString get_current_page_ident() const override { return m_xNotebook->GetPageName(m_xNotebook->GetCurPageId()); @@ -2083,6 +2088,11 @@ public: return m_xNotebook->GetPageText(m_xNotebook->GetPageId(rIdent)); } + virtual void set_tab_label_text(const OString& rIdent, const OUString& rText) override + { + return m_xNotebook->SetPageText(m_xNotebook->GetPageId(rIdent), rText); + } + virtual ~SalInstanceNotebook() override { for (auto &rGrid : m_aAddedGrids) @@ -2127,6 +2137,11 @@ public: return m_xNotebook->GetPagePos(m_xNotebook->GetCurPageId()); } + virtual OString get_page_ident(int nPage) const override + { + return m_xNotebook->GetPageId(nPage); + } + virtual OString get_current_page_ident() const override { return m_xNotebook->GetCurPageId(); @@ -2173,6 +2188,11 @@ public: return m_xNotebook->GetPageCount(); } + virtual void set_tab_label_text(const OString& rIdent, const OUString& rText) override + { + return m_xNotebook->SetPageText(rIdent, rText); + } + virtual OUString get_tab_label_text(const OString& rIdent) const override { return m_xNotebook->GetPageText(rIdent); diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx index a096ce63725e..8cef33be5232 100644 --- a/vcl/source/control/ivctrl.cxx +++ b/vcl/source/control/ivctrl.cxx @@ -611,4 +611,12 @@ OUString VerticalTabControl::GetPageText(const OString& rPageId) const return pData->pEntry->GetText(); } +void VerticalTabControl::SetPageText(const OString& rPageId, const OUString& rText) +{ + VerticalTabPageData* pData = GetPageData(rPageId); + if (!pData) + return; + pData->pEntry->SetText(rText); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx index 8636034c6fbd..ad5cb8279dad 100644 --- a/vcl/source/gdi/oldprintadaptor.cxx +++ b/vcl/source/gdi/oldprintadaptor.cxx @@ -44,8 +44,8 @@ namespace vcl }; } -OldStylePrintAdaptor::OldStylePrintAdaptor(const VclPtr<Printer>& i_xPrinter, const VclPtr<vcl::Window>& i_xWindow) - : PrinterController(i_xPrinter, i_xWindow) +OldStylePrintAdaptor::OldStylePrintAdaptor(const VclPtr<Printer>& i_xPrinter, weld::Window* i_pWindow) + : PrinterController(i_xPrinter, i_pWindow) , mpData(new ImplOldStyleAdaptorData) { } diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 89d0a405d7b8..50b20930cf19 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -138,7 +138,7 @@ public: typedef std::unordered_map< OUString, css::uno::Sequence< sal_Bool > > ChoiceDisableMap; VclPtr< Printer > mxPrinter; - VclPtr<vcl::Window> mxWindow; + weld::Window* mpWindow; css::uno::Sequence< css::beans::PropertyValue > maUIOptions; std::vector< css::beans::PropertyValue > maUIProperties; std::vector< bool > maUIPropertyEnabled; @@ -183,6 +183,7 @@ public: // history suggests this is intentional... ImplPrinterControllerData() : + mpWindow( nullptr ), mbFirstPage( true ), mbLastPage( false ), mbReversePageOrder( false ), @@ -219,11 +220,11 @@ public: void resetPaperToLastConfigured(); }; -PrinterController::PrinterController(const VclPtr<Printer>& i_xPrinter, const VclPtr<vcl::Window>& i_xWindow) +PrinterController::PrinterController(const VclPtr<Printer>& i_xPrinter, weld::Window* i_pWindow) : mpImplData( new ImplPrinterControllerData ) { mpImplData->mxPrinter = i_xPrinter; - mpImplData->mxWindow = i_xWindow; + mpImplData->mpWindow = i_pWindow; } static OUString queryFile( Printer const * pPrinter ) @@ -316,8 +317,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, { if (xController->isShowDialogs()) { - VclPtr<vcl::Window> xParent = xController->getWindow(); - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(xParent ? xParent->GetFrameWeld() : nullptr, "vcl/ui/errornoprinterdialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(xController->getWindow(), "vcl/ui/errornoprinterdialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("ErrorNoPrinterDialog")); xBox->run(); } @@ -467,8 +467,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, { if( xController->getFilteredPageCount() == 0 ) { - VclPtr<vcl::Window> xParent = xController->getWindow(); - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(xParent ? xParent->GetFrameWeld() : nullptr, "vcl/ui/errornocontentdialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(xController->getWindow(), "vcl/ui/errornocontentdialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("ErrorNoContentDialog")); xBox->run(); return false; @@ -484,14 +483,13 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, { try { - VclPtr<vcl::Window> xParent = xController->getWindow(); - ScopedVclPtrInstance< PrintDialog > aDlg( xParent, xController ); - if( ! aDlg->Execute() ) + PrintDialog aDlg(xController->getWindow(), xController); + if (!aDlg.run()) { xController->abortJob(); return false; } - if( aDlg->isPrintToFile() ) + if (aDlg.isPrintToFile()) { OUString aFile = queryFile( xController->getPrinter().get() ); if( aFile.isEmpty() ) @@ -502,7 +500,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, xController->setValue( "LocalFileName", css::uno::makeAny( aFile ) ); } - else if( aDlg->isSingleJobs() ) + else if (aDlg.isSingleJobs()) { xController->setValue( "PrintCollateAsSingleJobs", css::uno::makeAny( true ) ); @@ -775,9 +773,9 @@ const VclPtr<Printer>& PrinterController::getPrinter() const return mpImplData->mxPrinter; } -const VclPtr<vcl::Window>& PrinterController::getWindow() const +weld::Window* PrinterController::getWindow() const { - return mpImplData->mxWindow; + return mpImplData->mpWindow; } void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter ) @@ -1693,8 +1691,7 @@ void PrinterController::createProgressDialog() if( bShow && ! Application::IsHeadlessModeEnabled() ) { - VclPtr<vcl::Window> xParent = getWindow(); - mpImplData->mxProgress.reset(new PrintProgressDialog(xParent ? xParent->GetFrameWeld() : nullptr, getPageCountProtected())); + mpImplData->mxProgress.reset(new PrintProgressDialog(getWindow(), getPageCountProtected())); weld::DialogController::runAsync(mpImplData->mxProgress, [](sal_Int32 /*nResult*/){}); } } diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 3289e2e02620..4b417f7bbb7e 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -57,20 +57,6 @@ enum ORIENTATION_LANDSCAPE }; -extern "C" SAL_DLLPUBLIC_EXPORT void makePrintPreviewWindow(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap &) -{ - static_assert(std::is_same_v<std::remove_pointer_t<VclBuilder::customMakeWidget>, - decltype(makePrintPreviewWindow)>); - rRet = VclPtr<PrintDialog::PrintPreviewWindow>::Create(pParent); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void makeShowNupOrderWindow(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap &) -{ - static_assert(std::is_same_v<std::remove_pointer_t<VclBuilder::customMakeWidget>, - decltype(makeShowNupOrderWindow)>); - rRet = VclPtr<PrintDialog::ShowNupOrderWindow>::Create(pParent); -} - namespace { bool lcl_ListBoxCompare( const OUString& rStr1, const OUString& rStr2 ) { @@ -78,8 +64,8 @@ namespace { } } -MoreOptionsDialog::MoreOptionsDialog(VclPtr<PrintDialog> i_pParent) - : GenericDialogController(i_pParent->GetFrameWeld(), "vcl/ui/moreoptionsdialog.ui", "MoreOptionsDialog") +MoreOptionsDialog::MoreOptionsDialog(PrintDialog* i_pParent) + : GenericDialogController(i_pParent->getDialog(), "vcl/ui/moreoptionsdialog.ui", "MoreOptionsDialog") , mpParent( i_pParent ) , mxOKButton(m_xBuilder->weld_button("ok")) , mxCancelButton(m_xBuilder->weld_button("cancel")) @@ -108,8 +94,8 @@ IMPL_LINK (MoreOptionsDialog, ClickHdl, weld::Button&, rButton, void) } } -PrintDialog::PrintPreviewWindow::PrintPreviewWindow( vcl::Window* i_pParent ) - : Window( i_pParent, 0 ) +PrintDialog::PrintPreviewWindow::PrintPreviewWindow(PrintDialog* pDialog) + : mpDialog(pDialog) , maMtf() , maOrigSize( 10, 10 ) , maPreviewSize() @@ -117,36 +103,18 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( vcl::Window* i_pParent ) , mnDPIY(Application::GetDefaultDevice()->GetDPIY()) , maPreviewBitmap() , maReplacementString() - , maToolTipString(VclResId( SV_PRINT_PRINTPREVIEW_TXT)) , mbGreyscale( false ) - , maHorzDim(VclPtr<FixedLine>::Create(this, WB_HORZ | WB_CENTER)) - , maVertDim(VclPtr<FixedLine>::Create(this, WB_VERT | WB_VCENTER)) { - SetPaintTransparent( true ); - SetBackground(); - maHorzDim->Show(); - maVertDim->Show(); - - maHorzDim->SetText( "2.0in" ); - maVertDim->SetText( "2.0in" ); } PrintDialog::PrintPreviewWindow::~PrintPreviewWindow() { - disposeOnce(); -} - -void PrintDialog::PrintPreviewWindow::dispose() -{ - maHorzDim.disposeAndClear(); - maVertDim.disposeAndClear(); - Window::dispose(); } void PrintDialog::PrintPreviewWindow::Resize() { - Size aNewSize( GetSizePixel() ); - long nTextHeight = maHorzDim->GetTextHeight(); + Size aNewSize(GetOutputSizePixel()); + long nTextHeight = GetDrawingArea()->get_text_height(); // leave small space for decoration aNewSize.AdjustWidth( -(nTextHeight + 2) ); aNewSize.AdjustHeight( -(nTextHeight + 2) ); @@ -176,36 +144,71 @@ void PrintDialog::PrintPreviewWindow::Resize() maPreviewSize = aScaledSize; - // position dimension lines - Point aRef( nTextHeight + (aNewSize.Width() - maPreviewSize.Width())/2, - nTextHeight + (aNewSize.Height() - maPreviewSize.Height())/2 ); - maHorzDim->SetPosSizePixel( Point( aRef.X(), aRef.Y() - nTextHeight ), - Size( maPreviewSize.Width(), nTextHeight ) ); - maVertDim->SetPosSizePixel( Point( aRef.X() - nTextHeight, aRef.Y() ), - Size( nTextHeight, maPreviewSize.Height() ) ); - // check and evtl. recreate preview bitmap preparePreviewBitmap(); } void PrintDialog::PrintPreviewWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { - long nTextHeight = maHorzDim->GetTextHeight(); - Size aSize(GetSizePixel()); + rRenderContext.Push(); + if (vcl::Window* pDefaultDevice = dynamic_cast<vcl::Window*>(Application::GetDefaultDevice())) + { + Font aFont(rRenderContext.GetSettings().GetStyleSettings().GetLabelFont()); + pDefaultDevice->SetPointFont(rRenderContext, aFont); + } + + rRenderContext.SetBackground(Wallpaper(Application::GetSettings().GetStyleSettings().GetDialogColor())); + rRenderContext.Erase(); + + auto nTextHeight = rRenderContext.GetTextHeight(); + Size aSize(GetOutputSizePixel()); Point aOffset((aSize.Width() - maPreviewSize.Width() + nTextHeight) / 2, (aSize.Height() - maPreviewSize.Height() + nTextHeight) / 2); + // horizontal line + { + auto nTop = aOffset.Y() - nTextHeight; + + auto nWidth = rRenderContext.GetTextWidth(maHorzText); + + auto nStart = aOffset.X() + (maPreviewSize.Width() - nWidth) / 2; + rRenderContext.DrawText(Point(nStart, aOffset.Y() - nTextHeight), maHorzText, 0, maHorzText.getLength()); + + DecorationView aDecoView(&rRenderContext); + nTop = aOffset.Y() - (nTextHeight / 2); + aDecoView.DrawSeparator(Point(aOffset.X(), nTop), Point(nStart - 2, nTop), false); + aDecoView.DrawSeparator(Point(nStart + nWidth + 2, nTop), Point(aOffset.X() + maPreviewSize.Width(), nTop), false); + } + + // vertical line + { + rRenderContext.Push(PushFlags::FONT); + vcl::Font aFont(rRenderContext.GetFont()); + aFont.SetOrientation(900); + rRenderContext.SetFont(aFont); + + auto nLeft = aOffset.X() - nTextHeight; + + auto nWidth = rRenderContext.GetTextWidth(maVertText); + auto nStart = aOffset.Y() + (maPreviewSize.Height() + nWidth) / 2; + + rRenderContext.DrawText(Point(nLeft, nStart), maVertText, 0, maVertText.getLength()); + + DecorationView aDecoView(&rRenderContext); + nLeft = aOffset.X() - (nTextHeight / 2); + aDecoView.DrawSeparator(Point(nLeft, aOffset.Y()), Point(nLeft, nStart - nWidth - 2), true); + aDecoView.DrawSeparator(Point(nLeft, nStart + 2), Point(nLeft, aOffset.Y() + maPreviewSize.Height()), true); + + rRenderContext.Pop(); + } + if (!maReplacementString.isEmpty()) { // replacement is active - rRenderContext.Push(); - Font aFont(rRenderContext.GetSettings().GetStyleSettings().GetLabelFont()); - SetZoomedPointFont(rRenderContext, aFont); tools::Rectangle aTextRect(aOffset + Point(2, 2), Size(maPreviewSize.Width() - 4, maPreviewSize.Height() - 4)); rRenderContext.DrawText(aTextRect, maReplacementString, DrawTextFlags::Center | DrawTextFlags::VCenter | DrawTextFlags::WordBreak | DrawTextFlags::MultiLine); - rRenderContext.Pop(); } else { @@ -222,22 +225,22 @@ void PrintDialog::PrintPreviewWindow::Paint(vcl::RenderContext& rRenderContext, tools::Rectangle aFrameRect(aOffset + Point(-1, -1), Size(maPreviewSize.Width() + 2, maPreviewSize.Height() + 2)); DecorationView aDecorationView(&rRenderContext); aDecorationView.DrawFrame(aFrameRect, DrawFrameStyle::Group); + + rRenderContext.Pop(); } -void PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt ) +bool PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt ) { if( rEvt.GetCommand() == CommandEventId::Wheel ) { const CommandWheelData* pWheelData = rEvt.GetWheelData(); - PrintDialog* pDlg = dynamic_cast<PrintDialog*>(GetParentDialog()); - if( pDlg ) - { - if( pWheelData->GetDelta() > 0 ) - pDlg->previewForward(); - else if( pWheelData->GetDelta() < 0 ) - pDlg->previewBackward(); - } + if(pWheelData->GetDelta() > 0) + mpDialog->previewForward(); + else if (pWheelData->GetDelta() < 0) + mpDialog->previewBackward(); + return true; } + return CustomWidgetController::Command(rEvt); } void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPreview, @@ -249,9 +252,6 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi bool i_bGreyscale ) { - OUStringBuffer aBuf( 256 ); - aBuf.append( maToolTipString ); - SetQuickHelpText( aBuf.makeStringAndClear() ); maMtf = i_rNewPreview; mnDPIX = i_nDPIX; mnDPIY = i_nDPIY; @@ -260,7 +260,7 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi mbGreyscale = i_bGreyscale; // use correct measurements - const LocaleDataWrapper& rLocWrap( GetSettings().GetLocaleDataWrapper() ); + const LocaleDataWrapper& rLocWrap(Application::GetSettings().GetLocaleDataWrapper()); MapUnit eUnit = MapUnit::MapMM; int nDigits = 0; if( rLocWrap.getMeasurementSystemEnum() == MeasurementSystem::US ) @@ -268,8 +268,9 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi eUnit = MapUnit::Map100thInch; nDigits = 2; } - Size aLogicPaperSize( LogicToLogic( i_rOrigSize, MapMode( MapUnit::Map100thMM ), MapMode( eUnit ) ) ); + Size aLogicPaperSize(OutputDevice::LogicToLogic(i_rOrigSize, MapMode(MapUnit::Map100thMM), MapMode(eUnit))); OUString aNumText( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) ); + OUStringBuffer aBuf; aBuf.append( aNumText ) .append( u' ' ); aBuf.appendAscii( eUnit == MapUnit::MapMM ? "mm" : "in" ); @@ -279,13 +280,13 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi aBuf.append( i_rPaperName ); aBuf.append( ')' ); } - maHorzDim->SetText( aBuf.makeStringAndClear() ); + maHorzText = aBuf.makeStringAndClear(); aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits ); aBuf.append( aNumText ) .append( u' ' ); aBuf.appendAscii( eUnit == MapUnit::MapMM ? "mm" : "in" ); - maVertDim->SetText( aBuf.makeStringAndClear() ); + maVertText = aBuf.makeStringAndClear(); // We have a new Metafile and evtl. a new page, so we need to reset // the PreviewBitmap to force new creation @@ -418,7 +419,6 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap() pPrerenderVDev->Pop(); - SetMapMode(MapMode(MapUnit::MapPixel)); pPrerenderVDev->SetMapMode(MapMode(MapUnit::MapPixel)); maPreviewBitmap = pPrerenderVDev->GetBitmapEx(Point(0, 0), aVDevSize); @@ -426,24 +426,23 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap() pPrerenderVDev->SetDrawMode( nOldDrawMode ); } -PrintDialog::ShowNupOrderWindow::ShowNupOrderWindow( vcl::Window* i_pParent ) - : Window( i_pParent, WB_NOBORDER ) - , mnOrderMode( NupOrderType::LRTB ) +PrintDialog::ShowNupOrderWindow::ShowNupOrderWindow() + : mnOrderMode( NupOrderType::LRTB ) , mnRows( 1 ) , mnColumns( 1 ) { - SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) ); } -Size PrintDialog::ShowNupOrderWindow::GetOptimalSize() const +void PrintDialog::ShowNupOrderWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) { - return Size(70, 70); + Size aSize(70, 70); + pDrawingArea->set_size_request(aSize.Width(), aSize.Height()); + CustomWidgetController::SetDrawingArea(pDrawingArea); + SetOutputSizePixel(aSize); } -void PrintDialog::ShowNupOrderWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& i_rRect) +void PrintDialog::ShowNupOrderWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*i_rRect*/) { - Window::Paint(rRenderContext, i_rRect); - rRenderContext.SetMapMode(MapMode(MapUnit::MapPixel)); rRenderContext.SetTextColor(rRenderContext.GetSettings().GetStyleSettings().GetFieldTextColor()); @@ -512,103 +511,97 @@ Size const & PrintDialog::getJobPageSize() return maFirstPageSize; } -PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterController>& i_rController) -: ModalDialog(i_pWindow, "PrintDialog", "vcl/ui/printdialog.ui") -, maPController( i_rController ) -, maPrintToFileText( VclResId( SV_PRINT_TOFILE_TXT ) ) -, maDefPrtText( VclResId( SV_PRINT_DEFPRT_TXT ) ) -, maNoPageStr( VclResId( SV_PRINT_NOPAGES ) ) -, maNoPreviewStr( VclResId( SV_PRINT_NOPREVIEW ) ) -, mnCurPage( 0 ) -, mnCachedPages( 0 ) -, mbCollateAlwaysOff(false) -, mbShowLayoutFrame( true ) -, mbSingleJobs( false ) -{ - get(mpOKButton, "ok"); - get(mpCancelButton, "cancel"); - get(mpHelpButton, "help"); - get(mpMoreOptionsBtn, "moreoptionsbtn"); - get(mpTabCtrl, "tabcontrol"); - get(mpPageLayoutFrame, "layoutframe"); - get(mpForwardBtn, "forward"); - get(mpBackwardBtn, "backward"); - get(mpFirstBtn, "btnFirst"); - get(mpLastBtn, "btnLast"); - get(mpNumPagesText, "totalnumpages"); - get(mpPageEdit, "pageedit-nospin"); - get(mpPreviewWindow, "preview"); - get(mpPreviewBox, "previewbox"); - get(mpPrinters, "printersbox"); - get(mpSetupButton, "setup"); - get(mpStatusTxt, "status"); - get(mpCollateBox, "collate"); - get(mpCollateImage, "collateimage"); - get(mpPaperSidesBox, "sidesbox"); - get(mpReverseOrderBox, "reverseorder"); - get(mpCopyCountField, "copycount"); - get(mpNupOrderWin, "orderpreview"); - get(mpNupPagesBox, "pagespersheetbox"); - get(mpOrientationBox, "pageorientationbox"); - get(mpNupOrderTxt, "labelorder"); - get(mpPaperSizeBox, "papersizebox"); - get(mpNupOrderBox, "orderbox"); - get(mpPagesBtn, "pagespersheetbtn"); - get(mpBrochureBtn, "brochure"); - get(mpPagesBoxTitleTxt, "pagespersheettxt"); - get(mpNupNumPagesTxt, "pagestxt"); - get(mpNupColEdt, "pagecols"); - get(mpNupTimesTxt, "by"); - get(mpNupRowsEdt, "pagerows"); - get(mpPageMarginTxt1, "pagemargintxt1"); - get(mpPageMarginEdt, "pagemarginsb"); - get(mpPageMarginTxt2, "pagemargintxt2"); - get(mpSheetMarginTxt1, "sheetmargintxt1"); - get(mpSheetMarginEdt, "sheetmarginsb"); - get(mpSheetMarginTxt2, "sheetmargintxt2"); - get(mpBorderCB, "bordercb"); - +PrintDialog::PrintDialog(weld::Window* i_pWindow, const std::shared_ptr<PrinterController>& i_rController) + : GenericDialogController(i_pWindow, "vcl/ui/printdialog.ui", "PrintDialog") + , maPController( i_rController ) + , mxTabCtrl(m_xBuilder->weld_notebook("tabcontrol")) + , mxPageLayoutFrame(m_xBuilder->weld_frame("layoutframe")) + , mxPrinters(m_xBuilder->weld_combo_box("printersbox")) + , mxStatusTxt(m_xBuilder->weld_label("status")) + , mxSetupButton(m_xBuilder->weld_button("setup")) + , mxCopyCountField(m_xBuilder->weld_spin_button("copycount")) + , mxCollateBox(m_xBuilder->weld_check_button("collate")) + , mxCollateImage(m_xBuilder->weld_image("collateimage")) + , mxPaperSidesBox(m_xBuilder->weld_combo_box("sidesbox")) + , mxReverseOrderBox(m_xBuilder->weld_check_button("reverseorder")) + , mxOKButton(m_xBuilder->weld_button("ok")) + , mxCancelButton(m_xBuilder->weld_button("cancel")) + , mxHelpButton(m_xBuilder->weld_button("help")) + , mxMoreOptionsBtn(m_xBuilder->weld_button("moreoptionsbtn")) + , mxBackwardBtn(m_xBuilder->weld_button("backward")) + , mxForwardBtn(m_xBuilder->weld_button("forward")) + , mxFirstBtn(m_xBuilder->weld_button("btnFirst")) + , mxLastBtn(m_xBuilder->weld_button("btnLast")) + , mxPreviewBox(m_xBuilder->weld_check_button("previewbox")) + , mxNumPagesText(m_xBuilder->weld_label("totalnumpages")) + , mxPreview(new PrintPreviewWindow(this)) + , mxPreviewWindow(new weld::CustomWeld(*m_xBuilder, "preview", *mxPreview)) + , mxPageEdit(m_xBuilder->weld_entry("pageedit-nospin")) + , mxPagesBtn(m_xBuilder->weld_radio_button("pagespersheetbtn")) + , mxBrochureBtn(m_xBuilder->weld_radio_button("brochure")) + , mxPagesBoxTitleTxt(m_xBuilder->weld_label("pagespersheettxt")) + , mxNupPagesBox(m_xBuilder->weld_combo_box("pagespersheetbox")) + , mxNupNumPagesTxt(m_xBuilder->weld_label("pagestxt")) + , mxNupColEdt(m_xBuilder->weld_spin_button("pagecols")) + , mxNupTimesTxt(m_xBuilder->weld_label("by")) + , mxNupRowsEdt(m_xBuilder->weld_spin_button("pagerows")) + , mxPageMarginTxt1(m_xBuilder->weld_label("pagemargintxt1")) + , mxPageMarginEdt(m_xBuilder->weld_metric_spin_button("pagemarginsb", FieldUnit::MM)) + , mxPageMarginTxt2(m_xBuilder->weld_label("pagemargintxt2")) + , mxSheetMarginTxt1(m_xBuilder->weld_label("sheetmargintxt1")) + , mxSheetMarginEdt(m_xBuilder->weld_metric_spin_button("sheetmarginsb", FieldUnit::MM)) + , mxSheetMarginTxt2(m_xBuilder->weld_label("sheetmargintxt2")) + , mxPaperSizeBox(m_xBuilder->weld_combo_box("papersizebox")) + , mxOrientationBox(m_xBuilder->weld_combo_box("pageorientationbox")) + , mxNupOrderTxt(m_xBuilder->weld_label("labelorder")) + , mxNupOrderBox(m_xBuilder->weld_combo_box("orderbox")) + , mxNupOrder(new ShowNupOrderWindow) + , mxNupOrderWin(new weld::CustomWeld(*m_xBuilder, "orderpreview", *mxNupOrder)) + , mxBorderCB(m_xBuilder->weld_check_button("bordercb")) + , mxCustom(m_xBuilder->weld_widget("customcontents")) + , maPrintToFileText( VclResId( SV_PRINT_TOFILE_TXT ) ) + , maDefPrtText( VclResId( SV_PRINT_DEFPRT_TXT ) ) + , maNoPageStr( VclResId( SV_PRINT_NOPAGES ) ) + , maNoPreviewStr( VclResId( SV_PRINT_NOPREVIEW ) ) + , mnCurPage( 0 ) + , mnCachedPages( 0 ) + , mbCollateAlwaysOff(false) + , mbShowLayoutFrame( true ) + , mbSingleJobs( false ) +{ // save printbutton text, gets exchanged occasionally with print to file - maPrintText = mpOKButton->GetText(); - - // setup preview controls - mpForwardBtn->SetStyle( mpForwardBtn->GetStyle() | WB_BEVELBUTTON ); - mpBackwardBtn->SetStyle( mpBackwardBtn->GetStyle() | WB_BEVELBUTTON ); - mpFirstBtn->SetStyle( mpFirstBtn->GetStyle() | WB_BEVELBUTTON ); - mpLastBtn->SetStyle( mpLastBtn->GetStyle() | WB_BEVELBUTTON ); + maPrintText = mxOKButton->get_label(); - maPageStr = mpNumPagesText->GetText(); + maPageStr = mxNumPagesText->get_label(); Printer::updatePrinters(); - mpPrinters->InsertEntry( maPrintToFileText ); + mxPrinters->append_text(maPrintToFileText); // fill printer listbox std::vector< OUString > rQueues( Printer::GetPrinterQueues() ); std::sort( rQueues.begin(), rQueues.end(), lcl_ListBoxCompare ); for( const auto& rQueue : rQueues ) { - mpPrinters->InsertEntry( rQueue ); + mxPrinters->append_text(rQueue); } // select current printer - if( mpPrinters->GetEntryPos( maPController->getPrinter()->GetName() ) != LISTBOX_ENTRY_NOTFOUND ) - { - mpPrinters->SelectEntry( maPController->getPrinter()->GetName() ); - } + if (mxPrinters->find_text(maPController->getPrinter()->GetName()) != -1) + mxPrinters->set_active_text(maPController->getPrinter()->GetName()); else { // fall back to last printer SettingsConfigItem* pItem = SettingsConfigItem::get(); OUString aValue( pItem->getValue( "PrintDialog", "LastPrinter" ) ); - if( mpPrinters->GetEntryPos( aValue ) != LISTBOX_ENTRY_NOTFOUND ) + if (mxPrinters->find_text(aValue) != -1) { - mpPrinters->SelectEntry( aValue ); + mxPrinters->set_active_text(aValue); maPController->setPrinter( VclPtrInstance<Printer>( aValue ) ); } else { // fall back to default printer - mpPrinters->SelectEntry( Printer::GetDefaultPrinterName() ); + mxPrinters->set_active_text(Printer::GetDefaultPrinterName()); maPController->setPrinter( VclPtrInstance<Printer>( Printer::GetDefaultPrinterName() ) ); } } @@ -629,8 +622,8 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo setupPaperSidesBox(); // set initial focus to "Number of copies" - mpCopyCountField->GrabFocus(); - mpCopyCountField->SetSelection( Selection(0, 0xFFFF) ); + mxCopyCountField->grab_focus(); + mxCopyCountField->select_region(0, -1); // setup sizes for N-Up Size aNupSize( maPController->getPrinter()->PixelToLogic( @@ -652,44 +645,45 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo setupOptionalUI(); // hide layout frame if unwanted - mpPageLayoutFrame->Show( mbShowLayoutFrame ); + mxPageLayoutFrame->set_visible(mbShowLayoutFrame); // restore settings from last run readFromSettings(); // setup click hdl - mpOKButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); - mpCancelButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); - mpHelpButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); - mpSetupButton->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); - mpMoreOptionsBtn->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); - mpBackwardBtn->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); - mpForwardBtn->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); - mpFirstBtn->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); - mpLastBtn->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); - mpPreviewBox->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); - mpBorderCB->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); + mxOKButton->connect_clicked(LINK(this, PrintDialog, ClickHdl)); + mxCancelButton->connect_clicked(LINK(this, PrintDialog, ClickHdl)); + mxHelpButton->connect_clicked(LINK(this, PrintDialog, ClickHdl)); + mxSetupButton->connect_clicked( LINK( this, PrintDialog, ClickHdl ) ); + mxMoreOptionsBtn->connect_clicked( LINK( this, PrintDialog, ClickHdl ) ); + mxBackwardBtn->connect_clicked(LINK(this, PrintDialog, ClickHdl)); + mxForwardBtn->connect_clicked(LINK(this, PrintDialog, ClickHdl)); + mxFirstBtn->connect_clicked(LINK(this, PrintDialog, ClickHdl)); + mxLastBtn->connect_clicked( LINK( this, PrintDialog, ClickHdl ) ); + mxPreviewBox->connect_clicked( LINK( this, PrintDialog, ClickHdl ) ); + mxBorderCB->connect_clicked( LINK( this, PrintDialog, ClickHdl ) ); // setup toggle hdl - mpReverseOrderBox->SetToggleHdl( LINK( this, PrintDialog, ToggleHdl ) ); - mpCollateBox->SetToggleHdl( LINK( this, PrintDialog, ToggleHdl ) ); - mpPagesBtn->SetToggleHdl( LINK( this, PrintDialog, ToggleRadioHdl ) ); + mxReverseOrderBox->connect_toggled( LINK( this, PrintDialog, ToggleHdl ) ); + mxCollateBox->connect_toggled( LINK( this, PrintDialog, ToggleHdl ) ); + mxPagesBtn->connect_toggled( LINK( this, PrintDialog, ToggleHdl ) ); // setup select hdl - mpPrinters->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); - mpPaperSidesBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); - mpNupPagesBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); - mpOrientationBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); - mpNupOrderBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); - mpPaperSizeBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); + mxPrinters->connect_changed( LINK( this, PrintDialog, SelectHdl ) ); + mxPaperSidesBox->connect_changed( LINK( this, PrintDialog, SelectHdl ) ); + mxNupPagesBox->connect_changed( LINK( this, PrintDialog, SelectHdl ) ); + mxOrientationBox->connect_changed( LINK( this, PrintDialog, SelectHdl ) ); + mxNupOrderBox->connect_changed( LINK( this, PrintDialog, SelectHdl ) ); + mxPaperSizeBox->connect_changed( LINK( this, PrintDialog, SelectHdl ) ); // setup modify hdl - mpPageEdit->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); - mpCopyCountField->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); - mpNupColEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); - mpNupRowsEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); - mpPageMarginEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); - mpSheetMarginEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); + mxPageEdit->connect_activate( LINK( this, PrintDialog, ActivateHdl ) ); + mxPageEdit->connect_focus_out( LINK( this, PrintDialog, FocusOutHdl ) ); + mxCopyCountField->connect_value_changed( LINK( this, PrintDialog, SpinModifyHdl ) ); + mxNupColEdt->connect_value_changed( LINK( this, PrintDialog, SpinModifyHdl ) ); + mxNupRowsEdt->connect_value_changed( LINK( this, PrintDialog, SpinModifyHdl ) ); + mxPageMarginEdt->connect_value_changed( LINK( this, PrintDialog, MetricSpinModifyHdl ) ); + mxSheetMarginEdt->connect_value_changed( LINK( this, PrintDialog, MetricSpinModifyHdl ) ); updateNupFromPages(); } @@ -697,59 +691,6 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo PrintDialog::~PrintDialog() { - disposeOnce(); -} - -void PrintDialog::dispose() -{ - mpCustomOptionsUIBuilder.reset(); - mpTabCtrl.clear(); - mpPageLayoutFrame.clear(); - mpPreviewWindow.clear(); - mpPageEdit.clear(); - mpNumPagesText.clear(); - mpBackwardBtn.clear(); - mpForwardBtn.clear(); - mpFirstBtn.clear(); - mpLastBtn.clear(); - mpPreviewBox.clear(); - mpOKButton.clear(); - mpCancelButton.clear(); - mpHelpButton.clear(); - mpMoreOptionsBtn.clear(); - maPController.reset(); - maControlToPropertyMap.clear(); - maControlToNumValMap.clear(); - mpPrinters.clear(); - mpStatusTxt.clear(); - mpSetupButton.clear(); - mpCopyCountField.clear(); - mpCollateBox.clear(); - mpCollateImage.clear(); - mpPaperSidesBox.clear(); - mpReverseOrderBox.clear(); - mpPagesBtn.clear(); - mpBrochureBtn.clear(); - mpPagesBoxTitleTxt.clear(); - mpNupPagesBox.clear(); - mpNupNumPagesTxt.clear(); - mpNupColEdt.clear(); - mpNupTimesTxt.clear(); - mpNupRowsEdt.clear(); - mpPageMarginTxt1.clear(); - mpPageMarginEdt.clear(); - mpPageMarginTxt2.clear(); - mpSheetMarginTxt1.clear(); - mpSheetMarginEdt.clear(); - mpSheetMarginTxt2.clear(); - mpPaperSizeBox.clear(); - mpOrientationBox.clear(); - mpNupOrderBox.clear(); - mpNupOrderWin.clear(); - mpNupOrderTxt.clear(); - mpBorderCB.clear(); - mxMoreOptionsDlg.reset(); - ModalDialog::dispose(); } void PrintDialog::setupPaperSidesBox() @@ -758,13 +699,13 @@ void PrintDialog::setupPaperSidesBox() if ( eDuplex == DuplexMode::Unknown || isPrintToFile() ) { - mpPaperSidesBox->SelectEntryPos( 0 ); - mpPaperSidesBox->Enable( false ); + mxPaperSidesBox->set_active( 0 ); + mxPaperSidesBox->set_sensitive( false ); } else { - mpPaperSidesBox->SelectEntryPos( static_cast<sal_Int32>(eDuplex) - 1 ); - mpPaperSidesBox->Enable( true ); + mxPaperSidesBox->set_active( static_cast<sal_Int32>(eDuplex) - 1 ); + mxPaperSidesBox->set_sensitive( true ); } } @@ -775,23 +716,23 @@ void PrintDialog::storeToSettings() pItem->setValue( "PrintDialog", "LastPrinter", isPrintToFile() ? Printer::GetDefaultPrinterName() - : mpPrinters->GetSelectedEntry() ); + : mxPrinters->get_active_text() ); pItem->setValue( "PrintDialog", "LastPage", - mpTabCtrl->GetPageText( mpTabCtrl->GetCurPageId() ) ); + mxTabCtrl->get_tab_label_text(mxTabCtrl->get_current_page_ident())); pItem->setValue( "PrintDialog", "WindowState", - OStringToOUString( GetWindowState(), RTL_TEXTENCODING_UTF8 ) ); + OStringToOUString(m_xDialog->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_UTF8) ); pItem->setValue( "PrintDialog", "CopyCount", - mpCopyCountField->GetText() ); + mxCopyCountField->get_text() ); pItem->setValue( "PrintDialog", "Collate", - mpCollateBox->IsChecked() ? OUString("true") : + mxCollateBox->get_active() ? OUString("true") : OUString("false") ); pItem->setValue( "PrintDialog", @@ -814,14 +755,13 @@ void PrintDialog::readFromSettings() // read last selected tab page; if it exists, activate it OUString aValue = pItem->getValue( "PrintDialog", "LastPage" ); - sal_uInt16 nCount = mpTabCtrl->GetPageCount(); - for( sal_uInt16 i = 0; i < nCount; i++ ) + sal_uInt16 nCount = mxTabCtrl->get_n_pages(); + for (sal_uInt16 i = 0; i < nCount; ++i) { - sal_uInt16 nPageId = mpTabCtrl->GetPageId( i ); - - if( aValue == mpTabCtrl->GetPageText( nPageId ) ) + OString sPageId = mxTabCtrl->get_page_ident(i); + if (aValue == mxTabCtrl->get_tab_label_text(sPageId)) { - mpTabCtrl->SelectTabPage( nPageId ); + mxTabCtrl->set_current_page(sPageId); break; } } @@ -829,8 +769,8 @@ void PrintDialog::readFromSettings() // persistent window state aValue = pItem->getValue( "PrintDialog", "WindowState" ); - if( !aValue.isEmpty() ) - SetWindowState( OUStringToOString( aValue, RTL_TEXTENCODING_UTF8 ) ); + if (!aValue.isEmpty()) + m_xDialog->set_window_state(OUStringToOString(aValue, RTL_TEXTENCODING_UTF8)); // collate aValue = pItem->getValue( "PrintDialog", @@ -838,15 +778,15 @@ void PrintDialog::readFromSettings() if( aValue.equalsIgnoreAsciiCase("alwaysoff") ) { mbCollateAlwaysOff = true; - mpCollateBox->Check( false ); - mpCollateBox->Enable( false ); + mxCollateBox->set_active( false ); + mxCollateBox->set_sensitive( false ); } else { mbCollateAlwaysOff = false; aValue = pItem->getValue( "PrintDialog", "Collate" ); - mpCollateBox->Check( aValue.equalsIgnoreAsciiCase("true") ); + mxCollateBox->set_active( aValue.equalsIgnoreAsciiCase("true") ); } // collate single jobs @@ -861,22 +801,22 @@ void PrintDialog::readFromSettings() aValue = pItem->getValue( "PrintDialog", "HasPreview" ); if ( aValue.equalsIgnoreAsciiCase("false") ) - mpPreviewBox->Check( false ); + mxPreviewBox->set_active( false ); else - mpPreviewBox->Check( true ); + mxPreviewBox->set_active( true ); } void PrintDialog::setPaperSizes() { - mpPaperSizeBox->Clear(); + mxPaperSizeBox->clear(); VclPtr<Printer> aPrt( maPController->getPrinter() ); mePaper = aPrt->GetPaper(); if ( isPrintToFile() ) { - mpPaperSizeBox->Enable( false ); + mxPaperSizeBox->set_sensitive( false ); } else { @@ -886,7 +826,7 @@ void PrintDialog::setPaperSizes() aInfo.doSloppyFit(); Paper ePaper = aInfo.getPaper(); - const LocaleDataWrapper& rLocWrap( GetSettings().GetLocaleDataWrapper() ); + const LocaleDataWrapper& rLocWrap(Application::GetSettings().GetLocaleDataWrapper()); MapUnit eUnit = MapUnit::MapMM; int nDigits = 0; if( rLocWrap.getMeasurementSystemEnum() == MeasurementSystem::US ) @@ -895,45 +835,45 @@ void PrintDialog::setPaperSizes() nDigits = 2; } Size aSize = aPrt->GetPaperSize( nPaper ); - Size aLogicPaperSize( LogicToLogic( aSize, MapMode( MapUnit::Map100thMM ), MapMode( eUnit ) ) ); + Size aLogicPaperSize( OutputDevice::LogicToLogic( aSize, MapMode( MapUnit::Map100thMM ), MapMode( eUnit ) ) ); OUString aWidth( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) ); OUString aHeight( rLocWrap.getNum( aLogicPaperSize.Height(), nDigits ) ); OUString aUnit = eUnit == MapUnit::MapMM ? OUString("mm") : OUString("in"); OUString aPaperName = Printer::GetPaperName( ePaper ) + " " + aWidth + aUnit + " x " + aHeight + aUnit; - mpPaperSizeBox->InsertEntry( aPaperName ); + mxPaperSizeBox->append_text(aPaperName); if ( ePaper == mePaper ) - mpPaperSizeBox->SelectEntryPos( nPaper ); + mxPaperSizeBox->set_active( nPaper ); } - mpPaperSizeBox->Enable( true ); + mxPaperSizeBox->set_sensitive( true ); } } void PrintDialog::updatePrinterText() { const OUString aDefPrt( Printer::GetDefaultPrinterName() ); - const QueueInfo* pInfo = Printer::GetQueueInfo( mpPrinters->GetSelectedEntry(), true ); + const QueueInfo* pInfo = Printer::GetQueueInfo( mxPrinters->get_active_text(), true ); if( pInfo ) { // FIXME: status text OUString aStatus; if( aDefPrt == pInfo->GetPrinterName() ) aStatus = maDefPrtText; - mpStatusTxt->SetText( aStatus ); + mxStatusTxt->set_label( aStatus ); } else { - mpStatusTxt->SetText( OUString() ); + mxStatusTxt->set_label( OUString() ); } } void PrintDialog::setPreviewText() { OUString aNewText( maPageStr.replaceFirst( "%n", OUString::number( mnCachedPages ) ) ); - mpNumPagesText->SetText( aNewText ); + mxNumPagesText->set_label( aNewText ); } void PrintDialog::preparePreview( bool i_bMayUseCache ) @@ -946,26 +886,23 @@ void PrintDialog::preparePreview( bool i_bMayUseCache ) sal_Int32 nPages = maPController->getFilteredPageCount(); mnCachedPages = nPages; - mpPageEdit->SetMin( 1 ); - mpPageEdit->SetMax( nPages ); - setPreviewText(); if ( !hasPreview() ) { - mpPreviewWindow->setPreview( aMtf, aCurPageSize, + mxPreview->setPreview( aMtf, aCurPageSize, Printer::GetPaperName( mePaper ), maNoPreviewStr, aPrt->GetDPIX(), aPrt->GetDPIY(), aPrt->GetPrinterOptions().IsConvertToGreyscales() ); - mpForwardBtn->Enable( false ); - mpBackwardBtn->Enable( false ); - mpFirstBtn->Enable( false ); - mpLastBtn->Enable( false ); + mxForwardBtn->set_sensitive( false ); + mxBackwardBtn->set_sensitive( false ); + mxFirstBtn->set_sensitive( false ); + mxLastBtn->set_sensitive( false ); - mpPageEdit->Enable( false ); + mxPageEdit->set_sensitive( false ); return; } @@ -988,18 +925,18 @@ void PrintDialog::preparePreview( bool i_bMayUseCache ) } } - mpPreviewWindow->setPreview( aMtf, aCurPageSize, + mxPreview->setPreview( aMtf, aCurPageSize, Printer::GetPaperName( mePaper ), nPages > 0 ? OUString() : maNoPageStr, aPrt->GetDPIX(), aPrt->GetDPIY(), aPrt->GetPrinterOptions().IsConvertToGreyscales() ); - mpForwardBtn->Enable( mnCurPage < nPages-1 ); - mpBackwardBtn->Enable( mnCurPage != 0 ); - mpFirstBtn->Enable( mnCurPage != 0 ); - mpLastBtn->Enable( mnCurPage < nPages-1 ); - mpPageEdit->Enable( nPages > 1 ); + mxForwardBtn->set_sensitive( mnCurPage < nPages-1 ); + mxBackwardBtn->set_sensitive( mnCurPage != 0 ); + mxFirstBtn->set_sensitive( mnCurPage != 0 ); + mxLastBtn->set_sensitive( mnCurPage < nPages-1 ); + mxPageEdit->set_sensitive( nPages > 1 ); } void PrintDialog::updateOrientationBox( const bool bAutomatic ) @@ -1007,17 +944,17 @@ void PrintDialog::updateOrientationBox( const bool bAutomatic ) if ( !bAutomatic ) { Orientation eOrientation = maPController->getPrinter()->GetOrientation(); - mpOrientationBox->SelectEntryPos( static_cast<sal_Int32>(eOrientation) + 1 ); + mxOrientationBox->set_active( static_cast<sal_Int32>(eOrientation) + 1 ); } else if ( hasOrientationChanged() ) { - mpOrientationBox->SelectEntryPos( ORIENTATION_AUTOMATIC ); + mxOrientationBox->set_active( ORIENTATION_AUTOMATIC ); } } bool PrintDialog::hasOrientationChanged() const { - const int nOrientation = mpOrientationBox->GetSelectedEntryPos(); + const int nOrientation = mxOrientationBox->get_active(); const Orientation eOrientation = maPController->getPrinter()->GetOrientation(); return (nOrientation == ORIENTATION_LANDSCAPE && eOrientation == Orientation::Portrait) @@ -1057,23 +994,18 @@ void PrintDialog::setPaperOrientation( Orientation eOrientation ) void PrintDialog::checkControlDependencies() { - - if( mpCopyCountField->GetValue() > 1 ) - mpCollateBox->Enable( !mbCollateAlwaysOff ); + if (mxCopyCountField->get_value() > 1) + mxCollateBox->set_sensitive( !mbCollateAlwaysOff ); else - mpCollateBox->Enable( false ); - - Image aImg(StockImage::Yes, mpCollateBox->IsChecked() ? OUString(SV_PRINT_COLLATE_BMP) : OUString(SV_PRINT_NOCOLLATE_BMP)); + mxCollateBox->set_sensitive( false ); - Size aImgSize( aImg.GetSizePixel() ); + OUString aImg(mxCollateBox->get_active() ? OUString(SV_PRINT_COLLATE_BMP) : OUString(SV_PRINT_NOCOLLATE_BMP)); - // adjust size of image - mpCollateImage->SetSizePixel( aImgSize ); - mpCollateImage->SetImage( aImg ); + mxCollateImage->set_from_icon_name(aImg); // enable setup button only for printers that can be setup bool bHaveSetup = maPController->getPrinter()->HasSupport( PrinterSupport::SetupDialog ); - mpSetupButton->Enable(bHaveSetup); + mxSetupButton->set_sensitive(bHaveSetup); } void PrintDialog::checkOptionalControlDependencies() @@ -1082,7 +1014,7 @@ void PrintDialog::checkOptionalControlDependencies() { bool bShouldbeEnabled = maPController->isUIOptionEnabled( rEntry.second ); - if( bShouldbeEnabled && dynamic_cast<RadioButton*>(rEntry.first.get()) ) + if (bShouldbeEnabled && dynamic_cast<weld::RadioButton*>(rEntry.first)) { auto r_it = maControlToNumValMap.find( rEntry.first ); if( r_it != maControlToNumValMap.end() ) @@ -1091,21 +1023,21 @@ void PrintDialog::checkOptionalControlDependencies() } } - bool bIsEnabled = rEntry.first->IsEnabled(); + bool bIsEnabled = rEntry.first->get_sensitive(); // Enable does not do a change check first, so can be less cheap than expected - if( bShouldbeEnabled != bIsEnabled ) - rEntry.first->Enable( bShouldbeEnabled ); + if (bShouldbeEnabled != bIsEnabled) + rEntry.first->set_sensitive( bShouldbeEnabled ); } } void PrintDialog::initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& i_rMPS ) { - mpNupOrderWin->Show(); - mpPagesBtn->Check(); - mpBrochureBtn->Show( false ); + mxNupOrderWin->show(); + mxPagesBtn->set_active(true); + mxBrochureBtn->hide(); // setup field units for metric fields - const LocaleDataWrapper& rLocWrap( mpPageMarginEdt->GetLocaleDataWrapper() ); + const LocaleDataWrapper& rLocWrap(Application::GetSettings().GetLocaleDataWrapper()); FieldUnit eUnit = FieldUnit::MM; sal_uInt16 nDigits = 0; if( rLocWrap.getMeasurementSystemEnum() == MeasurementSystem::US ) @@ -1114,33 +1046,33 @@ void PrintDialog::initFromMultiPageSetup( const vcl::PrinterController::MultiPag nDigits = 2; } // set units - mpPageMarginEdt->SetUnit( eUnit ); - mpSheetMarginEdt->SetUnit( eUnit ); + mxPageMarginEdt->set_unit( eUnit ); + mxSheetMarginEdt->set_unit( eUnit ); // set precision - mpPageMarginEdt->SetDecimalDigits( nDigits ); - mpSheetMarginEdt->SetDecimalDigits( nDigits ); - - mpSheetMarginEdt->SetValue( mpSheetMarginEdt->Normalize( i_rMPS.nLeftMargin ), FieldUnit::MM_100TH ); - mpPageMarginEdt->SetValue( mpPageMarginEdt->Normalize( i_rMPS.nHorizontalSpacing ), FieldUnit::MM_100TH ); - mpBorderCB->Check( i_rMPS.bDrawBorder ); - mpNupRowsEdt->SetValue( i_rMPS.nRows ); - mpNupColEdt->SetValue( i_rMPS.nColumns ); - mpNupOrderBox->SelectEntryPos( static_cast<sal_Int32>(i_rMPS.nOrder) ); + mxPageMarginEdt->set_digits( nDigits ); + mxSheetMarginEdt->set_digits( nDigits ); + + mxSheetMarginEdt->set_value( mxSheetMarginEdt->normalize( i_rMPS.nLeftMargin ), FieldUnit::MM_100TH ); + mxPageMarginEdt->set_value( mxPageMarginEdt->normalize( i_rMPS.nHorizontalSpacing ), FieldUnit::MM_100TH ); + mxBorderCB->set_active( i_rMPS.bDrawBorder ); + mxNupRowsEdt->set_value( i_rMPS.nRows ); + mxNupColEdt->set_value( i_rMPS.nColumns ); + mxNupOrderBox->set_active( static_cast<sal_Int32>(i_rMPS.nOrder) ); if( i_rMPS.nRows != 1 || i_rMPS.nColumns != 1 ) { - mpNupPagesBox->SelectEntryPos( mpNupPagesBox->GetEntryCount()-1 ); + mxNupPagesBox->set_active( mxNupPagesBox->get_count()-1 ); showAdvancedControls( true ); - mpNupOrderWin->setValues( i_rMPS.nOrder, i_rMPS.nColumns, i_rMPS.nRows ); + mxNupOrder->setValues( i_rMPS.nOrder, i_rMPS.nColumns, i_rMPS.nRows ); } } void PrintDialog::updateNup( bool i_bMayUseCache ) { - int nRows = int(mpNupRowsEdt->GetValue()); - int nCols = int(mpNupColEdt->GetValue()); - long nPageMargin = mpPageMarginEdt->Denormalize(mpPageMarginEdt->GetValue( FieldUnit::MM_100TH )); - long nSheetMargin = mpSheetMarginEdt->Denormalize(mpSheetMarginEdt->GetValue( FieldUnit::MM_100TH )); + int nRows = mxNupRowsEdt->get_value(); + int nCols = mxNupColEdt->get_value(); + long nPageMargin = mxPageMarginEdt->denormalize(mxPageMarginEdt->get_value( FieldUnit::MM_100TH )); + long nSheetMargin = mxSheetMarginEdt->denormalize(mxSheetMarginEdt->get_value( FieldUnit::MM_100TH )); PrinterController::MultiPageSetup aMPS; aMPS.nRows = nRows; @@ -1153,11 +1085,11 @@ void PrintDialog::updateNup( bool i_bMayUseCache ) aMPS.nHorizontalSpacing = aMPS.nVerticalSpacing = nPageMargin; - aMPS.bDrawBorder = mpBorderCB->IsChecked(); + aMPS.bDrawBorder = mxBorderCB->get_active(); - aMPS.nOrder = static_cast<NupOrderType>(mpNupOrderBox->GetSelectedEntryPos()); + aMPS.nOrder = static_cast<NupOrderType>(mxNupOrderBox->get_active()); - int nOrientationMode = mpOrientationBox->GetSelectedEntryPos(); + int nOrientationMode = mxOrientationBox->get_active(); if( nOrientationMode == ORIENTATION_LANDSCAPE ) aMPS.aPaperSize = maNupLandscapeSize; else if( nOrientationMode == ORIENTATION_PORTRAIT ) @@ -1183,18 +1115,18 @@ void PrintDialog::updateNup( bool i_bMayUseCache ) maPController->setMultipage( aMPS ); - mpNupOrderWin->setValues( aMPS.nOrder, nCols, nRows ); + mxNupOrder->setValues( aMPS.nOrder, nCols, nRows ); preparePreview( i_bMayUseCache ); } void PrintDialog::updateNupFromPages( bool i_bMayUseCache ) { - sal_IntPtr nPages = sal_IntPtr(mpNupPagesBox->GetSelectedEntryData()); - int nRows = int(mpNupRowsEdt->GetValue()); - int nCols = int(mpNupColEdt->GetValue()); - long nPageMargin = mpPageMarginEdt->Denormalize(mpPageMarginEdt->GetValue( FieldUnit::MM_100TH )); - long nSheetMargin = mpSheetMarginEdt->Denormalize(mpSheetMarginEdt->GetValue( FieldUnit::MM_100TH )); + int nPages = mxNupPagesBox->get_active_id().toInt32(); + int nRows = mxNupRowsEdt->get_value(); + int nCols = mxNupColEdt->get_value(); + long nPageMargin = mxPageMarginEdt->denormalize(mxPageMarginEdt->get_value( FieldUnit::MM_100TH )); + long nSheetMargin = mxSheetMarginEdt->denormalize(mxSheetMarginEdt->get_value( FieldUnit::MM_100TH )); bool bCustom = false; if( nPages == 1 ) @@ -1258,8 +1190,8 @@ void PrintDialog::updateNupFromPages( bool i_bMayUseCache ) if( nSheetMargin > nVertMax ) nSheetMargin = nVertMax; - mpSheetMarginEdt->SetMax( - mpSheetMarginEdt->Normalize( + mxSheetMarginEdt->set_max( + mxSheetMarginEdt->normalize( std::min(nHorzMax, nVertMax) ), FieldUnit::MM_100TH ); // maximum page distance @@ -1275,15 +1207,15 @@ void PrintDialog::updateNupFromPages( bool i_bMayUseCache ) if( nPageMargin > nVertMax ) nPageMargin = nVertMax; - mpPageMarginEdt->SetMax( - mpSheetMarginEdt->Normalize( + mxPageMarginEdt->set_max( + mxSheetMarginEdt->normalize( std::min(nHorzMax, nVertMax ) ), FieldUnit::MM_100TH ); } - mpNupRowsEdt->SetValue( nRows ); - mpNupColEdt->SetValue( nCols ); - mpPageMarginEdt->SetValue( mpPageMarginEdt->Normalize( nPageMargin ), FieldUnit::MM_100TH ); - mpSheetMarginEdt->SetValue( mpSheetMarginEdt->Normalize( nSheetMargin ), FieldUnit::MM_100TH ); + mxNupRowsEdt->set_value( nRows ); + mxNupColEdt->set_value( nCols ); + mxPageMarginEdt->set_value( mxPageMarginEdt->normalize( nPageMargin ), FieldUnit::MM_100TH ); + mxSheetMarginEdt->set_value( mxSheetMarginEdt->normalize( nSheetMargin ), FieldUnit::MM_100TH ); showAdvancedControls( bCustom ); updateNup( i_bMayUseCache ); @@ -1291,51 +1223,51 @@ void PrintDialog::updateNupFromPages( bool i_bMayUseCache ) void PrintDialog::enableNupControls( bool bEnable ) { - mpNupPagesBox->Enable( bEnable ); - mpNupNumPagesTxt->Enable( bEnable ); - mpNupColEdt->Enable( bEnable ); - mpNupTimesTxt->Enable( bEnable ); - mpNupRowsEdt->Enable( bEnable ); - mpPageMarginTxt1->Enable( bEnable ); - mpPageMarginEdt->Enable( bEnable ); - mpPageMarginTxt2->Enable( bEnable ); - mpSheetMarginTxt1->Enable( bEnable ); - mpSheetMarginEdt->Enable( bEnable ); - mpSheetMarginTxt2->Enable( bEnable ); - mpNupOrderTxt->Enable( bEnable ); - mpNupOrderBox->Enable( bEnable ); - mpNupOrderWin->Enable( bEnable ); - mpBorderCB->Enable( bEnable ); + mxNupPagesBox->set_sensitive( bEnable ); + mxNupNumPagesTxt->set_sensitive( bEnable ); + mxNupColEdt->set_sensitive( bEnable ); + mxNupTimesTxt->set_sensitive( bEnable ); + mxNupRowsEdt->set_sensitive( bEnable ); + mxPageMarginTxt1->set_sensitive( bEnable ); + mxPageMarginEdt->set_sensitive( bEnable ); + mxPageMarginTxt2->set_sensitive( bEnable ); + mxSheetMarginTxt1->set_sensitive( bEnable ); + mxSheetMarginEdt->set_sensitive( bEnable ); + mxSheetMarginTxt2->set_sensitive( bEnable ); + mxNupOrderTxt->set_sensitive( bEnable ); + mxNupOrderBox->set_sensitive( bEnable ); + mxNupOrderWin->set_sensitive( bEnable ); + mxBorderCB->set_sensitive( bEnable ); } void PrintDialog::showAdvancedControls( bool i_bShow ) { - mpNupNumPagesTxt->Show( i_bShow ); - mpNupColEdt->Show( i_bShow ); - mpNupTimesTxt->Show( i_bShow ); - mpNupRowsEdt->Show( i_bShow ); - mpPageMarginTxt1->Show( i_bShow ); - mpPageMarginEdt->Show( i_bShow ); - mpPageMarginTxt2->Show( i_bShow ); - mpSheetMarginTxt1->Show( i_bShow ); - mpSheetMarginEdt->Show( i_bShow ); - mpSheetMarginTxt2->Show( i_bShow ); + mxNupNumPagesTxt->set_visible( i_bShow ); + mxNupColEdt->set_visible( i_bShow ); + mxNupTimesTxt->set_visible( i_bShow ); + mxNupRowsEdt->set_visible( i_bShow ); + mxPageMarginTxt1->set_visible( i_bShow ); + mxPageMarginEdt->set_visible( i_bShow ); + mxPageMarginTxt2->set_visible( i_bShow ); + mxSheetMarginTxt1->set_visible( i_bShow ); + mxSheetMarginEdt->set_visible( i_bShow ); + mxSheetMarginTxt2->set_visible( i_bShow ); } namespace { - void setHelpId( vcl::Window* i_pWindow, const Sequence< OUString >& i_rHelpIds, sal_Int32 i_nIndex ) + void setHelpId( weld::Widget* i_pWindow, const Sequence< OUString >& i_rHelpIds, sal_Int32 i_nIndex ) { if( i_nIndex >= 0 && i_nIndex < i_rHelpIds.getLength() ) - i_pWindow->SetHelpId( OUStringToOString( i_rHelpIds.getConstArray()[i_nIndex], RTL_TEXTENCODING_UTF8 ) ); + i_pWindow->set_help_id( OUStringToOString( i_rHelpIds.getConstArray()[i_nIndex], RTL_TEXTENCODING_UTF8 ) ); } - void setHelpText( vcl::Window* i_pWindow, const Sequence< OUString >& i_rHelpTexts, sal_Int32 i_nIndex ) + void setHelpText( weld::Widget* i_pWindow, const Sequence< OUString >& i_rHelpTexts, sal_Int32 i_nIndex ) { // without a help text set and the correct smartID, // help texts will be retrieved from the online help system if( i_nIndex >= 0 && i_nIndex < i_rHelpTexts.getLength() ) - i_pWindow->SetHelpText( i_rHelpTexts.getConstArray()[i_nIndex] ); + i_pWindow->set_tooltip_text(i_rHelpTexts.getConstArray()[i_nIndex]); } } @@ -1348,12 +1280,9 @@ void PrintDialog::setupOptionalUI() { OUString sOptionsUIFile; rOption.Value >>= sOptionsUIFile; - - vcl::Window *pCustom = get<vcl::Window>("customcontents"); - - mpCustomOptionsUIBuilder.reset(new VclBuilder(pCustom, getUIRootDir(), sOptionsUIFile)); - vcl::Window *pWindow = mpCustomOptionsUIBuilder->get_widget_root(); - pWindow->Show(); + mxCustomOptionsUIBuilder.reset(Application::CreateBuilder(mxCustom.get(), sOptionsUIFile)); + std::unique_ptr<weld::Container> xWindow = mxCustomOptionsUIBuilder->weld_container("box"); + xWindow->show(); continue; } @@ -1458,96 +1387,110 @@ void PrintDialog::setupOptionalUI() } } - if (aCtrlType == "Group" && !aID.isEmpty()) + if (aCtrlType == "Group") { - TabPage *pPage = get<TabPage>(aID); - if (!pPage && mpCustomOptionsUIBuilder) - pPage = mpCustomOptionsUIBuilder->get<TabPage>(aID); + aID = "custom"; + weld::Container* pPage = mxTabCtrl->get_page(aID); if (!pPage) continue; - sal_uInt16 nPageId = mpTabCtrl->GetPageId(*pPage); - - mpTabCtrl->SetPageText(nPageId, aText); + mxTabCtrl->set_tab_label_text(aID, aText); // set help id if (aHelpIds.hasElements()) - mpTabCtrl->SetHelpId(nPageId, OUStringToOString(aHelpIds.getConstArray()[0], RTL_TEXTENCODING_UTF8)); + pPage->set_help_id(OUStringToOString(aHelpIds.getConstArray()[0], RTL_TEXTENCODING_UTF8)); // set help text if (aHelpTexts.hasElements()) - mpTabCtrl->SetHelpText(nPageId, aHelpTexts.getConstArray()[0]); + pPage->set_tooltip_text(aHelpTexts.getConstArray()[0]); - pPage->Show(); + pPage->show(); } else if (aCtrlType == "Subgroup" && !aID.isEmpty()) { - vcl::Window *pFrame = get<vcl::Window>(aID); - if (!pFrame && mpCustomOptionsUIBuilder) - pFrame = mpCustomOptionsUIBuilder->get<vcl::Window>(aID); + std::unique_ptr<weld::Widget> xWidget; + // since 'New Print Dialog Design' fromwhich in calc is not a frame anymore + if (aID == "fromwhich") + { + std::unique_ptr<weld::Label> xLabel = m_xBuilder->weld_label(aID); + xLabel->set_label(aText); + xWidget = std::move(xLabel); + } + else + { + std::unique_ptr<weld::Frame> xFrame = m_xBuilder->weld_frame(aID); + if (!xFrame && mxCustomOptionsUIBuilder) + xFrame = mxCustomOptionsUIBuilder->weld_frame(aID); + if (xFrame) + { + xFrame->set_label(aText); + xWidget = std::move(xFrame); + } + } - if (!pFrame) + if (!xWidget) continue; - pFrame->SetText(aText); - // set help id - setHelpId(pFrame, aHelpIds, 0); + setHelpId(xWidget.get(), aHelpIds, 0); // set help text - setHelpText(pFrame, aHelpTexts, 0); + setHelpText(xWidget.get(), aHelpTexts, 0); - pFrame->Show(); + xWidget->show(); } // EVIL else if( aCtrlType == "Bool" && aGroupingHint == "LayoutPage" && aPropertyName == "PrintProspect" ) { - mpBrochureBtn->SetText( aText ); - mpBrochureBtn->Show(); + mxBrochureBtn->set_label(aText); + mxBrochureBtn->show(); bool bVal = false; PropertyValue* pVal = maPController->getValue( aPropertyName ); if( pVal ) pVal->Value >>= bVal; - mpBrochureBtn->Check( bVal ); - mpBrochureBtn->Enable( maPController->isUIOptionEnabled( aPropertyName ) && pVal != nullptr ); - mpBrochureBtn->SetToggleHdl( LINK( this, PrintDialog, ToggleRadioHdl ) ); + mxBrochureBtn->set_active( bVal ); + mxBrochureBtn->set_sensitive( maPController->isUIOptionEnabled( aPropertyName ) && pVal != nullptr ); + mxBrochureBtn->connect_toggled( LINK( this, PrintDialog, ToggleHdl ) ); - maPropertyToWindowMap[ aPropertyName ].emplace_back(mpBrochureBtn ); - maControlToPropertyMap[mpBrochureBtn] = aPropertyName; + maPropertyToWindowMap[aPropertyName].emplace_back(mxBrochureBtn.get()); + maControlToPropertyMap[mxBrochureBtn.get()] = aPropertyName; // set help id - setHelpId( mpBrochureBtn, aHelpIds, 0 ); + setHelpId( mxBrochureBtn.get(), aHelpIds, 0 ); // set help text - setHelpText( mpBrochureBtn, aHelpTexts, 0 ); + setHelpText( mxBrochureBtn.get(), aHelpTexts, 0 ); } else if (aCtrlType == "Bool") { // add a check box - CheckBox* pNewBox = get<CheckBox>(aID); - if (!pNewBox && mpCustomOptionsUIBuilder) - pNewBox = mpCustomOptionsUIBuilder->get<CheckBox>(aID); - - if (!pNewBox) + std::unique_ptr<weld::CheckButton> xNewBox = m_xBuilder->weld_check_button(aID); + if (!xNewBox && mxCustomOptionsUIBuilder) + xNewBox = mxCustomOptionsUIBuilder->weld_check_button(aID); + if (!xNewBox) continue; - pNewBox->SetText( aText ); - pNewBox->Show(); + xNewBox->set_label( aText ); + xNewBox->show(); bool bVal = false; PropertyValue* pVal = maPController->getValue( aPropertyName ); if( pVal ) pVal->Value >>= bVal; - pNewBox->Check( bVal ); - pNewBox->SetToggleHdl( LINK( this, PrintDialog, UIOption_CheckHdl ) ); + xNewBox->set_active( bVal ); + xNewBox->connect_toggled( LINK( this, PrintDialog, UIOption_CheckHdl ) ); + + maExtraControls.emplace_back(std::move(xNewBox)); - maPropertyToWindowMap[ aPropertyName ].emplace_back(pNewBox ); - maControlToPropertyMap[pNewBox] = aPropertyName; + weld::Widget* pWidget = maExtraControls.back().get(); + + maPropertyToWindowMap[aPropertyName].emplace_back(pWidget); + maControlToPropertyMap[pWidget] = aPropertyName; // set help id - setHelpId( pNewBox, aHelpIds, 0 ); + setHelpId(pWidget, aHelpIds, 0); // set help text - setHelpText( pNewBox, aHelpTexts, 0 ); + setHelpText(pWidget, aHelpTexts, 0); } else if (aCtrlType == "Radio") { @@ -1561,116 +1504,125 @@ void PrintDialog::setupOptionalUI() for( sal_Int32 m = 0; m < aChoices.getLength(); m++ ) { aID = OUStringToOString(aIDs[m], RTL_TEXTENCODING_UTF8); - RadioButton* pBtn = get<RadioButton>(aID); - if (!pBtn && mpCustomOptionsUIBuilder) - pBtn = mpCustomOptionsUIBuilder->get<RadioButton>(aID); - - if (!pBtn) + std::unique_ptr<weld::RadioButton> xBtn = m_xBuilder->weld_radio_button(aID); + if (!xBtn && mxCustomOptionsUIBuilder) + xBtn = mxCustomOptionsUIBuilder->weld_radio_button(aID); + if (!xBtn) continue; - pBtn->SetText( aChoices[m] ); - pBtn->Check( m == nSelectVal ); - pBtn->SetToggleHdl( LINK( this, PrintDialog, UIOption_RadioHdl ) ); + xBtn->set_label( aChoices[m] ); + xBtn->set_active( m == nSelectVal ); + xBtn->connect_toggled( LINK( this, PrintDialog, UIOption_RadioHdl ) ); if( aChoicesDisabled.getLength() > m && aChoicesDisabled[m] ) - pBtn->Enable( false ); - pBtn->Show(); - maPropertyToWindowMap[ aPropertyName ].emplace_back(pBtn ); - maControlToPropertyMap[pBtn] = aPropertyName; - maControlToNumValMap[pBtn] = m; + xBtn->set_sensitive( false ); + xBtn->show(); + + maExtraControls.emplace_back(std::move(xBtn)); + + weld::Widget* pWidget = maExtraControls.back().get(); + + maPropertyToWindowMap[ aPropertyName ].emplace_back(pWidget); + maControlToPropertyMap[pWidget] = aPropertyName; + maControlToNumValMap[pWidget] = m; // set help id - setHelpId( pBtn, aHelpIds, nCurHelpText ); + setHelpId( pWidget, aHelpIds, nCurHelpText ); // set help text - setHelpText( pBtn, aHelpTexts, nCurHelpText ); + setHelpText( pWidget, aHelpTexts, nCurHelpText ); nCurHelpText++; } } else if ( aCtrlType == "List" ) { - ListBox* pList = get<ListBox>(aID); - if (!pList && mpCustomOptionsUIBuilder) - pList = mpCustomOptionsUIBuilder->get<ListBox>(aID); - - if (!pList) + std::unique_ptr<weld::ComboBox> xList = m_xBuilder->weld_combo_box(aID); + if (!xList && mxCustomOptionsUIBuilder) + xList = mxCustomOptionsUIBuilder->weld_combo_box(aID); + if (!xList) continue; // iterate options for( const auto& rChoice : std::as_const(aChoices) ) - { - pList->InsertEntry( rChoice ); - } + xList->append_text(rChoice); + sal_Int32 nSelectVal = 0; PropertyValue* pVal = maPController->getValue( aPropertyName ); if( pVal && pVal->Value.hasValue() ) pVal->Value >>= nSelectVal; - pList->SelectEntryPos( static_cast<sal_uInt16>(nSelectVal) ); - pList->SetSelectHdl( LINK( this, PrintDialog, UIOption_SelectHdl ) ); - pList->SetDropDownLineCount( static_cast<sal_uInt16>(aChoices.getLength()) ); - pList->Show(); + xList->set_active(nSelectVal); + xList->connect_changed( LINK( this, PrintDialog, UIOption_SelectHdl ) ); + xList->show(); + + maExtraControls.emplace_back(std::move(xList)); + + weld::Widget* pWidget = maExtraControls.back().get(); + + maPropertyToWindowMap[ aPropertyName ].emplace_back(pWidget); + maControlToPropertyMap[pWidget] = aPropertyName; // set help id - setHelpId( pList, aHelpIds, 0 ); + setHelpId( pWidget, aHelpIds, 0 ); // set help text - setHelpText( pList, aHelpTexts, 0 ); - - maPropertyToWindowMap[ aPropertyName ].emplace_back(pList ); - maControlToPropertyMap[pList] = aPropertyName; + setHelpText( pWidget, aHelpTexts, 0 ); } else if ( aCtrlType == "Range" ) { - NumericField* pField = get<NumericField>(aID); - if (!pField && mpCustomOptionsUIBuilder) - pField = mpCustomOptionsUIBuilder->get<NumericField>(aID); - - if (!pField) + std::unique_ptr<weld::SpinButton> xField = m_xBuilder->weld_spin_button(aID); + if (!xField && mxCustomOptionsUIBuilder) + xField = mxCustomOptionsUIBuilder->weld_spin_button(aID); + if (!xField) continue; // set min/max and current value - if( nMinValue != nMaxValue ) - { - pField->SetMin( nMinValue ); - pField->SetMax( nMaxValue ); - } + if(nMinValue != nMaxValue) ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits