[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/source

Noel Grandin noel at peralex.com
Wed Jun 1 06:47:21 UTC 2016


 include/vcl/print.hxx           |   20 ++++++++++----------
 sfx2/source/dialog/printopt.cxx |   16 ++++++++--------
 vcl/source/gdi/print.cxx        |    6 +++---
 vcl/source/gdi/print2.cxx       |    2 +-
 vcl/source/gdi/print3.cxx       |    8 ++++----
 5 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit 76cacf1a6045b133ba07c84c67b34f85a389c81e
Author: Noel Grandin <noel at peralex.com>
Date:   Tue May 31 14:18:10 2016 +0200

    Convert printer enums to scoped enums
    
    Change-Id: Ic0f9d57181809b3fef3abbad462456fc2d5ced55
    Reviewed-on: https://gerrit.libreoffice.org/25719
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index fcb11bc..ff2f7b2 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -85,25 +85,25 @@ public:
 };
 
 
-enum PrinterTransparencyMode
+enum class PrinterTransparencyMode
 {
-    PRINTER_TRANSPARENCY_AUTO = 0,
-    PRINTER_TRANSPARENCY_NONE = 1
+    Auto = 0,
+    NONE = 1
 };
 
 
-enum PrinterGradientMode
+enum class PrinterGradientMode
 {
-    PRINTER_GRADIENT_STRIPES  = 0,
-    PRINTER_GRADIENT_COLOR    = 1
+    Stripes  = 0,
+    Color    = 1
 };
 
 
-enum PrinterBitmapMode
+enum class PrinterBitmapMode
 {
-    PRINTER_BITMAP_OPTIMAL    = 0,
-    PRINTER_BITMAP_NORMAL     = 1,
-    PRINTER_BITMAP_RESOLUTION = 2
+    Optimal    = 0,
+    Normal     = 1,
+    Resolution = 2
 };
 
 
diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx
index 9ae6496..fd42d4a 100644
--- a/sfx2/source/dialog/printopt.cxx
+++ b/sfx2/source/dialog/printopt.cxx
@@ -197,14 +197,14 @@ void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCu
 {
     m_pReduceTransparencyCB->Check( pCurrentOptions->IsReduceTransparency() );
 
-    if( pCurrentOptions->GetReducedTransparencyMode() == PRINTER_TRANSPARENCY_AUTO )
+    if( pCurrentOptions->GetReducedTransparencyMode() == PrinterTransparencyMode::Auto )
         m_pReduceTransparencyAutoRB->Check();
     else
         m_pReduceTransparencyNoneRB->Check( );
 
     m_pReduceGradientsCB->Check( pCurrentOptions->IsReduceGradients() );
 
-    if( pCurrentOptions->GetReducedGradientMode() == PRINTER_GRADIENT_STRIPES )
+    if( pCurrentOptions->GetReducedGradientMode() == PrinterGradientMode::Stripes )
         m_pReduceGradientsStripesRB->Check();
     else
         m_pReduceGradientsColorRB->Check();
@@ -213,9 +213,9 @@ void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCu
 
     m_pReduceBitmapsCB->Check( pCurrentOptions->IsReduceBitmaps() );
 
-    if( pCurrentOptions->GetReducedBitmapMode() == PRINTER_BITMAP_OPTIMAL )
+    if( pCurrentOptions->GetReducedBitmapMode() == PrinterBitmapMode::Optimal )
         m_pReduceBitmapsOptimalRB->Check();
-    else if( pCurrentOptions->GetReducedBitmapMode() == PRINTER_BITMAP_NORMAL )
+    else if( pCurrentOptions->GetReducedBitmapMode() == PrinterBitmapMode::Normal )
         m_pReduceBitmapsNormalRB->Check();
     else
         m_pReduceBitmapsResolutionRB->Check();
@@ -250,13 +250,13 @@ void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCu
 void SfxCommonPrintOptionsTabPage::ImplSaveControls( PrinterOptions* pCurrentOptions )
 {
     pCurrentOptions->SetReduceTransparency( m_pReduceTransparencyCB->IsChecked() );
-    pCurrentOptions->SetReducedTransparencyMode( m_pReduceTransparencyAutoRB->IsChecked() ? PRINTER_TRANSPARENCY_AUTO : PRINTER_TRANSPARENCY_NONE );
+    pCurrentOptions->SetReducedTransparencyMode( m_pReduceTransparencyAutoRB->IsChecked() ? PrinterTransparencyMode::Auto : PrinterTransparencyMode::NONE );
     pCurrentOptions->SetReduceGradients( m_pReduceGradientsCB->IsChecked() );
-    pCurrentOptions->SetReducedGradientMode( m_pReduceGradientsStripesRB->IsChecked() ? PRINTER_GRADIENT_STRIPES : PRINTER_GRADIENT_COLOR  );
+    pCurrentOptions->SetReducedGradientMode( m_pReduceGradientsStripesRB->IsChecked() ? PrinterGradientMode::Stripes : PrinterGradientMode::Color  );
     pCurrentOptions->SetReducedGradientStepCount( (sal_uInt16) m_pReduceGradientsStepCountNF->GetValue() );
     pCurrentOptions->SetReduceBitmaps( m_pReduceBitmapsCB->IsChecked() );
-    pCurrentOptions->SetReducedBitmapMode( m_pReduceBitmapsOptimalRB->IsChecked() ? PRINTER_BITMAP_OPTIMAL :
-                                           ( m_pReduceBitmapsNormalRB->IsChecked() ? PRINTER_BITMAP_NORMAL : PRINTER_BITMAP_RESOLUTION ) );
+    pCurrentOptions->SetReducedBitmapMode( m_pReduceBitmapsOptimalRB->IsChecked() ? PrinterBitmapMode::Optimal :
+                                           ( m_pReduceBitmapsNormalRB->IsChecked() ? PrinterBitmapMode::Normal : PrinterBitmapMode::Resolution ) );
     pCurrentOptions->SetReducedBitmapResolution( aDPIArray[ std::min<sal_uInt16>( m_pReduceBitmapsResolutionLB->GetSelectEntryPos(),
                                                                    SAL_N_ELEMENTS(aDPIArray) - 1 ) ] );
     pCurrentOptions->SetReducedBitmapIncludesTransparency( m_pReduceBitmapsTransparencyCB->IsChecked() );
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index c0cfdf59..c0d016f 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -88,12 +88,12 @@ void ImplUpdateJobSetupPaper( JobSetup& rJobSetup )
 // PrinterOptions
 PrinterOptions::PrinterOptions() :
     mbReduceTransparency( false ),
-    meReducedTransparencyMode( PRINTER_TRANSPARENCY_AUTO ),
+    meReducedTransparencyMode( PrinterTransparencyMode::Auto ),
     mbReduceGradients( false ),
-    meReducedGradientsMode( PRINTER_GRADIENT_STRIPES ),
+    meReducedGradientsMode( PrinterGradientMode::Stripes ),
     mnReducedGradientStepCount( 64 ),
     mbReduceBitmaps( false ),
-    meReducedBitmapMode( PRINTER_BITMAP_NORMAL ),
+    meReducedBitmapMode( PrinterBitmapMode::Normal ),
     mnReducedBitmapResolution( 200 ),
     mbReducedBitmapsIncludeTransparency( true ),
     mbConvertToGreyscales( false ),
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index d7056bc..c2e589d 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -1346,7 +1346,7 @@ void Printer::DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const
 
     if( rPrinterOptions.IsReduceGradients() )
     {
-        if( PRINTER_GRADIENT_STRIPES == rPrinterOptions.GetReducedGradientMode() )
+        if( PrinterGradientMode::Stripes == rPrinterOptions.GetReducedGradientMode() )
         {
             if( !rGradient.GetSteps() || ( rGradient.GetSteps() > rPrinterOptions.GetReducedGradientStepCount() ) )
             {
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index bb8081e..f2e73c62 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -1215,12 +1215,12 @@ DrawModeFlags PrinterController::removeTransparencies( GDIMetaFile& i_rIn, GDIMe
     if( rPrinterOptions.IsReduceBitmaps() )
     {
         // calculate maximum resolution for bitmap graphics
-        if( PRINTER_BITMAP_OPTIMAL == rPrinterOptions.GetReducedBitmapMode() )
+        if( PrinterBitmapMode::Optimal == rPrinterOptions.GetReducedBitmapMode() )
         {
             nMaxBmpDPIX = std::min( sal_Int32(OPTIMAL_BMP_RESOLUTION), nMaxBmpDPIX );
             nMaxBmpDPIY = std::min( sal_Int32(OPTIMAL_BMP_RESOLUTION), nMaxBmpDPIY );
         }
-        else if( PRINTER_BITMAP_NORMAL == rPrinterOptions.GetReducedBitmapMode() )
+        else if( PrinterBitmapMode::Normal == rPrinterOptions.GetReducedBitmapMode() )
         {
             nMaxBmpDPIX = std::min( sal_Int32(NORMAL_BMP_RESOLUTION), nMaxBmpDPIX );
             nMaxBmpDPIY = std::min( sal_Int32(NORMAL_BMP_RESOLUTION), nMaxBmpDPIY );
@@ -1241,7 +1241,7 @@ DrawModeFlags PrinterController::removeTransparencies( GDIMetaFile& i_rIn, GDIMe
     }
 
     // disable transparency output
-    if( rPrinterOptions.IsReduceTransparency() && ( PRINTER_TRANSPARENCY_NONE == rPrinterOptions.GetReducedTransparencyMode() ) )
+    if( rPrinterOptions.IsReduceTransparency() && ( PrinterTransparencyMode::NONE == rPrinterOptions.GetReducedTransparencyMode() ) )
     {
         mpImplData->mxPrinter->SetDrawMode( mpImplData->mxPrinter->GetDrawMode() | DrawModeFlags::NoTransparency );
     }
@@ -1256,7 +1256,7 @@ DrawModeFlags PrinterController::removeTransparencies( GDIMetaFile& i_rIn, GDIMe
     }
     mpImplData->mxPrinter->RemoveTransparenciesFromMetaFile( i_rIn, o_rOut, nMaxBmpDPIX, nMaxBmpDPIY,
                                                              rPrinterOptions.IsReduceTransparency(),
-                                                             rPrinterOptions.GetReducedTransparencyMode() == PRINTER_TRANSPARENCY_AUTO,
+                                                             rPrinterOptions.GetReducedTransparencyMode() == PrinterTransparencyMode::Auto,
                                                              rPrinterOptions.IsReduceBitmaps() && rPrinterOptions.IsReducedBitmapIncludesTransparency(),
                                                              aBg
                                                              );


More information about the Libreoffice-commits mailing list