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

Noel Grandin noel.grandin at collabora.co.uk
Thu Feb 9 10:04:14 UTC 2017


 include/vcl/pdfextoutdevdata.hxx    |    4 +-
 include/vcl/pdfwriter.hxx           |    5 ---
 sd/source/ui/unoidl/unomodel.cxx    |   14 ++++-----
 vcl/source/gdi/pdfextoutdevdata.cxx |    2 -
 vcl/source/gdi/pdfwriter_impl.cxx   |   52 ++----------------------------------
 5 files changed, 15 insertions(+), 62 deletions(-)

New commits:
commit 76e0f23171d899ef567b04b555a748b60f99353c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Feb 8 15:00:15 2017 +0200

    convert DestAreaType to scoped enum
    
    and drop read-only enumerators
    
    Change-Id: Ibc4c2a99448a83fc179e2779f8f3e5c8f034ae7b
    Reviewed-on: https://gerrit.libreoffice.org/34059
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index 566ff2a..2305814 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -226,7 +226,7 @@ public:
 
     /** provides detailed information about a destination range which previously has been registered using RegisterDest.
     */
-    void        DescribeRegisteredDest( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
+    void        DescribeRegisteredDest( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType = PDFWriter::DestAreaType::XYZ );
 
 //<---i56629
 
@@ -246,7 +246,7 @@ public:
     the destination id (to be used in SetLinkDest) or
     -1 if page id does not exist
     */
-    sal_Int32 CreateDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
+    sal_Int32 CreateDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::DestAreaType::XYZ );
     /** Create a new link on a page
 
     @param rRect
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 75f1230..d75b4ac 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -107,10 +107,7 @@ public:
     enum PDFVersion { PDF_1_2, PDF_1_3, PDF_1_4, PDF_1_5, PDF_A_1 };//i59651, PDF/A-1b & -1a, only -1b implemented for now
     // for the meaning of DestAreaType please look at PDF Reference Manual
     // version 1.4 section 8.2.1, page 475
-    enum DestAreaType { XYZ, Fit, FitHorizontal, FitVertical,
-                        FitRectangle, FitPageBoundingBox, FitPageBoundingBoxHorizontal,
-                        FitPageBoundingBoxVertical
-    };
+    enum class DestAreaType { XYZ, FitRectangle };
 
     // for a definition of structural element types please refer to
     // PDF Reference, 3rd ed. section 9.7.4
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index a7099f2..d529736 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1657,14 +1657,14 @@ void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape >& xSh
                     case presentation::ClickAction_LASTPAGE :
                     {
                         sal_Int32 nCount = rDoc.GetSdPageCount( PageKind::Standard );
-                        sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nCount - 1, vcl::PDFWriter::FitRectangle );
+                        sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nCount - 1, vcl::PDFWriter::DestAreaType::FitRectangle );
                         sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect );
                         rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
                     }
                     break;
                     case presentation::ClickAction_FIRSTPAGE :
                     {
-                        sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, 0, vcl::PDFWriter::FitRectangle );
+                        sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, 0, vcl::PDFWriter::DestAreaType::FitRectangle );
                         sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect );
                         rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
                     }
@@ -1674,7 +1674,7 @@ void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape >& xSh
                         sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber();
                         if ( nDestPage )
                             nDestPage--;
-                        sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle );
+                        sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::DestAreaType::FitRectangle );
                         sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect );
                         rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
                     }
@@ -1685,7 +1685,7 @@ void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape >& xSh
                         sal_Int32 nLastPage = rDoc.GetSdPageCount( PageKind::Standard ) - 1;
                         if ( nDestPage > nLastPage )
                             nDestPage = nLastPage;
-                        sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle );
+                        sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::DestAreaType::FitRectangle );
                         sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect );
                         rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
                     }
@@ -1713,7 +1713,7 @@ void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape >& xSh
                                     sal_Int32 nPage = ImplPDFGetBookmarkPage( aBookmark, rDoc );
                                     if ( nPage != -1 )
                                     {
-                                        sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle );
+                                        sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nPage, vcl::PDFWriter::DestAreaType::FitRectangle );
                                         sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect );
                                         rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
                                     }
@@ -2126,9 +2126,9 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
                                     if ( nPage != -1 )
                                     {
                                         if ( aIBeg->nLinkId != -1 )
-                                            pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle ) );
+                                            pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::DestAreaType::FitRectangle ) );
                                         else
-                                            pPDFExtOutDevData->DescribeRegisteredDest( aIBeg->nDestId, aPageRect, nPage, vcl::PDFWriter::FitRectangle );
+                                            pPDFExtOutDevData->DescribeRegisteredDest( aIBeg->nDestId, aPageRect, nPage, vcl::PDFWriter::DestAreaType::FitRectangle );
                                     }
                                     else
                                         pPDFExtOutDevData->SetLinkURL( aIBeg->nLinkId, aIBeg->aBookmark );
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index f70604b0..89f5703 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -616,7 +616,7 @@ sal_Int32 PDFExtOutDevData::CreateNamedDest(const OUString& sDestName,  const Re
     mpGlobalSyncData->mParaRects.push_back( rRect );
     mpGlobalSyncData->mParaMapModes.push_back( mrOutDev.GetMapMode() );
     mpGlobalSyncData->mParaInts.push_back( nPageNr == -1 ? mnPage : nPageNr );
-    mpGlobalSyncData->mParaDestAreaTypes.push_back( PDFWriter::XYZ );
+    mpGlobalSyncData->mParaDestAreaTypes.push_back( PDFWriter::DestAreaType::XYZ );
 
     return mpGlobalSyncData->mCurId++;
 }
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 646c79a..308c0d7 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3714,7 +3714,7 @@ bool PDFWriterImpl::appendDest( sal_Int32 nDestID, OStringBuffer& rBuffer )
 
     switch( rDest.m_eType )
     {
-        case PDFWriter::XYZ:
+        case PDFWriter::DestAreaType::XYZ:
         default:
             rBuffer.append( "/XYZ " );
             appendFixedInt( rDest.m_aRect.Left(), rBuffer );
@@ -3722,10 +3722,7 @@ bool PDFWriterImpl::appendDest( sal_Int32 nDestID, OStringBuffer& rBuffer )
             appendFixedInt( rDest.m_aRect.Bottom(), rBuffer );
             rBuffer.append( " 0" );
             break;
-        case PDFWriter::Fit:
-            rBuffer.append( "/Fit" );
-            break;
-        case PDFWriter::FitRectangle:
+        case PDFWriter::DestAreaType::FitRectangle:
             rBuffer.append( "/FitR " );
             appendFixedInt( rDest.m_aRect.Left(), rBuffer );
             rBuffer.append( ' ' );
@@ -3735,25 +3732,6 @@ bool PDFWriterImpl::appendDest( sal_Int32 nDestID, OStringBuffer& rBuffer )
             rBuffer.append( ' ' );
             appendFixedInt( rDest.m_aRect.Bottom(), rBuffer );
             break;
-        case PDFWriter::FitHorizontal:
-            rBuffer.append( "/FitH " );
-            appendFixedInt( rDest.m_aRect.Bottom(), rBuffer );
-            break;
-        case PDFWriter::FitVertical:
-            rBuffer.append( "/FitV " );
-            appendFixedInt( rDest.m_aRect.Left(), rBuffer );
-            break;
-        case PDFWriter::FitPageBoundingBox:
-            rBuffer.append( "/FitB" );
-            break;
-        case PDFWriter::FitPageBoundingBoxHorizontal:
-            rBuffer.append( "/FitBH " );
-            appendFixedInt( rDest.m_aRect.Bottom(), rBuffer );
-            break;
-        case PDFWriter::FitPageBoundingBoxVertical:
-            rBuffer.append( "/FitBV " );
-            appendFixedInt( rDest.m_aRect.Left(), rBuffer );
-            break;
     }
     rBuffer.append( ']' );
 
@@ -7477,7 +7455,7 @@ sal_Int32 PDFWriterImpl::emitNamedDestinations()
 
             switch( rDest.m_eType )
             {
-            case PDFWriter::XYZ:
+            case PDFWriter::DestAreaType::XYZ:
             default:
                 aLine.append( "/XYZ " );
                 appendFixedInt( rDest.m_aRect.Left(), aLine );
@@ -7485,10 +7463,7 @@ sal_Int32 PDFWriterImpl::emitNamedDestinations()
                 appendFixedInt( rDest.m_aRect.Bottom(), aLine );
                 aLine.append( " 0" );
                 break;
-            case PDFWriter::Fit:
-                aLine.append( "/Fit" );
-                break;
-            case PDFWriter::FitRectangle:
+            case PDFWriter::DestAreaType::FitRectangle:
                 aLine.append( "/FitR " );
                 appendFixedInt( rDest.m_aRect.Left(), aLine );
                 aLine.append( ' ' );
@@ -7498,25 +7473,6 @@ sal_Int32 PDFWriterImpl::emitNamedDestinations()
                 aLine.append( ' ' );
                 appendFixedInt( rDest.m_aRect.Bottom(), aLine );
                 break;
-            case PDFWriter::FitHorizontal:
-                aLine.append( "/FitH " );
-                appendFixedInt( rDest.m_aRect.Bottom(), aLine );
-                break;
-            case PDFWriter::FitVertical:
-                aLine.append( "/FitV " );
-                appendFixedInt( rDest.m_aRect.Left(), aLine );
-                break;
-            case PDFWriter::FitPageBoundingBox:
-                aLine.append( "/FitB" );
-                break;
-            case PDFWriter::FitPageBoundingBoxHorizontal:
-                aLine.append( "/FitBH " );
-                appendFixedInt( rDest.m_aRect.Bottom(), aLine );
-                break;
-            case PDFWriter::FitPageBoundingBoxVertical:
-                aLine.append( "/FitBV " );
-                appendFixedInt( rDest.m_aRect.Left(), aLine );
-                break;
             }
             aLine.append( "]\n" );
         }


More information about the Libreoffice-commits mailing list