sd/source/ui/view/DocumentRenderer.cxx |   38 ++++++++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 7 deletions(-)

New commits:
commit 844be49e7e511f0c397e1faebca10b4fa25ea937
Author:     Gabor Kelemen <kelemen.gab...@nisz.hu>
AuthorDate: Mon Jul 22 00:49:03 2019 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Fri Jul 26 10:23:14 2019 +0200

    tdf#39742 tdf#44786 Consider Impress/Draw default printing settings
    
    Default settings can be set under Options - APP - Print but
    Impress/Draw has not used these as defaults unlike other apps
    
    Change-Id: I7d430f8fb24f9626cd628b4fe9e0520d9d42b848
    Reviewed-on: https://gerrit.libreoffice.org/76079
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sd/source/ui/view/DocumentRenderer.cxx 
b/sd/source/ui/view/DocumentRenderer.cxx
index 7b5a894c91f5..19bf110c4a73 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -62,6 +62,9 @@
 #include <xmloff/autolayout.hxx>
 #include <sfx2/objsh.hxx>
 
+#include <officecfg/Office/Draw.hxx>
+#include <officecfg/Office/Impress.hxx>
+
 #include <memory>
 #include <vector>
 
@@ -438,7 +441,7 @@ namespace {
                                     
SdResId(STR_IMPRESS_PRINT_UI_IS_PRINT_NAME),
                                     
".HelpID:vcl:PrintDialog:IsPrintName:CheckBox" ,
                                     "IsPrintName" ,
-                                    false
+                                    
officecfg::Office::Impress::Print::Other::PageName::get()
                                     )
                                 );
             }
@@ -448,7 +451,7 @@ namespace {
                                     SdResId(STR_DRAW_PRINT_UI_IS_PRINT_NAME),
                                     
".HelpID:vcl:PrintDialog:IsPrintName:CheckBox" ,
                                     "IsPrintName" ,
-                                    false
+                                    
officecfg::Office::Draw::Print::Other::PageName::get()
                                     )
                                 );
             }
@@ -457,7 +460,12 @@ namespace {
                                 SdResId(STR_IMPRESS_PRINT_UI_IS_PRINT_DATE),
                                 
".HelpID:vcl:PrintDialog:IsPrintDateTime:CheckBox" ,
                                 "IsPrintDateTime" ,
-                                false
+                                // Separate settings for time and date in 
Impress/Draw -> Print page, check that both are set
+                                mbImpress ?
+                                
officecfg::Office::Impress::Print::Other::Date::get() &&
+                                
officecfg::Office::Impress::Print::Other::Time::get() :
+                                
officecfg::Office::Draw::Print::Other::Date::get() &&
+                                
officecfg::Office::Draw::Print::Other::Time::get()
                                 )
                             );
 
@@ -467,7 +475,7 @@ namespace {
                                     
SdResId(STR_IMPRESS_PRINT_UI_IS_PRINT_HIDDEN),
                                     
".HelpID:vcl:PrintDialog:IsPrintHidden:CheckBox" ,
                                     "IsPrintHidden" ,
-                                    false
+                                    
officecfg::Office::Impress::Print::Other::HiddenPage::get()
                                     )
                                 );
             }
@@ -489,7 +497,9 @@ namespace {
                                 aHelpIds,
                                 "Quality" ,
                                 
CreateChoice(STR_IMPRESS_PRINT_UI_QUALITY_CHOICES, 
SAL_N_ELEMENTS(STR_IMPRESS_PRINT_UI_QUALITY_CHOICES)),
-                                0)
+                                mbImpress ? 
officecfg::Office::Impress::Print::Other::Quality::get() :
+                                            
officecfg::Office::Draw::Print::Other::Quality::get() )
+
                             );
 
             AddDialogControl( 
vcl::PrinterOptionsHelper::setSubgroupControlOpt("pagesizes",
@@ -506,6 +516,19 @@ namespace {
             aWidgetIds[2] = "distributeonmultiple";
             aWidgetIds[3] = "tilesheet";
 
+            // Mutually exclusive page options settings are stored in separate 
config keys...
+            // TODO: There is no config key to set the distributeonmultiple 
option as default
+            sal_Int32 nDefaultChoice = 0;
+            if ( mbImpress ? 
officecfg::Office::Impress::Print::Page::PageSize::get() :
+                             
officecfg::Office::Draw::Print::Page::PageSize::get() )
+            {
+                nDefaultChoice = 1;
+            }
+            else if ( mbImpress ? 
officecfg::Office::Impress::Print::Page::PageTile::get() :
+                                  
officecfg::Office::Draw::Print::Page::PageTile::get() )
+            {
+                nDefaultChoice = 3;
+            }
             vcl::PrinterOptionsHelper::UIControlOptions 
aPageOptionsOpt("PrintProspect", 0);
             AddDialogControl( 
vcl::PrinterOptionsHelper::setChoiceRadiosControlOpt(
                                 aWidgetIds,
@@ -514,7 +537,7 @@ namespace {
                                 "PageOptions" ,
                                 mbImpress ? 
CreateChoice(STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES, 
SAL_N_ELEMENTS(STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES)) :
                                             
CreateChoice(STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW, 
SAL_N_ELEMENTS(STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW)),
-                                0,
+                                nDefaultChoice,
                                 Sequence< sal_Bool >(),
                                 aPageOptionsOpt
                                 )
@@ -531,7 +554,8 @@ namespace {
                                 SdResId(STR_IMPRESS_PRINT_UI_BROCHURE),
                                 
".HelpID:vcl:PrintDialog:PrintProspect:CheckBox" ,
                                 "PrintProspect" ,
-                                false,
+                                mbImpress ? 
officecfg::Office::Impress::Print::Page::Booklet::get() :
+                                            
officecfg::Office::Draw::Print::Page::Booklet::get(),
                                 aBrochureOpt
                                 )
                             );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to