diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-07-12 12:50:44 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-07-12 14:20:39 +0200 |
commit | 375d423573cf237fb082ed2b4908d8067036d8b2 (patch) | |
tree | 408fdc63c55d40ef5535fa5738bfd4a27ec0329e | |
parent | 8d03f1d83d4ca561c11463325f16d7520a36df32 (diff) |
Simplify a bit
Change-Id: I452619c5a1d0b414f09c1e3178fac9905b6d0374
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154349
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | sw/inc/doc.hxx | 2 | ||||
-rw-r--r-- | sw/inc/fmtmeta.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/txtnode/fmtatr2.cxx | 2 |
4 files changed, 7 insertions, 14 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 9fce6c92e4c9..a84df42b8c87 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1276,7 +1276,7 @@ public: SwTableLineFormat* MakeTableLineFormat(); // helper function: cleanup before checking number value - bool IsNumberFormat( std::u16string_view aString, sal_uInt32& F_Index, double& fOutNumber); + bool IsNumberFormat( const OUString& aString, sal_uInt32& F_Index, double& fOutNumber); // Check if box has numerical value. Change format of box if required. void ChkBoxNumFormat( SwTableBox& rCurrentBox, bool bCallUpdate ); void SetTableBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet ); diff --git a/sw/inc/fmtmeta.hxx b/sw/inc/fmtmeta.hxx index 93b5f9f49cb5..b7f9758484c4 100644 --- a/sw/inc/fmtmeta.hxx +++ b/sw/inc/fmtmeta.hxx @@ -182,7 +182,7 @@ private: sal_uInt32 m_nNumberFormat; bool m_bIsFixedLanguage; - sal_uInt32 GetNumberFormat(std::u16string_view aContent) const; + sal_uInt32 GetNumberFormat(const OUString& aContent) const; void SetNumberFormat(sal_uInt32 nNumberFormat); bool IsFixedLanguage() const { return m_bIsFixedLanguage; } void SetIsFixedLanguage(bool b) { m_bIsFixedLanguage = b; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 07216640f354..08775066cb91 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -4007,21 +4007,14 @@ void SwDoc::SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightTy } } -bool SwDoc::IsNumberFormat( std::u16string_view aString, sal_uInt32& F_Index, double& fOutNumber ) +bool SwDoc::IsNumberFormat( const OUString& aString, sal_uInt32& F_Index, double& fOutNumber ) { - if( aString.size() > 308 ) // optimization matches svl:IsNumberFormat arbitrary value + if( aString.getLength() > 308 ) // optimization matches svl:IsNumberFormat arbitrary value return false; // remove any comment anchor marks - OUStringBuffer sStringBuffer(aString); - sal_Int32 nCommentPosition = sStringBuffer.indexOf( CH_TXTATR_INWORD ); - while( nCommentPosition != -1 ) - { - sStringBuffer.remove( nCommentPosition, 1 ); - nCommentPosition = sStringBuffer.indexOf( CH_TXTATR_INWORD, nCommentPosition ); - } - - return GetNumberFormatter()->IsNumberFormat( sStringBuffer.makeStringAndClear(), F_Index, fOutNumber ); + return GetNumberFormatter()->IsNumberFormat( + aString.replaceAll(OUStringChar(CH_TXTATR_INWORD), u""), F_Index, fOutNumber); } void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate ) diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index c776116a4ecc..2e5a562e0690 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -767,7 +767,7 @@ void MetaField::GetPrefixAndSuffix( } } -sal_uInt32 MetaField::GetNumberFormat(std::u16string_view aContent) const +sal_uInt32 MetaField::GetNumberFormat(const OUString& aContent) const { //TODO: this probably lacks treatment for some special cases sal_uInt32 nNumberFormat( m_nNumberFormat ); |