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

Jochen Nitschke j.nitschke+logerrit at ok.de
Sun Aug 27 07:35:21 UTC 2017


 filter/source/msfilter/svdfppt.cxx  |    4 +++-
 include/filter/msfilter/svdfppt.hxx |   27 +++++++++++++++++++++++++--
 sd/source/filter/ppt/pptin.cxx      |   20 ++++++++++----------
 3 files changed, 38 insertions(+), 13 deletions(-)

New commits:
commit b2d7a1183597af19d775db584b9c280a8d21727e
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Tue Jul 11 23:08:30 2017 +0200

    replace magic numbers for ppt view types
    
    Change-Id: I0cd234cd039a2117fe49e6de3461becdbfa07e30
    Reviewed-on: https://gerrit.libreoffice.org/40475
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index eb68f70ede18..50eeb81bb173 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -465,6 +465,7 @@ class PptFontCollection : public std::vector<std::unique_ptr<PptFontEntityAtom>>
 
 SvStream& ReadPptUserEditAtom( SvStream& rIn, PptUserEditAtom& rAtom )
 {
+    sal_Int16 lastViewType = 0;
     ReadDffRecordHeader( rIn, rAtom.aHd );
     rIn
        .ReadInt32( rAtom.nLastSlideID )
@@ -473,7 +474,8 @@ SvStream& ReadPptUserEditAtom( SvStream& rIn, PptUserEditAtom& rAtom )
        .ReadUInt32( rAtom.nOffsetPersistDirectory )
        .ReadUInt32( rAtom.nDocumentRef )
        .ReadUInt32( rAtom.nMaxPersistWritten )
-       .ReadInt16( rAtom.eLastViewType );
+       .ReadInt16( lastViewType );
+    rAtom.eLastViewType = static_cast<PptViewTypeEnum>(lastViewType);
     rAtom.aHd.SeekToEndOfRecord(rIn);
     return rIn;
 }
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index 558a0396daa4..20c681b7fb98 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -284,6 +284,29 @@ struct PptFontEntityAtom
 };
 
 class PptFontCollection;
+enum class PptViewTypeEnum : sal_uInt16
+{
+    NONE = 0,
+    Slide = 1,
+    SlideMaster = 2,
+    Notes = 3,
+    Handout = 4,
+    NotesMaster = 5,
+    OutlineMaster = 6,
+    Outline = 7,
+    SlideSorter = 8,
+    VisualBasic = 9,
+    TitleMaster = 10,
+    SlideShow = 11,
+    SlideShowFullScreen = 12,
+    NotesText = 13,
+    PrintPreview = 14,
+    Thumbnails = 15,
+    MasterThumbnails = 16,
+    PodiumSlideView = 17,
+    PodiumNotesView = 18,
+};
+
 struct PptUserEditAtom
 {
     DffRecordHeader     aHd;
@@ -293,7 +316,7 @@ struct PptUserEditAtom
     sal_uInt32          nOffsetPersistDirectory; // Offset to PersistPtrs for this file version.
     sal_uInt32          nDocumentRef;
     sal_uInt32          nMaxPersistWritten;      // total number of Persist entries up to this point
-    sal_Int16           eLastViewType;           // enum view type
+    PptViewTypeEnum     eLastViewType;           // enum view type
 
 public:
     PptUserEditAtom()
@@ -303,7 +326,7 @@ public:
         , nOffsetPersistDirectory( 0 )
         , nDocumentRef( 0 )
         , nMaxPersistWritten( 0 )
-        , eLastViewType( 0 )
+        , eLastViewType( PptViewTypeEnum::NONE )
         {}
 
     friend SvStream& ReadPptUserEditAtom( SvStream& rIn, PptUserEditAtom& rAtom );
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index ce06ae52a268..3fb80c4e6b98 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -550,8 +550,8 @@ bool ImplSdPPTImport::Import()
     Size aVisAreaSize;
     switch ( aUserEditAtom.eLastViewType )
     {
-        case 5 :    // notes master
-        case 3 :    // notes
+        case PptViewTypeEnum::Notes:
+        case PptViewTypeEnum::NotesMaster:
             aVisAreaSize = aDocAtom.GetNotesPageSize();
         break;
         default :
@@ -1239,40 +1239,40 @@ bool ImplSdPPTImport::Import()
 
                 switch ( aUserEditAtom.eLastViewType )
                 {
-                    case 7 :    // outliner view
+                    case PptViewTypeEnum::Outline:
                     {
                         SfxItemSet* pSet = mrMed.GetItemSet();
                         if ( pSet )
                             pSet->Put( SfxUInt16Item( SID_VIEW_ID, 3 ) );
                     }
                     break;
-                    case 8 :    // slide sorter
+                    case PptViewTypeEnum::SlideSorter:
                     {
                         SfxItemSet* pSet = mrMed.GetItemSet();
                         if ( pSet )
                             pSet->Put( SfxUInt16Item( SID_VIEW_ID, 2 ) );
                     }
                     break;
-                    case 10 :   // titlemaster
+                    case PptViewTypeEnum::TitleMaster:
                         nSelectedPage = 1;
                         SAL_FALLTHROUGH;
-                    case 2 :    // master
+                    case PptViewTypeEnum::SlideMaster:
                     {
                         ePageKind = PageKind::Standard;
                         eEditMode = EditMode::MasterPage;
                     }
                     break;
-                    case 5 :    // notes master
+                    case PptViewTypeEnum::NotesMaster:
                         eEditMode = EditMode::MasterPage;
                         SAL_FALLTHROUGH;
-                    case 3 :    // notes
+                    case PptViewTypeEnum::Notes:
                         ePageKind = PageKind::Notes;
                     break;
-                    case 4 :    // handout
+                    case PptViewTypeEnum::Handout:
                         ePageKind = PageKind::Handout;
                     break;
                     default :
-                    case 1 :    // normal
+                    case PptViewTypeEnum::Slide:
                     break;
                 }
                 pFrameView->SetPageKind( ePageKind );


More information about the Libreoffice-commits mailing list