[Libreoffice-commits] core.git: compilerplugins/clang sw/inc sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 22 06:41:23 UTC 2018


 compilerplugins/clang/unusedenumconstants.untouched.results |    2 -
 sw/inc/tblafmt.hxx                                          |   10 +++++--
 sw/source/core/doc/tblafmt.cxx                              |   12 ++++-----
 sw/source/core/docnode/ndtbl.cxx                            |   16 ++++++------
 sw/source/filter/html/htmltab.cxx                           |    2 -
 5 files changed, 22 insertions(+), 20 deletions(-)

New commits:
commit 9decbd5998dc93549ef9f0268e86f53634071600
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Nov 21 15:00:47 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Nov 22 07:40:55 2018 +0100

    convert SwTableAutoFormat::UpdateFlags to scoped enum
    
    and remove unused UPDATE_ALL
    
    Change-Id: Ib8f21dcddec66947fff8e9cda63f10711da02883
    Reviewed-on: https://gerrit.libreoffice.org/63748
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/unusedenumconstants.untouched.results b/compilerplugins/clang/unusedenumconstants.untouched.results
index ce531f8143d7..fc9e160e6065 100644
--- a/compilerplugins/clang/unusedenumconstants.untouched.results
+++ b/compilerplugins/clang/unusedenumconstants.untouched.results
@@ -464,8 +464,6 @@ sw/inc/poolfmt.hxx:233
     enum RES_POOL_TABSTYLE_TYPE RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_ROWS
 sw/inc/poolfmt.hxx:234
     enum RES_POOL_TABSTYLE_TYPE RES_POOLTABLESTYLE_LO6_SIMPLE_LIST_SHADED
-sw/inc/tblafmt.hxx:286
-    enum SwTableAutoFormat::UpdateFlags UPDATE_ALL
 sw/source/filter/ww8/ww8scan.hxx:388
     enum ePLCFT SEP
 sw/source/filter/ww8/ww8struc.hxx:944
diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index 4f6275f92f1e..b2e6bded8be3 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -189,6 +189,11 @@ public:
     void SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion ) const;
 };
 
+enum class SwTableAutoFormatUpdateFlags { Char = 1, Box = 2 };
+namespace o3tl {
+    template<> struct typed_flags<SwTableAutoFormatUpdateFlags> : is_typed_flags<SwTableAutoFormatUpdateFlags, 0x03> {};
+};
+
 /*
 @remarks
 A table has a number of lines. These lines seem to correspond with rows, except in the case of
@@ -283,10 +288,9 @@ public:
     void SetName( const OUString& rNew ) { m_aName = rNew; nStrResId = USHRT_MAX; }
     const OUString& GetName() const { return m_aName; }
 
-    enum UpdateFlags { UPDATE_CHAR = 1, UPDATE_BOX = 2, UPDATE_ALL = 3 };
     void UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet,
-                                UpdateFlags eFlags, SvNumberFormatter const * );
-    void UpdateToSet( sal_uInt8 nPos, SfxItemSet& rSet, UpdateFlags eFlags,
+                                SwTableAutoFormatUpdateFlags eFlags, SvNumberFormatter const * );
+    void UpdateToSet( sal_uInt8 nPos, SfxItemSet& rSet, SwTableAutoFormatUpdateFlags eFlags,
                         SvNumberFormatter* ) const ;
 
     void RestoreTableProperties(SwTable &table) const;
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index e5fc328e07bb..7c9cd3e37781 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -728,7 +728,7 @@ const SwBoxAutoFormat& SwTableAutoFormat::GetDefaultBoxFormat()
 
 void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos,
                                     const SfxItemSet& rSet,
-                                    UpdateFlags eFlags,
+                                    SwTableAutoFormatUpdateFlags eFlags,
                                     SvNumberFormatter const * pNFormatr)
 {
     OSL_ENSURE( nPos < 16, "wrong area" );
@@ -740,7 +740,7 @@ void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos,
         aBoxAutoFormat[ nPos ] = pFormat;
     }
 
-    if( UPDATE_CHAR & eFlags )
+    if( SwTableAutoFormatUpdateFlags::Char & eFlags )
     {
         pFormat->SetFont( rSet.Get( RES_CHRATR_FONT ) );
         pFormat->SetHeight( rSet.Get( RES_CHRATR_FONTSIZE ) );
@@ -762,7 +762,7 @@ void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos,
         pFormat->SetColor( rSet.Get( RES_CHRATR_COLOR ) );
         pFormat->SetAdjust( rSet.Get( RES_PARATR_ADJUST ) );
     }
-    if( UPDATE_BOX & eFlags )
+    if( SwTableAutoFormatUpdateFlags::Box & eFlags )
     {
         pFormat->SetBox( rSet.Get( RES_BOX ) );
 // FIXME - add attribute IDs for the diagonal line items
@@ -792,11 +792,11 @@ void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos,
 }
 
 void SwTableAutoFormat::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
-                                 UpdateFlags eFlags, SvNumberFormatter* pNFormatr) const
+                                 SwTableAutoFormatUpdateFlags eFlags, SvNumberFormatter* pNFormatr) const
 {
     const SwBoxAutoFormat& rChg = GetBoxFormat( nPos );
 
-    if( UPDATE_CHAR & eFlags )
+    if( SwTableAutoFormatUpdateFlags::Char & eFlags )
     {
         if( IsFont() )
         {
@@ -851,7 +851,7 @@ void SwTableAutoFormat::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
             rSet.Put( rChg.GetAdjust() );
     }
 
-    if( UPDATE_BOX & eFlags )
+    if( SwTableAutoFormatUpdateFlags::Box & eFlags )
     {
         if( IsFrame() )
         {
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index af3d4313a03d..6f3438443463 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -171,7 +171,7 @@ lcl_SetDfltBoxAttr(SwTableBox& rBox, DfltBoxAttrList_t & rBoxFormatArr,
 
         if( pAutoFormat )
             pAutoFormat->UpdateToSet( nId, const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pNewTableBoxFormat->GetAttrSet())),
-                                    SwTableAutoFormat::UPDATE_BOX,
+                                    SwTableAutoFormatUpdateFlags::Box,
                                     pDoc->GetNumberFormatter() );
         else
             ::lcl_SetDfltBoxAttr( *pNewTableBoxFormat, nId );
@@ -204,7 +204,7 @@ static SwTableBoxFormat *lcl_CreateAFormatBoxFormat( SwDoc &rDoc, std::vector<Sw
     {
         SwTableBoxFormat* pBoxFormat = rDoc.MakeTableBoxFormat();
         rAutoFormat.UpdateToSet( nId, const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pBoxFormat->GetAttrSet())),
-                                SwTableAutoFormat::UPDATE_BOX,
+                                SwTableAutoFormatUpdateFlags::Box,
                                 rDoc.GetNumberFormatter( ) );
         if( USHRT_MAX != nCols )
             pBoxFormat->SetFormatAttr( SwFormatFrameSize( ATT_VAR_SIZE,
@@ -503,7 +503,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTableOpts,
                 {
                     aCharSet.ClearItem();
                     pTAFormat->UpdateToSet( nId, aCharSet,
-                                        SwTableAutoFormat::UPDATE_CHAR, nullptr );
+                                        SwTableAutoFormatUpdateFlags::Char, nullptr );
                     if( aCharSet.Count() )
                         GetNodes()[ aNdIdx.GetIndex()+1 ]->GetContentNode()->
                             SetAttr( aCharSet );
@@ -802,7 +802,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts,
                     {
                         aCharSet.ClearItem();
                         pTAFormat->UpdateToSet( nId, aCharSet,
-                                            SwTableAutoFormat::UPDATE_CHAR, nullptr );
+                                            SwTableAutoFormatUpdateFlags::Char, nullptr );
                         if( aCharSet.Count() )
                         {
                             sal_uLong nSttNd = pBox->GetSttIdx()+1;
@@ -3644,8 +3644,8 @@ static bool lcl_SetAFormatBox(FndBox_ & rBox, SetAFormatTabPara *pSetPara, bool
             SfxItemSet aCharSet(pDoc->GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1>{});
             SfxItemSet aBoxSet(pDoc->GetAttrPool(), aTableBoxSetRange);
             sal_uInt8 nPos = pSetPara->nAFormatLine * 4 + pSetPara->nAFormatBox;
-            pSetPara->rTableFormat.UpdateToSet(nPos, aCharSet, SwTableAutoFormat::UPDATE_CHAR, nullptr);
-            pSetPara->rTableFormat.UpdateToSet(nPos, aBoxSet, SwTableAutoFormat::UPDATE_BOX, pDoc->GetNumberFormatter());
+            pSetPara->rTableFormat.UpdateToSet(nPos, aCharSet, SwTableAutoFormatUpdateFlags::Char, nullptr);
+            pSetPara->rTableFormat.UpdateToSet(nPos, aBoxSet, SwTableAutoFormatUpdateFlags::Box, pDoc->GetNumberFormatter());
 
             if (aCharSet.Count())
             {
@@ -3834,9 +3834,9 @@ bool SwDoc::GetTableAutoFormat( const SwSelBoxes& rBoxes, SwTableAutoFormat& rGe
 
             if( pCNd )
                 rGet.UpdateFromSet( nPos, pCNd->GetSwAttrSet(),
-                                    SwTableAutoFormat::UPDATE_CHAR, nullptr );
+                                    SwTableAutoFormatUpdateFlags::Char, nullptr );
             rGet.UpdateFromSet( nPos, pFBox->GetFrameFormat()->GetAttrSet(),
-                                SwTableAutoFormat::UPDATE_BOX,
+                                SwTableAutoFormatUpdateFlags::Box,
                                 GetNumberFormatter() );
         }
     }
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index b293885853b8..15f10c1090fa 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -1482,7 +1482,7 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
                 pTableFormat->UpdateToSet(nPos,
                                           const_cast<SfxItemSet&>(static_cast<SfxItemSet const&>(
                                               pFrameFormat->GetAttrSet())),
-                                          SwTableAutoFormat::UPDATE_BOX,
+                                          SwTableAutoFormatUpdateFlags::Box,
                                           pFrameFormat->GetDoc()->GetNumberFormatter());
             }
         }


More information about the Libreoffice-commits mailing list