[Libreoffice-commits] core.git: 3 commits - include/vcl sw/source vcl/inc vcl/osx vcl/source vcl/unx vcl/win

Noel Grandin noel.grandin at collabora.co.uk
Sat Dec 16 18:02:37 UTC 2017


 include/vcl/print.hxx                        |    3 ++-
 sw/source/uibase/sidebar/PageStylesPanel.cxx |    2 +-
 vcl/inc/osx/salprn.h                         |    2 --
 vcl/inc/salprn.hxx                           |    2 +-
 vcl/inc/salptype.hxx                         |    7 +++++--
 vcl/inc/unx/genprn.h                         |    1 -
 vcl/inc/unx/gtk/gtkinst.hxx                  |    2 +-
 vcl/inc/win/salprn.h                         |    4 ++--
 vcl/osx/salprn.cxx                           |   10 ----------
 vcl/source/gdi/print.cxx                     |    6 +++---
 vcl/unx/generic/print/genprnpsp.cxx          |    5 -----
 vcl/unx/gtk/gtkinst.cxx                      |    2 +-
 vcl/win/gdi/salprn.cxx                       |   22 +++++++++++-----------
 13 files changed, 27 insertions(+), 41 deletions(-)

New commits:
commit 52bf4eb47bb150d190bc1f1035f1d517df4db28c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Dec 15 11:35:28 2017 +0200

    can use GetSelectedEntryData here
    
    Change-Id: I1f42603a034a28cdd75f6d611a2ddab1fa3c8e40
    Reviewed-on: https://gerrit.libreoffice.org/46585
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/uibase/sidebar/PageStylesPanel.cxx b/sw/source/uibase/sidebar/PageStylesPanel.cxx
index 0408d7fe23db..d8e4eec4fd58 100644
--- a/sw/source/uibase/sidebar/PageStylesPanel.cxx
+++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx
@@ -467,7 +467,7 @@ IMPL_LINK_NOARG( PageStylesPanel, ModifyColumnCountHdl, ListBox&, void )
 
 IMPL_LINK_NOARG( PageStylesPanel, ModifyNumberingHdl, ListBox&, void )
 {
-    SvxNumType nEntryData = static_cast<SvxNumType>(reinterpret_cast<sal_uLong>(mpNumberSelectLB->GetEntryData(mpNumberSelectLB->GetSelectedEntryPos())));
+    SvxNumType nEntryData = static_cast<SvxNumType>(reinterpret_cast<sal_uLong>(mpNumberSelectLB->GetSelectedEntryData()));
     mpPageItem->SetNumType(nEntryData);
     mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE, SfxCallMode::RECORD, { mpPageItem.get() });
 }
commit 5637ff950fc1a951bdd999406770cc2b92d81384
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Dec 15 11:29:01 2017 +0200

    sal_uLong->SalPrinterError in SalPrinter
    
    and define a default implementation in the base class that returns
    SalPrinterError::NONE, since only one of the subclasses wants to
    override and return something useful
    
    Change-Id: Id41ff90693527e8624cc2993b7481114af85fcee
    Reviewed-on: https://gerrit.libreoffice.org/46509
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 94e8ea377d27..a4846becd1bb 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -43,6 +43,7 @@ class SalInfoPrinter;
 struct SalPrinterQueueInfo;
 class SalPrinter;
 class VirtualDevice;
+enum class SalPrinterError;
 namespace vcl { class Window; }
 
 namespace vcl {
@@ -217,7 +218,7 @@ private:
     SAL_DLLPRIVATE bool         StartJob( const OUString& rJobName, std::shared_ptr<vcl::PrinterController> const & );
 
     static SAL_DLLPRIVATE ErrCode
-                                ImplSalPrinterErrorCodeToVCL( sal_uLong nError );
+                                ImplSalPrinterErrorCodeToVCL( SalPrinterError nError );
 
 private:
     SAL_DLLPRIVATE bool         EndJob();
diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h
index f98a4c4e595f..8e390bcaa33b 100644
--- a/vcl/inc/osx/salprn.h
+++ b/vcl/inc/osx/salprn.h
@@ -95,7 +95,6 @@ class AquaSalInfoPrinter : public SalInfoPrinter
     bool                        AbortJob();
     SalGraphics*                StartPage( ImplJobSetup* i_pSetupData, bool i_bNewJobData );
     bool                        EndPage();
-    static sal_uLong            GetErrorCode();
 
     NSPrintInfo* getPrintInfo() const { return mpPrintInfo; }
     void setStartPageOffset( int nOffsetX, int nOffsetY ) { mnStartPageOffsetX = nOffsetX; mnStartPageOffsetY = nOffsetY; }
@@ -136,7 +135,6 @@ class AquaSalPrinter : public SalPrinter
     virtual bool                    EndJob() override;
     virtual SalGraphics*            StartPage( ImplJobSetup* i_pSetupData, bool i_bNewJobData ) override;
     virtual void                    EndPage() override;
-    virtual sal_uLong               GetErrorCode() override;
 
     private:
     AquaSalPrinter( const AquaSalPrinter& ) = delete;
diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx
index 083adfb1bc2a..d8b4182f4fee 100644
--- a/vcl/inc/salprn.hxx
+++ b/vcl/inc/salprn.hxx
@@ -108,7 +108,7 @@ public:
     virtual bool                    EndJob() = 0;
     virtual SalGraphics*            StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) = 0;
     virtual void                    EndPage() = 0;
-    virtual sal_uLong               GetErrorCode() = 0;
+    virtual SalPrinterError         GetErrorCode() { return SalPrinterError::NONE; }
 
 };
 
diff --git a/vcl/inc/salptype.hxx b/vcl/inc/salptype.hxx
index c2414450b6a1..dce4e40fd1b9 100644
--- a/vcl/inc/salptype.hxx
+++ b/vcl/inc/salptype.hxx
@@ -39,8 +39,11 @@ template<> struct typed_flags<JobSetFlags>: is_typed_flags<JobSetFlags, 0xF> {};
 
 }
 
-#define SAL_PRINTER_ERROR_GENERALERROR          1
-#define SAL_PRINTER_ERROR_ABORT                 2
+enum class SalPrinterError {
+  NONE = 0,
+  General = 1,
+  Abort = 2
+};
 
 class SalPrinter;
 typedef long (*SALPRNABORTPROC)( void* pInst, SalPrinter* pPrinter );
diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h
index 134cd8708914..4a1c2db0a538 100644
--- a/vcl/inc/unx/genprn.h
+++ b/vcl/inc/unx/genprn.h
@@ -88,7 +88,6 @@ public:
     virtual bool                    EndJob() override;
     virtual SalGraphics*            StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) override;
     virtual void                    EndPage() override;
-    virtual sal_uIntPtr                 GetErrorCode() override;
 };
 
 #endif // INCLUDED_VCL_INC_GENERIC_GENPRN_H
diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h
index 65c1097ebf1c..a1be0336e4c1 100644
--- a/vcl/inc/win/salprn.h
+++ b/vcl/inc/win/salprn.h
@@ -77,7 +77,7 @@ public:
     WinSalInfoPrinter*      mpInfoPrinter;          // pointer to the compatible InfoPrinter
     WinSalPrinter*          mpNextPrinter;          // next printing printer
     HDC                     mhDC;                   // printer hdc
-    sal_uIntPtr             mnError;                // error code
+    SalPrinterError         mnError;                // error code
     sal_uIntPtr             mnCopies;               // copies
     bool                    mbCollate;              // collated copies
     bool                    mbAbort;                // Job Aborted
@@ -102,7 +102,7 @@ public:
     virtual bool                    EndJob() override;
     virtual SalGraphics*            StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) override;
     virtual void                    EndPage() override;
-    virtual sal_uIntPtr             GetErrorCode() override;
+    virtual SalPrinterError         GetErrorCode() override;
 
     void markInvalid();
     bool isValid() const { return mbValid; }
diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx
index 9fdfe569422c..e77d2c39a3fc 100644
--- a/vcl/osx/salprn.cxx
+++ b/vcl/osx/salprn.cxx
@@ -555,11 +555,6 @@ bool AquaSalInfoPrinter::EndPage()
     return true;
 }
 
-sal_uLong AquaSalInfoPrinter::GetErrorCode()
-{
-    return 0;
-}
-
 AquaSalPrinter::AquaSalPrinter( AquaSalInfoPrinter* i_pInfoPrinter ) :
     mpInfoPrinter( i_pInfoPrinter )
 {
@@ -605,11 +600,6 @@ void AquaSalPrinter::EndPage()
     mpInfoPrinter->EndPage();
 }
 
-sal_uLong AquaSalPrinter::GetErrorCode()
-{
-    return AquaSalInfoPrinter::GetErrorCode();
-}
-
 void AquaSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
 {
     m_aPaperFormats.clear();
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 62a12325847f..71bcf976d418 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1604,15 +1604,15 @@ bool Printer::SetCopyCount( sal_uInt16 nCopy, bool bCollate )
     return true;
 }
 
-ErrCode Printer::ImplSalPrinterErrorCodeToVCL( sal_uLong nError )
+ErrCode Printer::ImplSalPrinterErrorCodeToVCL( SalPrinterError nError )
 {
     ErrCode nVCLError;
     switch ( nError )
     {
-        case 0:
+        case SalPrinterError::NONE:
             nVCLError = ERRCODE_NONE;
             break;
-        case SAL_PRINTER_ERROR_ABORT:
+        case SalPrinterError::Abort:
             nVCLError = PRINTER_ABORT;
             break;
         default:
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 51b23dcb4a2d..7a90bd0b0b3d 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -967,11 +967,6 @@ void PspSalPrinter::EndPage()
     SAL_INFO( "vcl.unx.print", "PspSalPrinter::EndPage");
 }
 
-sal_uLong PspSalPrinter::GetErrorCode()
-{
-    return 0;
-}
-
 struct PDFNewJobParameters
 {
     Size        maPageSize;
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index d107a90717ff..59aff3f27448 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1352,7 +1352,7 @@ WinSalPrinter::WinSalPrinter() :
     mpInfoPrinter( nullptr ),
     mpNextPrinter( nullptr ),
     mhDC( nullptr ),
-    mnError( 0 ),
+    mnError( SalPrinterError::NONE ),
     mnCopies( 0 ),
     mbCollate( FALSE ),
     mbAbort( FALSE ),
@@ -1420,7 +1420,7 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
                            bool /*bDirect*/,
                            ImplJobSetup* pSetupData )
 {
-    mnError     = 0;
+    mnError     = SalPrinterError::NONE;
     mbAbort     = FALSE;
     mnCopies        = nCopies;
     mbCollate   = bCollate;
@@ -1449,7 +1449,7 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
 
     if ( !hDC )
     {
-        mnError = SAL_PRINTER_ERROR_GENERALERROR;
+        mnError = SalPrinterError::General;
         return FALSE;
     }
 
@@ -1457,11 +1457,11 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
     mhDC = hDC;
     if ( SetAbortProc( hDC, SalPrintAbortProc ) <= 0 )
     {
-        mnError = SAL_PRINTER_ERROR_GENERALERROR;
+        mnError = SalPrinterError::General;
         return FALSE;
     }
 
-    mnError = 0;
+    mnError = SalPrinterError::NONE;
     mbAbort = FALSE;
 
     // As the Telecom Balloon Fax driver tends to send messages repeatedly
@@ -1486,7 +1486,7 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
         }
         else
         {
-            mnError = SAL_PRINTER_ERROR_ABORT;
+            mnError = SalPrinterError::Abort;
             return FALSE;
         }
     }
@@ -1514,9 +1514,9 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
     {
         long nError = GetLastError();
         if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (nError == ERROR_PRINT_CANCELLED) || (nError == ERROR_CANCELLED) )
-            mnError = SAL_PRINTER_ERROR_ABORT;
+            mnError = SalPrinterError::Abort;
         else
-            mnError = SAL_PRINTER_ERROR_GENERALERROR;
+            mnError = SalPrinterError::General;
         return FALSE;
     }
 
@@ -1584,7 +1584,7 @@ SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, bool bNewJobDat
     if ( nRet <= 0 )
     {
         GetLastError();
-        mnError = SAL_PRINTER_ERROR_GENERALERROR;
+        mnError = SalPrinterError::General;
         return nullptr;
     }
 
@@ -1621,11 +1621,11 @@ void WinSalPrinter::EndPage()
     if ( nRet <= 0 )
     {
         GetLastError();
-        mnError = SAL_PRINTER_ERROR_GENERALERROR;
+        mnError = SalPrinterError::General;
     }
 }
 
-sal_uLong WinSalPrinter::GetErrorCode()
+SalPrinterError WinSalPrinter::GetErrorCode()
 {
     return mnError;
 }
commit f53d9322b0ffefc4d3492ba9e8da3f5d8d96879c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Dec 15 11:17:28 2017 +0200

    sal_uIntPtr->sal_uInt32 in yieldCounts
    
    to match the underlying field in GenericSolarMutex
    
    Change-Id: I98dcab3b684278c4a184534ba782b5b03b0504f0
    Reviewed-on: https://gerrit.libreoffice.org/46508
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 8ab1ba98a1e3..4b48a4b3762e 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -46,7 +46,7 @@ class GtkPrintWrapper;
 class GenPspGraphics;
 class GtkYieldMutex : public SalYieldMutex
 {
-    thread_local static std::stack<sal_uIntPtr> yieldCounts;
+    thread_local static std::stack<sal_uInt32> yieldCounts;
 
 public:
          GtkYieldMutex() {}
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index 30f0aa51843f..4b840923a971 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -295,7 +295,7 @@ SalPrinter* GtkInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter )
  * for each pair, so we can accurately restore
  * it later.
  */
-thread_local std::stack<sal_uIntPtr> GtkYieldMutex::yieldCounts;
+thread_local std::stack<sal_uInt32> GtkYieldMutex::yieldCounts;
 
 void GtkYieldMutex::ThreadsEnter()
 {


More information about the Libreoffice-commits mailing list