[Libreoffice-commits] core.git: sc/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Oct 31 06:37:29 UTC 2017


 sc/source/filter/excel/excrecds.cxx          |    2 +-
 sc/source/filter/excel/impop.cxx             |    2 +-
 sc/source/filter/excel/xechart.cxx           |    6 +++---
 sc/source/filter/excel/xecontent.cxx         |   12 ++++++------
 sc/source/filter/excel/xeescher.cxx          |    2 +-
 sc/source/filter/excel/xeformula.cxx         |    4 ++--
 sc/source/filter/excel/xehelper.cxx          |    2 +-
 sc/source/filter/excel/xelink.cxx            |    4 ++--
 sc/source/filter/excel/xename.cxx            |    6 +++---
 sc/source/filter/excel/xepage.cxx            |    4 ++--
 sc/source/filter/excel/xestring.cxx          |   12 ++++++------
 sc/source/filter/excel/xestyle.cxx           |    8 ++++----
 sc/source/filter/excel/xetable.cxx           |    6 +++---
 sc/source/filter/excel/xichart.cxx           |    2 +-
 sc/source/filter/excel/xistring.cxx          |   10 +++++-----
 sc/source/filter/excel/xlpivot.cxx           |    6 +++---
 sc/source/filter/inc/xcl97rec.hxx            |    2 +-
 sc/source/filter/inc/xehelper.hxx            |   12 ++++++------
 sc/source/filter/inc/xestring.hxx            |    8 ++++----
 sc/source/filter/inc/xistring.hxx            |    2 +-
 sc/source/filter/inc/xlstring.hxx            |   21 +++++++++++++--------
 sc/source/filter/xcl97/XclExpChangeTrack.cxx |    2 +-
 sc/source/filter/xcl97/xcl97rec.cxx          |   10 +++++-----
 23 files changed, 75 insertions(+), 70 deletions(-)

New commits:
commit 05fbb25379516f529dde9400104d402c51ec2f2c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Oct 30 15:33:25 2017 +0200

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

diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index 7e0e360d936e..0461d7e48c66 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -581,7 +581,7 @@ void ExcFilterCondition::SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, double fV,
     nType = nTp;
     nOper = nOp;
     fVal = fV;
-    pText.reset( pT ? new XclExpString( *pT, EXC_STR_8BITLENGTH ) : nullptr);
+    pText.reset( pT ? new XclExpString( *pT, XclStrFlags::EightBitLength ) : nullptr);
 }
 
 void ExcFilterCondition::Save( XclExpStream& rStrm )
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index ea7dcb5701da..8f02b00dd0cf 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -348,7 +348,7 @@ void ImportExcel::ReadLabel()
             0x0204      8       2 byte      16-bit length, unicode string */
         bool bBiff2 = maStrm.GetRecId() == EXC_ID2_LABEL;
         sal_uInt16 nXFIdx = ReadXFIndex( aScPos, bBiff2 );
-        XclStrFlags nFlags = (bBiff2 && (GetBiff() <= EXC_BIFF5)) ? EXC_STR_8BITLENGTH : EXC_STR_DEFAULT;
+        XclStrFlags nFlags = (bBiff2 && (GetBiff() <= EXC_BIFF5)) ? XclStrFlags::EightBitLength : XclStrFlags::NONE;
         XclImpString aString;
 
         // #i63105# use text encoding from FONT record
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index c199e6114f6c..d45e694bb557 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -954,7 +954,7 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > c
 
 void XclExpChSourceLink::ConvertString( const OUString& aString )
 {
-    mxString = XclExpStringHelper::CreateString( GetRoot(), aString, EXC_STR_FORCEUNICODE | EXC_STR_8BITLENGTH | EXC_STR_SEPARATEFORMATS );
+    mxString = XclExpStringHelper::CreateString( GetRoot(), aString, XclStrFlags::ForceUnicode | XclStrFlags::EightBitLength | XclStrFlags::SeparateFormats );
 }
 
 sal_uInt16 XclExpChSourceLink::ConvertStringSequence( const Sequence< Reference< XFormattedString > >& rStringSeq )
@@ -963,7 +963,7 @@ sal_uInt16 XclExpChSourceLink::ConvertStringSequence( const Sequence< Reference<
     sal_uInt16 nFontIdx = EXC_FONT_APP;
     if( rStringSeq.hasElements() )
     {
-        mxString = XclExpStringHelper::CreateString( GetRoot(), OUString(), EXC_STR_FORCEUNICODE | EXC_STR_8BITLENGTH | EXC_STR_SEPARATEFORMATS );
+        mxString = XclExpStringHelper::CreateString( GetRoot(), OUString(), XclStrFlags::ForceUnicode | XclStrFlags::EightBitLength | XclStrFlags::SeparateFormats );
         Reference< XBreakIterator > xBreakIt = GetDoc().GetBreakIterator();
         namespace ApiScriptType = ::com::sun::star::i18n::ScriptType;
 
@@ -1128,7 +1128,7 @@ void XclExpChFrLabelProps::Convert( const ScfPropertySet& rPropSet,
 
 void XclExpChFrLabelProps::WriteBody( XclExpStream& rStrm )
 {
-    XclExpString aXclSep( maData.maSeparator, EXC_STR_FORCEUNICODE | EXC_STR_SMARTFLAGS );
+    XclExpString aXclSep( maData.maSeparator, XclStrFlags::ForceUnicode | XclStrFlags::SmartFlags );
     rStrm << maData.mnFlags << aXclSep;
 }
 
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 856c4f3086d5..2237811b32f4 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -337,7 +337,7 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
     // description
     if( bWithRepr )
     {
-        XclExpString aDescr( rRepr, EXC_STR_FORCEUNICODE, 255 );
+        XclExpString aDescr( rRepr, XclStrFlags::ForceUnicode, 255 );
         aXclStrm << sal_uInt32( aDescr.Len() + 1 );     // string length + 1 trailing zero word
         aDescr.WriteBuffer( aXclStrm );                 // NO flags
         aXclStrm << sal_uInt16( 0 );
@@ -369,7 +369,7 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
 
         OString aAsciiLink(OUStringToOString(aFileName,
             rRoot.GetTextEncoding()));
-        XclExpString aLink( aFileName, EXC_STR_FORCEUNICODE, 255 );
+        XclExpString aLink( aFileName, XclStrFlags::ForceUnicode, 255 );
         aXclStrm    << XclTools::maGuidFileMoniker
                     << nLevel
                     << sal_uInt32( aAsciiLink.getLength() + 1 );      // string length + 1 trailing zero byte
@@ -401,7 +401,7 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
     }
     else if( eProtocol != INetProtocol::NotValid )
     {
-        XclExpString aUrl( aUrlObj.GetURLNoMark(), EXC_STR_FORCEUNICODE, 255 );
+        XclExpString aUrl( aUrlObj.GetURLNoMark(), XclStrFlags::ForceUnicode, 255 );
         aXclStrm    << XclTools::maGuidUrlMoniker
                     << sal_uInt32( aUrl.GetBufferSize() + 2 );  // byte count + 1 trailing zero word
         aUrl.WriteBuffer( aXclStrm );                           // NO flags
@@ -433,12 +433,12 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
             }
         }
 
-        mxTextMark.reset( new XclExpString( aTextMark, EXC_STR_FORCEUNICODE, 255 ) );
+        mxTextMark.reset( new XclExpString( aTextMark, XclStrFlags::ForceUnicode, 255 ) );
     }
 
     // text mark
     if( !mxTextMark.get() && aUrlObj.HasMark() )
-        mxTextMark.reset( new XclExpString( aUrlObj.GetMark(), EXC_STR_FORCEUNICODE, 255 ) );
+        mxTextMark.reset( new XclExpString( aUrlObj.GetMark(), XclStrFlags::ForceUnicode, 255 ) );
 
     if( mxTextMark.get() )
     {
@@ -1665,7 +1665,7 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) :
                     /*  Formula is a list of string tokens -> build the Excel string.
                         Data validity is BIFF8 only (important for the XclExpString object).
                         Excel uses the NUL character as string list separator. */
-                    mxString1.reset( new XclExpString( EXC_STR_8BITLENGTH ) );
+                    mxString1.reset( new XclExpString( XclStrFlags::EightBitLength ) );
                     sal_Int32 nTokenCnt = comphelper::string::getTokenCount(aString, '\n');
                     sal_Int32 nStringIx = 0;
                     for( sal_Int32 nToken = 0; nToken < nTokenCnt; ++nToken )
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index 8e8506ad9116..0082e1c0e0b3 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1220,7 +1220,7 @@ XclExpNote::XclExpNote(const XclExpRoot& rRoot, const ScAddress& rScPos,
                 if( pScNote->GetAuthor().isEmpty() )
                     maAuthor = XclExpString( " " );
                 else
-                    maAuthor = XclExpString( pScNote->GetAuthor(), EXC_STR_DEFAULT, 54 );
+                    maAuthor = XclExpString( pScNote->GetAuthor(), XclStrFlags::NONE, 54 );
             }
 
             SetRecSize( 9 + maAuthor.GetSize() );
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index e43b2a2ff84a..dab92a0ba6a9 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -2255,7 +2255,7 @@ void XclExpFmlaCompImpl::Append( double fData )
 
 void XclExpFmlaCompImpl::Append( const OUString& rString )
 {
-    lclAppend( mxData->maTokVec, GetRoot(), rString, EXC_STR_8BITLENGTH );
+    lclAppend( mxData->maTokVec, GetRoot(), rString, XclStrFlags::EightBitLength );
 }
 
 void XclExpFmlaCompImpl::AppendAddress( const XclAddress& rXclPos )
@@ -2542,7 +2542,7 @@ void XclExpFmlaCompImpl::AppendExt( double fData )
 
 void XclExpFmlaCompImpl::AppendExt( const OUString& rString )
 {
-    lclAppend( mxData->maExtDataVec, GetRoot(), rString, (meBiff == EXC_BIFF8) ? EXC_STR_DEFAULT : EXC_STR_8BITLENGTH );
+    lclAppend( mxData->maExtDataVec, GetRoot(), rString, (meBiff == EXC_BIFF8) ? XclStrFlags::NONE : XclStrFlags::EightBitLength );
 }
 
 namespace {
diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx
index 6c9de578ee0b..51b194ddb813 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -1036,7 +1036,7 @@ void XclExpCachedMatrix::Save( XclExpStream& rStrm ) const
             }
             else if( ScMatrix::IsNonValueType( nMatVal.nType ) )
             {
-                XclExpString aStr( nMatVal.GetString().getString(), EXC_STR_DEFAULT );
+                XclExpString aStr( nMatVal.GetString().getString(), XclStrFlags::NONE );
                 rStrm.SetSliceSize( 6 );
                 rStrm << EXC_CACHEDVAL_STRING << aStr;
             }
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index e3b78b7b0a8e..9c741e5e08d1 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -900,7 +900,7 @@ XclExpExtNameBase::XclExpExtNameBase(
     XclExpRecord( EXC_ID_EXTERNNAME ),
     XclExpRoot( rRoot ),
     maName( rName ),
-    mxName( XclExpStringHelper::CreateString( rRoot, rName, EXC_STR_8BITLENGTH ) ),
+    mxName( XclExpStringHelper::CreateString( rRoot, rName, XclStrFlags::EightBitLength ) ),
     mnFlags( nFlags )
 {
     OSL_ENSURE( maName.getLength() <= 255, "XclExpExtNameBase::XclExpExtNameBase - string too long" );
@@ -1473,7 +1473,7 @@ void XclExpExternSheet::Save( XclExpStream& rStrm )
 void XclExpExternSheet::Init( const OUString& rEncUrl )
 {
     OSL_ENSURE_BIFF( GetBiff() <= EXC_BIFF5 );
-    maTabName.AssignByte( rEncUrl, GetTextEncoding(), EXC_STR_8BITLENGTH );
+    maTabName.AssignByte( rEncUrl, GetTextEncoding(), XclStrFlags::EightBitLength );
     SetRecSize( maTabName.GetSize() );
 }
 
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index 8d4879f3df0b..7b315d195476 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -190,7 +190,7 @@ XclExpName::XclExpName( const XclExpRoot& rRoot, const OUString& rName ) :
     XclExpRecord( EXC_ID_NAME ),
     XclExpRoot( rRoot ),
     maOrigName( rName ),
-    mxName( XclExpStringHelper::CreateString( rRoot, rName, EXC_STR_8BITLENGTH ) ),
+    mxName( XclExpStringHelper::CreateString( rRoot, rName, XclStrFlags::EightBitLength ) ),
     mcBuiltIn( EXC_BUILTIN_UNKNOWN ),
     mnScTab( SCTAB_GLOBAL ),
     mnFlags( EXC_NAME_DEFAULT ),
@@ -216,13 +216,13 @@ XclExpName::XclExpName( const XclExpRoot& rRoot, sal_Unicode cBuiltIn ) :
     if( (GetBiff() <= EXC_BIFF5) && (cBuiltIn == EXC_BUILTIN_FILTERDATABASE) )
     {
         OUString aName( XclTools::GetXclBuiltInDefName( EXC_BUILTIN_FILTERDATABASE ) );
-        mxName = XclExpStringHelper::CreateString( rRoot, aName, EXC_STR_8BITLENGTH );
+        mxName = XclExpStringHelper::CreateString( rRoot, aName, XclStrFlags::EightBitLength );
         maOrigName = XclTools::GetXclBuiltInDefName( cBuiltIn );
     }
     else
     {
         maOrigName =  XclTools::GetBuiltInDefNameXml( cBuiltIn ) ;
-        mxName = XclExpStringHelper::CreateString( rRoot, cBuiltIn, EXC_STR_8BITLENGTH );
+        mxName = XclExpStringHelper::CreateString( rRoot, cBuiltIn, XclStrFlags::EightBitLength );
         ::set_flag( mnFlags, EXC_NAME_BUILTIN );
     }
 }
diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx
index 076d8f6a3787..172e01ec3f2f 100644
--- a/sc/source/filter/excel/xepage.cxx
+++ b/sc/source/filter/excel/xepage.cxx
@@ -68,9 +68,9 @@ void XclExpHeaderFooter::WriteBody( XclExpStream& rStrm )
     {
         XclExpString aExString;
         if( rStrm.GetRoot().GetBiff() <= EXC_BIFF5 )
-            aExString.AssignByte( maHdrString, rStrm.GetRoot().GetTextEncoding(), EXC_STR_8BITLENGTH );
+            aExString.AssignByte( maHdrString, rStrm.GetRoot().GetTextEncoding(), XclStrFlags::EightBitLength );
         else
-            aExString.Assign( maHdrString, EXC_STR_DEFAULT, 255 );  // 16-bit length, but max 255 chars
+            aExString.Assign( maHdrString, XclStrFlags::NONE, 255 );  // 16-bit length, but max 255 chars
         rStrm << aExString;
     }
 }
diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx
index b7129b7e6e28..1b92cf17c905 100644
--- a/sc/source/filter/excel/xestring.cxx
+++ b/sc/source/filter/excel/xestring.cxx
@@ -115,7 +115,7 @@ void XclExpString::Assign( const OUString& rString, XclStrFlags nFlags, sal_uInt
 
 void XclExpString::Assign( sal_Unicode cChar )
 {
-    Build( &cChar, 1, EXC_STR_DEFAULT, EXC_STR_MAXLEN );
+    Build( &cChar, 1, XclStrFlags::NONE, EXC_STR_MAXLEN );
 }
 
 void XclExpString::AssignByte(
@@ -496,12 +496,12 @@ void XclExpString::CharsToBuffer( const sal_Char* pcSource, sal_Int32 nBegin, sa
 void XclExpString::Init( sal_Int32 nCurrLen, XclStrFlags nFlags, sal_uInt16 nMaxLen, bool bBiff8 )
 {
     mbIsBiff8 = bBiff8;
-    mbIsUnicode = bBiff8 && ::get_flag( nFlags, EXC_STR_FORCEUNICODE );
-    mb8BitLen = ::get_flag( nFlags, EXC_STR_8BITLENGTH );
-    mbSmartFlags = bBiff8 && ::get_flag( nFlags, EXC_STR_SMARTFLAGS );
-    mbSkipFormats = ::get_flag( nFlags, EXC_STR_SEPARATEFORMATS );
+    mbIsUnicode = bBiff8 && ( nFlags & XclStrFlags::ForceUnicode );
+    mb8BitLen = bool( nFlags & XclStrFlags::EightBitLength );
+    mbSmartFlags = bBiff8 && ( nFlags & XclStrFlags::SmartFlags );
+    mbSkipFormats = bool( nFlags & XclStrFlags::SeparateFormats );
     mbWrapped = false;
-    mbSkipHeader = ::get_flag( nFlags, EXC_STR_NOHEADER );
+    mbSkipHeader = bool( nFlags & XclStrFlags::NoHeader );
     mnMaxLen = nMaxLen;
     SetStrLen( nCurrLen );
 
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 1d149225057d..31d54f5da67e 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1006,9 +1006,9 @@ void XclExpFont::WriteBody( XclExpStream& rStrm )
     OSL_ENSURE( maData.maName.getLength() < 256, "XclExpFont::WriteBody - font name too long" );
     XclExpString aFontName;
     if( GetBiff() <= EXC_BIFF5 )
-        aFontName.AssignByte( maData.maName, GetTextEncoding(), EXC_STR_8BITLENGTH );
+        aFontName.AssignByte( maData.maName, GetTextEncoding(), XclStrFlags::EightBitLength );
     else
-        aFontName.Assign( maData.maName, EXC_STR_FORCEUNICODE | EXC_STR_8BITLENGTH );
+        aFontName.Assign( maData.maName, XclStrFlags::ForceUnicode | XclStrFlags::EightBitLength );
 
     rStrm   << maData.mnHeight
             << nAttr
@@ -1418,7 +1418,7 @@ void XclExpNumFmtBuffer::WriteFormatRecord( XclExpStream& rStrm, sal_uInt16 nXcl
 {
     XclExpString aExpStr;
     if( GetBiff() <= EXC_BIFF5 )
-        aExpStr.AssignByte( rFormatStr, GetTextEncoding(), EXC_STR_8BITLENGTH );
+        aExpStr.AssignByte( rFormatStr, GetTextEncoding(), XclStrFlags::EightBitLength );
     else
         aExpStr.Assign( rFormatStr );
 
@@ -2312,7 +2312,7 @@ void XclExpStyle::WriteBody( XclExpStream& rStrm )
         if( rStrm.GetRoot().GetBiff() == EXC_BIFF8 )
             aNameEx.Assign( maName );
         else
-            aNameEx.AssignByte( maName, rStrm.GetRoot().GetTextEncoding(), EXC_STR_8BITLENGTH );
+            aNameEx.AssignByte( maName, rStrm.GetRoot().GetTextEncoding(), XclStrFlags::EightBitLength );
         rStrm << aNameEx;
     }
 }
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index ebd7f660c22a..39302bbc637e 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -691,7 +691,7 @@ XclExpLabelCell::XclExpLabelCell(
 {
     sal_uInt16 nMaxLen = (rRoot.GetBiff() == EXC_BIFF8) ? EXC_STR_MAXLEN : EXC_LABEL_MAXLEN;
     XclExpStringRef xText = XclExpStringHelper::CreateCellString(
-        rRoot, rStr, pPattern, EXC_STR_DEFAULT, nMaxLen);
+        rRoot, rStr, pPattern, XclStrFlags::NONE, nMaxLen);
     Init( rRoot, pPattern, xText );
 }
 
@@ -706,10 +706,10 @@ XclExpLabelCell::XclExpLabelCell(
     XclExpStringRef xText;
     if (pEditText)
         xText = XclExpStringHelper::CreateCellString(
-            rRoot, *pEditText, pPattern, rLinkHelper, EXC_STR_DEFAULT, nMaxLen);
+            rRoot, *pEditText, pPattern, rLinkHelper, XclStrFlags::NONE, nMaxLen);
     else
         xText = XclExpStringHelper::CreateCellString(
-            rRoot, EMPTY_OUSTRING, pPattern, EXC_STR_DEFAULT, nMaxLen);
+            rRoot, EMPTY_OUSTRING, pPattern, XclStrFlags::NONE, nMaxLen);
 
     Init( rRoot, pPattern, xText );
 }
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 9876d40cd997..49aa0c9ac3c9 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -759,7 +759,7 @@ void XclImpChSourceLink::ReadChSourceLink( XclImpStream& rStrm )
     {
         mxString.reset( new XclImpString );
         rStrm.Ignore( 2 );
-        mxString->Read( rStrm, EXC_STR_8BITLENGTH | EXC_STR_SEPARATEFORMATS );
+        mxString->Read( rStrm, XclStrFlags::EightBitLength | XclStrFlags::SeparateFormats );
     }
 }
 
diff --git a/sc/source/filter/excel/xistring.cxx b/sc/source/filter/excel/xistring.cxx
index 79ca6a2d9375..d1ca07c1cc2b 100644
--- a/sc/source/filter/excel/xistring.cxx
+++ b/sc/source/filter/excel/xistring.cxx
@@ -25,7 +25,7 @@
 // Byte/Unicode strings =======================================================
 
 /** All allowed flags for import. */
-const XclStrFlags nAllowedFlags = EXC_STR_8BITLENGTH | EXC_STR_SMARTFLAGS | EXC_STR_SEPARATEFORMATS;
+const XclStrFlags nAllowedFlags = XclStrFlags::EightBitLength | XclStrFlags::SmartFlags | XclStrFlags::SeparateFormats;
 
 XclImpString::XclImpString()
 {
@@ -42,13 +42,13 @@ XclImpString::~XclImpString()
 
 void XclImpString::Read( XclImpStream& rStrm, XclStrFlags nFlags )
 {
-    if( !::get_flag( nFlags, EXC_STR_SEPARATEFORMATS ) )
+    if( !( nFlags & XclStrFlags::SeparateFormats ) )
         maFormats.clear();
 
     SAL_WARN_IF(
-        (nFlags & ~nAllowedFlags) != 0, "sc.filter",
+        nFlags & ~nAllowedFlags, "sc.filter",
         "XclImpString::Read - unknown flag");
-    bool b16BitLen = !::get_flag( nFlags, EXC_STR_8BITLENGTH );
+    bool b16BitLen = !( nFlags & XclStrFlags::EightBitLength );
 
     switch( rStrm.GetRoot().GetBiff() )
     {
@@ -65,7 +65,7 @@ void XclImpString::Read( XclImpStream& rStrm, XclStrFlags nFlags )
             // --- string header ---
             sal_uInt16 nChars = b16BitLen ? rStrm.ReaduInt16() : rStrm.ReaduInt8();
             sal_uInt8 nFlagField = 0;
-            if( nChars || !::get_flag( nFlags, EXC_STR_SMARTFLAGS ) )
+            if( nChars || !( nFlags & XclStrFlags::SmartFlags ) )
                 nFlagField = rStrm.ReaduInt8();
 
             bool b16Bit, bRich, bFarEast;
diff --git a/sc/source/filter/excel/xlpivot.cxx b/sc/source/filter/excel/xlpivot.cxx
index bcccaa8608eb..908f0a0e28a2 100644
--- a/sc/source/filter/excel/xlpivot.cxx
+++ b/sc/source/filter/excel/xlpivot.cxx
@@ -409,7 +409,7 @@ XclExpStream& operator<<( XclExpStream& rStrm, const XclPTCachedName& rCachedNam
     if( rCachedName.mbUseCache )
         rStrm << EXC_PT_NOSTRING;
     else
-        rStrm << XclExpString( rCachedName.maName, EXC_STR_DEFAULT, EXC_PT_MAXSTRLEN );
+        rStrm << XclExpString( rCachedName.maName, XclStrFlags::NONE, EXC_PT_MAXSTRLEN );
     return rStrm;
 }
 
@@ -657,7 +657,7 @@ XclExpStream& operator<<( XclExpStream& rStrm, const XclPTFieldExtInfo& rInfo )
         sal_uInt8 nNameLen = static_cast<sal_uInt8>(aFinalName.getLength());
         rStrm << nNameLen;
         rStrm.WriteZeroBytes(10);
-        rStrm << XclExpString(aFinalName, EXC_STR_NOHEADER);
+        rStrm << XclExpString(aFinalName, XclStrFlags::NoHeader);
     }
     else
     {
@@ -1016,7 +1016,7 @@ XclExpStream& operator<<( XclExpStream& rStrm, const XclPTViewEx9Info& rInfo )
         << EXC_PT_AUTOFMT_FLAGS
         << rInfo.mnAutoFormat
         << rInfo.mnGridLayout
-        << XclExpString(rInfo.maGrandTotalName, EXC_STR_DEFAULT, EXC_PT_MAXSTRLEN);
+        << XclExpString(rInfo.maGrandTotalName, XclStrFlags::NONE, EXC_PT_MAXSTRLEN);
 }
 
 XclPTAddl::XclPTAddl() :
diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index db8ceebb8f46..964788a27e6f 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -304,7 +304,7 @@ class ExcBundlesheet8 : public ExcBundlesheetBase
 {
 private:
     OUString                    sUnicodeName;
-    XclExpString                GetName() const { return XclExpString( sUnicodeName, EXC_STR_8BITLENGTH );}
+    XclExpString                GetName() const { return XclExpString( sUnicodeName, XclStrFlags::EightBitLength );}
 
     virtual void                SaveCont( XclExpStream& rStrm ) override;
 
diff --git a/sc/source/filter/inc/xehelper.hxx b/sc/source/filter/inc/xehelper.hxx
index 7bcdd57759ad..22ae75852343 100644
--- a/sc/source/filter/inc/xehelper.hxx
+++ b/sc/source/filter/inc/xehelper.hxx
@@ -229,7 +229,7 @@ public:
     static XclExpStringRef CreateString(
                             const XclExpRoot& rRoot,
                             const OUString& rString,
-                            XclStrFlags nFlags = EXC_STR_DEFAULT,
+                            XclStrFlags nFlags = XclStrFlags::NONE,
                             sal_uInt16 nMaxLen = EXC_STR_MAXLEN );
 
     /** Creates a new unformatted string from the passed character.
@@ -242,7 +242,7 @@ public:
     static XclExpStringRef CreateString(
                             const XclExpRoot& rRoot,
                             sal_Unicode cChar,
-                            XclStrFlags nFlags = EXC_STR_DEFAULT,
+                            XclStrFlags nFlags = XclStrFlags::NONE,
                             sal_uInt16 nMaxLen = EXC_STR_MAXLEN );
 
     /** Appends an unformatted string to an Excel string object.
@@ -279,7 +279,7 @@ public:
                             const XclExpRoot& rRoot,
                             const OUString& rString,
                             const ScPatternAttr* pCellAttr,
-                            XclStrFlags nFlags = EXC_STR_DEFAULT,
+                            XclStrFlags nFlags = XclStrFlags::NONE,
                             sal_uInt16 nMaxLen = EXC_STR_MAXLEN );
 
     /** Creates a new formatted string from a Calc edit cell.
@@ -296,7 +296,7 @@ public:
                             const EditTextObject& rEditText,
                             const ScPatternAttr* pCellAttr,
                             XclExpHyperlinkHelper& rLinkHelper,
-                            XclStrFlags nFlags = EXC_STR_DEFAULT,
+                            XclStrFlags nFlags = XclStrFlags::NONE,
                             sal_uInt16 nMaxLen = EXC_STR_MAXLEN );
 
     /** Creates a new formatted string from a drawing text box.
@@ -308,7 +308,7 @@ public:
     static XclExpStringRef CreateString(
                             const XclExpRoot& rRoot,
                             const SdrTextObj& rTextObj,
-                            XclStrFlags nFlags = EXC_STR_DEFAULT );
+                            XclStrFlags nFlags = XclStrFlags::NONE );
 
     /** Creates a new formatted string from a edit text string.
         @param rEditObj  The edittext object.
@@ -317,7 +317,7 @@ public:
     static XclExpStringRef CreateString(
                             const XclExpRoot& rRoot,
                             const EditTextObject& rEditObj,
-                            XclStrFlags nFlags = EXC_STR_DEFAULT );
+                            XclStrFlags nFlags = XclStrFlags::NONE );
 
     /** Returns the script type first text portion different to WEAK, or the system
         default script type, if there is only weak script in the passed string. */
diff --git a/sc/source/filter/inc/xestring.hxx b/sc/source/filter/inc/xestring.hxx
index 56726faea3fc..6bb88f824524 100644
--- a/sc/source/filter/inc/xestring.hxx
+++ b/sc/source/filter/inc/xestring.hxx
@@ -49,7 +49,7 @@ public:
         @param nFlags  Modifiers for string export.
         @param nMaxLen  The maximum number of characters to store in this string. */
     explicit            XclExpString(
-                            XclStrFlags nFlags = EXC_STR_DEFAULT,
+                            XclStrFlags nFlags = XclStrFlags::NONE,
                             sal_uInt16 nMaxLen = EXC_STR_MAXLEN );
 
     /** Constructs an unformatted BIFF8 Unicode string.
@@ -57,7 +57,7 @@ public:
         @param nMaxLen  The maximum number of characters to store in this string. */
     explicit            XclExpString(
                             const OUString& rString,
-                            XclStrFlags nFlags = EXC_STR_DEFAULT,
+                            XclStrFlags nFlags = XclStrFlags::NONE,
                             sal_uInt16 nMaxLen = EXC_STR_MAXLEN );
 
     // assign -----------------------------------------------------------------
@@ -67,7 +67,7 @@ public:
         @param nMaxLen  The maximum number of characters to store in this string. */
     void                Assign(
                             const OUString& rString,
-                            XclStrFlags nFlags = EXC_STR_DEFAULT,
+                            XclStrFlags nFlags = XclStrFlags::NONE,
                             sal_uInt16 nMaxLen = EXC_STR_MAXLEN );
 
     /** Assigns a Unicode character, converts this object to a BIFF8 Unicode string. */
@@ -79,7 +79,7 @@ public:
     void                AssignByte(
                             const OUString& rString,
                             rtl_TextEncoding eTextEnc,
-                            XclStrFlags nFlags = EXC_STR_DEFAULT,
+                            XclStrFlags nFlags = XclStrFlags::NONE,
                             sal_uInt16 nMaxLen = EXC_STR_MAXLEN );
 
     // append -----------------------------------------------------------------
diff --git a/sc/source/filter/inc/xistring.hxx b/sc/source/filter/inc/xistring.hxx
index bb9d9f360ae2..2fc25cf9302e 100644
--- a/sc/source/filter/inc/xistring.hxx
+++ b/sc/source/filter/inc/xistring.hxx
@@ -38,7 +38,7 @@ public:
                         ~XclImpString();
 
     /** Reads a complete string from the passed stream. */
-    void                Read( XclImpStream& rStrm, XclStrFlags nFlags = EXC_STR_DEFAULT );
+    void                Read( XclImpStream& rStrm, XclStrFlags nFlags = XclStrFlags::NONE );
 
     /** Sets the passed string data. */
     void         SetText( const OUString& rText ) { maString = rText; }
diff --git a/sc/source/filter/inc/xlstring.hxx b/sc/source/filter/inc/xlstring.hxx
index e7e68a611812..7cf72899ae96 100644
--- a/sc/source/filter/inc/xlstring.hxx
+++ b/sc/source/filter/inc/xlstring.hxx
@@ -21,18 +21,23 @@
 #define INCLUDED_SC_SOURCE_FILTER_INC_XLSTRING_HXX
 
 #include "ftools.hxx"
+#include <o3tl/typed_flags_set.hxx>
 
 // Constants and enumerations =================================================
 
 /** Flags used to specify import/export mode of strings. */
-typedef sal_uInt16 XclStrFlags;
-
-const XclStrFlags EXC_STR_DEFAULT           = 0x0000;   /// Default string settings.
-const XclStrFlags EXC_STR_FORCEUNICODE      = 0x0001;   /// Always use UCS-2 characters (default: try to compress). BIFF8 only.
-const XclStrFlags EXC_STR_8BITLENGTH        = 0x0002;   /// 8-bit string length field (default: 16-bit).
-const XclStrFlags EXC_STR_SMARTFLAGS        = 0x0004;   /// Omit flags on empty string (default: read/write always). BIFF8 only.
-const XclStrFlags EXC_STR_SEPARATEFORMATS   = 0x0008;   /// Import: Keep old formats when reading unformatted string (default: clear formats); Export: Write unformatted string.
-const XclStrFlags EXC_STR_NOHEADER          = 0x0010;   /// Export: Don't write the length and flag fields.
+enum class XclStrFlags : sal_uInt16 {
+    NONE              = 0x0000,   /// Default string settings.
+    ForceUnicode      = 0x0001,   /// Always use UCS-2 characters (default: try to compress). BIFF8 only.
+    EightBitLength    = 0x0002,   /// 8-bit string length field (default: 16-bit).
+    SmartFlags        = 0x0004,   /// Omit flags on empty string (default: read/write always). BIFF8 only.
+    SeparateFormats   = 0x0008,   /// Import: Keep old formats when reading unformatted string (default: clear formats); Export: Write unformatted string.
+    NoHeader          = 0x0010,   /// Export: Don't write the length and flag fields.
+};
+namespace o3tl {
+    template<> struct typed_flags<XclStrFlags> : is_typed_flags<XclStrFlags, 0x001f> {};
+}
+
 
 const sal_uInt16 EXC_STR_MAXLEN_8BIT        = 0x00FF;
 const sal_uInt16 EXC_STR_MAXLEN             = 0x7FFF;
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 0cbb72b2e9da..9559c30f7413 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -912,7 +912,7 @@ void XclExpChTrCellContent::GetCellData(
                         rRoot, EMPTY_OUSTRING, nullptr);
                 }
             }
-            rpData->pString = new XclExpString( sCellStr, EXC_STR_DEFAULT, 32766 );
+            rpData->pString = new XclExpString( sCellStr, XclStrFlags::NONE, 32766 );
             rpData->nType = EXC_CHTR_TYPE_STRING;
             rpData->nSize = 3 + rpData->pString->GetSize();
             rXclLength1 = 64 + (sCellStr.getLength() << 1);
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 8a1923933c8e..8ac8765f246c 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1317,7 +1317,7 @@ std::size_t XclCodename::GetLen() const
 ExcEScenarioCell::ExcEScenarioCell( sal_uInt16 nC, sal_uInt16 nR, const OUString& rTxt ) :
         nCol( nC ),
         nRow( nR ),
-        sText( rTxt, EXC_STR_DEFAULT, 255 )
+        sText( rTxt, XclStrFlags::NONE, 255 )
 {
 }
 
@@ -1353,17 +1353,17 @@ ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab )
     ScDocument& rDoc = rRoot.GetDoc();
     rDoc.GetName(nTab, aTmp);
     sTmpName = aTmp;
-    sName.Assign( sTmpName, EXC_STR_8BITLENGTH );
+    sName.Assign( sTmpName, XclStrFlags::EightBitLength );
     nRecLen = 8 + sName.GetBufferSize();
 
     rDoc.GetScenarioData( nTab, aTmp, aDummyCol, nFlags );
     sTmpComm = aTmp;
-    sComment.Assign( sTmpComm, EXC_STR_DEFAULT, 255 );
+    sComment.Assign( sTmpComm, XclStrFlags::NONE, 255 );
     if( sComment.Len() )
         nRecLen += sComment.GetSize();
     bProtected = (nFlags & ScScenarioFlags::Protected) != ScScenarioFlags::NONE;
 
-    sUserName.Assign( rRoot.GetUserName(), EXC_STR_DEFAULT, 255 );
+    sUserName.Assign( rRoot.GetUserName(), XclStrFlags::NONE, 255 );
     nRecLen += sUserName.GetSize();
 
     const ScRangeList* pRList = rDoc.GetScenarioRanges( nTab );
@@ -1819,7 +1819,7 @@ XclExpFileSharing::XclExpFileSharing( const XclExpRoot& rRoot, sal_uInt16 nPassw
     mbRecommendReadOnly( bRecommendReadOnly )
 {
     if( rRoot.GetBiff() <= EXC_BIFF5 )
-        maUserName.AssignByte( rRoot.GetUserName(), rRoot.GetTextEncoding(), EXC_STR_8BITLENGTH );
+        maUserName.AssignByte( rRoot.GetUserName(), rRoot.GetTextEncoding(), XclStrFlags::EightBitLength );
     else
         maUserName.Assign( rRoot.GetUserName() );
 }


More information about the Libreoffice-commits mailing list