[Libreoffice-commits] core.git: 3 commits - filter/source sw/inc sw/source
Matteo Casalin
matteo.casalin at yahoo.com
Sun Dec 15 00:27:20 PST 2013
filter/source/msfilter/util.cxx | 6
sw/inc/ndtxt.hxx | 65 +++----
sw/source/core/access/accpara.cxx | 22 +-
sw/source/core/access/parachangetrackinginfo.cxx | 16 -
sw/source/core/crsr/crsrsh.cxx | 6
sw/source/core/doc/docedt.cxx | 3
sw/source/core/doc/doclay.cxx | 14 -
sw/source/core/docnode/node.cxx | 2
sw/source/core/edit/edlingu.cxx | 14 -
sw/source/core/inc/SwGrammarMarkUp.hxx | 16 -
sw/source/core/inc/wrong.hxx | 62 +++---
sw/source/core/layout/layact.cxx | 2
sw/source/core/table/swtable.cxx | 2
sw/source/core/text/SwGrammarMarkUp.cxx | 46 ++---
sw/source/core/text/inftxt.cxx | 4
sw/source/core/text/inftxt.hxx | 4
sw/source/core/text/itratr.cxx | 17 -
sw/source/core/text/txtfrm.cxx | 17 -
sw/source/core/text/wrong.cxx | 206 +++++++++++------------
sw/source/core/txtnode/fntcache.cxx | 18 +-
sw/source/core/txtnode/ndtxt.cxx | 49 ++---
sw/source/core/txtnode/thints.cxx | 29 +--
sw/source/core/txtnode/txtedt.cxx | 85 ++++-----
sw/source/core/undo/undel.cxx | 2
sw/source/core/undo/undraw.cxx | 4
sw/source/core/unocore/unoportenum.cxx | 14 -
sw/source/core/unocore/unotextmarkup.cxx | 38 +---
27 files changed, 378 insertions(+), 385 deletions(-)
New commits:
commit b1ac01de06262bda39be7f970fbceeda9b267fe4
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat Dec 14 22:46:05 2013 +0100
xub_StrLen/sal_uLong to sal_Int32 + minor optimizations
Change-Id: Ibbca8e2d2a4742247648a611337bd8a75db7ee2f
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 545cd8f..3268232 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -67,12 +67,11 @@ namespace com { namespace sun { namespace star {
namespace text { class XTextContent; }
} } }
-typedef std::set< xub_StrLen > SwSoftPageBreakList;
+typedef std::set< sal_Int32 > SwSoftPageBreakList;
// do not fill the String up to the max - need to be able to have a
// SwPosition "behind" the last character, i.e., at index TXTNODE_MAX + 1
-// (also STRING_LEN is often used for "not found")
-const xub_StrLen TXTNODE_MAX = STRING_LEN - 2;
+static const sal_Int32 TXTNODE_MAX = SAL_MAX_INT32 - 2;
/// SwTxtNode is a paragraph in the document model.
class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
@@ -124,14 +123,14 @@ class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
const SfxItemSet* pAutoAttr = 0 );
/// Copies the attributes at nStart to pDest.
- SW_DLLPRIVATE void CopyAttr( SwTxtNode *pDest, const xub_StrLen nStart, const xub_StrLen nOldPos);
+ SW_DLLPRIVATE void CopyAttr( SwTxtNode *pDest, const sal_Int32 nStart, const sal_Int32 nOldPos);
SW_DLLPRIVATE SwTxtNode* _MakeNewTxtNode( const SwNodeIndex&, sal_Bool bNext = sal_True,
sal_Bool bChgFollow = sal_True );
SW_DLLPRIVATE void CutImpl(
SwTxtNode * const pDest, const SwIndex & rDestStart,
- const SwIndex & rStart, /*const*/ xub_StrLen nLen,
+ const SwIndex & rStart, /*const*/ sal_Int32 nLen,
const bool bUpdate = true );
/// Move all comprising hard attributes to the AttrSet of the paragraph.
@@ -251,7 +250,7 @@ public:
ATTENTION: must not be called with a range that overlaps the start of
an attribute with both extent and dummy char
*/
- void EraseText ( const SwIndex &rIdx, const xub_StrLen nCount = STRING_LEN,
+ void EraseText ( const SwIndex &rIdx, const sal_Int32 nCount = SAL_MAX_INT32,
const enum IDocumentContentOperations::InsertFlags nMode
= IDocumentContentOperations::INS_DEFAULT );
@@ -268,7 +267,7 @@ public:
*/
void RstTxtAttr(
const SwIndex &rIdx,
- const xub_StrLen nLen,
+ const sal_Int32 nLen,
const sal_uInt16 nWhich = 0,
const SfxItemSet* pSet = 0,
const sal_Bool bInclRefToxMark = sal_False );
@@ -286,13 +285,13 @@ public:
/// create new text attribute from rAttr and insert it
/// @return inserted hint; 0 if not sure the hint is inserted
SwTxtAttr* InsertItem( SfxPoolItem& rAttr,
- const xub_StrLen nStart, const xub_StrLen nEnd,
+ const sal_Int32 nStart, const sal_Int32 nEnd,
const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
/** Set these attributes at TextNode. If the whole range is comprised
set them only in AutoAttrSet (SwCntntNode::SetAttr). */
sal_Bool SetAttr( const SfxItemSet& rSet,
- xub_StrLen nStt, xub_StrLen nEnd,
+ sal_Int32 nStt, sal_Int32 nEnd,
const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
/** Query the attributes of textnode over the range.
Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
@@ -301,7 +300,7 @@ public:
the requested item set as a LR-SPACE item, if <bOnlyTxtAttr> == sal_False,
corresponding node has not its own indent attributes and the
position-and-space mode of the list level is SvxNumberFormat::LABEL_ALIGNMENT. */
- sal_Bool GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
+ sal_Bool GetAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
sal_Bool bOnlyTxtAttr = sal_False,
sal_Bool bGetFromChrFmt = sal_True,
const bool bMergeIndentValuesOfNumRule = false ) const;
@@ -311,7 +310,7 @@ public:
/// delete all attributes of type nWhich at nStart (opt. end nEnd)
void DeleteAttributes( const sal_uInt16 nWhich,
- const xub_StrLen nStart, const xub_StrLen nEnd = 0 );
+ const sal_Int32 nStart, const sal_Int32 nEnd = 0 );
/// delete the attribute pTxtAttr
void DeleteAttribute ( SwTxtAttr * const pTxtAttr );
@@ -319,25 +318,25 @@ public:
introduce optional parameter to control, if all attributes have to be copied. */
void CopyText( SwTxtNode * const pDest,
const SwIndex &rStart,
- const xub_StrLen nLen,
+ const sal_Int32 nLen,
const bool bForceCopyOfAllAttrs = false );
void CopyText( SwTxtNode * const pDest,
const SwIndex &rDestStart,
const SwIndex &rStart,
- xub_StrLen nLen,
+ sal_Int32 nLen,
const bool bForceCopyOfAllAttrs = false );
void CutText(SwTxtNode * const pDest,
- const SwIndex & rStart, const xub_StrLen nLen);
+ const SwIndex & rStart, const sal_Int32 nLen);
inline void CutText(SwTxtNode * const pDest, const SwIndex &rDestStart,
- const SwIndex & rStart, const xub_StrLen nLen);
+ const SwIndex & rStart, const sal_Int32 nLen);
/// replace nDelLen characters at rStart with rText
/// in case the replacement does not fit, it is partially inserted up to
/// TXTNODE_MAX
- void ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen,
+ void ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen,
const OUString & rText );
- void ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen,
+ void ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen,
const OUString& rText,
const ::com::sun::star::uno::Sequence<sal_Int32>& rOffsets );
@@ -368,7 +367,7 @@ public:
RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
*/
SwTxtAttr *GetTxtAttrAt(
- xub_StrLen const nIndex,
+ sal_Int32 const nIndex,
RES_TXTATR const nWhich,
enum GetTxtAttrMode const eMode = DEFAULT ) const;
@@ -377,7 +376,7 @@ public:
@param eMode the predicate for matching (@see GetTxtAttrMode).
*/
::std::vector<SwTxtAttr *> GetTxtAttrsAt(
- xub_StrLen const nIndex,
+ sal_Int32 const nIndex,
RES_TXTATR const nWhich,
enum GetTxtAttrMode const eMode = DEFAULT ) const;
@@ -389,14 +388,14 @@ public:
@return the text attribute at nIndex of type nWhich, if it exists
*/
SwTxtAttr *GetTxtAttrForCharAt(
- const xub_StrLen nIndex,
+ const sal_Int32 nIndex,
const RES_TXTATR nWhich = RES_TXTATR_END ) const;
SwTxtFld* GetFldTxtAttrAt(
- const xub_StrLen nIndex,
+ const sal_Int32 nIndex,
const bool bIncludeInputFldAtStart = false ) const;
- OUString GetCurWord(xub_StrLen) const;
+ OUString GetCurWord(sal_Int32) const;
sal_uInt16 Spell(SwSpellArgs*);
sal_uInt16 Convert( SwConversionArgs & );
@@ -665,12 +664,12 @@ public:
sal_uInt16 nScript = 0 ) const;
/// in ndcopy.cxx
- sal_Bool IsSymbol( const xub_StrLen nBegin ) const; // In itratr.cxx.
+ sal_Bool IsSymbol( const sal_Int32 nBegin ) const; // In itratr.cxx.
virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
/// Interactive hyphenation: we find TxtFrm and call its CalcHyph.
sal_Bool Hyphenate( SwInterHyphInfo &rHyphInf );
- void DelSoftHyph( const xub_StrLen nStart, const xub_StrLen nEnd );
+ void DelSoftHyph( const sal_Int32 nStart, const sal_Int32 nEnd );
/** add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating,
when <bWithNum = true> that a space is inserted after the string for
@@ -689,8 +688,8 @@ public:
bool bWithNum = false, bool bWithFtn = true,
bool bReplaceTabsWithSpaces = false ) const;
- OUString GetRedlineTxt( xub_StrLen nIdx = 0,
- xub_StrLen nLen = STRING_LEN,
+ OUString GetRedlineTxt( sal_Int32 nIdx = 0,
+ sal_Int32 nLen = SAL_MAX_INT32,
sal_Bool bExpandFlds = sal_False,
sal_Bool bWithNum = sal_False ) const;
@@ -742,11 +741,11 @@ public:
/// change text to Upper/Lower/Hiragana/Katagana/...
void TransliterateText( utl::TransliterationWrapper& rTrans,
- xub_StrLen nStart, xub_StrLen nEnd,
+ sal_Int32 nStart, sal_Int32 nEnd,
SwUndoTransliterate* pUndo = 0 );
/// count words in given range - returns true if we refreshed out count
- bool CountWords( SwDocStat& rStat, xub_StrLen nStart, xub_StrLen nEnd ) const;
+ bool CountWords( SwDocStat& rStat, sal_Int32 nStart, sal_Int32 nEnd ) const;
/** Checks some global conditions like loading or destruction of document
to economize notifications */
@@ -772,7 +771,7 @@ public:
bool IsFirstOfNumRule() const;
- sal_uInt16 GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) const;
+ sal_uInt16 GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd ) const;
SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
::com::sun::star::text::XTextContent> const& GetXParagraph() const
@@ -793,11 +792,11 @@ public:
virtual void dumpAsXml( xmlTextWriterPtr writer = NULL );
- sal_uInt32 GetRsid( xub_StrLen nStt, xub_StrLen nEnd ) const;
+ sal_uInt32 GetRsid( sal_Int32 nStt, sal_Int32 nEnd ) const;
sal_uInt32 GetParRsid() const;
- bool CompareRsid( const SwTxtNode &rTxtNode, xub_StrLen nStt1, xub_StrLen nStt2,
- xub_StrLen nEnd1 = 0, xub_StrLen nEnd2 = 0 ) const;
+ bool CompareRsid( const SwTxtNode &rTxtNode, sal_Int32 nStt1, sal_Int32 nStt2,
+ sal_Int32 nEnd1 = 0, sal_Int32 nEnd2 = 0 ) const;
bool CompareParRsid( const SwTxtNode &rTxtNode ) const;
DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode)
@@ -851,7 +850,7 @@ inline const SwTxtNode *SwNode::GetTxtNode() const
inline void
SwTxtNode::CutText(SwTxtNode * const pDest, const SwIndex & rDestStart,
- const SwIndex & rStart, const xub_StrLen nLen)
+ const SwIndex & rStart, const sal_Int32 nLen)
{
CutImpl( pDest, rDestStart, rStart, nLen, true );
}
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index a1d3e2e..8171500 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -714,7 +714,8 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const OUString &rStr )
SwTxtNode *pNode = rPt.nNode.GetNode().GetTxtNode();
if (!pNode || ( static_cast<size_t>(rStr.getLength()) // worst case: no erase
- + static_cast<size_t>(pNode->GetTxt().getLength()) > TXTNODE_MAX))
+ + static_cast<size_t>(pNode->GetTxt().getLength())
+ > static_cast<size_t>(TXTNODE_MAX)))
{
return false;
}
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 2ea2fb9..f41864f 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -633,8 +633,8 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos,
if (pTxtNode != NULL)
{
SwFmtFlyCnt aFmt( pFmt );
- bool const bSuccess( pTxtNode->InsertItem(aFmt, nStt, nStt) );
- if (!bSuccess) // may fail if there's no space left or header/ftr
+ // may fail if there's no space left or header/ftr
+ if (!pTxtNode->InsertItem(aFmt, nStt, nStt))
{ // pFmt is dead now
return 0;
}
@@ -925,10 +925,8 @@ SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg,
{
const sal_Int32 nStt = rRg.GetPoint()->nContent.GetIndex();
SwFmtFlyCnt aFmt( pFmt );
- bool const bSuccess( // may fail if there's no space left
- rRg.GetPoint()->nNode.GetNode().GetTxtNode()->InsertItem(
- aFmt, nStt, nStt));
- if (!bSuccess)
+ // may fail if there's no space left
+ if (!rRg.GetPoint()->nNode.GetNode().GetTxtNode()->InsertItem(aFmt, nStt, nStt))
{ // pFmt is dead now
return 0;
}
@@ -1385,7 +1383,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
{
aTxt += rSeparator;
}
- sal_Int32 nSepIdx = aTxt.getLength();
+ const sal_Int32 nSepIdx = aTxt.getLength();
aTxt += rTxt;
// Insert string
@@ -1677,7 +1675,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
}
sal_Int32 nIdx = aTxt.getLength();
aTxt += rSeparator;
- sal_Int32 nSepIdx = aTxt.getLength();
+ const sal_Int32 nSepIdx = aTxt.getLength();
aTxt += rTxt;
// insert text
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index e474cb6..acdc7c7 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1648,7 +1648,7 @@ static bool lcl_CheckMaxLength(SwNode const& rPrev, SwNode const& rNext)
}
size_t const nSum(static_cast<const SwTxtNode&>(rPrev).GetTxt().getLength()
+ static_cast<const SwTxtNode&>(rNext).GetTxt().getLength());
- return (nSum <= TXTNODE_MAX);
+ return (nSum <= static_cast<size_t>(TXTNODE_MAX));
}
/// Can we join two Nodes?
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index e9418cf..4325e38 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -2080,7 +2080,7 @@ sal_Bool SwLayIdle::_DoIdleJob( const SwCntntFrm *pCnt, IdleJobType eJob )
break;
case WORD_COUNT :
{
- const xub_StrLen nEnd = pTxtNode->GetTxt().getLength();
+ const sal_Int32 nEnd = pTxtNode->GetTxt().getLength();
SwDocStat aStat;
pTxtNode->CountWords( aStat, 0, nEnd );
if ( Application::AnyInput( VCL_INPUT_ANY ) )
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index b51ee42..59e4487 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2161,7 +2161,7 @@ void ChgNumToText( SwTableBox& rBox, sal_uLong nFmt )
// Reset DontExpand-Flags before exchange, to retrigger expansion
pTNd->DontExpandFmt( aIdx, false, false );
aIdx = 0;
- pTNd->EraseText( aIdx, STRING_LEN,
+ pTNd->EraseText( aIdx, SAL_MAX_INT32,
IDocumentContentOperations::INS_EMPTYEXPAND );
pTNd->InsertText( sTmp, aIdx,
IDocumentContentOperations::INS_EMPTYEXPAND );
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 743ce9e..a249ead 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -428,7 +428,7 @@ static sal_Bool lcl_MinMaxString( SwMinMaxArgs& rArg, SwFont* pFnt, const OUStri
return bRet;
}
-sal_Bool SwTxtNode::IsSymbol( const xub_StrLen nBegin ) const
+sal_Bool SwTxtNode::IsSymbol( const sal_Int32 nBegin ) const
{
SwScriptInfo aScriptInfo;
SwAttrIter aIter( *(SwTxtNode*)this, aScriptInfo );
@@ -819,7 +819,7 @@ void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMa
* changing this method very likely requires changing of "GetMinMaxSize"
*************************************************************************/
-sal_uInt16 SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd )
+sal_uInt16 SwTxtNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd )
const
{
SwViewShell* pSh = NULL;
@@ -863,8 +863,8 @@ sal_uInt16 SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd
return 100;
}
- nStt = (xub_StrLen)aBound.startPos;
- nEnd = (xub_StrLen)aBound.endPos;
+ nStt = aBound.startPos;
+ nEnd = aBound.endPos;
if ( nStt == nEnd )
{
@@ -885,7 +885,7 @@ sal_uInt16 SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd
aAttr.SetPriorityAttr( sal_True );
rAH.PushAndChg( aAttr, *(aIter.GetFnt()) );
- xub_StrLen nIdx = nStt;
+ sal_Int32 nIdx = nStt;
sal_uLong nWidth = 0;
sal_uLong nProWidth = 0;
@@ -895,12 +895,9 @@ sal_uInt16 SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd
aIter.SeekAndChgAttrIter( nIdx, pOut );
// scan for end of portion
- xub_StrLen nNextChg = aIter.GetNextAttr();
- xub_StrLen nStop = aScriptInfo.NextScriptChg( nIdx );
- if( nNextChg > nStop )
- nNextChg = nStop;
+ const sal_Int32 nNextChg = std::max(aIter.GetNextAttr(), aScriptInfo.NextScriptChg( nIdx ));
- nStop = nIdx;
+ sal_Int32 nStop = nIdx;
sal_Unicode cChar = CH_BLANK;
SwTxtAttr* pHint = NULL;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 8f1a892..f1aea8d 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1249,7 +1249,7 @@ lcl_GetTxtAttrs(
}
::std::vector<SwTxtAttr *>
-SwTxtNode::GetTxtAttrsAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
+SwTxtNode::GetTxtAttrsAt(sal_Int32 const nIndex, RES_TXTATR const nWhich,
enum GetTxtAttrMode const eMode) const
{
::std::vector<SwTxtAttr *> ret;
@@ -1258,7 +1258,7 @@ SwTxtNode::GetTxtAttrsAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
}
SwTxtAttr *
-SwTxtNode::GetTxtAttrAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
+SwTxtNode::GetTxtAttrAt(sal_Int32 const nIndex, RES_TXTATR const nWhich,
enum GetTxtAttrMode const eMode) const
{
assert( (nWhich == RES_TXTATR_META)
@@ -1290,7 +1290,7 @@ const SwTxtInputFld* SwTxtNode::GetOverlappingInputFld( const SwTxtAttr& rTxtAtt
}
SwTxtFld* SwTxtNode::GetFldTxtAttrAt(
- const xub_StrLen nIndex,
+ const sal_Int32 nIndex,
const bool bIncludeInputFldAtStart ) const
{
SwTxtFld* pTxtFld = NULL;
@@ -1456,8 +1456,8 @@ void lcl_CopyHint(
|* gesetzt werden sollen.
*************************************************************************/
-void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
- const xub_StrLen nOldPos )
+void SwTxtNode::CopyAttr( SwTxtNode *pDest, const sal_Int32 nTxtStartIdx,
+ const sal_Int32 nOldPos )
{
if ( HasHints() ) // keine Attribute, keine Kekse
{
@@ -1519,7 +1519,7 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
// introduction of new optional parameter to control, if all attributes have to be copied.
void SwTxtNode::CopyText( SwTxtNode *const pDest,
const SwIndex &rStart,
- const xub_StrLen nLen,
+ const sal_Int32 nLen,
const bool bForceCopyOfAllAttrs )
{
SwIndex const aIdx( pDest, pDest->m_Text.getLength() );
@@ -1530,7 +1530,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
void SwTxtNode::CopyText( SwTxtNode *const pDest,
const SwIndex &rDestStart,
const SwIndex &rStart,
- xub_StrLen nLen,
+ sal_Int32 nLen,
const bool bForceCopyOfAllAttrs )
{
sal_Int32 nTxtStartIdx = rStart.GetIndex();
@@ -1644,7 +1644,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
// Del-Array fuer alle RefMarks ohne Ausdehnung
SwpHts aRefMrkArr;
- sal_uInt16 nDeletedDummyChars(0);
+ sal_Int32 nDeletedDummyChars(0);
//Achtung: kann ungueltig sein!!
for (sal_uInt16 n = 0; ( n < nSize ); ++n)
{
@@ -1920,7 +1920,7 @@ OUString SwTxtNode::InsertText( const OUString & rStr, const SwIndex & rIdx,
*************************************************************************/
void SwTxtNode::CutText( SwTxtNode * const pDest,
- const SwIndex & rStart, const xub_StrLen nLen )
+ const SwIndex & rStart, const sal_Int32 nLen )
{
if(pDest)
{
@@ -1937,7 +1937,7 @@ void SwTxtNode::CutText( SwTxtNode * const pDest,
void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart,
- const SwIndex & rStart, xub_StrLen nLen, const bool bUpdate )
+ const SwIndex & rStart, sal_Int32 nLen, const bool bUpdate )
{
if(!pDest)
{
@@ -2286,13 +2286,13 @@ void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart,
}
-void SwTxtNode::EraseText(const SwIndex &rIdx, const xub_StrLen nCount,
+void SwTxtNode::EraseText(const SwIndex &rIdx, const sal_Int32 nCount,
const IDocumentContentOperations::InsertFlags nMode )
{
assert(rIdx <= m_Text.getLength()); // invalid index
const sal_Int32 nStartIdx = rIdx.GetIndex();
- const sal_Int32 nCnt = (STRING_LEN == nCount)
+ const sal_Int32 nCnt = (nCount==SAL_MAX_INT32)
? m_Text.getLength() - nStartIdx : nCount;
const sal_Int32 nEndIdx = nStartIdx + nCnt;
m_Text = m_Text.replaceAt(nStartIdx, nCnt, "");
@@ -2697,7 +2697,7 @@ SwCntntNode* SwTxtNode::AppendNode( const SwPosition & rPos )
*************************************************************************/
SwTxtAttr * SwTxtNode::GetTxtAttrForCharAt(
- const xub_StrLen nIndex,
+ const sal_Int32 nIndex,
const RES_TXTATR nWhich ) const
{
if ( HasHints() )
@@ -2705,7 +2705,7 @@ SwTxtAttr * SwTxtNode::GetTxtAttrForCharAt(
for ( sal_uInt16 i = 0; i < m_pSwpHints->Count(); ++i )
{
SwTxtAttr * const pHint = m_pSwpHints->GetTextHint(i);
- const xub_StrLen nStartPos = *pHint->GetStart();
+ const sal_Int32 nStartPos = *pHint->GetStart();
if ( nIndex < nStartPos )
{
return 0;
@@ -3174,7 +3174,7 @@ bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
for ( sal_uInt16 i = 0; i < m_pSwpHints->Count(); i++ )
{
const SwTxtAttr* pHt = (*m_pSwpHints)[i];
- const xub_StrLen nAttrStartIdx = *pHt->GetStart();
+ const sal_Int32 nAttrStartIdx = *pHt->GetStart();
const sal_uInt16 nWhich = pHt->Which();
if (nIdx + nLen <= nAttrStartIdx)
break; // ueber das Textende
@@ -3212,7 +3212,7 @@ bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
SAL_INFO_IF(ins.getLength() != aExpand.getLength(),
"sw.core", "GetExpandTxt lossage");
aDestIdx = nInsPos + nAttrStartIdx;
- nInsPos = nInsPos + ins.getLength();
+ nInsPos += ins.getLength();
}
rDestNd.EraseText( aDestIdx, 1 );
--nInsPos;
@@ -3247,7 +3247,7 @@ bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
SAL_INFO_IF(ins.getLength() != sExpand.getLength(),
"sw.core", "GetExpandTxt lossage");
aDestIdx = nInsPos + nAttrStartIdx;
- nInsPos = nInsPos + ins.getLength();
+ nInsPos += ins.getLength();
}
}
rDestNd.EraseText( aDestIdx, 1 );
@@ -3308,7 +3308,7 @@ bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
return true;
}
-OUString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen,
+OUString SwTxtNode::GetRedlineTxt( sal_Int32 nIdx, sal_Int32 nLen,
sal_Bool bExpandFlds, sal_Bool bWithNum ) const
{
std::vector<sal_Int32> aRedlArr;
@@ -3358,7 +3358,8 @@ OUString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen,
? GetTxt().copy(nIdx)
: GetTxt().copy(nIdx, nLen));
- sal_Int32 nTxtStt = nIdx, nIdxEnd = nIdx + aTxt.getLength();
+ sal_Int32 nTxtStt = nIdx;
+ sal_Int32 nIdxEnd = nIdx + aTxt.getLength();
for( size_t n = 0; n < aRedlArr.size(); n += 2 )
{
sal_Int32 nStt = aRedlArr[ n ];
@@ -3371,7 +3372,7 @@ OUString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen,
const sal_Int32 nDelCnt = nEnd - nStt;
aTxt.remove(nStt - nTxtStt, nDelCnt);
Replace0xFF(*this, aTxt, nTxtStt, nStt - nTxtStt, bExpandFlds);
- nTxtStt = nTxtStt + nDelCnt;
+ nTxtStt += nDelCnt;
}
else if( nStt >= nIdxEnd )
break;
@@ -3387,7 +3388,7 @@ OUString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen,
* SwTxtNode::ReplaceText
*************************************************************************/
-void SwTxtNode::ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen,
+void SwTxtNode::ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen,
const OUString & rStr)
{
assert( rStart.GetIndex() < m_Text.getLength() // index out of bounds
@@ -4912,7 +4913,7 @@ sal_uInt16 SwTxtNode::ResetAllAttr()
}
-sal_uInt32 SwTxtNode::GetRsid( xub_StrLen nStt, xub_StrLen nEnd ) const
+sal_uInt32 SwTxtNode::GetRsid( sal_Int32 nStt, sal_Int32 nEnd ) const
{
SfxItemSet aSet( (SfxItemPool&) (GetDoc()->GetAttrPool()), RES_CHRATR_RSID, RES_CHRATR_RSID );
if ( GetAttr(aSet, nStt, nEnd) )
@@ -4938,8 +4939,8 @@ bool SwTxtNode::CompareParRsid( const SwTxtNode &rTxtNode ) const
return nThisRsid == nRsid;
}
-bool SwTxtNode::CompareRsid( const SwTxtNode &rTxtNode, xub_StrLen nStt1, xub_StrLen nStt2,
- xub_StrLen nEnd1, xub_StrLen nEnd2 ) const
+bool SwTxtNode::CompareRsid( const SwTxtNode &rTxtNode, sal_Int32 nStt1, sal_Int32 nStt2,
+ sal_Int32 nEnd1, sal_Int32 nEnd2 ) const
{
sal_uInt32 nThisRsid = GetRsid( nStt1, nEnd1 ? nEnd1 : nStt1 );
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 64a813d..f67a400 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1200,7 +1200,7 @@ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr )
SwTxtAttr*
SwTxtNode::InsertItem( SfxPoolItem& rAttr,
- const xub_StrLen nStart, const xub_StrLen nEnd, const SetAttrMode nMode )
+ const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode )
{
// character attributes will be inserted as automatic styles:
OSL_ENSURE( !isCHRATR(rAttr.Which()), "AUTOSTYLES - "
@@ -1242,7 +1242,7 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode )
: IDocumentContentOperations::INS_EMPTYEXPAND;
// need this after TryInsertHint, when pAttr may be deleted
- const xub_StrLen nStart( *pAttr->GetStart() );
+ const sal_Int32 nStart( *pAttr->GetStart() );
const bool bDummyChar( pAttr->HasDummyChar() );
if (bDummyChar)
{
@@ -1475,7 +1475,7 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode )
}
// handle attributes which provide content
- xub_StrLen nEnd = nStart;
+ sal_Int32 nEnd = nStart;
bool bInputFieldStartCharInserted = false;
bool bInputFieldEndCharInserted = false;
const bool bHasContent( pAttr->HasContent() );
@@ -1668,8 +1668,8 @@ void SwTxtNode::DeleteAttribute( SwTxtAttr * const pAttr )
//FIXME: this does NOT respect SORT NUMBER (for CHARFMT)!
void SwTxtNode::DeleteAttributes(
const sal_uInt16 nWhich,
- const xub_StrLen nStart,
- const xub_StrLen nEnd )
+ const sal_Int32 nStart,
+ const sal_Int32 nEnd )
{
if ( !HasHints() )
return;
@@ -1743,12 +1743,17 @@ void SwTxtNode::DeleteAttributes(
* SwTxtNode::DelSoftHyph()
*************************************************************************/
-void SwTxtNode::DelSoftHyph( const xub_StrLen nStt, const xub_StrLen nEnd )
+void SwTxtNode::DelSoftHyph( const sal_Int32 nStt, const sal_Int32 nEnd )
{
- sal_Int32 nFndPos = nStt, nEndPos = nEnd;
- while ((-1 != (nFndPos = m_Text.indexOf(CHAR_SOFTHYPHEN, nFndPos))) &&
- nFndPos < nEndPos )
+ sal_Int32 nFndPos = nStt;
+ sal_Int32 nEndPos = nEnd;
+ for (;;)
{
+ nFndPos = m_Text.indexOf(CHAR_SOFTHYPHEN, nFndPos);
+ if (nFndPos<0 || nFndPos>=nEndPos )
+ {
+ break;
+ }
const SwIndex aIdx( this, nFndPos );
EraseText( aIdx, 1 );
--nEndPos;
@@ -1829,8 +1834,8 @@ bool SwTxtNode::TryCharSetExpandToNum(const SfxItemSet& aCharSet)
// dann setze sie nur im AutoAttrSet (SwCntntNode:: SetAttr)
sal_Bool SwTxtNode::SetAttr(
const SfxItemSet& rSet,
- const xub_StrLen nStt,
- const xub_StrLen nEnd,
+ const sal_Int32 nStt,
+ const sal_Int32 nEnd,
const SetAttrMode nMode )
{
if( !rSet.Count() )
@@ -2047,7 +2052,7 @@ static void lcl_MergeListLevelIndentAsLRSpaceItem( const SwTxtNode& rTxtNode,
}
// erfrage die Attribute vom TextNode ueber den Bereich
-sal_Bool SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
+sal_Bool SwTxtNode::GetAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
sal_Bool bOnlyTxtAttr, sal_Bool bGetFromChrFmt,
const bool bMergeIndentValuesOfNumRule ) const
{
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 679a328..2fba6e9 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -371,7 +371,7 @@ static bool lcl_HaveCommonAttributes( IStyleAccess& rStyleAccess,
void SwTxtNode::RstTxtAttr(
const SwIndex &rIdx,
- const xub_StrLen nLen,
+ const sal_Int32 nLen,
const sal_uInt16 nWhich,
const SfxItemSet* pSet,
const sal_Bool bInclRefToxMark )
@@ -651,7 +651,7 @@ sal_Int32 clipIndexBounds(const OUString &rStr, sal_Int32 nPos)
* Wenn dieses erste Wort nur aus Whitespaces besteht, returnen wir
* einen leeren String.
*************************************************************************/
-OUString SwTxtNode::GetCurWord( xub_StrLen nPos ) const
+OUString SwTxtNode::GetCurWord( sal_Int32 nPos ) const
{
assert(nPos <= m_Text.getLength()); // invalid index
@@ -682,7 +682,7 @@ OUString SwTxtNode::GetCurWord( xub_StrLen nPos ) const
// check if word was found and if it uses a symbol font, if so
// enforce returning an empty string
- if (aBndry.endPos != aBndry.startPos && IsSymbol( (xub_StrLen)aBndry.startPos ))
+ if (aBndry.endPos != aBndry.startPos && IsSymbol( aBndry.startPos ))
aBndry.endPos = aBndry.startPos;
// can have -1 as start/end of bounds not found
@@ -1618,8 +1618,8 @@ namespace
{
struct swTransliterationChgData
{
- xub_StrLen nStart;
- xub_StrLen nLen;
+ sal_Int32 nStart;
+ sal_Int32 nLen;
OUString sChanged;
Sequence< sal_Int32 > aOffsets;
};
@@ -1628,7 +1628,7 @@ namespace
// change text to Upper/Lower/Hiragana/Katagana/...
void SwTxtNode::TransliterateText(
utl::TransliterationWrapper& rTrans,
- xub_StrLen nStt, xub_StrLen nEnd,
+ sal_Int32 nStt, sal_Int32 nEnd,
SwUndoTransliterate* pUndo )
{
if (nStt < nEnd && g_pBreakIt->GetBreakIter().is())
@@ -1686,9 +1686,9 @@ void SwTxtNode::TransliterateText(
Boundary aCurWordBndry( aSttBndry );
while (aCurWordBndry.startPos <= aEndBndry.startPos)
{
- nStt = (xub_StrLen)aCurWordBndry.startPos;
- nEnd = (xub_StrLen)aCurWordBndry.endPos;
- sal_Int32 nLen = nEnd - nStt;
+ nStt = aCurWordBndry.startPos;
+ nEnd = aCurWordBndry.endPos;
+ const sal_Int32 nLen = nEnd - nStt;
OSL_ENSURE( nLen > 0, "invalid word length of 0" );
Sequence <sal_Int32> aOffsets;
@@ -1812,8 +1812,8 @@ void SwTxtNode::TransliterateText(
else
pIter = 0;
- xub_StrLen nEndPos;
- sal_uInt16 nLang;
+ sal_Int32 nEndPos = 0;
+ sal_uInt16 nLang = LANGUAGE_NONE;
do {
if( pIter )
{
@@ -1827,7 +1827,7 @@ void SwTxtNode::TransliterateText(
nLang = LANGUAGE_SYSTEM;
nEndPos = nEnd;
}
- xub_StrLen nLen = nEndPos - nStt;
+ const sal_Int32 nLen = nEndPos - nStt;
Sequence <sal_Int32> aOffsets;
OUString const sChgd( rTrans.transliterate(
@@ -1860,8 +1860,8 @@ void SwTxtNode::TransliterateText(
// call to ReplaceTextOnly
swTransliterationChgData & rData =
aChanges[ aChanges.size() - 1 - i ];
- nSum = nSum + rData.sChanged.getLength() - rData.nLen;
- if (nSum > TXTNODE_MAX)
+ nSum += rData.sChanged.getLength() - rData.nLen;
+ if (nSum > static_cast<size_t>(TXTNODE_MAX))
{
SAL_WARN("sw.core", "SwTxtNode::ReplaceTextOnly: "
"node text with insertion > TXTNODE_MAX.");
@@ -1875,7 +1875,7 @@ void SwTxtNode::TransliterateText(
}
}
-void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen,
+void SwTxtNode::ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen,
const OUString & rText,
const Sequence<sal_Int32>& rOffsets )
{
@@ -1886,14 +1886,14 @@ void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen,
sal_Int32 nTLen = rText.getLength();
const sal_Int32* pOffsets = rOffsets.getConstArray();
// now look for no 1-1 mapping -> move the indizies!
- xub_StrLen nI, nMyOff;
- for( nI = 0, nMyOff = nPos; nI < nTLen; ++nI, ++nMyOff )
+ sal_Int32 nMyOff = nPos;
+ for( sal_Int32 nI = 0; nI < nTLen; ++nI )
{
- xub_StrLen nOff = (xub_StrLen)pOffsets[ nI ];
+ const sal_Int32 nOff = pOffsets[ nI ];
if( nOff < nMyOff )
{
// something is inserted
- xub_StrLen nCnt = 1;
+ sal_Int32 nCnt = 1;
while( nI + nCnt < nTLen && nOff == pOffsets[ nI + nCnt ] )
++nCnt;
@@ -1908,6 +1908,7 @@ void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen,
Update( SwIndex( this, nMyOff+1 ), nOff - nMyOff, sal_True );
nMyOff = nOff;
}
+ ++nMyOff;
}
if( nMyOff < nLen )
// something is deleted at the end
@@ -1924,7 +1925,7 @@ void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen,
// the return values allows us to see if we did the heavy-
// lifting required to actually break and count the words.
bool SwTxtNode::CountWords( SwDocStat& rStat,
- xub_StrLen nStt, xub_StrLen nEnd ) const
+ sal_Int32 nStt, sal_Int32 nEnd ) const
{
if( nStt > nEnd )
{ // bad call
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index cb4f9a2..7c427fb 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -343,7 +343,7 @@ sal_Bool SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd
if( pSttTxtNd )
{
bool bOneNode = nSttNode == nEndNode;
- xub_StrLen nLen = bOneNode ? nEndCntnt - nSttCntnt
+ sal_Int32 nLen = bOneNode ? nEndCntnt - nSttCntnt
: pSttTxtNd->GetTxt().getLength() - nSttCntnt;
SwRegHistory aRHst( *pSttTxtNd, pHistory );
// always save all text atttibutes because of possibly overlapping
diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx
index 9488377..b766fc2 100644
--- a/sw/source/core/undo/undraw.cxx
+++ b/sw/source/core/undo/undraw.cxx
@@ -129,7 +129,7 @@ static void lcl_SaveAnchor( SwFrmFmt* pFmt, sal_uLong& rNodePos )
(FLY_AS_CHAR == rAnchor.GetAnchorId()))
{
rNodePos = rAnchor.GetCntntAnchor()->nNode.GetIndex();
- xub_StrLen nCntntPos = 0;
+ sal_Int32 nCntntPos = 0;
if (FLY_AS_CHAR == rAnchor.GetAnchorId())
{
@@ -166,7 +166,7 @@ static void lcl_RestoreAnchor( SwFrmFmt* pFmt, sal_uLong& rNodePos )
(FLY_AT_FLY == rAnchor.GetAnchorId()) ||
(FLY_AS_CHAR == rAnchor.GetAnchorId()))
{
- xub_StrLen nCntntPos = rAnchor.GetPageNum();
+ const sal_Int32 nCntntPos = rAnchor.GetPageNum();
SwNodes& rNds = pFmt->GetDoc()->GetNodes();
SwNodeIndex aIdx( rNds, rNodePos );
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 39955aa..f7f3c3e 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -95,7 +95,7 @@ namespace
, aPosition ( rPosition )
{
}
- sal_uLong getIndex ()
+ sal_Int32 getIndex ()
{
return aPosition.nContent.GetIndex();
}
@@ -503,7 +503,7 @@ lcl_ExportBookmark(
TextRangeList_t & rPortions,
Reference<XText> const& xParent,
const SwUnoCrsr * const pUnoCrsr,
- SwXBookmarkPortion_ImplList& rBkmArr, const sal_uLong nIndex)
+ SwXBookmarkPortion_ImplList& rBkmArr, const sal_Int32 nIndex)
{
for ( SwXBookmarkPortion_ImplList::iterator aIter = rBkmArr.begin(), aEnd = rBkmArr.end();
aIter != aEnd; )
@@ -545,7 +545,7 @@ lcl_ExportSoftPageBreak(
TextRangeList_t & rPortions,
Reference<XText> const& xParent,
const SwUnoCrsr * const pUnoCrsr,
- SwSoftPageBreakList& rBreakArr, const sal_uLong nIndex)
+ SwSoftPageBreakList& rBreakArr, const sal_Int32 nIndex)
{
for ( SwSoftPageBreakList::iterator aIter = rBreakArr.begin(),
aEnd = rBreakArr.end();
@@ -576,7 +576,7 @@ struct SwXRedlinePortion_Impl
{
}
- sal_uLong getRealIndex ()
+ sal_Int32 getRealIndex ()
{
return m_bStart ? m_pRedline->Start()->nContent.GetIndex()
: m_pRedline->End() ->nContent.GetIndex();
@@ -971,7 +971,7 @@ lcl_ExportRedline(
TextRangeList_t & rPortions,
Reference<XText> const& xParent,
const SwUnoCrsr * const pUnoCrsr,
- SwXRedlinePortion_ImplList& rRedlineArr, const sal_uLong nIndex)
+ SwXRedlinePortion_ImplList& rRedlineArr, const sal_Int32 nIndex)
{
// MTG: 23/11/05: We want this loop to iterate over all red lines in this
@@ -980,7 +980,7 @@ lcl_ExportRedline(
aIter != aEnd; )
{
SwXRedlinePortion_ImplSharedPtr pPtr = (*aIter );
- sal_uLong nRealIndex = pPtr->getRealIndex();
+ sal_Int32 nRealIndex = pPtr->getRealIndex();
// MTG: 23/11/05: If there are elements before nIndex, remove them
if ( nIndex > nRealIndex )
rRedlineArr.erase ( aIter++ );
@@ -1005,7 +1005,7 @@ lcl_ExportBkmAndRedline(
SwXBookmarkPortion_ImplList& rBkmArr,
SwXRedlinePortion_ImplList& rRedlineArr,
SwSoftPageBreakList& rBreakArr,
- const sal_uLong nIndex)
+ const sal_Int32 nIndex)
{
if (!rBkmArr.empty())
lcl_ExportBookmark(rPortions, xParent, pUnoCrsr, rBkmArr, nIndex);
commit afe6738b717f89a14be62fcf4645ec4d53642edd
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun Dec 8 16:21:14 2013 +0100
Fix static linkage and use SAL_N_ELEMENTS
Change-Id: Iced21e010b3c06a5f36731f63d41ab55a5c8a2e4
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index 614c3ac..bf5648d 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -1088,10 +1088,10 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
{ "ooxml-ribbon", "ribbon" },
};
-struct {
+static struct {
const char* sDML;
MSO_SPT nVML;
-} pDMLToVMLTable[] = {
+} const pDMLToVMLTable[] = {
{"notPrimitive", mso_sptNotPrimitive},
{"rectangle", mso_sptRectangle},
{"roundRectangle", mso_sptRoundRectangle},
@@ -1307,7 +1307,7 @@ const char* GetOOXMLPresetGeometry( const char* sShapeType )
if( pCustomShapeTypeTranslationHashMap == NULL )
{
pCustomShapeTypeTranslationHashMap = new CustomShapeTypeTranslationHashMap ();
- for( unsigned int i = 0; i < sizeof( pCustomShapeTypeTranslationTable )/sizeof( CustomShapeTypeTranslationTable ); i ++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(pCustomShapeTypeTranslationTable); ++i )
{
(*pCustomShapeTypeTranslationHashMap)[ pCustomShapeTypeTranslationTable[ i ].sOOo ] = pCustomShapeTypeTranslationTable[ i ].sMSO;
}
commit 4ba63be415a959a6b8891c5a7924e527f93c6afd
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun Dec 8 14:08:22 2013 +0100
xub_StrLen to sal_Int32 with minor optimizations
Change-Id: I111e7c84e003b2bd4599824e42215066c4726023
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 0bcf314..e3f0577 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -973,9 +973,9 @@ sal_Bool SwAccessibleParagraph::GetTextBoundary(
{
sal_Int32 nBegin = nPos;
sal_Int32 nLen = 1;
- const xub_StrLen nNext = pWrongList->NextWrong(nBegin);
- xub_StrLen nLast;
- xub_StrLen nWrongPos = pWrongList->GetWrongPos( nBegin );
+ const sal_Int32 nNext = pWrongList->NextWrong(nBegin);
+ sal_Int32 nLast = 0;
+ sal_uInt16 nWrongPos = pWrongList->GetWrongPos( nBegin );
if ( nWrongPos >= pWrongList->Count() ||
( nLast = pWrongList->Pos( nWrongPos ) ) >= nBegin )
{
@@ -986,9 +986,7 @@ sal_Bool SwAccessibleParagraph::GetTextBoundary(
if ( nBegin > pWrongList->GetBeginInv() &&
( nLast == STRING_LEN || nLast < pWrongList->GetEndInv() ) )
{
- nLast = nBegin > pWrongList->GetEndInv()
- ? pWrongList->GetEndInv()
- : nBegin;
+ nLast = min(nBegin, pWrongList->GetEndInv());
}
else if ( nLast < STRING_LEN )
{
@@ -998,23 +996,23 @@ sal_Bool SwAccessibleParagraph::GetTextBoundary(
sal_Bool bIn = pWrongList->InWrongWord(nBegin,nLen); // && !pTxtNode->IsSymbol(nBegin) )
if(bIn)
{
- rBound.startPos = max(nNext,(xub_StrLen)rBound.startPos);
- rBound.endPos = min(xub_StrLen(nNext + nLen),(xub_StrLen)rBound.endPos);
+ rBound.startPos = max(nNext, rBound.startPos);
+ rBound.endPos = min(nNext+nLen, rBound.endPos);
}
else
{
if (STRING_LEN == nLast)//first
{
- rBound.endPos = min(nNext,(xub_StrLen)rBound.endPos);
+ rBound.endPos = min(nNext, rBound.endPos);
}
else if(STRING_LEN == nNext)
{
- rBound.startPos = max(nLast,(xub_StrLen)rBound.startPos);
+ rBound.startPos = max(nLast, rBound.startPos);
}
else
{
- rBound.startPos = max(nLast,(xub_StrLen)rBound.startPos);
- rBound.endPos = min(nNext,(xub_StrLen)rBound.endPos);
+ rBound.startPos = max(nLast, rBound.startPos);
+ rBound.endPos = min(nNext, rBound.endPos);
}
}
}
diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx
index 66b6db1..b76d9d3 100644
--- a/sw/source/core/access/parachangetrackinginfo.cxx
+++ b/sw/source/core/access/parachangetrackinginfo.cxx
@@ -28,6 +28,8 @@
#include <docary.hxx>
#include <redline.hxx>
+#include <algorithm>
+
namespace {
void initChangeTrackTextMarkupLists( const SwTxtFrm& rTxtFrm,
SwWrongList*& opChangeTrackInsertionTextMarkupList,
@@ -124,15 +126,11 @@ namespace {
}
if ( pMarkupList )
{
- const xub_StrLen nTxtFrmChangeTrackStart =
- nTxtNodeChangeTrackStart <= nTxtFrmTextStartPos
- ? nTxtFrmTextStartPos
- : nTxtNodeChangeTrackStart;
-
- const xub_StrLen nTxtFrmChangeTrackEnd =
- nTxtNodeChangeTrackEnd >= nTxtFrmTextEndPos
- ? nTxtFrmTextEndPos
- : nTxtNodeChangeTrackEnd;
+ const sal_Int32 nTxtFrmChangeTrackStart =
+ std::max(nTxtNodeChangeTrackStart, nTxtFrmTextStartPos);
+
+ const sal_Int32 nTxtFrmChangeTrackEnd =
+ std::min(nTxtNodeChangeTrackEnd, nTxtFrmTextEndPos);
pMarkupList->Insert( OUString(), 0,
nTxtFrmChangeTrackStart,
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 7e0cb2b..ee85607 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3268,7 +3268,7 @@ OUString SwCrsrShell::GetCrsrDescr() const
static void lcl_FillRecognizerData( uno::Sequence< OUString >& rSmartTagTypes,
uno::Sequence< uno::Reference< container::XStringKeyMap > >& rStringKeyMaps,
- const SwWrongList& rSmartTagList, xub_StrLen nCurrent )
+ const SwWrongList& rSmartTagList, sal_Int32 nCurrent )
{
// Insert smart tag information
std::vector< OUString > aSmartTagTypes;
@@ -3276,8 +3276,8 @@ static void lcl_FillRecognizerData( uno::Sequence< OUString >& rSmartTagTypes,
for ( sal_uInt16 i = 0; i < rSmartTagList.Count(); ++i )
{
- const xub_StrLen nSTPos = rSmartTagList.Pos( i );
- const xub_StrLen nSTLen = rSmartTagList.Len( i );
+ const sal_Int32 nSTPos = rSmartTagList.Pos( i );
+ const sal_Int32 nSTLen = rSmartTagList.Len( i );
if ( nSTPos <= nCurrent && nCurrent < nSTPos + nSTLen )
{
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index b8c09d6..2f64eef 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -967,15 +967,13 @@ bool SwEditShell::GetGrammarCorrection(
// get error position of cursor in XFlatParagraph
rErrorPosInText = aConversionMap.ConvertToViewPosition( nBegin );
- sal_Int32 nStartOfSentence = aConversionMap.ConvertToViewPosition( pWrong->getSentenceStart( nBegin ) );
- sal_Int32 nEndOfSentence = aConversionMap.ConvertToViewPosition( pWrong->getSentenceEnd( nBegin ) );
- if( nEndOfSentence == STRING_LEN )
- {
- nEndOfSentence = aExpandText.getLength();
- }
+ const sal_Int32 nStartOfSentence = aConversionMap.ConvertToViewPosition( pWrong->getSentenceStart( nBegin ) );
+ const sal_Int32 nEndOfSentence = aConversionMap.ConvertToViewPosition( pWrong->getSentenceEnd( nBegin ) );
rResult = xGCIterator->checkSentenceAtPosition(
- xDoc, xFlatPara, aExpandText, lang::Locale(), nStartOfSentence, nEndOfSentence, rErrorPosInText );
+ xDoc, xFlatPara, aExpandText, lang::Locale(), nStartOfSentence,
+ nEndOfSentence == STRING_LEN ? aExpandText.getLength() : nEndOfSentence,
+ rErrorPosInText );
bRes = true;
// get suggestions to use for the specific error position
@@ -1722,7 +1720,7 @@ void SwEditShell::IgnoreGrammarErrorAt( SwPaM& rErrorPosition )
SwNodeIndex aIdx = rErrorPosition.Start()->nNode;
SwNodeIndex aEndIdx = rErrorPosition.Start()->nNode;
sal_Int32 nStart = rErrorPosition.Start()->nContent.GetIndex();
- xub_StrLen nEnd = STRING_LEN;
+ sal_Int32 nEnd = STRING_LEN;
while( aIdx <= aEndIdx )
{
pNode = aIdx.GetNode().GetTxtNode();
diff --git a/sw/source/core/inc/SwGrammarMarkUp.hxx b/sw/source/core/inc/SwGrammarMarkUp.hxx
index 76b8622..8a04ac4 100644
--- a/sw/source/core/inc/SwGrammarMarkUp.hxx
+++ b/sw/source/core/inc/SwGrammarMarkUp.hxx
@@ -35,7 +35,7 @@
class SwGrammarMarkUp : public SwWrongList
{
- std::vector< xub_StrLen > maSentence;
+ std::vector< sal_Int32 > maSentence;
public:
SwGrammarMarkUp() : SwWrongList( WRONGLIST_GRAMMAR ) {}
@@ -46,22 +46,22 @@ public:
virtual void CopyFrom( const SwWrongList& rCopy );
/* SwWrongList::Move() + handling of maSentence */
- void MoveGrammar( xub_StrLen nPos, long nDiff );
+ void MoveGrammar( sal_Int32 nPos, sal_Int32 nDiff );
/* SwWrongList::SplitList() + handling of maSentence */
- SwGrammarMarkUp* SplitGrammarList( xub_StrLen nSplitPos );
+ SwGrammarMarkUp* SplitGrammarList( sal_Int32 nSplitPos );
/* SwWrongList::JoinList() + handling of maSentence */
- void JoinGrammarList( SwGrammarMarkUp* pNext, xub_StrLen nInsertPos );
+ void JoinGrammarList( SwGrammarMarkUp* pNext, sal_Int32 nInsertPos );
/* SwWrongList::ClearList() + handling of maSentence */
- void ClearGrammarList( xub_StrLen nSentenceEnd = STRING_LEN );
+ void ClearGrammarList( sal_Int32 nSentenceEnd = STRING_LEN );
/* setSentence to define the start positionof a sentence,
at the moment the end position is given by the next start position */
- void setSentence( xub_StrLen nStart );
+ void setSentence( sal_Int32 nStart );
/* getSentenceStart returns the last start position of a sentence
which is lower or equal to the given parameter */
- xub_StrLen getSentenceStart( xub_StrLen nPos );
+ sal_Int32 getSentenceStart( sal_Int32 nPos );
/* getSentenceEnd returns the first start position of a sentence
which is greater than the given parameter */
- xub_StrLen getSentenceEnd( xub_StrLen nPos );
+ sal_Int32 getSentenceEnd( sal_Int32 nPos );
};
#endif
diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx
index c04c3ec..1363635 100644
--- a/sw/source/core/inc/wrong.hxx
+++ b/sw/source/core/inc/wrong.hxx
@@ -59,8 +59,8 @@ class SwWrongArea
public:
OUString maType;
com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > mxPropertyBag;
- xub_StrLen mnPos;
- xub_StrLen mnLen;
+ sal_Int32 mnPos;
+ sal_Int32 mnLen;
SwWrongList* mpSubList;
Color mColor;
@@ -69,13 +69,13 @@ public:
SwWrongArea( const OUString& rType,
WrongListType listType,
com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag,
- xub_StrLen nPos,
- xub_StrLen nLen);
+ sal_Int32 nPos,
+ sal_Int32 nLen);
SwWrongArea( const OUString& rType,
com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag,
- xub_StrLen nPos,
- xub_StrLen nLen,
+ sal_Int32 nPos,
+ sal_Int32 nLen,
SwWrongList* pSubList);
private:
@@ -186,14 +186,14 @@ class SwWrongList
std::vector<SwWrongArea> maList;
WrongListType meType;
- xub_StrLen nBeginInvalid; // Start of the invalid range
- xub_StrLen nEndInvalid; // End of the invalid range
+ sal_Int32 nBeginInvalid; // Start of the invalid range
+ sal_Int32 nEndInvalid; // End of the invalid range
- void ShiftLeft( xub_StrLen &rPos, xub_StrLen nStart, xub_StrLen nEnd )
+ void ShiftLeft( sal_Int32 &rPos, sal_Int32 nStart, sal_Int32 nEnd )
{ if( rPos > nStart ) rPos = rPos > nEnd ? rPos - nEnd + nStart : nStart; }
- void ShiftRight( xub_StrLen &rPos, xub_StrLen nStart, xub_StrLen nEnd )
+ void ShiftRight( sal_Int32 &rPos, sal_Int32 nStart, sal_Int32 nEnd )
{ if( rPos >= nStart ) rPos += nStart - nEnd; }
- void _Invalidate( xub_StrLen nBegin, xub_StrLen nEnd );
+ void _Invalidate( sal_Int32 nBegin, sal_Int32 nEnd );
void Insert(sal_uInt16 nWhere, std::vector<SwWrongArea>::iterator startPos, std::vector<SwWrongArea>::iterator endPos);
void Remove( sal_uInt16 nIdx, sal_uInt16 nLen );
@@ -210,38 +210,38 @@ public:
virtual void CopyFrom( const SwWrongList& rCopy );
inline WrongListType GetWrongListType() const { return meType; }
- inline xub_StrLen GetBeginInv() const { return nBeginInvalid; }
- inline xub_StrLen GetEndInv() const { return nEndInvalid; }
- inline sal_Bool InsideInvalid( xub_StrLen nChk ) const
+ inline sal_Int32 GetBeginInv() const { return nBeginInvalid; }
+ inline sal_Int32 GetEndInv() const { return nEndInvalid; }
+ inline sal_Bool InsideInvalid( sal_Int32 nChk ) const
{ return nChk >= nBeginInvalid && nChk <= nEndInvalid; }
- void SetInvalid( xub_StrLen nBegin, xub_StrLen nEnd );
+ void SetInvalid( sal_Int32 nBegin, sal_Int32 nEnd );
inline void Validate(){ nBeginInvalid = STRING_LEN; }
- void Invalidate( xub_StrLen nBegin, xub_StrLen nEnd );
+ void Invalidate( sal_Int32 nBegin, sal_Int32 nEnd );
sal_Bool InvalidateWrong();
- sal_Bool Fresh( xub_StrLen &rStart, xub_StrLen &rEnd, xub_StrLen nPos,
- xub_StrLen nLen, sal_uInt16 nIndex, xub_StrLen nCursorPos );
- sal_uInt16 GetWrongPos( xub_StrLen nValue ) const;
+ sal_Bool Fresh( sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nPos,
+ sal_Int32 nLen, sal_uInt16 nIndex, sal_Int32 nCursorPos );
+ sal_uInt16 GetWrongPos( sal_Int32 nValue ) const;
- sal_Bool Check( xub_StrLen &rChk, xub_StrLen &rLn ) const;
+ sal_Bool Check( sal_Int32 &rChk, sal_Int32 &rLn ) const;
sal_Bool InWrongWord( sal_Int32 &rChk, sal_Int32 &rLn ) const;
- xub_StrLen NextWrong( xub_StrLen nChk ) const;
+ sal_Int32 NextWrong( sal_Int32 nChk ) const;
- void Move( xub_StrLen nPos, long nDiff );
+ void Move( sal_Int32 nPos, sal_Int32 nDiff );
void ClearList();
// Divide the list into two part, the wrong words until nSplitPos will be
// removed and transferred to a new SwWrongList.
- SwWrongList* SplitList( xub_StrLen nSplitPos );
+ SwWrongList* SplitList( sal_Int32 nSplitPos );
// Join the next SwWrongList, nInsertPos is my own text length, where
// the other wrong list has to be inserted.
- void JoinList( SwWrongList* pNext, xub_StrLen nInsertPos );
+ void JoinList( SwWrongList* pNext, sal_Int32 nInsertPos );
- inline xub_StrLen Len( sal_uInt16 nIdx ) const
+ inline sal_Int32 Len( sal_uInt16 nIdx ) const
{
return nIdx < maList.size() ? maList[nIdx].mnLen : 0;
}
- inline xub_StrLen Pos( sal_uInt16 nIdx ) const
+ inline sal_Int32 Pos( sal_uInt16 nIdx ) const
{
return nIdx < maList.size() ? maList[nIdx].mnPos : 0;
}
@@ -250,7 +250,7 @@ public:
inline void Insert( const OUString& rType,
com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag,
- xub_StrLen nNewPos, xub_StrLen nNewLen, sal_uInt16 nWhere )
+ sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere )
{
std::vector<SwWrongArea>::iterator i = maList.begin();
if ( nWhere >= maList.size() )
@@ -263,21 +263,21 @@ public:
void Insert( const OUString& rType,
com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag,
- xub_StrLen nNewPos, xub_StrLen nNewLen );
+ sal_Int32 nNewPos, sal_Int32 nNewLen );
inline SwWrongList* SubList( sal_uInt16 nIdx ) const
{
return nIdx < maList.size() ? maList[nIdx].mpSubList : 0;
}
- void InsertSubList( xub_StrLen nNewPos, xub_StrLen nNewLen, sal_uInt16 nWhere, SwWrongList* pSubList );
+ void InsertSubList( sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere, SwWrongList* pSubList );
inline const SwWrongArea* GetElement( sal_uInt16 nIdx ) const
{
return nIdx < maList.size() ? &maList[nIdx] : 0;
}
- void RemoveEntry( xub_StrLen nBegin, xub_StrLen nEnd );
- bool LookForEntry( xub_StrLen nBegin, xub_StrLen nEnd );
+ void RemoveEntry( sal_Int32 nBegin, sal_Int32 nEnd );
+ bool LookForEntry( sal_Int32 nBegin, sal_Int32 nEnd );
};
#endif
diff --git a/sw/source/core/text/SwGrammarMarkUp.cxx b/sw/source/core/text/SwGrammarMarkUp.cxx
index f40ed7d..53c4264 100644
--- a/sw/source/core/text/SwGrammarMarkUp.cxx
+++ b/sw/source/core/text/SwGrammarMarkUp.cxx
@@ -38,31 +38,31 @@ void SwGrammarMarkUp::CopyFrom( const SwWrongList& rCopy )
}
-void SwGrammarMarkUp::MoveGrammar( xub_StrLen nPos, long nDiff )
+void SwGrammarMarkUp::MoveGrammar( sal_Int32 nPos, sal_Int32 nDiff )
{
Move( nPos, nDiff );
if( !maSentence.size() )
return;
- std::vector< xub_StrLen >::iterator pIter = maSentence.begin();
+ std::vector< sal_Int32 >::iterator pIter = maSentence.begin();
while( pIter != maSentence.end() && *pIter < nPos )
++pIter;
- xub_StrLen nEnd = nDiff < 0 ? xub_StrLen(nPos - nDiff) : nPos;
+ const sal_Int32 nEnd = nDiff < 0 ? nPos-nDiff : nPos;
while( pIter != maSentence.end() )
{
if( *pIter >= nEnd )
- *pIter = xub_StrLen( *pIter + nDiff );
+ *pIter += *pIter;
else
*pIter = nPos;
++pIter;
}
}
-SwGrammarMarkUp* SwGrammarMarkUp::SplitGrammarList( xub_StrLen nSplitPos )
+SwGrammarMarkUp* SwGrammarMarkUp::SplitGrammarList( sal_Int32 nSplitPos )
{
SwGrammarMarkUp* pNew = (SwGrammarMarkUp*)SplitList( nSplitPos );
if( !maSentence.size() )
return pNew;
- std::vector< xub_StrLen >::iterator pIter = maSentence.begin();
+ std::vector< sal_Int32 >::iterator pIter = maSentence.begin();
while( pIter != maSentence.end() && *pIter < nSplitPos )
++pIter;
if( pIter != maSentence.begin() )
@@ -77,14 +77,14 @@ SwGrammarMarkUp* SwGrammarMarkUp::SplitGrammarList( xub_StrLen nSplitPos )
return pNew;
}
-void SwGrammarMarkUp::JoinGrammarList( SwGrammarMarkUp* pNext, xub_StrLen nInsertPos )
+void SwGrammarMarkUp::JoinGrammarList( SwGrammarMarkUp* pNext, sal_Int32 nInsertPos )
{
JoinList( pNext, nInsertPos );
if (pNext)
{
if( !pNext->maSentence.size() )
return;
- std::vector< xub_StrLen >::iterator pIter = pNext->maSentence.begin();
+ std::vector< sal_Int32 >::iterator pIter = pNext->maSentence.begin();
while( pIter != pNext->maSentence.end() )
{
*pIter = *pIter + nInsertPos;
@@ -94,21 +94,21 @@ void SwGrammarMarkUp::JoinGrammarList( SwGrammarMarkUp* pNext, xub_StrLen nInser
}
}
-void SwGrammarMarkUp::ClearGrammarList( xub_StrLen nSentenceEnd )
+void SwGrammarMarkUp::ClearGrammarList( sal_Int32 nSentenceEnd )
{
if( STRING_LEN == nSentenceEnd ) {
ClearList();
maSentence.clear();
Validate();
} else if( GetBeginInv() <= nSentenceEnd ) {
- std::vector< xub_StrLen >::iterator pIter = maSentence.begin();
- xub_StrLen nStart = 0;
+ std::vector< sal_Int32 >::iterator pIter = maSentence.begin();
+ sal_Int32 nStart = 0;
while( pIter != maSentence.end() && *pIter < GetBeginInv() )
{
nStart = *pIter;
++pIter;
}
- std::vector< xub_StrLen >::iterator pLast = pIter;
+ std::vector< sal_Int32 >::iterator pLast = pIter;
while( pLast != maSentence.end() && *pLast <= nSentenceEnd )
++pLast;
maSentence.erase( pIter, pLast );
@@ -117,41 +117,39 @@ void SwGrammarMarkUp::ClearGrammarList( xub_StrLen nSentenceEnd )
}
}
-void SwGrammarMarkUp::setSentence( xub_StrLen nStart )
+void SwGrammarMarkUp::setSentence( sal_Int32 nStart )
{
- std::vector< xub_StrLen >::iterator pIter = maSentence.begin();
+ std::vector< sal_Int32 >::iterator pIter = maSentence.begin();
while( pIter != maSentence.end() && *pIter < nStart )
++pIter;
if( pIter == maSentence.end() || *pIter > nStart )
maSentence.insert( pIter, nStart );
}
-xub_StrLen SwGrammarMarkUp::getSentenceStart( xub_StrLen nPos )
+sal_Int32 SwGrammarMarkUp::getSentenceStart( sal_Int32 nPos )
{
if( !maSentence.size() )
return 0;
- std::vector< xub_StrLen >::iterator pIter = maSentence.begin();
+ std::vector< sal_Int32 >::iterator pIter = maSentence.begin();
while( pIter != maSentence.end() && *pIter < nPos )
++pIter;
if( pIter != maSentence.begin() )
--pIter;
- xub_StrLen nRet = 0;
if( pIter != maSentence.end() && *pIter < nPos )
- nRet = *pIter;
- return nRet;
+ return *pIter;
+ return 0;
}
-xub_StrLen SwGrammarMarkUp::getSentenceEnd( xub_StrLen nPos )
+sal_Int32 SwGrammarMarkUp::getSentenceEnd( sal_Int32 nPos )
{
if( !maSentence.size() )
return STRING_LEN;
- std::vector< xub_StrLen >::iterator pIter = maSentence.begin();
+ std::vector< sal_Int32 >::iterator pIter = maSentence.begin();
while( pIter != maSentence.end() && *pIter <= nPos )
++pIter;
- xub_StrLen nRet = STRING_LEN;
if( pIter != maSentence.end() )
- nRet = *pIter;
- return nRet;
+ return *pIter;
+ return STRING_LEN;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index ecde3b0..fa23107 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1696,7 +1696,7 @@ SwTxtSlot::SwTxtSlot(
if ( pOldSmartTagList )
{
const sal_uInt16 nPos = pOldSmartTagList->GetWrongPos(nIdx);
- const xub_StrLen nListPos = pOldSmartTagList->Pos(nPos);
+ const sal_Int32 nListPos = pOldSmartTagList->Pos(nPos);
if( nListPos == nIdx )
((SwTxtPaintInfo*)pInf)->SetSmartTags( pOldSmartTagList->SubList( nPos ) );
else if( !pTempList && nPos < pOldSmartTagList->Count() && nListPos < nIdx && !aTxt.isEmpty() )
@@ -1712,7 +1712,7 @@ SwTxtSlot::SwTxtSlot(
if ( pOldGrammarCheckList )
{
const sal_uInt16 nPos = pOldGrammarCheckList->GetWrongPos(nIdx);
- const xub_StrLen nListPos = pOldGrammarCheckList->Pos(nPos);
+ const sal_Int32 nListPos = pOldGrammarCheckList->Pos(nPos);
if( nListPos == nIdx )
((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( pOldGrammarCheckList->SubList( nPos ) );
else if( !pTempList && nPos < pOldGrammarCheckList->Count() && nListPos < nIdx && !aTxt.isEmpty() )
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 6602f94..51f42eb 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -749,8 +749,8 @@ class SwTxtSlot
const SwWrongList* pOldSmartTagList;
const SwWrongList* pOldGrammarCheckList;
SwWrongList* pTempList;
- xub_StrLen nIdx;
- xub_StrLen nLen;
+ sal_Int32 nIdx;
+ sal_Int32 nLen;
sal_Bool bOn;
protected:
SwTxtSizeInfo *pInf;
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index b00a588..3079288 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -810,7 +810,7 @@ void SwTxtFrm::CalcLineSpace()
}
}
-static void lcl_SetWrong( SwTxtFrm& rFrm, sal_Int32 nPos, long nCnt, bool bMove )
+static void lcl_SetWrong( SwTxtFrm& rFrm, sal_Int32 nPos, sal_Int32 nCnt, bool bMove )
{
if ( !rFrm.IsFollow() )
{
@@ -833,24 +833,24 @@ static void lcl_SetWrong( SwTxtFrm& rFrm, sal_Int32 nPos, long nCnt, bool bMove
}
else
{
- xub_StrLen nLen = (xub_StrLen)nCnt;
if( pTxtNode->GetWrong() )
- pTxtNode->GetWrong()->Invalidate( nPos, nLen );
+ pTxtNode->GetWrong()->Invalidate( nPos, nCnt );
if( pWrongGrammar )
- pWrongGrammar->Invalidate( nPos, nLen );
+ pWrongGrammar->Invalidate( nPos, nCnt );
if( pTxtNode->GetSmartTags() )
- pTxtNode->GetSmartTags()->Invalidate( nPos, nLen );
+ pTxtNode->GetSmartTags()->Invalidate( nPos, nCnt );
}
+ const sal_Int32 nEnd = nPos + (nCnt > 0 ? nCnt : 1 );
if ( !pTxtNode->GetWrong() && !pTxtNode->IsWrongDirty() )
{
pTxtNode->SetWrong( new SwWrongList( WRONGLIST_SPELL ) );
- pTxtNode->GetWrong()->SetInvalid( nPos, nPos + (sal_uInt16)( nCnt > 0 ? nCnt : 1 ) );
+ pTxtNode->GetWrong()->SetInvalid( nPos, nEnd );
}
if ( !pTxtNode->GetSmartTags() && !pTxtNode->IsSmartTagDirty() )
{
// SMARTTAGS
pTxtNode->SetSmartTags( new SwWrongList( WRONGLIST_SMARTTAG ) );
- pTxtNode->GetSmartTags()->SetInvalid( nPos, nPos + (sal_uInt16)( nCnt > 0 ? nCnt : 1 ) );
+ pTxtNode->GetSmartTags()->SetInvalid( nPos, nEnd );
}
pTxtNode->SetWrongDirty( true );
pTxtNode->SetGrammarCheckDirty( true );
@@ -986,8 +986,7 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
{
nPos = ((SwDelTxt*)pNew)->nStart;
nLen = ((SwDelTxt*)pNew)->nLen;
- long m = nLen;
- m *= -1;
+ const sal_Int32 m = -nLen;
if( IsIdxInside( nPos, nLen ) )
{
if( !nLen )
diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx
index 00930b0..49d76f8 100644
--- a/sw/source/core/text/wrong.cxx
+++ b/sw/source/core/text/wrong.cxx
@@ -28,8 +28,8 @@
SwWrongArea::SwWrongArea( const rtl::OUString& rType, WrongListType listType,
com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag,
- xub_StrLen nPos,
- xub_StrLen nLen)
+ sal_Int32 nPos,
+ sal_Int32 nLen)
: maType(rType), mxPropertyBag(xPropertyBag), mnPos(nPos), mnLen(nLen), mpSubList(0)
{
mColor = getWrongAreaColor(listType, xPropertyBag);
@@ -38,8 +38,8 @@ SwWrongArea::SwWrongArea( const rtl::OUString& rType, WrongListType listType,
SwWrongArea::SwWrongArea( const rtl::OUString& rType,
com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag,
- xub_StrLen nPos,
- xub_StrLen nLen,
+ sal_Int32 nPos,
+ sal_Int32 nLen,
SwWrongList* pSubList)
: maType(rType), mxPropertyBag(xPropertyBag), mnPos(nPos), mnLen(nLen), mpSubList(pSubList), mLineType(WRONGAREA_NONE)
{
@@ -130,27 +130,24 @@ sal_Bool SwWrongList::InWrongWord( sal_Int32 &rChk, sal_Int32 &rLn ) const
/*************************************************************************
* sal_Bool SwWrongList::Check() liefert den ersten falschen Bereich
*************************************************************************/
-sal_Bool SwWrongList::Check( xub_StrLen &rChk, xub_StrLen &rLn ) const
+sal_Bool SwWrongList::Check( sal_Int32 &rChk, sal_Int32 &rLn ) const
{
MSHORT nPos = GetWrongPos( rChk );
- rLn = rLn + rChk;
- xub_StrLen nWrPos;
+ rLn += rChk;
if( nPos == Count() )
return sal_False;
- xub_StrLen nEnd = Len( nPos );
- nEnd = nEnd + ( nWrPos = Pos( nPos ) );
+ sal_Int32 nWrPos = Pos( nPos );
+ sal_Int32 nEnd = nWrPos + Len( nPos );
if( nEnd == rChk )
{
++nPos;
if( nPos == Count() )
return sal_False;
- else
- {
- nEnd = Len( nPos );
- nEnd = nEnd + ( nWrPos = Pos( nPos ) );
- }
+
+ nWrPos = Pos( nPos );
+ nEnd = nWrPos + Len( nPos );
}
if( nEnd > rChk && nWrPos < rLn )
{
@@ -158,20 +155,20 @@ sal_Bool SwWrongList::Check( xub_StrLen &rChk, xub_StrLen &rLn ) const
rChk = nWrPos;
if( nEnd < rLn )
rLn = nEnd;
- rLn = rLn - rChk;
+ rLn -= rChk;
return 0 != rLn;
}
return sal_False;
}
/*************************************************************************
- * xub_StrLen SwWrongList::NextWrong() liefert die naechste Fehlerposition
+ * sal_Int32 SwWrongList::NextWrong() liefert die naechste Fehlerposition
*************************************************************************/
-xub_StrLen SwWrongList::NextWrong( xub_StrLen nChk ) const
+sal_Int32 SwWrongList::NextWrong( sal_Int32 nChk ) const
{
- xub_StrLen nRet;
- xub_StrLen nPos = GetWrongPos( nChk );
+ sal_Int32 nRet = STRING_LEN;
+ sal_uInt16 nPos = GetWrongPos( nChk );
if( nPos < Count() )
{
nRet = Pos( nPos );
@@ -183,22 +180,21 @@ xub_StrLen SwWrongList::NextWrong( xub_StrLen nChk ) const
nRet = STRING_LEN;
}
}
- else
- nRet = STRING_LEN;
if( nRet > GetBeginInv() && nChk < GetEndInv() )
nRet = nChk > GetBeginInv() ? nChk : GetBeginInv();
return nRet;
}
/*************************************************************************
- * MSHORT SwWrongList::GetWrongPos( xub_StrLen nValue )
+ * sal_uInt16 SwWrongList::GetWrongPos( sal_Int32 nValue )
* sucht die erste Position im Array, die groessergleich nValue ist,
* dies kann natuerlich auch hinter dem letzten Element sein!
*************************************************************************/
-MSHORT SwWrongList::GetWrongPos( xub_StrLen nValue ) const
+sal_uInt16 SwWrongList::GetWrongPos( sal_Int32 nValue ) const
{
- MSHORT nOben = Count(), nUnten = 0;
+ sal_uInt16 nOben = Count();
+ sal_uInt16 nUnten = 0;
if( nOben > 0 )
{
@@ -208,11 +204,11 @@ MSHORT SwWrongList::GetWrongPos( xub_StrLen nValue ) const
{
for (std::vector<SwWrongArea>::const_iterator aIter(maList.begin()), aEnd(maList.end()); aIter != aEnd; ++aIter)
{
- const xub_StrLen nSTPos = (*aIter).mnPos;
- const xub_StrLen nSTLen = (*aIter).mnLen;
+ const sal_Int32 nSTPos = (*aIter).mnPos;
+ const sal_Int32 nSTLen = (*aIter).mnLen;
if ( nSTPos <= nValue && nValue < nSTPos + nSTLen )
break;
- else if ( nSTPos > nValue )
+ if ( nSTPos > nValue )
break;
++nUnten;
@@ -221,11 +217,11 @@ MSHORT SwWrongList::GetWrongPos( xub_StrLen nValue ) const
}
--nOben;
- MSHORT nMitte = 0;
+ sal_uInt16 nMitte = 0;
while( nUnten <= nOben )
{
nMitte = nUnten + ( nOben - nUnten ) / 2;
- xub_StrLen nTmp = Pos( nMitte );
+ const sal_Int32 nTmp = Pos( nMitte );
if( nTmp == nValue )
{
nUnten = nMitte;
@@ -260,7 +256,7 @@ MSHORT SwWrongList::GetWrongPos( xub_StrLen nValue ) const
* void SwWrongList::_Invalidate()
*************************************************************************/
-void SwWrongList::_Invalidate( xub_StrLen nBegin, xub_StrLen nEnd )
+void SwWrongList::_Invalidate( sal_Int32 nBegin, sal_Int32 nEnd )
{
if ( nBegin < GetBeginInv() )
nBeginInvalid = nBegin;
@@ -268,7 +264,7 @@ void SwWrongList::_Invalidate( xub_StrLen nBegin, xub_StrLen nEnd )
nEndInvalid = nEnd;
}
-void SwWrongList::SetInvalid( xub_StrLen nBegin, xub_StrLen nEnd )
+void SwWrongList::SetInvalid( sal_Int32 nBegin, sal_Int32 nEnd )
{
nBeginInvalid = nBegin;
nEndInvalid = nEnd;
@@ -276,34 +272,36 @@ void SwWrongList::SetInvalid( xub_StrLen nBegin, xub_StrLen nEnd )
/*************************************************************************
- * SwWrongList::Move( xub_StrLen nPos, long nDiff )
+ * SwWrongList::Move( sal_Int32 nPos, sal_Int32 nDiff )
* veraendert alle Positionen ab nPos um den angegebenen Wert,
* wird nach Einfuegen oder Loeschen von Buchstaben benoetigt.
*************************************************************************/
-void SwWrongList::Move( xub_StrLen nPos, long nDiff )
+void SwWrongList::Move( sal_Int32 nPos, sal_Int32 nDiff )
{
MSHORT i = GetWrongPos( nPos );
if( nDiff < 0 )
{
- xub_StrLen nEnd = nPos + xub_StrLen( -nDiff );
+ const sal_Int32 nEnd = nPos - nDiff;
MSHORT nLst = i;
- xub_StrLen nWrPos;
- xub_StrLen nWrLen;
bool bJump = false;
while( nLst < Count() && Pos( nLst ) < nEnd )
++nLst;
- if( nLst > i && ( nWrPos = Pos( nLst - 1 ) ) <= nPos )
+ if( nLst > i )
{
- nWrLen = Len( nLst - 1 );
- // calculate new length of word
- nWrLen = ( nEnd > nWrPos + nWrLen ) ?
- nPos - nWrPos :
- static_cast<xub_StrLen>(nWrLen + nDiff);
- if( nWrLen )
+ const sal_Int32 nWrPos = Pos( nLst - 1 );
+ if ( nWrPos <= nPos )
{
- maList[--nLst].mnLen = nWrLen;
- bJump = true;
+ sal_Int32 nWrLen = Len( nLst - 1 );
+ // calculate new length of word
+ nWrLen = ( nEnd > nWrPos + nWrLen ) ?
+ nPos - nWrPos :
+ nWrLen + nDiff;
+ if( nWrLen )
+ {
+ maList[--nLst].mnLen = nWrLen;
+ bJump = true;
+ }
}
}
Remove( i, nLst - i );
@@ -321,32 +319,33 @@ void SwWrongList::Move( xub_StrLen nPos, long nDiff )
}
else
{
- xub_StrLen nWrPos;
- xub_StrLen nEnd = nPos + xub_StrLen( nDiff );
+ const sal_Int32 nEnd = nPos + nDiff;
if( STRING_LEN != GetBeginInv() )
{
if( nBeginInvalid > nPos )
- nBeginInvalid = nBeginInvalid + xub_StrLen( nDiff );
+ nBeginInvalid += nDiff;
if( nEndInvalid >= nPos )
- nEndInvalid = nEndInvalid + xub_StrLen( nDiff );
+ nEndInvalid += nDiff;
}
// Wenn wir mitten in einem falschen Wort stehen, muss vom Wortanfang
// invalidiert werden.
- if( i < Count() && nPos >= ( nWrPos = Pos( i ) ) )
+ if( i < Count() )
{
- Invalidate( nWrPos, nEnd );
- xub_StrLen nWrLen = Len( i ) + xub_StrLen( nDiff );
- maList[i++].mnLen = nWrLen;
- nWrLen = nWrLen + nWrPos;
- Invalidate( nWrPos, nWrLen );
+ const sal_Int32 nWrPos = Pos( i );
+ if (nPos >= nWrPos)
+ {
+ Invalidate( nWrPos, nEnd );
+ const sal_Int32 nWrLen = Len( i ) + nDiff;
+ maList[i++].mnLen = nWrLen;
+ Invalidate( nWrPos, nWrPos + nWrLen );
+ }
}
else
Invalidate( nPos, nEnd );
}
while( i < Count() )
{
- const xub_StrLen nTmp = static_cast<xub_StrLen>(nDiff + maList[i].mnPos);
- maList[i++].mnPos = nTmp;
+ maList[i++].mnPos += nDiff;
}
}
@@ -357,23 +356,29 @@ void SwWrongList::Move( xub_StrLen nPos, long nDiff )
* basically counts the number of SwWrongArea entries starting with nIndex
* up to nPos + nLen. All these entries are removed.
*************************************************************************/
-sal_Bool SwWrongList::Fresh( xub_StrLen &rStart, xub_StrLen &rEnd, xub_StrLen nPos,
- xub_StrLen nLen, MSHORT nIndex, xub_StrLen nCursorPos )
+sal_Bool SwWrongList::Fresh( sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nPos,
+ sal_Int32 nLen, MSHORT nIndex, sal_Int32 nCursorPos )
{
// length of word must be greater than 0 and cursor position must be outside the word
sal_Bool bRet = nLen && ( nCursorPos > nPos + nLen || nCursorPos < nPos );
- xub_StrLen nWrPos = 0;
- xub_StrLen nWrEnd = rEnd;
+ sal_Int32 nWrPos = 0;
+ sal_Int32 nWrEnd = rEnd;
MSHORT nCnt = nIndex;
- if( nCnt < Count() && ( nWrPos = Pos( nIndex ) ) < nPos )
+ if( nCnt < Count() )
{
- if( rStart > nWrPos )
+ nWrPos = Pos( nIndex );
+ if( nWrPos < nPos && rStart > nWrPos )
rStart = nWrPos;
}
- while( nCnt < Count() && ( nWrPos = Pos( nCnt ) ) < nPos )
+ while( nCnt < Count() )
+ {
+ nWrPos = Pos( nCnt );
+ if ( nWrPos >= nPos )
+ break;
nWrEnd = nWrPos + Len( nCnt++ );
+ }
if( nCnt < Count() && nWrPos == nPos && Len( nCnt ) == nLen )
{
@@ -390,16 +395,22 @@ sal_Bool SwWrongList::Fresh( xub_StrLen &rStart, xub_StrLen &rEnd, xub_StrLen nP
}
}
- nPos = nPos + nLen;
+ nPos += nLen;
- if( nCnt < Count() && ( nWrPos = Pos( nCnt ) ) < nPos )
+ if( nCnt < Count() )
{
- if( rStart > nWrPos )
+ nWrPos = Pos( nCnt );
+ if( nWrPos < nPos && rStart > nWrPos )
rStart = nWrPos;
}
- while( nCnt < Count() && ( nWrPos = Pos( nCnt ) ) < nPos )
+ while( nCnt < Count() )
+ {
+ nWrPos = Pos( nCnt );
+ if ( nWrPos >= nPos )
+ break;
nWrEnd = nWrPos + Len( nCnt++ );
+ }
if( rEnd < nWrEnd )
rEnd = nWrEnd;
@@ -409,7 +420,7 @@ sal_Bool SwWrongList::Fresh( xub_StrLen &rStart, xub_StrLen &rEnd, xub_StrLen nP
return bRet;
}
-void SwWrongList::Invalidate( xub_StrLen nBegin, xub_StrLen nEnd )
+void SwWrongList::Invalidate( sal_Int32 nBegin, sal_Int32 nEnd )
{
if (STRING_LEN == GetBeginInv())
SetInvalid( nBegin, nEnd );
@@ -421,29 +432,30 @@ sal_Bool SwWrongList::InvalidateWrong( )
{
if( Count() )
{
- xub_StrLen nFirst = Pos( 0 );
- xub_StrLen nLast = Pos( Count() - 1 ) + Len( Count() - 1 );
+ const sal_Int32 nFirst = Pos( 0 );
+ const sal_Int32 nLast = Pos( Count() - 1 ) + Len( Count() - 1 );
Invalidate( nFirst, nLast );
return sal_True;
}
- else
- return sal_False;
+ return sal_False;
}
-SwWrongList* SwWrongList::SplitList( xub_StrLen nSplitPos )
+SwWrongList* SwWrongList::SplitList( sal_Int32 nSplitPos )
{
SwWrongList *pRet = NULL;
MSHORT nLst = 0;
- xub_StrLen nWrPos;
- xub_StrLen nWrLen;
while( nLst < Count() && Pos( nLst ) < nSplitPos )
++nLst;
- if( nLst && ( nWrPos = Pos( nLst - 1 ) )
- + ( nWrLen = Len( nLst - 1 ) ) > nSplitPos )
+ if( nLst )
{
- nWrLen += nWrPos - nSplitPos;
- maList[--nLst].mnPos = nSplitPos;
- maList[nLst].mnLen = nWrLen;
+ sal_Int32 nWrPos = Pos( nLst - 1 );
+ sal_Int32 nWrLen = Len( nLst - 1 );
+ if ( nWrPos+nWrLen > nSplitPos )
+ {
+ nWrLen += nWrPos - nSplitPos;
+ maList[--nLst].mnPos = nSplitPos;
+ maList[nLst].mnLen = nWrLen;
+ }
}
if( nLst )
{
@@ -464,16 +476,14 @@ SwWrongList* SwWrongList::SplitList( xub_StrLen nSplitPos )
ShiftLeft( nEndInvalid, 0, nSplitPos );
_Invalidate( 0, 1 );
}
- nLst = 0;
- while( nLst < Count() )
+ for (nLst = 0; nLst < Count(); ++nLst )
{
- nWrPos = maList[nLst].mnPos - nSplitPos;
- maList[nLst++].mnPos = nWrPos;
+ maList[nLst].mnPos -= nSplitPos;
}
return pRet;
}
-void SwWrongList::JoinList( SwWrongList* pNext, xub_StrLen nInsertPos )
+void SwWrongList::JoinList( SwWrongList* pNext, sal_Int32 nInsertPos )
{
if (pNext)
{
@@ -488,18 +498,18 @@ void SwWrongList::JoinList( SwWrongList* pNext, xub_StrLen nInsertPos )
Invalidate( pNext->GetBeginInv(), pNext->GetEndInv() );
if( nCnt && Count() > nCnt )
{
- xub_StrLen nWrPos = Pos( nCnt );
- xub_StrLen nWrLen = Len( nCnt );
+ sal_Int32 nWrPos = Pos( nCnt );
+ sal_Int32 nWrLen = Len( nCnt );
if( !nWrPos )
{
- nWrPos = nWrPos + nInsertPos;
- nWrLen = nWrLen - nInsertPos;
+ nWrPos += nInsertPos;
+ nWrLen -= nInsertPos;
maList[nCnt].mnPos = nWrPos;
maList[nCnt].mnLen = nWrLen;
}
if( nWrPos == Pos( nCnt - 1 ) + Len( nCnt - 1 ) )
{
- nWrLen = nWrLen + Len( nCnt - 1 );
+ nWrLen += Len( nCnt - 1 );
maList[nCnt - 1].mnLen = nWrLen;
Remove( nCnt, 1 );
}
@@ -509,7 +519,7 @@ void SwWrongList::JoinList( SwWrongList* pNext, xub_StrLen nInsertPos )
}
-void SwWrongList::InsertSubList( xub_StrLen nNewPos, xub_StrLen nNewLen, sal_uInt16 nWhere, SwWrongList* pSubList )
+void SwWrongList::InsertSubList( sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere, SwWrongList* pSubList )
{
if (pSubList)
{
@@ -575,7 +585,7 @@ void SwWrongList::Remove(sal_uInt16 nIdx, sal_uInt16 nLen )
#endif
}
-void SwWrongList::RemoveEntry( xub_StrLen nBegin, xub_StrLen nEnd ) {
+void SwWrongList::RemoveEntry( sal_Int32 nBegin, sal_Int32 nEnd ) {
sal_uInt16 nDelPos = 0;
sal_uInt16 nDel = 0;
std::vector<SwWrongArea>::const_iterator aIter(maList.begin()), aEnd(maList.end());
@@ -604,7 +614,7 @@ void SwWrongList::RemoveEntry( xub_StrLen nBegin, xub_StrLen nEnd ) {
Remove( nDelPos, nDel );
}
-bool SwWrongList::LookForEntry( xub_StrLen nBegin, xub_StrLen nEnd ) {
+bool SwWrongList::LookForEntry( sal_Int32 nBegin, sal_Int32 nEnd ) {
std::vector<SwWrongArea>::iterator aIter = maList.begin();
while( aIter != maList.end() && (*aIter).mnPos < nBegin )
++aIter;
@@ -615,13 +625,13 @@ bool SwWrongList::LookForEntry( xub_StrLen nBegin, xub_StrLen nEnd ) {
void SwWrongList::Insert( const OUString& rType,
com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag,
- xub_StrLen nNewPos, xub_StrLen nNewLen )
+ sal_Int32 nNewPos, sal_Int32 nNewLen )
{
std::vector<SwWrongArea>::iterator aIter = maList.begin();
while ( aIter != maList.end() )
{
- const xub_StrLen nSTPos = (*aIter).mnPos;
+ const sal_Int32 nSTPos = (*aIter).mnPos;
if ( nNewPos < nSTPos )
{
@@ -632,9 +642,7 @@ void SwWrongList::Insert( const OUString& rType,
{
while ( aIter != maList.end() && (*aIter).mnPos == nSTPos )
{
- const xub_StrLen nSTLen = (*aIter).mnLen;
-
- if ( nNewLen < nSTLen )
+ if ( nNewLen < (*aIter).mnLen )
{
// insert at current position
break;
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index a1b0eeb..5d33091 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -673,7 +673,7 @@ static bool lcl_IsMonoSpaceFont( const OutputDevice& rOut )
/* This helper structure (SwForbidden) contains the already marked parts of the string
to avoid double lines (e.g grammar + spell check error) */
-typedef std::vector< std::pair< xub_StrLen, xub_StrLen > > SwForbidden;
+typedef std::vector< std::pair< sal_Int32, sal_Int32 > > SwForbidden;
static void lcl_DrawLineForWrongListData(
SwForbidden &rForbidden,
@@ -684,8 +684,8 @@ static void lcl_DrawLineForWrongListData(
{
if (!pWList) return;
- xub_StrLen nStart = rInf.GetIdx();
- xub_StrLen nWrLen = rInf.GetLen();
+ sal_Int32 nStart = rInf.GetIdx();
+ sal_Int32 nWrLen = rInf.GetLen();
// check if respective data is available in the current text range
if (!pWList->Check( nStart, nWrLen ))
@@ -711,22 +711,22 @@ static void lcl_DrawLineForWrongListData(
// iterate over all ranges stored in the respective SwWrongList
do
{
- nStart = nStart - rInf.GetIdx();
+ nStart -= rInf.GetIdx();
- const xub_StrLen nEnd = nStart + nWrLen;
- xub_StrLen nNext = nStart;
+ const sal_Int32 nEnd = nStart + nWrLen;
+ sal_Int32 nNext = nStart;
while( nNext < nEnd )
{
while( pIter != rForbidden.end() && pIter->second <= nNext )
++pIter;
- xub_StrLen nNextStart = nNext;
- xub_StrLen nNextEnd = nEnd;
+ const sal_Int32 nNextStart = nNext;
+ sal_Int32 nNextEnd = nEnd;
if( pIter == rForbidden.end() || nNextEnd <= pIter->first )
{
// No overlapping mark up found
- std::pair< xub_StrLen, xub_StrLen > aNew;
+ std::pair< sal_Int32, sal_Int32 > aNew;
aNew.first = nNextStart;
aNew.second = nNextEnd;
rForbidden.insert( pIter, aNew );
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 900419c..679a328 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -965,7 +965,7 @@ sal_uInt16 SwTxtNode::Spell(SwSpellArgs* pArgs)
//
if(!IsWrongDirty())
{
- xub_StrLen nTemp = GetWrong()->NextWrong( nBegin );
+ const sal_Int32 nTemp = GetWrong()->NextWrong( nBegin );
if(nTemp > nEnd)
{
// reset original text
@@ -1243,13 +1243,13 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
// a change of data indicates that at least one word has been modified
const bool bRedlineChg = (pNode->GetTxt().getStr() != aOldTxt.getStr());
- xub_StrLen nBegin = 0;
- sal_Int32 nEnd = pNode->GetTxt().getLength();
- xub_StrLen nInsertPos = 0;
- xub_StrLen nChgStart = STRING_LEN;
- xub_StrLen nChgEnd = 0;
- xub_StrLen nInvStart = STRING_LEN;
- xub_StrLen nInvEnd = 0;
+ sal_Int32 nBegin = 0;
+ sal_Int32 nEnd = pNode->GetTxt().getLength();
+ sal_Int32 nInsertPos = 0;
+ sal_Int32 nChgStart = STRING_LEN;
+ sal_Int32 nChgEnd = 0;
+ sal_Int32 nInvStart = STRING_LEN;
+ sal_Int32 nInvEnd = 0;
const bool bAddAutoCmpl = pNode->IsAutoCompleteWordDirty() &&
rViewOpt.IsAutoCompleteWords();
@@ -1259,11 +1259,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
nBegin = pNode->GetWrong()->GetBeginInv();
if( STRING_LEN != nBegin )
{
- nEnd = pNode->GetWrong()->GetEndInv();
- if (nEnd > pNode->GetTxt().getLength())
- {
- nEnd = pNode->GetTxt().getLength();
- }
+ nEnd = std::max(pNode->GetWrong()->GetEndInv(), pNode->GetTxt().getLength());
}
// get word around nBegin, we start at nBegin - 1
@@ -1277,7 +1273,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
g_pBreakIt->GetBreakIter()->getWordBoundary( pNode->GetTxt(), nBegin,
g_pBreakIt->GetLocale( eActLang ),
WordType::DICTIONARY_WORD, sal_True );
- nBegin = xub_StrLen(aBound.startPos);
+ nBegin = aBound.startPos;
}
// get the position in the wrong list
@@ -1413,22 +1409,22 @@ SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/
SwWrongList* pSmartTagList = pNode->GetSmartTags();
- xub_StrLen nBegin = 0;
- xub_StrLen nEnd = static_cast< xub_StrLen >(rText.getLength());
+ sal_Int32 nBegin = 0;
+ sal_Int32 nEnd = rText.getLength();
if ( pSmartTagList )
{
if ( pSmartTagList->GetBeginInv() != STRING_LEN )
{
nBegin = pSmartTagList->GetBeginInv();
- nEnd = std::min( pSmartTagList->GetEndInv(), (xub_StrLen)rText.getLength() );
+ nEnd = std::min( pSmartTagList->GetEndInv(), rText.getLength() );
if ( nBegin < nEnd )
{
const LanguageType aCurrLang = pNode->GetLang( nBegin );
const com::sun::star::lang::Locale aCurrLocale = g_pBreakIt->GetLocale( aCurrLang );
- nBegin = static_cast< xub_StrLen >(g_pBreakIt->GetBreakIter()->beginOfSentence( rText, nBegin, aCurrLocale ));
- nEnd = static_cast< xub_StrLen >(std::min( rText.getLength(), g_pBreakIt->GetBreakIter()->endOfSentence( rText, nEnd, aCurrLocale ) ));
+ nBegin = g_pBreakIt->GetBreakIter()->beginOfSentence( rText, nBegin, aCurrLocale );
+ nEnd = std::min( rText.getLength(), g_pBreakIt->GetBreakIter()->endOfSentence( rText, nEnd, aCurrLocale ) );
}
}
}
@@ -1440,8 +1436,8 @@ SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/
// clear smart tag list between nBegin and nEnd:
if ( 0 != nNumberOfEntries )
{
- xub_StrLen nChgStart = STRING_LEN;
- xub_StrLen nChgEnd = 0;
+ sal_Int32 nChgStart = STRING_LEN;
+ sal_Int32 nChgEnd = 0;
const sal_uInt16 nCurrentIndex = pSmartTagList->GetWrongPos( nBegin );
pSmartTagList->Fresh( nChgStart, nChgEnd, nBegin, nEnd - nBegin, nCurrentIndex, STRING_LEN );
nNumberOfRemovedEntries = nNumberOfEntries - pSmartTagList->Count();
@@ -1466,8 +1462,8 @@ SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/
rSmartTagMgr.RecognizeTextRange(xRange, xTextMarkup, xController);
- xub_StrLen nLangBegin = nBegin;
- xub_StrLen nLangEnd = nEnd;
+ sal_Int32 nLangBegin = nBegin;
+ sal_Int32 nLangEnd = nEnd;
// smart tag recognization has to be done for each language portion:
SwLanguageIterator aIter( *pNode, nLangBegin );
@@ -1476,7 +1472,7 @@ SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/
{
const LanguageType nLang = aIter.GetLanguage();
const com::sun::star::lang::Locale aLocale = g_pBreakIt->GetLocale( nLang );
- nLangEnd = std::min( nEnd, aIter.GetChgPos() );
+ nLangEnd = std::min<sal_Int32>( nEnd, aIter.GetChgPos() );
const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nLangBegin );
const sal_Int32 nExpandEnd = aConversionMap.ConvertToViewPosition( nLangEnd );
diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx
index dc7b04b..1a28999 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -188,7 +188,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup(
if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
{
nStart = aStartPos.mnSubPos;
- const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
+ const sal_Int32 nFieldPosModel = aStartPos.mnPos;
const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
SwWrongList* pSubList = pWList->SubList( nInsertPos );
@@ -217,7 +217,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup(
sal_Int32 nEnd = aEndPos.mnPos;
if( bStartInField && nType != text::TextMarkupType::SENTENCE )
{
- const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
+ const sal_Int32 nFieldPosModel = aStartPos.mnPos;
const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
SwWrongList* pSubList = pWList->SubList( nInsertPos );
if ( !pSubList )
@@ -232,18 +232,17 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup(
{
if( nType == text::TextMarkupType::SENTENCE )
{
- ((SwGrammarMarkUp*)pSubList)->setSentence( static_cast< xub_StrLen >(aStartPos.mnSubPos) );
+ ((SwGrammarMarkUp*)pSubList)->setSentence( aStartPos.mnSubPos );
bCommit = false;
}
else
- pSubList->Insert( rIdentifier, xMarkupInfoContainer,
- static_cast< xub_StrLen >(aStartPos.mnSubPos), static_cast< xub_StrLen >(nTmpLen) );
+ pSubList->Insert( rIdentifier, xMarkupInfoContainer, aStartPos.mnSubPos, nTmpLen );
}
++nStart;
}
if( bEndInField && nType != text::TextMarkupType::SENTENCE )
{
- const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aEndPos.mnPos);
+ const sal_Int32 nFieldPosModel = aEndPos.mnPos;
const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
SwWrongList* pSubList = pWList->SubList( nInsertPos );
if ( !pSubList )
@@ -252,7 +251,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup(
pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
}
const sal_Int32 nTmpLen = aEndPos.mnSubPos + 1;
- pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, static_cast< xub_StrLen >(nTmpLen) );
+ pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, nTmpLen );
}
else
++nEnd;
@@ -265,10 +264,9 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup(
if ( bCommit )
{
if( nType == text::TextMarkupType::SENTENCE )
- ((SwGrammarMarkUp*)pWList)->setSentence( static_cast< xub_StrLen >(nStart) );
+ ((SwGrammarMarkUp*)pWList)->setSentence( nStart );
else
- pWList->Insert( rIdentifier, xMarkupInfoContainer,
- static_cast< xub_StrLen >(nStart), static_cast< xub_StrLen >(nLength) );
+ pWList->Insert( rIdentifier, xMarkupInfoContainer, nStart, nLength );
}
if( bRepaint )
@@ -298,7 +296,7 @@ static void lcl_commitGrammarMarkUp(
if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
{
nStart = aStartPos.mnSubPos;
- const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
+ const sal_Int32 nFieldPosModel = aStartPos.mnPos;
const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos );
@@ -324,7 +322,7 @@ static void lcl_commitGrammarMarkUp(
sal_Int32 nEnd = aEndPos.mnPos;
if( bStartInField && nType != text::TextMarkupType::SENTENCE )
{
- const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
+ const sal_Int32 nFieldPosModel = aStartPos.mnPos;
const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos );
if ( !pSubList )
@@ -336,13 +334,12 @@ static void lcl_commitGrammarMarkUp(
const sal_Int32 nTmpLen = rConversionMap.ConvertToViewPosition( aStartPos.mnPos + 1 )
- nTmpStart - aStartPos.mnSubPos;
if( nTmpLen > 0 )
- pSubList->Insert( rIdentifier, xMarkupInfoContainer,
- static_cast< xub_StrLen >(aStartPos.mnSubPos), static_cast< xub_StrLen >(nTmpLen) );
+ pSubList->Insert( rIdentifier, xMarkupInfoContainer, aStartPos.mnSubPos, nTmpLen );
++nStart;
}
if( bEndInField && nType != text::TextMarkupType::SENTENCE )
{
- const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aEndPos.mnPos);
+ const sal_Int32 nFieldPosModel = aEndPos.mnPos;
const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos );
if ( !pSubList )
@@ -351,7 +348,7 @@ static void lcl_commitGrammarMarkUp(
pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
}
const sal_Int32 nTmpLen = aEndPos.mnSubPos + 1;
- pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, static_cast< xub_StrLen >(nTmpLen) );
+ pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, nTmpLen );
}
else
++nEnd;
@@ -364,10 +361,9 @@ static void lcl_commitGrammarMarkUp(
if ( bCommit )
{
if( nType == text::TextMarkupType::SENTENCE )
- ((SwGrammarMarkUp*)pWList)->setSentence( static_cast< xub_StrLen >(nStart+nLength) );
+ ((SwGrammarMarkUp*)pWList)->setSentence( nStart+nLength );
else
- pWList->Insert( rIdentifier, xMarkupInfoContainer,
- static_cast< xub_StrLen >(nStart), static_cast< xub_StrLen >(nLength) );
+ pWList->Insert( rIdentifier, xMarkupInfoContainer, nStart, nLength );
}
}
@@ -437,8 +433,8 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
const ModelToViewHelper::ModelPosition aSentenceEnd =
maConversionMap.ConvertToModelPosition(
pMarkups[nSentenceMarkUpIndex].nOffset + pMarkups[nSentenceMarkUpIndex].nLength );
- bAcceptGrammarError = (xub_StrLen)aSentenceEnd.mnPos > pWList->GetBeginInv();
- pWList->ClearGrammarList( (xub_StrLen)aSentenceEnd.mnPos );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list