diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-08-05 17:05:44 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-08-08 23:25:25 +0200 |
commit | 92a2862e5c0dd60fd6ed8ae21bd6f4852f0044a1 (patch) | |
tree | 15648f5fb8950d70c48fad7235680729e84f15c4 /sw | |
parent | 91f3d77b98c1c0e13ef867e27972cb000887f8bb (diff) |
convert some SwTxtNode methods to OUString
Change-Id: Id60ffcc392d0ee71d3ddcb8de21bdaca4d0b54cd
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/ndtxt.hxx | 22 | ||||
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/edit/editsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 46 | ||||
-rw-r--r-- | sw/source/core/txtnode/txtedt.cxx | 9 |
5 files changed, 36 insertions, 45 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 125b723608a6..a0e1135a1abc 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -247,7 +247,7 @@ public: /// @param rStr text to insert; in case it does not fit into the limit of /// TXTNODE_MAX, the longest prefix that fits is inserted /// @return the prefix of rStr that was actually inserted - OUString InsertText( const XubString & rStr, const SwIndex & rIdx, + OUString InsertText( const OUString & rStr, const SwIndex & rIdx, const enum IDocumentContentOperations::InsertFlags nMode = IDocumentContentOperations::INS_DEFAULT ); @@ -336,9 +336,10 @@ public: /// in case the replacement does not fit, it is partially inserted up to /// TXTNODE_MAX void ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen, - const XubString& rText ); - void ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen, const XubString& rText, - const ::com::sun::star::uno::Sequence<sal_Int32>& rOffsets ); + const OUString & rText ); + void ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen, + const OUString& rText, + const ::com::sun::star::uno::Sequence<sal_Int32>& rOffsets ); /// Virtual methods from CntntNode. virtual SwCntntFrm *MakeFrm( SwFrm* ); @@ -387,7 +388,7 @@ public: SwTxtAttr *GetTxtAttrForCharAt( const xub_StrLen nIndex, const RES_TXTATR nWhich = RES_TXTATR_END ) const; - XubString GetCurWord(xub_StrLen) const; + OUString GetCurWord(xub_StrLen) const; sal_uInt16 Spell(SwSpellArgs*); sal_uInt16 Convert( SwConversionArgs & ); @@ -466,7 +467,8 @@ public: level to which the output string must be restricted to. Default value is MAXLEVEL */ - XubString GetNumString( const bool _bInclPrefixAndSuffixStrings = true, const unsigned int _nRestrictToThisLevel = MAXLEVEL ) const; + OUString GetNumString( const bool _bInclPrefixAndSuffixStrings = true, + const unsigned int _nRestrictToThisLevel = MAXLEVEL ) const; /** Returns the additional indents of this text node and its numbering. @@ -663,9 +665,9 @@ public: @author OD - @return XubString - the list tab stop position + @return the list tab stop position as string */ - XubString GetLabelFollowedBy() const; + OUString GetLabelFollowedBy() const; // // END OF BULLET/NUMBERING/OUTLINE STUFF: @@ -690,7 +692,7 @@ public: add 5th optional parameter <bWithSpacesForLevel> indicating, if additional spaces are inserted in front of the expanded text string depending on the list level. */ - XubString GetExpandTxt( const xub_StrLen nIdx = 0, + OUString GetExpandTxt( const xub_StrLen nIdx = 0, const xub_StrLen nLen = STRING_LEN, const bool bWithNum = false, const bool bAddSpaceAfterListLabelStr = false, @@ -700,7 +702,7 @@ public: sal_Bool bWithNum = sal_False, sal_Bool bWithFtn = sal_True, sal_Bool bReplaceTabsWithSpaces = sal_False ) const; - XubString GetRedlineTxt( xub_StrLen nIdx = 0, + OUString GetRedlineTxt( xub_StrLen nIdx = 0, xub_StrLen nLen = STRING_LEN, sal_Bool bExpandFlds = sal_False, sal_Bool bWithNum = sal_False ) const; diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 2be80a9437b4..254da0c9b742 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -2379,7 +2379,7 @@ String SwDoc::getListItemText( const SwNodeNum& rNodeNum, return rNodeNum.GetTxtNode() ? rNodeNum.GetTxtNode()->GetExpandTxt( 0, STRING_LEN, bWithNumber, bWithNumber, bWithSpacesForLevel ) - : String(); + : OUString(); } void SwDoc::getListItems( tSortedNodeNumList& orNodeNumList ) const diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 91e1d782f270..8acf2d5fc391 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -421,7 +421,7 @@ String SwEditShell::GetCurWord() const SwTxtNode* pNd = rPaM.GetNode()->GetTxtNode(); OUString aString = pNd ? pNd->GetCurWord(rPaM.GetPoint()->nContent.GetIndex()) : - aEmptyStr; + OUString(); return aString; } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 7b3b98dcc3a9..954da7b00827 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1720,19 +1720,19 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, } -OUString SwTxtNode::InsertText( const XubString & rStr, const SwIndex & rIdx, +OUString SwTxtNode::InsertText( const OUString & rStr, const SwIndex & rIdx, const IDocumentContentOperations::InsertFlags nMode ) { assert(rIdx <= m_Text.getLength()); // invalid index xub_StrLen aPos = rIdx.GetIndex(); xub_StrLen nLen = m_Text.getLength() - aPos; - long const nOverflow(static_cast<long>(m_Text.getLength()) - + static_cast<long>(rStr.Len()) - TXTNODE_MAX); + sal_Int32 const nOverflow( + m_Text.getLength() + rStr.getLength() - TXTNODE_MAX); SAL_WARN_IF(nOverflow > 0, "sw.core", "SwTxtNode::InsertText: node text with insertion > TXTNODE_MAX."); OUString const sInserted( - (nOverflow > 0) ? rStr.Copy(0, rStr.Len() - nOverflow) : rStr); + (nOverflow > 0) ? rStr.copy(0, rStr.getLength() - nOverflow) : rStr); if (sInserted.isEmpty()) { return sInserted; @@ -2686,7 +2686,8 @@ sal_Bool SwTxtNode::HasBullet() const // #128041# - introduce parameter <_bInclPrefixAndSuffixStrings> //i53420 added max outline parameter -XubString SwTxtNode::GetNumString( const bool _bInclPrefixAndSuffixStrings, const unsigned int _nRestrictToThisLevel ) const +OUString SwTxtNode::GetNumString( const bool _bInclPrefixAndSuffixStrings, + const unsigned int _nRestrictToThisLevel ) const { if (GetDoc()->IsClipBoard() && m_pNumStringCache.get()) { @@ -2710,7 +2711,7 @@ XubString SwTxtNode::GetNumString( const bool _bInclPrefixAndSuffixStrings, cons } } - return aEmptyStr; + return OUString(); } long SwTxtNode::GetLeftMarginWithNum( sal_Bool bTxtLeft ) const @@ -2963,7 +2964,7 @@ void SwTxtNode::Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt, * Expand fields *************************************************************************/ // #i83479# - handling of new parameters -XubString SwTxtNode::GetExpandTxt( const xub_StrLen nIdx, +OUString SwTxtNode::GetExpandTxt( const xub_StrLen nIdx, const xub_StrLen nLen, const bool bWithNum, const bool bAddSpaceAfterListLabelStr, @@ -3306,7 +3307,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, int eMode) m_aMap.push_back( ConversionMapEntry( rNodeText.getLength()+1, m_aRetText.getLength()+1 ) ); } -XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen, +OUString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen, sal_Bool bExpandFlds, sal_Bool bWithNum ) const { std::vector<sal_uInt16> aRedlArr; @@ -3326,7 +3327,7 @@ XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen, { if( pREnd->nNode > nNdIdx ) // Absatz ist komplett geloescht - return aEmptyStr; + return OUString(); else if( pREnd->nNode == nNdIdx ) { // von 0 bis nContent ist alles geloescht @@ -3383,17 +3384,17 @@ XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen, *************************************************************************/ void SwTxtNode::ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen, - const XubString& rStr) + const OUString & rStr) { assert( rStart.GetIndex() < m_Text.getLength() // index out of bounds && rStart.GetIndex() + nDelLen <= m_Text.getLength()); - long const nOverflow(static_cast<long>(m_Text.getLength()) - + static_cast<long>(rStr.Len()) - nDelLen - TXTNODE_MAX); + long const nOverflow( + m_Text.getLength() + rStr.getLength() - nDelLen - TXTNODE_MAX); SAL_WARN_IF(nOverflow > 0, "sw.core", "SwTxtNode::ReplaceText: node text with insertion > TXTNODE_MAX."); OUString const sInserted( - (nOverflow > 0) ? rStr.Copy(0, rStr.Len() - nOverflow) : rStr); + (nOverflow > 0) ? rStr.copy(0, rStr.getLength() - nOverflow) : rStr); if (sInserted.isEmpty() && 0 == nDelLen) { return; // nothing to do @@ -4200,17 +4201,8 @@ bool SwTxtNode::GetListTabStopPosition( long& nListTabStopPosition ) const return bListTanStopPositionProvided; } -/** Retrieves the character following the list label, if the paragraph's - list level defines one. - - @author OD - - @return XubString - the list tab stop position -*/ -XubString SwTxtNode::GetLabelFollowedBy() const +OUString SwTxtNode::GetLabelFollowedBy() const { - XubString aLabelFollowedBy; - const SwNumRule* pNumRule = GetNum() ? GetNum()->GetNumRule() : 0; if ( pNumRule && HasVisibleNumberingOrBullet() && GetActualListLevel() >= 0 ) { @@ -4221,14 +4213,12 @@ XubString SwTxtNode::GetLabelFollowedBy() const { case SvxNumberFormat::LISTTAB: { - const sal_Unicode aTab = '\t'; - aLabelFollowedBy.Insert( aTab, 0 ); + return OUString("\t"); } break; case SvxNumberFormat::SPACE: { - const sal_Unicode aSpace = ' '; - aLabelFollowedBy.Insert( aSpace, 0 ); + return OUString(" "); } break; case SvxNumberFormat::NOTHING: @@ -4244,7 +4234,7 @@ XubString SwTxtNode::GetLabelFollowedBy() const } } - return aLabelFollowedBy; + return OUString(); } void SwTxtNode::CalcHiddenCharFlags() const diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 016d56a5db02..a2566dc8f1b6 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -615,7 +615,7 @@ sal_Int32 clipIndexBounds(const OUString &rStr, sal_Int32 nPos) * einen leeren String. *************************************************************************/ -XubString SwTxtNode::GetCurWord( xub_StrLen nPos ) const +OUString SwTxtNode::GetCurWord( xub_StrLen nPos ) const { assert(nPos <= m_Text.getLength()); // invalid index @@ -1868,15 +1868,14 @@ void SwTxtNode::TransliterateText( } void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen, - const XubString& rText, + const OUString & rText, const Sequence<sal_Int32>& rOffsets ) { - assert(static_cast<size_t>(m_Text.getLength()) + - static_cast<size_t>(rText.Len()) - nLen <= TXTNODE_MAX); + assert(m_Text.getLength() + rText.getLength() - nLen <= TXTNODE_MAX); m_Text = m_Text.replaceAt(nPos, nLen, rText); - xub_StrLen nTLen = rText.Len(); + xub_StrLen nTLen = rText.getLength(); const sal_Int32* pOffsets = rOffsets.getConstArray(); // now look for no 1-1 mapping -> move the indizies! xub_StrLen nI, nMyOff; |