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

Noel Grandin noel.grandin at collabora.co.uk
Thu Apr 26 11:18:01 UTC 2018


 sw/inc/doc.hxx                       |    4 ++--
 sw/inc/editsh.hxx                    |    6 +++---
 sw/inc/itabenum.hxx                  |   21 +++++++++++++--------
 sw/qa/core/uwriter.cxx               |    2 +-
 sw/qa/extras/uiwriter/uiwriter.cxx   |   14 +++++++-------
 sw/source/core/doc/tblrwcl.cxx       |    2 +-
 sw/source/core/docnode/ndtbl.cxx     |   14 +++++++-------
 sw/source/core/edit/autofmt.cxx      |    2 +-
 sw/source/core/edit/edtab.cxx        |    2 +-
 sw/source/core/unocore/unotbl.cxx    |    2 +-
 sw/source/filter/html/htmltab.cxx    |    2 +-
 sw/source/filter/ww8/ww8par2.cxx     |    2 +-
 sw/source/ui/config/optpage.cxx      |   16 ++++++++--------
 sw/source/ui/table/convert.cxx       |   12 ++++++------
 sw/source/ui/table/instable.cxx      |   12 ++++++------
 sw/source/uibase/config/modcfg.cxx   |   16 ++++++++--------
 sw/source/uibase/dochdl/swdtflvr.cxx |    2 +-
 sw/source/uibase/shells/basesh.cxx   |   20 ++++++++++----------
 18 files changed, 78 insertions(+), 73 deletions(-)

New commits:
commit 9370c07101bbca313f8e69518b0988b07eb21888
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Apr 26 11:42:54 2018 +0200

    convert tabopts to scoped enum
    
    Change-Id: I6c9290e3319d2afd1bd71847091c7ab77b8ea6e6
    Reviewed-on: https://gerrit.libreoffice.org/53497
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index a5d88504ab94..d588428b8890 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1123,7 +1123,7 @@ public:
        propagation.
        false: do not propagate
     */
-    const SwTable* InsertTable( const SwInsertTableOptions& rInsTableOpts,  // HEADLINE_NO_BORDER
+    const SwTable* InsertTable( const SwInsertTableOptions& rInsTableOpts,  // HeadlineNoBorder
                                 const SwPosition& rPos, sal_uInt16 nRows,
                                 sal_uInt16 nCols, short eAdjust,
                                 const SwTableAutoFormat* pTAFormat = nullptr,
@@ -1136,7 +1136,7 @@ public:
     inline const SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx ) const;
 
     // Create a balanced table out of the selected range.
-    const SwTable* TextToTable( const SwInsertTableOptions& rInsTableOpts, // HEADLINE_NO_BORDER,
+    const SwTable* TextToTable( const SwInsertTableOptions& rInsTableOpts, // HeadlineNoBorder,
                                 const SwPaM& rRange, sal_Unicode cCh,
                                 short eAdjust,
                                 const SwTableAutoFormat* );
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index c7f3c078a3b4..42a542ff3502 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -709,11 +709,11 @@ public:
     /// For Inserting SoftHyphen. Position is offset within the syllabificated word.
     static void InsertSoftHyph( const sal_Int32 nHyphPos );
 
-    const SwTable& InsertTable( const SwInsertTableOptions& rInsTableOpts,  ///< ALL_TBL_INS_ATTR
+    const SwTable& InsertTable( const SwInsertTableOptions& rInsTableOpts,  ///< All
                                 sal_uInt16 nRows, sal_uInt16 nCols,
                                 const SwTableAutoFormat* pTAFormat = nullptr );
 
-    void InsertDDETable( const SwInsertTableOptions& rInsTableOpts,  ///< HEADLINE_NO_BORDER
+    void InsertDDETable( const SwInsertTableOptions& rInsTableOpts,  ///< HeadlineNoBorder
                          SwDDEFieldType* pDDEType,
                          sal_uInt16 nRows, sal_uInt16 nCols  );
 
@@ -721,7 +721,7 @@ public:
     void SetTableName( SwFrameFormat& rTableFormat, const OUString &rNewName );
 
     SwFrameFormat *GetTableFormat();
-    bool TextToTable( const SwInsertTableOptions& rInsTableOpts,  ///< ALL_TBL_INS_ATTR
+    bool TextToTable( const SwInsertTableOptions& rInsTableOpts,  ///< All
                       sal_Unicode cCh,
                       const SwTableAutoFormat* pTAFormat = nullptr );
     bool TableToText( sal_Unicode cCh );
diff --git a/sw/inc/itabenum.hxx b/sw/inc/itabenum.hxx
index c3c06e5d6abb..d5c68cb510d9 100644
--- a/sw/inc/itabenum.hxx
+++ b/sw/inc/itabenum.hxx
@@ -20,22 +20,27 @@
 #define INCLUDED_SW_INC_ITABENUM_HXX
 
 #include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
 
-namespace tabopts
+enum class SwInsertTableFlags
 {
-    const sal_uInt16 DEFAULT_BORDER     = 0x01;
-    const sal_uInt16 HEADLINE           = 0x02;
-    const sal_uInt16 SPLIT_LAYOUT       = 0x08;
-    const sal_uInt16 HEADLINE_NO_BORDER = HEADLINE | SPLIT_LAYOUT;
-    const sal_uInt16 ALL_TBL_INS_ATTR   = DEFAULT_BORDER | HEADLINE | SPLIT_LAYOUT;
+    NONE               = 0x00,
+    DefaultBorder      = 0x01,
+    Headline           = 0x02,
+    SplitLayout        = 0x08,
+    HeadlineNoBorder   = Headline | SplitLayout,
+    All   = DefaultBorder | Headline | SplitLayout
+};
+namespace o3tl {
+    template<> struct typed_flags<SwInsertTableFlags> : is_typed_flags<SwInsertTableFlags, 0x0b> {};
 }
 
 struct SwInsertTableOptions
 {
-    sal_uInt16 mnInsMode;
+    SwInsertTableFlags mnInsMode;
     sal_uInt16 mnRowsToRepeat;
 
-    SwInsertTableOptions( sal_uInt16 nInsMode, sal_uInt16 nRowsToRepeat ) :
+    SwInsertTableOptions( SwInsertTableFlags nInsMode, sal_uInt16 nRowsToRepeat ) :
         mnInsMode( nInsMode ), mnRowsToRepeat( nRowsToRepeat ) {};
 };
 
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 33fc1debfded..d573c84ffd45 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1532,7 +1532,7 @@ void SwDocTest::testFormulas()
     SwPosition aPos(aIdx);
 
     const SwTable *pTable = m_pDoc->InsertTable(
-        SwInsertTableOptions(tabopts::HEADLINE_NO_BORDER, 0), aPos, 1, 3, 0);
+        SwInsertTableOptions(SwInsertTableFlags::HeadlineNoBorder, 0), aPos, 1, 3, 0);
     SwTableNode* pTableNode = pTable->GetTableNode();
     SwTableFormulaTest aFormula("<\x12-1,0>+<Table1.A1>", pTableNode);
 
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index e729ccf06816..735bbe8f7cd0 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -710,7 +710,7 @@ void SwUiWriterTest::testTdf67238()
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
     //insert a 3X3 table in the newly created document
-    SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0);
+    SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
     const SwTable& rTable = pWrtShell->InsertTable(TableOpt, 3, 3);
     //checking for the rows and columns
     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
@@ -1854,7 +1854,7 @@ void SwUiWriterTest::testDeleteTableRedlines()
 {
     SwDoc* pDoc = createDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-    SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0);
+    SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
     const SwTable& rTable = pWrtShell->InsertTable(TableOpt, 1, 3);
     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
@@ -2399,7 +2399,7 @@ void SwUiWriterTest::testTdf60967()
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
     pWrtShell->ChangeHeaderOrFooter("Default Style", true, true, true);
     //Inserting table
-    SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0);
+    SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
     pWrtShell->InsertTable(TableOpt, 2, 2);
     //getting the cursor's position just after the table insert
     SwPosition aPosAfterTable(*(pCursor->GetPoint()));
@@ -3072,7 +3072,7 @@ void SwUiWriterTest::testTdf80663()
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     //Inserting 2x2 Table
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
-    SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0);
+    SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
     pWrtShell->InsertTable(TableOpt, 2, 2);
     //Checking for the number of rows and columns
     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
@@ -3159,7 +3159,7 @@ void SwUiWriterTest::testTdf57197()
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     //Inserting 1x1 Table
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
-    SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0);
+    SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
     pWrtShell->InsertTable(TableOpt, 1, 1);
     //Checking for the number of rows and columns
     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
@@ -3515,7 +3515,7 @@ void SwUiWriterTest::testTableBackgroundColor()
 {
     SwDoc* pDoc = createDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-    SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0);
+    SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
     pWrtShell->InsertTable(TableOpt, 3, 3); //Inserting Table
     //Checking Rows and Columns of Inserted Table
     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
@@ -6057,7 +6057,7 @@ void SwUiWriterTest::testTdf115132()
     pWrtShell->SplitNode();
     pWrtShell->SttDoc();
     // Create a table at the start of document body
-    SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0);
+    SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
     const SwTable* pTable = &pWrtShell->InsertTable(TableOpt, 2, 3);
     const SwTableFormat* pFormat = pTable->GetFrameFormat();
     CPPUNIT_ASSERT(pFormat);
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index d1dd34c0a5da..0c589270ce24 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -2061,7 +2061,7 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos,
     }
 
     SwTable* pNewTable = const_cast<SwTable*>(pInsDoc->InsertTable(
-            SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ),
+            SwInsertTableOptions( SwInsertTableFlags::HeadlineNoBorder, 1 ),
             rPos, 1, 1, GetFrameFormat()->GetHoriOrient().GetHoriOrient(),
             nullptr, nullptr, false, IsNewModel() ));
     if( !pNewTable )
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 3edfcdf51310..629a766254c0 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -365,13 +365,13 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTableOpts,
     SwTextFormatColl *pBodyColl = getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TABLE ),
                  *pHeadColl = pBodyColl;
 
-    bool bDfltBorders = 0 != ( rInsTableOpts.mnInsMode & tabopts::DEFAULT_BORDER );
+    bool bDfltBorders( rInsTableOpts.mnInsMode & SwInsertTableFlags::DefaultBorder );
 
-    if( (rInsTableOpts.mnInsMode & tabopts::HEADLINE) && (1 != nRows || !bDfltBorders) )
+    if( (rInsTableOpts.mnInsMode & SwInsertTableFlags::Headline) && (1 != nRows || !bDfltBorders) )
         pHeadColl = getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TABLE_HDLN );
 
     const sal_uInt16 nRowsToRepeat =
-            tabopts::HEADLINE == (rInsTableOpts.mnInsMode & tabopts::HEADLINE) ?
+            SwInsertTableFlags::Headline == (rInsTableOpts.mnInsMode & SwInsertTableFlags::Headline) ?
             rInsTableOpts.mnRowsToRepeat :
             0;
 
@@ -434,7 +434,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTableOpts,
         nWidth *= nCols; // to avoid rounding problems
     }
     pTableFormat->SetFormatAttr( SwFormatFrameSize( ATT_VAR_SIZE, nWidth ));
-    if( !(rInsTableOpts.mnInsMode & tabopts::SPLIT_LAYOUT) )
+    if( !(rInsTableOpts.mnInsMode & SwInsertTableFlags::SplitLayout) )
         pTableFormat->SetFormatAttr( SwFormatLayoutSplit( false ));
 
     // Move the hard PageDesc/PageBreak Attributes if needed
@@ -702,7 +702,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts,
     pLineFormat->SetFormatAttr( SwFormatFillOrder( ATT_LEFT_TO_RIGHT ));
     // The Table's SSize is USHRT_MAX
     pTableFormat->SetFormatAttr( SwFormatFrameSize( ATT_VAR_SIZE, USHRT_MAX ));
-    if( !(rInsTableOpts.mnInsMode & tabopts::SPLIT_LAYOUT) )
+    if( !(rInsTableOpts.mnInsMode & SwInsertTableFlags::SplitLayout) )
         pTableFormat->SetFormatAttr( SwFormatLayoutSplit( false ));
 
     /* If the first node in the selection is a context node and if it
@@ -732,7 +732,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts,
     SwTable& rNdTable = pTableNd->GetTable();
 
     const sal_uInt16 nRowsToRepeat =
-            tabopts::HEADLINE == (rInsTableOpts.mnInsMode & tabopts::HEADLINE) ?
+            SwInsertTableFlags::Headline == (rInsTableOpts.mnInsMode & SwInsertTableFlags::Headline) ?
             rInsTableOpts.mnRowsToRepeat :
             0;
     rNdTable.SetRowsToRepeat(nRowsToRepeat);
@@ -752,7 +752,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts,
     pTableFormat->SetFormatAttr( SwFormatHoriOrient( 0, eAdjust ) );
     rNdTable.RegisterToFormat(*pTableFormat);
 
-    if( pTAFormat || ( rInsTableOpts.mnInsMode & tabopts::DEFAULT_BORDER) )
+    if( pTAFormat || ( rInsTableOpts.mnInsMode & SwInsertTableFlags::DefaultBorder) )
     {
         sal_uInt8 nBoxArrLen = pTAFormat ? 16 : 4;
         std::unique_ptr< DfltBoxAttrList_t > aBoxFormatArr1;
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 09ccd39c604a..5674124a266e 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -666,7 +666,7 @@ bool SwAutoFormat::DoTable()
         DelEmptyLine();
         SwNodeIndex aIdx( m_aDelPam.GetPoint()->nNode );
         m_aDelPam.Move( fnMoveForward );
-        m_pDoc->InsertTable( SwInsertTableOptions( tabopts::ALL_TBL_INS_ATTR , 1 ),
+        m_pDoc->InsertTable( SwInsertTableOptions( SwInsertTableFlags::All , 1 ),
                            *m_aDelPam.GetPoint(), 1, nColCnt, eHori,
                            nullptr, &aPosArr );
         m_aDelPam.GetPoint()->nNode = aIdx;
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index 4f69a04b713b..4859b5efdcbb 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -225,7 +225,7 @@ void SwEditShell::InsertDDETable( const SwInsertTableOptions& rInsTableOpts,
         GetDoc()->getIDocumentContentOperations().SplitNode( *pPos, false );
     }
 
-    const SwInsertTableOptions aInsTableOpts( rInsTableOpts.mnInsMode | tabopts::DEFAULT_BORDER,
+    const SwInsertTableOptions aInsTableOpts( rInsTableOpts.mnInsMode | SwInsertTableFlags::DefaultBorder,
                                             rInsTableOpts.mnRowsToRepeat );
     SwTable* pTable = const_cast<SwTable*>(GetDoc()->InsertTable( aInsTableOpts, *pPos,
                                                      nRows, nCols, css::text::HoriOrientation::FULL ));
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 21f44c5e34fd..1d28972928c2 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -2145,7 +2145,7 @@ SwXTextTable::attach(const uno::Reference<text::XTextRange> & xTextRange)
             pDoc->getIDocumentContentOperations().DeleteAndJoin(aPam);
             aPam.DeleteMark();
         }
-        pTable = pDoc->InsertTable(SwInsertTableOptions( tabopts::HEADLINE | tabopts::DEFAULT_BORDER | tabopts::SPLIT_LAYOUT, 0 ),
+        pTable = pDoc->InsertTable(SwInsertTableOptions( SwInsertTableFlags::Headline | SwInsertTableFlags::DefaultBorder | SwInsertTableFlags::SplitLayout, 0 ),
                 *aPam.GetPoint(),
                 m_pImpl->m_nRows,
                 m_pImpl->m_nColumns,
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index be3776cb1846..9e7230dc7b35 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -3441,7 +3441,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
                 OSL_ENSURE( !m_pPam->GetPoint()->nContent.GetIndex(),
                         "The paragraph after the table is not empty!" );
                 const SwTable* pSwTable = m_xDoc->InsertTable(
-                        SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ),
+                        SwInsertTableOptions( SwInsertTableFlags::HeadlineNoBorder, 1 ),
                         *m_pPam->GetPoint(), 1, 1, text::HoriOrientation::LEFT );
                 SwFrameFormat *pFrameFormat = pSwTable ? pSwTable->GetFrameFormat() : nullptr;
 
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 0f328d303d0f..0bfeeb680fb8 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2389,7 +2389,7 @@ void WW8TabDesc::CreateSwTable()
     // The number of rows is the count of bands because (identically)
     // rows of a band can be duplicated easy.
     m_pTable = m_pIo->m_rDoc.InsertTable(
-            SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 0 ),
+            SwInsertTableOptions( SwInsertTableFlags::HeadlineNoBorder, 0 ),
             *m_xTmpPos, m_nBands, m_nDefaultSwCols, m_eOri );
 
     OSL_ENSURE(m_pTable && m_pTable->GetFrameFormat(), "insert table failed");
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 133b423ae433..a60459508964 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1171,19 +1171,19 @@ bool SwTableOptionsTabPage::FillItemSet( SfxItemSet* )
         bRet = true;
     }
 
-    SwInsertTableOptions aInsOpts( 0, 0 );
+    SwInsertTableOptions aInsOpts( SwInsertTableFlags::NONE, 0 );
 
     if (m_pHeaderCB->IsChecked())
-        aInsOpts.mnInsMode |= tabopts::HEADLINE;
+        aInsOpts.mnInsMode |= SwInsertTableFlags::Headline;
 
     if (m_pRepeatHeaderCB->IsEnabled() )
         aInsOpts.mnRowsToRepeat = m_pRepeatHeaderCB->IsChecked()? 1 : 0;
 
     if (!m_pDontSplitCB->IsChecked())
-        aInsOpts.mnInsMode |= tabopts::SPLIT_LAYOUT;
+        aInsOpts.mnInsMode |= SwInsertTableFlags::SplitLayout;
 
     if (m_pBorderCB->IsChecked())
-        aInsOpts.mnInsMode |= tabopts::DEFAULT_BORDER;
+        aInsOpts.mnInsMode |= SwInsertTableFlags::DefaultBorder;
 
     if (m_pHeaderCB->IsValueChangedFromSaved() ||
         m_pRepeatHeaderCB->IsValueChangedFromSaved() ||
@@ -1252,12 +1252,12 @@ void SwTableOptionsTabPage::Reset( const SfxItemSet* rSet)
     }
 
     SwInsertTableOptions aInsOpts = pModOpt->GetInsTableFlags(m_bHTMLMode);
-    const sal_uInt16 nInsTableFlags = aInsOpts.mnInsMode;
+    const SwInsertTableFlags nInsTableFlags = aInsOpts.mnInsMode;
 
-    m_pHeaderCB->Check(0 != (nInsTableFlags & tabopts::HEADLINE));
+    m_pHeaderCB->Check(bool(nInsTableFlags & SwInsertTableFlags::Headline));
     m_pRepeatHeaderCB->Check((!m_bHTMLMode) && (aInsOpts.mnRowsToRepeat > 0));
-    m_pDontSplitCB->Check(!(nInsTableFlags & tabopts::SPLIT_LAYOUT));
-    m_pBorderCB->Check(0 != (nInsTableFlags & tabopts::DEFAULT_BORDER));
+    m_pDontSplitCB->Check(!(nInsTableFlags & SwInsertTableFlags::SplitLayout));
+    m_pBorderCB->Check(bool(nInsTableFlags & SwInsertTableFlags::DefaultBorder));
 
     m_pNumFormattingCB->Check(pModOpt->IsInsTableFormatNum(m_bHTMLMode));
     m_pNumFormatFormattingCB->Check(pModOpt->IsInsTableChangeNumFormat(m_bHTMLMode));
diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx
index e5c8f9ffdefe..066ad5f51a99 100644
--- a/sw/source/ui/table/convert.cxx
+++ b/sw/source/ui/table/convert.cxx
@@ -74,15 +74,15 @@ void SwConvertTableDlg::GetValues(  sal_Unicode& rDelim,
         }
     }
 
-    sal_uInt16 nInsMode = 0;
+    SwInsertTableFlags nInsMode = SwInsertTableFlags::NONE;
     if (m_xHeaderCB->get_active())
-        nInsMode |= tabopts::HEADLINE;
+        nInsMode |= SwInsertTableFlags::Headline;
     if (m_xRepeatHeaderCB->get_sensitive() && m_xRepeatHeaderCB->get_active())
         rInsTableOpts.mnRowsToRepeat = m_xRepeatHeaderNF->get_value();
     else
         rInsTableOpts.mnRowsToRepeat = 0;
     if (!m_xDontSplitCB->get_active())
-        nInsMode |= tabopts::SPLIT_LAYOUT;
+        nInsMode |= SwInsertTableFlags::SplitLayout;
 
     if (mxTAutoFormat)
         prTAFormat = new SwTableAutoFormat(*mxTAutoFormat);
@@ -158,11 +158,11 @@ SwConvertTableDlg::SwConvertTableDlg(SwView& rView, bool bToTable)
     bool bHTMLMode = 0 != (::GetHtmlMode(rView.GetDocShell())&HTMLMODE_ON);
 
     SwInsertTableOptions aInsOpts = pModOpt->GetInsTableFlags(bHTMLMode);
-    sal_uInt16 nInsTableFlags = aInsOpts.mnInsMode;
+    SwInsertTableFlags nInsTableFlags = aInsOpts.mnInsMode;
 
-    m_xHeaderCB->set_active(0 != (nInsTableFlags & tabopts::HEADLINE));
+    m_xHeaderCB->set_active(bool(nInsTableFlags & SwInsertTableFlags::Headline));
     m_xRepeatHeaderCB->set_active(aInsOpts.mnRowsToRepeat > 0);
-    m_xDontSplitCB->set_active(0 == (nInsTableFlags & tabopts::SPLIT_LAYOUT));
+    m_xDontSplitCB->set_active(!(nInsTableFlags & SwInsertTableFlags::SplitLayout));
 
     m_xHeaderCB->connect_clicked(LINK(this, SwConvertTableDlg, CheckBoxHdl));
     m_xRepeatHeaderCB->connect_clicked(LINK(this, SwConvertTableDlg, ReapeatHeaderCheckBoxHdl));
diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx
index 958d3fde05de..51a9315b1760 100644
--- a/sw/source/ui/table/instable.cxx
+++ b/sw/source/ui/table/instable.cxx
@@ -31,19 +31,19 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rC
                                 SwInsertTableOptions& rInsTableOpts, OUString& rAutoName,
                                 SwTableAutoFormat *& prTAFormat )
 {
-    sal_uInt16 nInsMode = 0;
+    SwInsertTableFlags nInsMode = SwInsertTableFlags::NONE;
     rName = m_xNameEdit->get_text();
     rRow = m_xRowNF->get_value();
     rCol = m_xColNF->get_value();
 
     if (m_xHeaderCB->get_active())
-        nInsMode |= tabopts::HEADLINE;
+        nInsMode |= SwInsertTableFlags::Headline;
     if (m_xRepeatHeaderCB->get_sensitive() && m_xRepeatHeaderCB->get_active())
         rInsTableOpts.mnRowsToRepeat = m_xRepeatHeaderNF->get_value();
     else
         rInsTableOpts.mnRowsToRepeat = 0;
     if (!m_xDontSplitCB->get_active())
-        nInsMode |= tabopts::SPLIT_LAYOUT;
+        nInsMode |= SwInsertTableFlags::SplitLayout;
     if( pTAutoFormat )
     {
         prTAFormat = new SwTableAutoFormat( *pTAutoFormat );
@@ -97,14 +97,14 @@ SwInsTableDlg::SwInsTableDlg(SwView& rView)
     const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
 
     SwInsertTableOptions aInsOpts = pModOpt->GetInsTableFlags(bHTMLMode);
-    sal_uInt16 nInsTableFlags = aInsOpts.mnInsMode;
+    SwInsertTableFlags nInsTableFlags = aInsOpts.mnInsMode;
 
-    m_xHeaderCB->set_active(0 != (nInsTableFlags & tabopts::HEADLINE));
+    m_xHeaderCB->set_active(bool(nInsTableFlags & SwInsertTableFlags::Headline));
     m_xRepeatHeaderCB->set_active(aInsOpts.mnRowsToRepeat > 0);
     if (bHTMLMode)
         m_xDontSplitCB->hide();
     else
-        m_xDontSplitCB->set_active(0 == (nInsTableFlags & tabopts::SPLIT_LAYOUT));
+        m_xDontSplitCB->set_active(!(nInsTableFlags & SwInsertTableFlags::SplitLayout));
 
     m_xRepeatHeaderNF->connect_value_changed( LINK( this, SwInsTableDlg, ModifyRepeatHeaderNF_Hdl ) );
     m_xHeaderCB->connect_toggled( LINK( this, SwInsTableDlg, CheckBoxHdl ) );
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index aeabf55f9c6e..dc605f7f644e 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -587,7 +587,7 @@ SwInsertConfig::SwInsertConfig(bool bWeb) :
     pOLEMiscOpt(nullptr),
     bInsWithCaption( false ),
     bCaptionOrderNumberingFirst( false ),
-    aInsTableOpts(0,0),
+    aInsTableOpts(SwInsertTableFlags::NONE,0),
     bIsWeb(bWeb)
 {
     aGlobalNames[GLOB_NAME_CALC   ] = SvGlobalName(SO3_SC_CLASSID);
@@ -656,16 +656,16 @@ void SwInsertConfig::ImplCommit()
         switch(nProp)
         {
             case INS_PROP_TABLE_HEADER:
-                pValues[nProp] <<= 0 != (aInsTableOpts.mnInsMode & tabopts::HEADLINE);
+                pValues[nProp] <<= bool(aInsTableOpts.mnInsMode & SwInsertTableFlags::Headline);
             break;//"Table/Header",
             case INS_PROP_TABLE_REPEATHEADER:
                 pValues[nProp] <<= aInsTableOpts.mnRowsToRepeat > 0;
             break;//"Table/RepeatHeader",
             case INS_PROP_TABLE_BORDER:
-                pValues[nProp] <<= 0 != (aInsTableOpts.mnInsMode & tabopts::DEFAULT_BORDER );
+                pValues[nProp] <<= bool(aInsTableOpts.mnInsMode & SwInsertTableFlags::DefaultBorder);
             break;//"Table/Border",
             case INS_PROP_TABLE_SPLIT:
-                pValues[nProp] <<= 0 != (aInsTableOpts.mnInsMode & tabopts::SPLIT_LAYOUT);
+                pValues[nProp] <<= bool(aInsTableOpts.mnInsMode & SwInsertTableFlags::SplitLayout);
             break;//"Table/Split",
             case INS_PROP_CAP_AUTOMATIC:
                 pValues[nProp] <<= bInsWithCaption;
@@ -890,7 +890,7 @@ void SwInsertConfig::Load()
     else if (!bIsWeb)
         return;
 
-    sal_uInt16 nInsTableFlags = 0;
+    SwInsertTableFlags nInsTableFlags = SwInsertTableFlags::NONE;
     for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
     {
         if (pValues[nProp].hasValue())
@@ -901,7 +901,7 @@ void SwInsertConfig::Load()
                 case INS_PROP_TABLE_HEADER:
                 {
                     if(bBool)
-                        nInsTableFlags|= tabopts::HEADLINE;
+                        nInsTableFlags |= SwInsertTableFlags::Headline;
                 }
                 break;//"Table/Header",
                 case INS_PROP_TABLE_REPEATHEADER:
@@ -913,13 +913,13 @@ void SwInsertConfig::Load()
                 case INS_PROP_TABLE_BORDER:
                 {
                     if(bBool)
-                        nInsTableFlags|= tabopts::DEFAULT_BORDER;
+                        nInsTableFlags |= SwInsertTableFlags::DefaultBorder;
                 }
                 break;//"Table/Border",
                 case INS_PROP_TABLE_SPLIT:
                 {
                     if(bBool)
-                        nInsTableFlags|= tabopts::SPLIT_LAYOUT;
+                        nInsTableFlags |= SwInsertTableFlags::SplitLayout;
                 }
                 break;//"Table/Split",
                 case INS_PROP_CAP_AUTOMATIC:
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 52ea174a5f71..4e69db27180e 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -2183,7 +2183,7 @@ bool SwTransferable::PasteDDE( TransferableDataHelper& rData,
                 }
 
                 rWrtShell.InsertDDETable(
-                    SwInsertTableOptions( tabopts::SPLIT_LAYOUT, 1 ), // TODO MULTIHEADER
+                    SwInsertTableOptions( SwInsertTableFlags::SplitLayout, 1 ), // TODO MULTIHEADER
                     pDDETyp, nRows, nCols );
             }
             else if( 1 < comphelper::string::getTokenCount(aExpand, '\n') )
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 6d25e2a52039..234daac5e1f3 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -823,13 +823,13 @@ void SwBaseShell::Execute(SfxRequest &rReq)
             if( nSlot == FN_CONVERT_TEXT_TO_TABLE ||
                 ( nSlot == FN_CONVERT_TEXT_TABLE && nullptr == rSh.GetTableFormat() ))
                 bToTable = true;
-            SwInsertTableOptions aInsTableOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
+            SwInsertTableOptions aInsTableOpts( SwInsertTableFlags::All, 1 );
             SwTableAutoFormat const* pTAFormat = nullptr;
             std::unique_ptr<SwTableAutoFormatTable> pAutoFormatTable;
             bool bDeleteFormat = true;
             if(pArgs && SfxItemState::SET == pArgs->GetItemState( FN_PARAM_1, true, &pItem))
             {
-                aInsTableOpts.mnInsMode = 0;
+                aInsTableOpts.mnInsMode = SwInsertTableFlags::NONE;
                 // Delimiter
                 OUString sDelim = static_cast< const SfxStringItem* >(pItem)->GetValue();
                 if(!sDelim.isEmpty())
@@ -856,7 +856,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
                 //WithHeader
                 if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_3, true, &pItem) &&
                             static_cast< const SfxBoolItem* >(pItem)->GetValue())
-                    aInsTableOpts.mnInsMode |= tabopts::HEADLINE;
+                    aInsTableOpts.mnInsMode |= SwInsertTableFlags::Headline;
                 // RepeatHeaderLines
                 if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_4, true, &pItem))
                    aInsTableOpts.mnRowsToRepeat =
@@ -864,11 +864,11 @@ void SwBaseShell::Execute(SfxRequest &rReq)
                 //WithBorder
                 if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_5, true, &pItem) &&
                     static_cast< const SfxBoolItem* >(pItem)->GetValue())
-                    aInsTableOpts.mnInsMode |= tabopts::DEFAULT_BORDER;
+                    aInsTableOpts.mnInsMode |= SwInsertTableFlags::DefaultBorder;
                 //DontSplitTable
                 if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_6, true, &pItem) &&
                     !static_cast< const SfxBoolItem* >(pItem)->GetValue() )
-                    aInsTableOpts.mnInsMode |= tabopts::SPLIT_LAYOUT;
+                    aInsTableOpts.mnInsMode |= SwInsertTableFlags::SplitLayout;
             }
             else
             {
@@ -899,10 +899,10 @@ void SwBaseShell::Execute(SfxRequest &rReq)
                     {
                         if(pTAFormat)
                             aReq.AppendItem( SfxStringItem( FN_PARAM_2, pTAFormat->GetName()));
-                        aReq.AppendItem( SfxBoolItem ( FN_PARAM_3, 0 != (aInsTableOpts.mnInsMode & tabopts::HEADLINE)));
+                        aReq.AppendItem( SfxBoolItem ( FN_PARAM_3, bool(aInsTableOpts.mnInsMode & SwInsertTableFlags::Headline)));
                         aReq.AppendItem( SfxInt16Item( FN_PARAM_4, static_cast<short>(aInsTableOpts.mnRowsToRepeat) ));
-                        aReq.AppendItem( SfxBoolItem ( FN_PARAM_5, 0 != (aInsTableOpts.mnInsMode & tabopts::DEFAULT_BORDER) ));
-                        aReq.AppendItem( SfxBoolItem ( FN_PARAM_6, !(aInsTableOpts.mnInsMode & tabopts::SPLIT_LAYOUT)));
+                        aReq.AppendItem( SfxBoolItem ( FN_PARAM_5, bool(aInsTableOpts.mnInsMode & SwInsertTableFlags::DefaultBorder) ));
+                        aReq.AppendItem( SfxBoolItem ( FN_PARAM_6, !(aInsTableOpts.mnInsMode & SwInsertTableFlags::SplitLayout)));
                     }
                     aReq.Done();
                 }
@@ -2626,7 +2626,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
         {
             sal_uInt16 nCols = 0;
             sal_uInt16 nRows = 0;
-            SwInsertTableOptions aInsTableOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
+            SwInsertTableOptions aInsTableOpts( SwInsertTableFlags::All, 1 );
             OUString aTableName;
             OUString aAutoName;
             SwTableAutoFormat* pTAFormat = nullptr;
@@ -2664,7 +2664,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
                 }
 
                 if ( pFlags )
-                    aInsTableOpts.mnInsMode = static_cast<sal_uInt16>(pFlags->GetValue());
+                    aInsTableOpts.mnInsMode = static_cast<SwInsertTableFlags>(pFlags->GetValue());
                 else
                 {
                     const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();


More information about the Libreoffice-commits mailing list