[Libreoffice-commits] core.git: Branch 'feature/print_revamp' - vcl/inc vcl/source vcl/uiconfig

2018-11-29 Thread Libreoffice Gerrit user
 vcl/inc/printdlg.hxx |7 +--
 vcl/source/window/printdlg.cxx   |   71 +--
 vcl/uiconfig/ui/moreoptionsdialog.ui |2 
 vcl/uiconfig/ui/printdialog.ui   |   17 
 4 files changed, 49 insertions(+), 48 deletions(-)

New commits:
commit bb1e313acea493d1ad5deba50b2d4235991c111e
Author: Daniel Silva 
AuthorDate: Wed Nov 28 19:28:26 2018 -0200
Commit: Daniel Silva 
CommitDate: Thu Nov 29 15:34:21 2018 +0100

Prepare to rebase

Change-Id: I27b17e27d56a236d5d3bf59e1ce1f452fe36cce0
Reviewed-on: https://gerrit.libreoffice.org/64197
Tested-by: Jenkins
Reviewed-by: Daniel Silva 

diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 5afddc7fd73d..5fe92285d650 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -159,15 +159,15 @@ namespace vcl
 VclPtrmpPageEdit;
 
 OUStringmaPageStr;
-OUStringmaNoPageStr;
-OUStringmaNoPreviewStr;
+OUString const  maNoPageStr;
+OUString const  maNoPreviewStr;
 sal_Int32   mnCurPage;
 sal_Int32   mnCachedPages;
 
 BitmapEx const  maCollateBmp;
 BitmapEx const  maNoCollateBmp;
 
-longmnCollateUIMode;
+boolmbCollateAlwaysOff;
 
 VclPtr mpPagesBtn;
 VclPtr mpBrochureBtn;
@@ -201,7 +201,6 @@ namespace vcl
 maPropertyToWindowMap;
 std::map< VclPtr, sal_Int32 >
 maControlToNumValMap;
-std::set< OUString >maReverseDependencySet;
 
 SizemaNupPortraitSize;
 SizemaNupLandscapeSize;
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index fd5fbbed9dd4..6a038106fd23 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -528,7 +528,6 @@ Size const & PrintDialog::getJobPageSize()
 
 PrintDialog::PrintDialog(vcl::Window* i_pWindow, const 
std::shared_ptr& i_rController)
 : ModalDialog(i_pWindow, "PrintDialog", "vcl/ui/printdialog.ui")
-, mpCustomOptionsUIBuilder(nullptr)
 , maPController( i_rController )
 , maPrintToFileText( VclResId( SV_PRINT_TOFILE_TXT ) )
 , maDefPrtText( VclResId( SV_PRINT_DEFPRT_TXT ) )
@@ -538,7 +537,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const 
std::shared_ptrInsertEntry( *it );
+mpPrinters->InsertEntry( rQueue );
 }
 // select current printer
 if( mpPrinters->GetEntryPos( maPController->getPrinter()->GetName() ) != 
LISTBOX_ENTRY_NOTFOUND )
@@ -847,13 +846,13 @@ void PrintDialog::readFromSettings()
   "CollateBox" );
 if( aValue.equalsIgnoreAsciiCase("alwaysoff") )
 {
-mnCollateUIMode = 1;
+mbCollateAlwaysOff = true;
 mpCollateBox->Check( false );
 mpCollateBox->Enable( false );
 }
 else
 {
-mnCollateUIMode = 0;
+mbCollateAlwaysOff = false;
 aValue = pItem->getValue( "PrintDialog",
   "Collate" );
 mpCollateBox->Check( aValue.equalsIgnoreAsciiCase("true") );
@@ -1076,7 +1075,7 @@ void PrintDialog::checkControlDependencies()
 {
 
 if( mpCopyCountField->GetValue() > 1 )
-mpCollateBox->Enable( mnCollateUIMode == 0 );
+mpCollateBox->Enable( !mbCollateAlwaysOff );
 else
 mpCollateBox->Enable( false );
 
@@ -1095,41 +1094,23 @@ void PrintDialog::checkControlDependencies()
 
 void PrintDialog::checkOptionalControlDependencies()
 {
-for( auto it = maControlToPropertyMap.begin();
- it != maControlToPropertyMap.end(); ++it )
+for( const auto& rEntry : maControlToPropertyMap )
 {
-bool bShouldbeEnabled = maPController->isUIOptionEnabled( it->second );
-if( ! bShouldbeEnabled )
-{
-// enable controls that are directly attached to a dependency 
anyway
-// if the normally disabled controls get modified, change the 
dependency
-// so the control would be enabled
-// example: in print range "Print All" is selected, "Page Range" 
is then of course
-// not selected and the Edit for the Page Range would be disabled
-// as a convenience we should enable the Edit anyway and 
automatically select
-// "Page Range" instead of "Print All" if the Edit gets modified
-if( maReverseDependencySet.find( it->second ) != 
maReverseDependencySet.end() )
-{
-

[Libreoffice-commits] core.git: Branch 'feature/print_revamp' - vcl/inc vcl/source vcl/uiconfig vcl/UIConfig_vcl.mk

2018-07-26 Thread Libreoffice Gerrit user
 vcl/UIConfig_vcl.mk  |1 
 vcl/inc/printdlg.hxx |   23 +
 vcl/source/gdi/print3.cxx|   11 +---
 vcl/source/window/printdlg.cxx   |   53 -
 vcl/uiconfig/ui/moreoptionsdialog.ui |   88 +++
 vcl/uiconfig/ui/printdialog.ui   |2 
 6 files changed, 170 insertions(+), 8 deletions(-)

New commits:
commit 4bfb749c06884c5506c48668a46e95c7bb18006c
Author: Daniel Silva 
AuthorDate: Thu Jun 21 10:20:54 2018 -0300
Commit: Katarina Behrens 
CommitDate: Thu Jul 26 21:07:58 2018 +0200

Adds More options dialog with single jobs checkbox in print dialog

Change-Id: I5f88e48edb5dfd966bcafca7866ee2a982a7f020
Reviewed-on: https://gerrit.libreoffice.org/56236
Tested-by: Jenkins
Reviewed-by: Katarina Behrens 

diff --git a/vcl/UIConfig_vcl.mk b/vcl/UIConfig_vcl.mk
index 8238c717a279..8a385de8 100644
--- a/vcl/UIConfig_vcl.mk
+++ b/vcl/UIConfig_vcl.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_UIConfig_add_uifiles,vcl,\
vcl/uiconfig/ui/editmenu \
vcl/uiconfig/ui/errornocontentdialog \
vcl/uiconfig/ui/errornoprinterdialog \
+   vcl/uiconfig/ui/moreoptionsdialog \
vcl/uiconfig/ui/printdialog \
vcl/uiconfig/ui/printerdevicepage \
vcl/uiconfig/ui/printerpaperpage \
diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 5264fa506034..0be16fcd8413 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -35,9 +35,27 @@
 
 namespace vcl
 {
+class MoreOptionsDialog : public ModalDialog
+{
+VclPtr mpParent;
+VclPtrmpOKButton;
+VclPtrmpCancelButton;
+VclPtrmpSingleJobsBox;
+
+DECL_LINK( ClickHdl, Button*, void );
+
+public:
+
+MoreOptionsDialog( VclPtr i_pParent );
+virtual ~MoreOptionsDialog() override;
+virtual void dispose() override;
+};
+
 class PrintDialog : public ModalDialog
 {
+friend class MoreOptionsDialog;
 public:
+
 class PrintPreviewWindow : public vcl::Window
 {
 GDIMetaFile maMtf;
@@ -98,6 +116,7 @@ namespace vcl
 
 bool isPrintToFile();
 bool isCollate();
+bool isSingleJobs() const { return mbSingleJobs; };
 bool hasPreview();
 
 void previewForward();
@@ -109,6 +128,8 @@ namespace vcl
 
 std::shared_ptr  maPController;
 
+VclPtr< MoreOptionsDialog > mpMoreOptionsDlg;
+
 VclPtr  mpTabCtrl;
 VclPtrmpPageLayoutFrame;
 VclPtr mpPrinters;
@@ -126,6 +147,7 @@ namespace vcl
 VclPtrmpOKButton;
 VclPtrmpCancelButton;
 VclPtr  mpHelpButton;
+VclPtr  mpMoreOptionsBtn;
 
 VclPtr  mpBackwardBtn;
 VclPtr  mpForwardBtn;
@@ -184,6 +206,7 @@ namespace vcl
 SizemaFirstPageSize;
 
 boolmbShowLayoutFrame;
+boolmbSingleJobs;
 
 DECL_LINK( ClickHdl, Button*, void );
 DECL_LINK( SelectHdl, ListBox&, void );
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 599965f479f5..69dc05d9a949 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -491,12 +491,11 @@ bool 
Printer::PreparePrintJob(std::shared_ptr xController,
 xController->setValue( "LocalFileName",
css::uno::makeAny( aFile ) );
 }
-// FIXME: single jobs is not implemented yet.
-// else if( aDlg->isSingleJobs() )
-// {
-// xController->setValue( "PrintCollateAsSingleJobs",
-//css::uno::makeAny( true ) );
-// }
+else if( aDlg->isSingleJobs() )
+{
+xController->setValue( "PrintCollateAsSingleJobs",
+css::uno::makeAny( true ) );
+}
 }
 catch (const std::bad_alloc&)
 {
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 97c3bca84689..c10dd7bed22f 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -77,6 +77,48 @@ namespace {
}
 }
 
+MoreOptionsDialog::MoreOptionsDialog( VclPtr i_pParent )
+: ModalDialog(i_pParent, "MoreOptionsDialog", 
"vcl/ui/moreoptionsdialog.ui")
+, mpParent( i_pParent )
+{
+get(mpOKButton, "ok");
+get(mpCancelButton, "cancel");
+get(mpSingleJobsBox, "singlejobs");
+
+mpSingleJobsBox->Check( mpParent->isSingleJobs() );
+
+mpOKButton->SetClickHdl( 

[Libreoffice-commits] core.git: Branch 'feature/print_revamp' - vcl/inc vcl/source vcl/uiconfig

2018-06-27 Thread Daniel Silva
 vcl/inc/printdlg.hxx   |1 
 vcl/source/window/printdlg.cxx |   31 +-
 vcl/uiconfig/ui/printdialog.ui |  182 +
 3 files changed, 159 insertions(+), 55 deletions(-)

New commits:
commit 18acebfc14fac1e2645218ee929b9c63c7320e35
Author: Daniel Silva 
Date:   Mon Jun 18 14:52:16 2018 -0300

Sets pages per sheet and brochure in print dialog

Change-Id: Iee6fea72cee02d9ffd00b81511382992aad72e61
Reviewed-on: https://gerrit.libreoffice.org/56057
Tested-by: Jenkins
Reviewed-by: Daniel Silva 

diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 2baa21dc53d3..5264fa506034 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -164,6 +164,7 @@ namespace vcl
 VclPtr mpNupOrientationBox;
 
 // page order ("left to right, then down")
+VclPtr   mpNupOrderTxt;
 VclPtr mpNupOrderBox;
 VclPtr  mpNupOrderWin;
 /// border around each page
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 967b88335b09..97c3bca84689 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -518,6 +518,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const 
std::shared_ptrSetModifyHdl( 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 ) );
 
 preparePreview( true, true );
 }
@@ -690,6 +693,7 @@ void PrintDialog::dispose()
 mpNupOrientationBox.clear();
 mpNupOrderBox.clear();
 mpNupOrderWin.clear();
+mpNupOrderTxt.clear();
 mpBorderCB.clear();
 ModalDialog::dispose();
 }
@@ -1024,10 +1028,28 @@ void PrintDialog::updateNupFromPages()
 mpSheetMarginEdt->SetValue( mpSheetMarginEdt->Normalize( nSheetMargin ), 
FUNIT_100TH_MM );
 
 showAdvancedControls( bCustom );
-
 updateNup();
 }
 
+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 );
+}
+
 void PrintDialog::showAdvancedControls( bool i_bShow )
 {
 mpNupNumPagesTxt->Show( i_bShow );
@@ -1232,8 +1254,7 @@ void PrintDialog::setupOptionalUI()
 else if( aCtrlType == "Bool" && aGroupingHint == "LayoutPage" && 
aPropertyName == "PrintProspect" )
 {
 mpBrochureBtn->SetText( aText );
-// FIXME: Brochure button is still not working, so it is hidden 
for now
-// mpBrochureBtn->Show();
+mpBrochureBtn->Show();
 
 bool bVal = false;
 PropertyValue* pVal = maPController->getValue( aPropertyName );
@@ -1582,12 +1603,12 @@ IMPL_LINK ( PrintDialog, ClickHdl, Button*, pButton, 
void )
 mpNupPagesBox->SelectEntryPos( 0 );
 updateNupFromPages();
 showAdvancedControls( false );
-//enableNupControls( false );
+enableNupControls( false );
 }
 }
 else if( pButton == mpPagesBtn )
 {
-//enableNupControls( true );
+enableNupControls( true );
 updateNupFromPages();
 }
 else if( pButton == mpCollateBox )
diff --git a/vcl/uiconfig/ui/printdialog.ui b/vcl/uiconfig/ui/printdialog.ui
index f7b7de2db876..4775d131fab5 100644
--- a/vcl/uiconfig/ui/printdialog.ui
+++ b/vcl/uiconfig/ui/printdialog.ui
@@ -1,5 +1,5 @@
 
-
+
 
   
   
@@ -29,6 +29,64 @@
 gtk-media-next
 1
   
+  
+
+  
+  
+  
+  
+
+
+  
+1
+1
+  
+  
+2
+2
+  
+  
+4
+4
+  
+  
+6
+6
+  
+  
+9
+9
+  
+  
+16
+16
+  
+  
+Custom
+65535
+  
+
+  
+  
+
+  
+  
+
+
+  
+left 
to right, then down
+  
+  
+top to 
bottom, then right
+  
+  
+top to 
bottom, then left
+  
+  
+right 
to left, then down
+  
+
+  
   
 False
 dialog
@@ -125,14 +183,14 @@
 vertical
 6
 
-  
+  
  

[Libreoffice-commits] core.git: Branch 'feature/print_revamp' - vcl/inc vcl/source vcl/uiconfig

2018-06-14 Thread Daniel
 vcl/inc/printdlg.hxx   |   23 +
 vcl/source/window/printdlg.cxx |  616 -
 vcl/uiconfig/ui/printdialog.ui |   15 
 3 files changed, 641 insertions(+), 13 deletions(-)

New commits:
commit e0c9aaf19bed5a38ecb2748008d02b5c88a7ff26
Author: Daniel 
Date:   Fri Jun 8 00:26:21 2018 -0300

Reinserts optional UI options into print dialog

Change-Id: I9ee0e250ea476aa546b842cbd45fff8ea208cfe5
Reviewed-on: https://gerrit.libreoffice.org/55450
Tested-by: Jenkins
Reviewed-by: Daniel Silva 

diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 03e01b840003..2baa21dc53d3 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -104,9 +105,12 @@ namespace vcl
 
 private:
 
+std::unique_ptr mpCustomOptionsUIBuilder;
+
 std::shared_ptr  maPController;
 
 VclPtr  mpTabCtrl;
+VclPtrmpPageLayoutFrame;
 VclPtr mpPrinters;
 VclPtr   mpStatusTxt;
 VclPtr  mpSetupButton;
@@ -165,30 +169,47 @@ namespace vcl
 /// border around each page
 VclPtrmpBorderCB;
 
-std::map< VclPtr, OUString >  maControlToPropertyMap;
+std::map< VclPtr, OUString >
+maControlToPropertyMap;
+std::map< OUString, std::vector< VclPtr > >
+maPropertyToWindowMap;
+std::map< VclPtr, sal_Int32 >
+maControlToNumValMap;
+std::set< OUString >maReverseDependencySet;
 
 SizemaNupPortraitSize;
 SizemaNupLandscapeSize;
 /// internal, used for automatic Nup-Portrait/landscape
 SizemaFirstPageSize;
 
+boolmbShowLayoutFrame;
+
 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( UIOption_CheckHdl, CheckBox&, void );
+DECL_LINK( UIOption_RadioHdl, RadioButton&, void );
+DECL_LINK( UIOption_SelectHdl, ListBox&, void );
+DECL_LINK( UIOption_ModifyHdl, Edit&, void );
+
 css::beans::PropertyValue* getValueForWindow( vcl::Window* ) const;
 
 void preparePreview( bool i_bPrintChanged = true, bool i_bMayUseCache 
= false );
 void setPreviewText();
 void updatePrinterText();
 void checkControlDependencies();
+void checkOptionalControlDependencies();
+void makeEnabled( vcl::Window* );
+void updateWindowFromProperty( const OUString& );
 void initFromMultiPageSetup( const 
vcl::PrinterController::MultiPageSetup& );
 void showAdvancedControls( bool );
 void updateNup();
 void updateNupFromPages();
 void enableNupControls( bool bEnable );
+void setupOptionalUI();
 Size const & getJobPageSize();
 
 };
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 06f3ed8470f0..967b88335b09 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -482,8 +482,8 @@ Size const & PrintDialog::getJobPageSize()
 }
 
 PrintDialog::PrintDialog(vcl::Window* i_pWindow, const 
std::shared_ptr& i_rController)
-
 : ModalDialog(i_pWindow, "PrintDialog", "vcl/ui/printdialog.ui")
+, mpCustomOptionsUIBuilder(nullptr)
 , maPController( i_rController )
 , maPrintToFileText( VclResId( SV_PRINT_TOFILE_TXT ) )
 , maDefPrtText( VclResId( SV_PRINT_DEFPRT_TXT ) )
@@ -494,11 +494,14 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const 
std::shared_ptrgetMultipage() );
 
+// setup optional UI options set by application
+setupOptionalUI();
+
+// hide layout frame if unwanted
+mpPageLayoutFrame->Show( mbShowLayoutFrame );
+
 // setup click hdl
 mpOKButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl));
 mpCancelButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl));
@@ -618,7 +627,6 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const 
std::shared_ptrSetToggleHdl( LINK( this, PrintDialog, ToggleHdl ) );
 mpCollateBox->SetToggleHdl( LINK( this, PrintDialog, ToggleHdl ) );
 mpPagesBtn->SetToggleHdl( LINK( this, PrintDialog, ToggleRadioHdl ) );
-mpBrochureBtn->SetToggleHdl( LINK( this, PrintDialog, ToggleRadioHdl ) );
 
 // setup select hdl
 mpPrinters->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
@@ -643,8 +651,9 @@ PrintDialog::~PrintDialog()
 
 void 

[Libreoffice-commits] core.git: Branch 'feature/print_revamp' - vcl/inc vcl/source vcl/uiconfig

2018-06-07 Thread Daniel
 vcl/inc/printdlg.hxx   |  208 +---
 vcl/source/gdi/print3.cxx  |   11 
 vcl/source/window/printdlg.cxx | 1562 +++---
 vcl/uiconfig/ui/printdialog.ui | 2069 +++--
 4 files changed, 1225 insertions(+), 2625 deletions(-)

New commits:
commit 1d5edc87667625d8b97c7cc9f59cbd2c8c96fe36
Author: Daniel 
Date:   Sat Jun 2 19:40:52 2018 -0300

New Print Dialog Design

Change-Id: Ib92a16ccfab70b84ffea07970a694800ecc16d07
Reviewed-on: https://gerrit.libreoffice.org/55237
Tested-by: Jenkins 
Reviewed-by: Daniel Silva 

diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 0a5b09fd366a..03e01b840003 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -17,8 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_PRINTDLG_HXX
-#define INCLUDED_VCL_INC_PRINTDLG_HXX
+#ifndef VCL_INC_NEWPRINTDLG_HXX
+#define VCL_INC_NEWPRINTDLG_HXX
 
 #include 
 
@@ -91,168 +91,106 @@ namespace vcl
 }
 };
 
-private:
-
-class NUpTabPage
-{
-public:
-VclPtr mpPagesBtn;
-VclPtr mpBrochureBtn;
-VclPtr   mpPagesBoxTitleTxt;
-VclPtr mpNupPagesBox;
-
-// controls for "Custom" page mode
-VclPtr   mpNupNumPagesTxt;
-VclPtrmpNupColEdt;
-VclPtr   mpNupTimesTxt;
-VclPtrmpNupRowsEdt;
-VclPtr   mpPageMarginTxt1;
-VclPtr mpPageMarginEdt;
-VclPtr   mpPageMarginTxt2;
-VclPtr   mpSheetMarginTxt1;
-VclPtr mpSheetMarginEdt;
-VclPtr   mpSheetMarginTxt2;
-VclPtr   mpNupOrientationTxt;
-VclPtr mpNupOrientationBox;
-
-// page order ("left to right, then down")
-VclPtr   mpNupOrderTxt;
-VclPtr mpNupOrderBox;
-VclPtr  mpNupOrderWin;
-/// border around each page
-VclPtrmpBorderCB;
-
-NUpTabPage( VclBuilder* );
-
-void initFromMultiPageSetup( const 
vcl::PrinterController::MultiPageSetup& );
-void enableNupControls( bool bEnable );
-
-void showAdvancedControls( bool );
-};
-
-class JobTabPage
-{
-public:
-VclPtr mpPrinters;
-VclPtr   mpStatusTxt;
-VclPtr   mpLocationTxt;
-VclPtr   mpCommentTxt;
-
-VclPtr  mpSetupButton;
-
-VclPtrmpCopyCountField;
-VclPtrmpCollateBox;
-VclPtr  mpCollateImage;
-VclPtrmpReverseOrderBox;
-
-BitmapExmaCollateBmp;
-BitmapExmaNoCollateBmp;
-
-longmnCollateUIMode;
-
-JobTabPage( VclBuilder* );
-
-void readFromSettings();
-void storeToSettings();
-};
-
-class OutputOptPage
-{
-public:
-VclPtrmpCollateSingleJobsBox;
-VclPtrmpPapersizeFromSetup;
+PrintDialog( vcl::Window*, const std::shared_ptr< PrinterController >& 
);
+virtual ~PrintDialog() override;
+virtual void dispose() override;
 
-OutputOptPage( VclBuilder* );
+bool isPrintToFile();
+bool isCollate();
+bool hasPreview();
 
-void readFromSettings();
-void storeToSettings();
-};
+void previewForward();
+void previewBackward();
 
-std::unique_ptr mpCustomOptionsUIBuilder;
+private:
 
 std::shared_ptr  maPController;
-VclPtr  mpTabCtrl;
-NUpTabPage  maNUpPage;
-JobTabPage  maJobPage;
-OutputOptPage   maOptionsPage;
-VclPtr  mpPreviewWindow;
-VclPtrmpPageEdit;
 
-VclPtr   mpNumPagesText;
-VclPtr  mpBackwardBtn;
-VclPtr  mpForwardBtn;
-VclPtrmpPreviewBox;
+VclPtr  mpTabCtrl;
+VclPtr 

[Libreoffice-commits] core.git: Branch 'feature/print_revamp' - vcl/inc vcl/source vcl/uiconfig

2018-05-29 Thread Daniel
 vcl/inc/printdlg.hxx   |3 +
 vcl/inc/strings.hrc|1 
 vcl/source/window/printdlg.cxx |   62 +
 vcl/uiconfig/ui/printdialog.ui |   16 ++
 4 files changed, 71 insertions(+), 11 deletions(-)

New commits:
commit b9c297021d2b95b67fa2ab2842f0f4b344338129
Author: Daniel 
Date:   Tue May 15 22:58:38 2018 -0300

tdf#67905 adds an option to disable print preview in print dialog

Change-Id: Id6dd1724a1b8f61d94f0685f63d28b3cff19988f

diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index b16d91cad1f6..0a5b09fd366a 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -181,6 +181,7 @@ namespace vcl
 VclPtr   mpNumPagesText;
 VclPtr  mpBackwardBtn;
 VclPtr  mpForwardBtn;
+VclPtrmpPreviewBox;
 
 VclPtrmpOKButton;
 VclPtrmpCancelButton;
@@ -188,6 +189,7 @@ namespace vcl
 
 OUStringmaPageStr;
 OUStringmaNoPageStr;
+OUStringmaNoPreviewStr;
 sal_Int32   mnCurPage;
 sal_Int32   mnCachedPages;
 
@@ -247,6 +249,7 @@ namespace vcl
 bool isPrintToFile();
 bool isCollate();
 bool isSingleJobs();
+bool hasPreview();
 
 void previewForward();
 void previewBackward();
diff --git a/vcl/inc/strings.hrc b/vcl/inc/strings.hrc
index 1475e2a65ceb..1e5eb9d14743 100644
--- a/vcl/inc/strings.hrc
+++ b/vcl/inc/strings.hrc
@@ -113,6 +113,7 @@
 #define SV_ACCESSERROR_NO_FONTS  
NC_("SV_ACCESSERROR_NO_FONTS", "No fonts could be found on the system.")
 
 #define SV_PRINT_NOPAGES NC_("SV_PRINT_NOPAGES", 
"No pages")
+#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")
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 084763fa934b..e59694ca8c0f 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -650,6 +650,7 @@ PrintDialog::PrintDialog( vcl::Window* i_pParent, const 
std::shared_ptrGetText();
@@ -715,9 +717,6 @@ PrintDialog::PrintDialog( vcl::Window* i_pParent, const 
std::shared_ptrresetPrinterOptions( false );
 
-// get the first page
-preparePreview( true, true );
-
 // update the text fields for the printer
 updatePrinterText();
 
@@ -747,6 +746,7 @@ PrintDialog::PrintDialog( vcl::Window* i_pParent, const 
std::shared_ptrSetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
 mpForwardBtn->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
 mpBackwardBtn->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
+mpPreviewBox->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
 
 maJobPage.mpCollateBox->SetToggleHdl( LINK( this, PrintDialog, ToggleHdl ) 
);
 maJobPage.mpSetupButton->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) 
);
@@ -805,6 +805,7 @@ void PrintDialog::dispose()
 mpNumPagesText.clear();
 mpBackwardBtn.clear();
 mpForwardBtn.clear();
+mpPreviewBox.clear();
 mpOKButton.clear();
 mpCancelButton.clear();
 mpHelpButton.clear();
@@ -834,6 +835,16 @@ void PrintDialog::readFromSettings()
 }
 }
 
+aValue = pItem->getValue( "PrintDialog", "HasPreview" );
+if ( aValue.equalsIgnoreAsciiCase("true") )
+{
+mpPreviewBox->Check();
+}
+else
+{
+mpPreviewBox->Check( false );
+}
+
 // persistent window state
 OUString aWinState( pItem->getValue( "PrintDialog",
   "WindowState" ) );
@@ -864,6 +875,9 @@ void PrintDialog::storeToSettings()
  "WindowState",
  OStringToOUString( GetWindowState(), 
RTL_TEXTENCODING_UTF8 )
  );
+pItem->setValue( "PrintDialog",
+ "HasPreview",
+ hasPreview() ? OUString("true") : OUString("false") );
 pItem->Commit();
 }
 
@@ -882,6 +896,11 @@ bool PrintDialog::isSingleJobs()
 return maOptionsPage.mpCollateSingleJobsBox->IsChecked();
 }
 
+bool PrintDialog::hasPreview()
+{
+return mpPreviewBox->IsChecked();
+}
+
 void setHelpId( vcl::Window* i_pWindow, const Sequence< OUString >& 
i_rHelpIds, sal_Int32 i_nIndex )
 {
 if( i_nIndex >= 0 && i_nIndex < i_rHelpIds.getLength() )
@@ -1381,25 +1400,43 @@ void PrintDialog::setPreviewText()
 
 void