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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 29 14:34:49 UTC 2018


 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 <danielfaleirosilva at gmail.com>
AuthorDate: Wed Nov 28 19:28:26 2018 -0200
Commit:     Daniel Silva <danielfaleirosilva at gmail.com>
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 <danielfaleirosilva at gmail.com>

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
         VclPtr<NumericField>                    mpPageEdit;
 
         OUString                                maPageStr;
-        OUString                                maNoPageStr;
-        OUString                                maNoPreviewStr;
+        OUString const                          maNoPageStr;
+        OUString const                          maNoPreviewStr;
         sal_Int32                               mnCurPage;
         sal_Int32                               mnCachedPages;
 
         BitmapEx const                          maCollateBmp;
         BitmapEx const                          maNoCollateBmp;
 
-        long                                    mnCollateUIMode;
+        bool                                    mbCollateAlwaysOff;
 
         VclPtr<RadioButton>                     mpPagesBtn;
         VclPtr<RadioButton>                     mpBrochureBtn;
@@ -201,7 +201,6 @@ namespace vcl
                                                 maPropertyToWindowMap;
         std::map< VclPtr<vcl::Window>, sal_Int32 >
                                                 maControlToNumValMap;
-        std::set< OUString >                    maReverseDependencySet;
 
         Size                                    maNupPortraitSize;
         Size                                    maNupLandscapeSize;
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<PrinterController>& 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_ptr<PrinterCo
 , mnCachedPages( 0 )
 , maCollateBmp(SV_PRINT_COLLATE_BMP)
 , maNoCollateBmp(SV_PRINT_NOCOLLATE_BMP)
-, mnCollateUIMode(0)
+, mbCollateAlwaysOff(false)
 , mbShowLayoutFrame( true )
 , mbSingleJobs( false )
 {
@@ -600,7 +599,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
     std::sort( rQueues.begin(), rQueues.end(), lcl_ListBoxCompare );
     for( const auto& rQueue : rQueues )
     {
-        mpPrinters->InsertEntry( *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() )
-            {
-                OUString aDep( maPController->getDependency( it->second ) );
-                // if the dependency is at least enabled, then enable this control anyway
-                if( !aDep.isEmpty() && maPController->isUIOptionEnabled( aDep ) )
-                    bShouldbeEnabled = true;
-            }
-        }
+        bool bShouldbeEnabled = maPController->isUIOptionEnabled( rEntry.second );
 
-        if( bShouldbeEnabled && dynamic_cast<RadioButton*>(it->first.get()) )
+        if( bShouldbeEnabled && dynamic_cast<RadioButton*>(rEntry.first.get()) )
         {
-            auto r_it = maControlToNumValMap.find( it->first );
+            auto r_it = maControlToNumValMap.find( rEntry.first );
             if( r_it != maControlToNumValMap.end() )
             {
-                bShouldbeEnabled = maPController->isUIChoiceEnabled( it->second, r_it->second );
+                bShouldbeEnabled = maPController->isUIChoiceEnabled( rEntry.second, r_it->second );
             }
         }
 
-        bool bIsEnabled = it->first->IsEnabled();
+        bool bIsEnabled = rEntry.first->IsEnabled();
         // Enable does not do a change check first, so can be less cheap than expected
         if( bShouldbeEnabled != bIsEnabled )
-            it->first->Enable( bShouldbeEnabled );
+            rEntry.first->Enable( bShouldbeEnabled );
     }
 }
 
@@ -1141,11 +1122,11 @@ void PrintDialog::initFromMultiPageSetup( const vcl::PrinterController::MultiPag
 
     // setup field units for metric fields
     const LocaleDataWrapper& rLocWrap( mpPageMarginEdt->GetLocaleDataWrapper() );
-    FieldUnit eUnit = FUNIT_MM;
+    FieldUnit eUnit = FieldUnit::MM;
     sal_uInt16 nDigits = 0;
     if( rLocWrap.getMeasurementSystemEnum() == MeasurementSystem::US )
     {
-        eUnit = FUNIT_INCH;
+        eUnit = FieldUnit::INCH;
         nDigits = 2;
     }
     // set units
@@ -1156,8 +1137,8 @@ void PrintDialog::initFromMultiPageSetup( const vcl::PrinterController::MultiPag
     mpPageMarginEdt->SetDecimalDigits( nDigits );
     mpSheetMarginEdt->SetDecimalDigits( nDigits );
 
-    mpSheetMarginEdt->SetValue( mpSheetMarginEdt->Normalize( i_rMPS.nLeftMargin ), FUNIT_100TH_MM );
-    mpPageMarginEdt->SetValue( mpPageMarginEdt->Normalize( i_rMPS.nHorizontalSpacing ), FUNIT_100TH_MM );
+    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 );
@@ -1174,8 +1155,8 @@ void PrintDialog::updateNup( bool i_bMayUseCache )
 {
     int nRows         = int(mpNupRowsEdt->GetValue());
     int nCols         = int(mpNupColEdt->GetValue());
-    long nPageMargin  = mpPageMarginEdt->Denormalize(mpPageMarginEdt->GetValue( FUNIT_100TH_MM ));
-    long nSheetMargin = mpSheetMarginEdt->Denormalize(mpSheetMarginEdt->GetValue( FUNIT_100TH_MM ));
+    long nPageMargin  = mpPageMarginEdt->Denormalize(mpPageMarginEdt->GetValue( FieldUnit::MM_100TH ));
+    long nSheetMargin = mpSheetMarginEdt->Denormalize(mpSheetMarginEdt->GetValue( FieldUnit::MM_100TH ));
 
     PrinterController::MultiPageSetup aMPS;
     aMPS.nRows         = nRows;
@@ -1228,8 +1209,8 @@ 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( FUNIT_100TH_MM ));
-    long nSheetMargin = mpSheetMarginEdt->Denormalize(mpSheetMarginEdt->GetValue( FUNIT_100TH_MM ));
+    long nPageMargin  = mpPageMarginEdt->Denormalize(mpPageMarginEdt->GetValue( FieldUnit::MM_100TH ));
+    long nSheetMargin = mpSheetMarginEdt->Denormalize(mpSheetMarginEdt->GetValue( FieldUnit::MM_100TH ));
     bool bCustom = false;
 
     if( nPages == 1 )
@@ -1295,7 +1276,7 @@ void PrintDialog::updateNupFromPages( bool i_bMayUseCache )
 
         mpSheetMarginEdt->SetMax(
                   mpSheetMarginEdt->Normalize(
-                           std::min(nHorzMax, nVertMax) ), FUNIT_100TH_MM );
+                           std::min(nHorzMax, nVertMax) ), FieldUnit::MM_100TH );
 
         // maximum page distance
         nHorzMax = (aSize.Width() - 2*nSheetMargin);
@@ -1312,13 +1293,13 @@ void PrintDialog::updateNupFromPages( bool i_bMayUseCache )
 
         mpPageMarginEdt->SetMax(
                  mpSheetMarginEdt->Normalize(
-                           std::min(nHorzMax, nVertMax ) ), FUNIT_100TH_MM );
+                           std::min(nHorzMax, nVertMax ) ), FieldUnit::MM_100TH );
     }
 
     mpNupRowsEdt->SetValue( nRows );
     mpNupColEdt->SetValue( nCols );
-    mpPageMarginEdt->SetValue( mpPageMarginEdt->Normalize( nPageMargin ), FUNIT_100TH_MM );
-    mpSheetMarginEdt->SetValue( mpSheetMarginEdt->Normalize( nSheetMargin ), FUNIT_100TH_MM );
+    mpPageMarginEdt->SetValue( mpPageMarginEdt->Normalize( nPageMargin ), FieldUnit::MM_100TH );
+    mpSheetMarginEdt->SetValue( mpSheetMarginEdt->Normalize( nSheetMargin ), FieldUnit::MM_100TH );
 
     showAdvancedControls( bCustom );
     updateNup( i_bMayUseCache );
@@ -1729,6 +1710,10 @@ void PrintDialog::setupOptionalUI()
         mpPagesBoxTitleTxt->SetText( mpPagesBtn->GetText() );
         mpPagesBoxTitleTxt->Show();
         mpPagesBtn->Show( false );
+
+        mpPagesBoxTitleTxt->SetAccessibleRelationLabelFor(mpNupPagesBox);
+        mpNupPagesBox->SetAccessibleRelationLabeledBy(mpPagesBoxTitleTxt);
+        mpPagesBtn->SetAccessibleRelationLabelFor(nullptr);
     }
 
     // update enable states
diff --git a/vcl/uiconfig/ui/moreoptionsdialog.ui b/vcl/uiconfig/ui/moreoptionsdialog.ui
index 7fb615d60417..decde6d3ba41 100644
--- a/vcl/uiconfig/ui/moreoptionsdialog.ui
+++ b/vcl/uiconfig/ui/moreoptionsdialog.ui
@@ -59,7 +59,7 @@
             <property name="orientation">vertical</property>
             <child>
               <object class="GtkCheckButton" id="singlejobs">
-                <property name="label" translatable="yes" context="moreoptionsdialog|singlejobs">Create single print jobs for collated output</property>
+                <property name="label" translatable="yes" context="moreoptionsdialog|singlejobs">Create separate print jobs for collated output</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
diff --git a/vcl/uiconfig/ui/printdialog.ui b/vcl/uiconfig/ui/printdialog.ui
index 951c2e3ac189..b8a04ebf9093 100644
--- a/vcl/uiconfig/ui/printdialog.ui
+++ b/vcl/uiconfig/ui/printdialog.ui
@@ -254,6 +254,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
+                                <property name="tooltip_text" translatable="yes" context="printdialog|forward">Next page</property>
                                 <property name="image">image2</property>
                               </object>
                               <packing>
@@ -293,6 +294,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
+                                <property name="tooltip_text" translatable="yes" context="printdialog|backward">Previous page</property>
                                 <property name="image">image1</property>
                               </object>
                               <packing>
@@ -372,11 +374,14 @@
                   <object class="GtkNotebook" id="tabcontrol">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
+                    <property name="scrollable">True</property>
+                    <property name="enable_popup">True</property>
                     <child>
                       <object class="GtkBox" id="box11">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="margin_left">6</property>
+                        <property name="margin_right">6</property>
                         <property name="margin_top">6</property>
                         <property name="orientation">vertical</property>
                         <property name="spacing">12</property>
@@ -419,6 +424,9 @@
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="label" translatable="yes" context="printdialog|labelstatus">Status:</property>
+                                            <accessibility>
+                                              <relation type="label-for" target="status"/>
+                                            </accessibility>
                                           </object>
                                           <packing>
                                             <property name="expand">False</property>
@@ -431,6 +439,9 @@
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="label" translatable="yes" context="printdialog|status">Default Printer</property>
+                                            <accessibility>
+                                              <relation type="labelled-by" target="labelstatus"/>
+                                            </accessibility>
                                           </object>
                                           <packing>
                                             <property name="expand">False</property>
@@ -606,6 +617,9 @@
                                             <property name="label" translatable="yes" context="printdialog|labelpages">Pages:</property>
                                             <property name="use_underline">True</property>
                                             <property name="mnemonic_widget">pagerange</property>
+                                            <accessibility>
+                                              <relation type="label-for" target="pagerange"/>
+                                            </accessibility>
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
@@ -616,6 +630,9 @@
                                           <object class="GtkEntry" id="pagerange">
                                             <property name="can_focus">True</property>
                                             <property name="placeholder_text" translatable="yes" context="printdialog|pagerange">e.g.: 1, 3-5, 7, 9</property>
+                                            <accessibility>
+                                              <relation type="labelled-by" target="printrange"/>
+                                            </accessibility>
                                           </object>
                                           <packing>
                                             <property name="left_attach">1</property>


More information about the Libreoffice-commits mailing list