summaryrefslogtreecommitdiff
path: root/sw/source/core/text
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/text')
-rw-r--r--sw/source/core/text/frmpaint.cxx6
-rw-r--r--sw/source/core/text/itratr.cxx4
-rw-r--r--sw/source/core/text/porlay.cxx119
-rw-r--r--sw/source/core/text/pormulti.cxx102
-rw-r--r--sw/source/core/text/txtfld.cxx91
5 files changed, 184 insertions, 138 deletions
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 443900e1942c..9babcdde2b79 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -38,12 +38,8 @@
#include <tgrditem.hxx>
#include <paratr.hxx>
-#ifndef _FMTLINE_HXX
#include <fmtline.hxx>
-#endif
-#ifndef _LINEINFO_HXX
#include <lineinfo.hxx>
-#endif
#include <charfmt.hxx>
#include <pagefrm.hxx>
#include <viewsh.hxx> // ViewShell
@@ -596,7 +592,7 @@ sal_Bool SwTxtFrm::PaintEmpty( const SwRect &rRect, sal_Bool bCheck ) const
* SwTxtFrm::Paint()
*************************************************************************/
-void SwTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) const
+void SwTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
{
ResetRepaint();
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 36eaed83795c..c4ec51b5ecb4 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -779,7 +779,7 @@ void SwTxtNode::GetMinMaxSize( ULONG nIndex, ULONG& rMin, ULONG &rMax,
case RES_TXTATR_FIELD :
{
SwField *pFld = (SwField*)pHint->GetFld().GetFld();
- const String aTxt = pFld->GetCntnt( FALSE );
+ const String aTxt = pFld->ExpandField(true);
if( lcl_MinMaxString( aArg, aIter.GetFnt(), aTxt, 0,
aTxt.Len() ) )
nAdd = 20;
@@ -982,7 +982,7 @@ USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd )
case RES_TXTATR_FIELD :
{
SwField *pFld = (SwField*)pHint->GetFld().GetFld();
- const String aTxt = pFld->GetCntnt( FALSE );
+ String const aTxt = pFld->ExpandField(true);
SwDrawTextInfo aDrawInf( pSh, *pOut, 0, aTxt, 0, aTxt.Len() );
nProWidth += aIter.GetFnt()->_GetTxtSize( aDrawInf ).Width();
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index dd2c1c3a1d38..84732637628c 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -805,8 +805,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
MultiSelection aHiddenMulti( aRange );
CalcHiddenRanges( rNode, aHiddenMulti );
- aHiddenChg.Remove( 0, aHiddenChg.Count() );
- USHORT nHiddenIdx = 0;
+ aHiddenChg.clear();
USHORT i = 0;
for( i = 0; i < aHiddenMulti.GetRangeCount(); ++i )
{
@@ -814,8 +813,8 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
const xub_StrLen nStart = (xub_StrLen)rRange.Min();
const xub_StrLen nEnd = (xub_StrLen)rRange.Max() + 1;
- aHiddenChg.Insert( nStart, nHiddenIdx++ );
- aHiddenChg.Insert( nEnd, nHiddenIdx++ );
+ aHiddenChg.push_back( nStart );
+ aHiddenChg.push_back( nEnd );
}
//
@@ -915,9 +914,9 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
//
// remove invalid entries from script information arrays
- const USHORT nScriptRemove = aScriptChg.Count() - nCnt;
- aScriptChg.Remove( nCnt, nScriptRemove );
- aScriptType.Remove( nCnt, nScriptRemove );
+ const size_t nScriptRemove = aScriptChg.size() - nCnt;
+ aScriptChg.erase( aScriptChg.begin() + nCnt, aScriptChg.end() );
+ aScriptType.erase( aScriptType.begin() + nCnt, aScriptType.begin() + (nCnt + nScriptRemove) );
// get the start of the last compression group
USHORT nLastCompression = nChg;
@@ -933,10 +932,10 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
}
// remove invalid entries from compression information arrays
- const USHORT nCompRemove = aCompChg.Count() - nCntComp;
- aCompChg.Remove( nCntComp, nCompRemove );
- aCompLen.Remove( nCntComp, nCompRemove );
- aCompType.Remove( nCntComp, nCompRemove );
+ const size_t nCompRemove = aCompChg.size() - nCntComp;
+ aCompChg.erase( aCompChg.begin() + nCntComp, aCompChg.end() );
+ aCompLen.erase( aCompLen.begin() + nCntComp, aCompLen.begin() + (nCntComp + nCompRemove) );
+ aCompType.erase( aCompType.begin() + nCntComp, aCompType.end() );
// get the start of the last kashida group
USHORT nLastKashida = nChg;
@@ -947,7 +946,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
}
// remove invalid entries from kashida array
- aKashida.Remove( nCntKash, aKashida.Count() - nCntKash );
+ aKashida.erase( aKashida.begin() + nCntKash, aKashida.end() );
//
// TAKE CARE OF WEAK CHARACTERS: WE MUST FIND AN APPROPRIATE
@@ -981,8 +980,9 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
if ( nScript != nNextScript )
{
- aScriptChg.Insert( nEnd, nCnt );
- aScriptType.Insert( nScript, nCnt++ );
+ aScriptChg.insert( aScriptChg.begin() + nCnt, nEnd );
+ aScriptType.insert( aScriptType.begin() + nCnt, nScript );
+ nCnt++;
nScript = nNextScript;
}
}
@@ -991,7 +991,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// UPDATE THE SCRIPT INFO ARRAYS:
//
- while ( nChg < rTxt.Len() || ( !aScriptChg.Count() && !rTxt.Len() ) )
+ while ( nChg < rTxt.Len() || ( aScriptChg.empty() && !rTxt.Len() ) )
{
ASSERT( i18n::ScriptType::WEAK != nScript,
"Inserting WEAK into SwScriptInfo structure" );
@@ -1032,18 +1032,19 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
if (nType == U_NON_SPACING_MARK || nType == U_ENCLOSING_MARK ||
nType == U_COMBINING_SPACING_MARK )
{
- aScriptChg.Insert( nChg - 1, nCnt );
+ aScriptChg.insert( aScriptChg.begin() + nCnt, nChg - 1 );
}
else
{
- aScriptChg.Insert( nChg, nCnt );
+ aScriptChg.insert( aScriptChg.begin() + nCnt, nChg );
}
}
else
{
- aScriptChg.Insert( nChg, nCnt );
+ aScriptChg.insert( aScriptChg.begin() + nCnt, nChg );
}
- aScriptType.Insert( nScript, nCnt++ );
+ aScriptType.insert( aScriptType.begin() + nCnt, nScript );
+ nCnt++;
// if current script is asian, we search for compressable characters
// in this range
@@ -1087,10 +1088,11 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
if ( CHARCOMPRESS_PUNCTUATION_KANA == aCompEnum ||
ePrevState != KANA )
{
- aCompChg.Insert( nPrevChg, nCntComp );
+ aCompChg.insert( aCompChg.begin() + nCntComp, nPrevChg );
BYTE nTmpType = ePrevState;
- aCompType.Insert( nTmpType, nCntComp );
- aCompLen.Insert( nLastCompression - nPrevChg, nCntComp++ );
+ aCompType.insert( aCompType.begin() + nCntComp, nTmpType );
+ aCompLen.insert( aCompLen.begin() + nCntComp, nLastCompression - nPrevChg );
+ nCntComp++;
}
}
@@ -1108,10 +1110,11 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
if ( CHARCOMPRESS_PUNCTUATION_KANA == aCompEnum ||
ePrevState != KANA )
{
- aCompChg.Insert( nPrevChg, nCntComp );
+ aCompChg.insert( aCompChg.begin() + nCntComp, nPrevChg );
BYTE nTmpType = ePrevState;
- aCompType.Insert( nTmpType, nCntComp );
- aCompLen.Insert( nLastCompression - nPrevChg, nCntComp++ );
+ aCompType.insert( aCompType.begin() + nCntComp, nTmpType );
+ aCompLen.insert( aCompLen.begin() + nCntComp, nLastCompression - nPrevChg );
+ nCntComp++;
}
}
}
@@ -1277,7 +1280,10 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
} // end of current word
if ( STRING_LEN != nKashidaPos )
- aKashida.Insert( nKashidaPos, nCntKash++ );
+ {
+ aKashida.insert( aKashida.begin() + nCntKash, nKashidaPos);
+ nCntKash++;
+ }
} // end of kashida search
}
@@ -1292,7 +1298,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// check kashida data
long nTmpKashidaPos = -1;
sal_Bool bWrongKash = sal_False;
- for (i = 0; i < aKashida.Count(); ++i )
+ for (i = 0; i < aKashida.size(); ++i )
{
long nCurrKashidaPos = GetKashida( i );
if ( nCurrKashidaPos <= nTmpKashidaPos )
@@ -1306,9 +1312,8 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
#endif
// remove invalid entries from direction information arrays
- const USHORT nDirRemove = aDirChg.Count();
- aDirChg.Remove( 0, nDirRemove );
- aDirType.Remove( 0, nDirRemove );
+ aDirChg.clear();
+ aDirType.clear();
// Perform Unicode Bidi Algorithm for text direction information
bool bPerformUBA = UBIDI_LTR != nDefaultDir;
@@ -1328,7 +1333,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// 1. All text in RTL runs will use the CTL font
// #i89825# change the script type also to CTL (hennerdrewes)
// 2. Text in embedded LTR runs that does not have any strong LTR characters (numbers!)
- for ( USHORT nDirIdx = 0; nDirIdx < aDirChg.Count(); ++nDirIdx )
+ for ( size_t nDirIdx = 0; nDirIdx < aDirChg.size(); ++nDirIdx )
{
const BYTE nCurrDirType = GetDirType( nDirIdx );
// nStart ist start of RTL run:
@@ -1340,7 +1345,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( rTxt, nStart, nEnd ) ) ) // non-strong text in embedded LTR run
{
// nScriptIdx points into the ScriptArrays:
- USHORT nScriptIdx = 0;
+ size_t nScriptIdx = 0;
// Skip entries in ScriptArray which are not inside the RTL run:
// Make nScriptIdx become the index of the script group with
@@ -1360,21 +1365,21 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// we have to insert a new script change:
if ( nStart > 0 && nStartPosOfGroup < nStart )
{
- aScriptChg.Insert( nStart, nScriptIdx );
- aScriptType.Insert( nScriptTypeOfGroup, nScriptIdx );
+ aScriptChg.insert( aScriptChg.begin() + nScriptIdx, nStart );
+ aScriptType.insert( aScriptType.begin() + nScriptIdx, nScriptTypeOfGroup );
++nScriptIdx;
}
// Remove entries in ScriptArray which end inside the RTL run:
- while ( nScriptIdx < aScriptChg.Count() && GetScriptChg( nScriptIdx ) <= nEnd )
+ while ( nScriptIdx < aScriptChg.size() && GetScriptChg( nScriptIdx ) <= nEnd )
{
- aScriptChg.Remove( nScriptIdx, 1 );
- aScriptType.Remove( nScriptIdx, 1 );
+ aScriptChg.erase( aScriptChg.begin() + nScriptIdx );
+ aScriptType.erase( aScriptType.begin() + nScriptIdx );
}
// Insert a new entry in ScriptArray for the end of the RTL run:
- aScriptChg.Insert( nEnd, nScriptIdx );
- aScriptType.Insert( i18n::ScriptType::COMPLEX, nScriptIdx );
+ aScriptChg.insert( aScriptChg.begin() + nScriptIdx, nEnd );
+ aScriptType.insert( aScriptType.begin() + nScriptIdx, i18n::ScriptType::COMPLEX );
#if OSL_DEBUG_LEVEL > 1
BYTE nScriptType;
@@ -1384,7 +1389,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
(void) nLastScriptChg;
(void) nLastScriptType;
- for ( USHORT i2 = 0; i2 < aScriptChg.Count(); ++i2 )
+ for ( size_t i2 = 0; i2 < aScriptChg.size(); ++i2 )
{
nScriptChg = GetScriptChg( i2 );
nScriptType = GetScriptType( i2 );
@@ -1401,9 +1406,8 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
void SwScriptInfo::UpdateBidiInfo( const String& rTxt )
{
// remove invalid entries from direction information arrays
- const USHORT nDirRemove = aDirChg.Count();
- aDirChg.Remove( 0, nDirRemove );
- aDirType.Remove( 0, nDirRemove );
+ aDirChg.clear();
+ aDirType.clear();
//
// Bidi functions from icu 2.0
@@ -1420,13 +1424,12 @@ void SwScriptInfo::UpdateBidiInfo( const String& rTxt )
int32_t nEnd;
UBiDiLevel nCurrDir;
// counter for direction information arrays
- USHORT nCntDir = 0;
for ( USHORT nIdx = 0; nIdx < nCount; ++nIdx )
{
ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir );
- aDirChg.Insert( (USHORT)nEnd, nCntDir );
- aDirType.Insert( (BYTE)nCurrDir, nCntDir++ );
+ aDirChg.push_back( (USHORT)nEnd );
+ aDirType.push_back( (BYTE)nCurrDir );
nStart = nEnd;
}
@@ -2011,7 +2014,7 @@ sal_Bool SwScriptInfo::IsArabicText( const XubString& rTxt, xub_StrLen nStt, xub
sal_Bool SwScriptInfo::IsKashidaValid ( xub_StrLen nKashPos ) const
{
- for ( xub_StrLen i = 0; i < aKashidaInvalid.Count(); ++i )
+ for ( size_t i = 0; i < aKashidaInvalid.size(); ++i )
{
if ( aKashidaInvalid [ i ] == nKashPos )
return false;
@@ -2023,13 +2026,13 @@ sal_Bool SwScriptInfo::IsKashidaValid ( xub_StrLen nKashPos ) const
* SwScriptInfo::ClearKashidaInvalid()
*************************************************************************/
-void SwScriptInfo::ClearKashidaInvalid ( xub_StrLen nKashPos )
+void SwScriptInfo::ClearKashidaInvalid ( xub_StrLen nKashPos )
{
- for ( xub_StrLen i = 0; i < aKashidaInvalid.Count(); ++i )
+ for ( size_t i = 0; i < aKashidaInvalid.size(); ++i )
{
if ( aKashidaInvalid [ i ] == nKashPos )
{
- aKashidaInvalid.Remove (i, 1);
+ aKashidaInvalid.erase ( aKashidaInvalid.begin() + i );
return;
}
}
@@ -2085,7 +2088,7 @@ bool SwScriptInfo::MarkOrClearKashidaInvalid ( xub_StrLen nStt, xub_StrLen nLen,
void SwScriptInfo::MarkKashidaInvalid ( xub_StrLen nKashPos )
{
- aKashidaInvalid.Insert( nKashPos, aKashidaInvalid.Count() );
+ aKashidaInvalid.push_back( nKashPos );
}
/*************************************************************************
@@ -2122,8 +2125,8 @@ USHORT SwScriptInfo::GetKashidaPositions ( xub_StrLen nStt, xub_StrLen nLen,
void SwScriptInfo::SetNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen )
{
- aNoKashidaLine.Insert( nStt, aNoKashidaLine.Count());
- aNoKashidaLineEnd.Insert( nStt+nLen, aNoKashidaLineEnd.Count());
+ aNoKashidaLine.push_back( nStt );
+ aNoKashidaLineEnd.push_back( nStt+nLen );
}
/*************************************************************************
@@ -2133,7 +2136,7 @@ void SwScriptInfo::SetNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen )
bool SwScriptInfo::IsKashidaLine ( xub_StrLen nCharIdx ) const
{
- for( xub_StrLen i = 0; i < aNoKashidaLine.Count(); ++i )
+ for( size_t i = 0; i < aNoKashidaLine.size(); ++i )
{
if( nCharIdx >= aNoKashidaLine[ i ] && nCharIdx < aNoKashidaLineEnd[ i ])
return false;
@@ -2146,13 +2149,13 @@ bool SwScriptInfo::IsKashidaLine ( xub_StrLen nCharIdx ) const
void SwScriptInfo::ClearNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen )
{
- xub_StrLen i = 0;
- while( i < aNoKashidaLine.Count())
+ size_t i = 0;
+ while( i < aNoKashidaLine.size())
{
if( nStt + nLen >= aNoKashidaLine[ i ] && nStt < aNoKashidaLineEnd [ i ] )
{
- aNoKashidaLine.Remove(i, 1);
- aNoKashidaLineEnd.Remove(i, 1);
+ aNoKashidaLine.erase(aNoKashidaLine.begin() + i);
+ aNoKashidaLineEnd.erase(aNoKashidaLineEnd.begin() + i);
}
else
++i;
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index f9f86db667b9..35f45f20d4c7 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -1022,10 +1022,10 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
{
pRet->pItem = NULL;
pRet->pAttr = (*pHints)[n2Lines];
- aEnd.Insert( *pRet->pAttr->GetEnd(), 0 );
+ aEnd.push_front( *pRet->pAttr->GetEnd() );
if( pItem )
{
- aEnd[ 0 ] = GetTxt().Len();
+ aEnd.front() = GetTxt().Len();
bOn = ((SvxTwoLinesItem*)pItem)->GetEndBracket() ==
p2Lines->GetEndBracket() &&
((SvxTwoLinesItem*)pItem)->GetStartBracket() ==
@@ -1036,7 +1036,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
{
pRet->pItem = pItem;
pRet->pAttr = NULL;
- aEnd.Insert( GetTxt().Len(), 0 );
+ aEnd.push_front( GetTxt().Len() );
}
pRet->nId = SW_MC_DOUBLE;
pRet->nLevel = GetTxtFrm()->IsRightToLeft() ? 1 : 0;
@@ -1070,23 +1070,23 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
// If the start of the next atribute is behind the end of
// the last attribute on the aEnd-stack, this is the endposition
// on the stack is the end of the 2-line portion.
- if( !bOn || aEnd[ aEnd.Count()-1 ] < *pTmp->GetStart() )
+ if( !bOn || aEnd.back() < *pTmp->GetStart() )
break;
// At this moment, bOn is TRUE and the next attribute starts
// behind rPos, so we could move rPos to the next startpoint
rPos = *pTmp->GetStart();
// We clean up the aEnd-stack, endpositions equal to rPos are
// superfluous.
- while( aEnd.Count() && aEnd[ aEnd.Count()-1 ] <= rPos )
+ while( !aEnd.empty() && aEnd.back() <= rPos )
{
bOn = !bOn;
- aEnd.Remove( aEnd.Count()-1, 1 );
+ aEnd.pop_back();
}
// If the endstack is empty, we simulate an attribute with
// state TRUE and endposition rPos
- if( !aEnd.Count() )
+ if( aEnd.empty() )
{
- aEnd.Insert( rPos, 0 );
+ aEnd.push_front( rPos );
bOn = sal_True;
}
}
@@ -1098,8 +1098,8 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
if( bTwo == bOn )
{ // .. with the same state, so the last attribute could
// be continued.
- if( aEnd[ aEnd.Count()-1 ] < *pTmp->GetEnd() )
- aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+ if( aEnd.back() < *pTmp->GetEnd() )
+ aEnd.back() = *pTmp->GetEnd();
}
else
{ // .. with a different state.
@@ -1107,17 +1107,17 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
// If this is smaller than the last on the stack, we put
// it on the stack. If it has the same endposition, the last
// could be removed.
- if( aEnd[ aEnd.Count()-1 ] > *pTmp->GetEnd() )
- aEnd.Insert( *pTmp->GetEnd(), aEnd.Count() );
- else if( aEnd.Count() > 1 )
- aEnd.Remove( aEnd.Count()-1, 1 );
+ if( aEnd.back() > *pTmp->GetEnd() )
+ aEnd.push_back( *pTmp->GetEnd() );
+ else if( aEnd.size() > 1 )
+ aEnd.pop_back();
else
- aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+ aEnd.back() = *pTmp->GetEnd();
}
}
}
- if( bOn && aEnd.Count() )
- rPos = aEnd[ aEnd.Count()-1 ];
+ if( bOn && !aEnd.empty() )
+ rPos = aEnd.back();
return pRet;
}
if( nRotate < nCount || ( pRotItem && pRotItem == pRotate &&
@@ -1133,7 +1133,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
// The bOn flag signs the state of the last 2-line attribute in the
// aEnd-stack, which could interrupts the winning rotation attribute.
sal_Bool bOn = pItem ? sal_True : sal_False;
- aEnd.Insert( GetTxt().Len(), 0 );
+ aEnd.push_front( GetTxt().Len() );
// n2Lines is the index of the last 2-line-attribute, which contains
// the actual position.
i = 0;
@@ -1145,17 +1145,17 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
continue;
if( n2Start < *pTmp->GetStart() )
{
- if( bOn || aEnd[ aEnd.Count()-1 ] < *pTmp->GetStart() )
+ if( bOn || aEnd.back() < *pTmp->GetStart() )
break;
n2Start = *pTmp->GetStart();
- while( aEnd.Count() && aEnd[ aEnd.Count()-1 ] <= n2Start )
+ while( !aEnd.empty() && aEnd.back() <= n2Start )
{
bOn = !bOn;
- aEnd.Remove( aEnd.Count()-1, 1 );
+ aEnd.pop_back();
}
- if( !aEnd.Count() )
+ if( aEnd.empty() )
{
- aEnd.Insert( n2Start, 0 );
+ aEnd.push_front( n2Start );
bOn = sal_False;
}
}
@@ -1170,36 +1170,36 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
{
if( bTwo == bOn )
{
- if( aEnd[ aEnd.Count()-1 ] < *pTmp->GetEnd() )
- aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+ if( aEnd.back() < *pTmp->GetEnd() )
+ aEnd.back() = *pTmp->GetEnd();
}
else
{
bOn = bTwo;
- if( aEnd[ aEnd.Count()-1 ] > *pTmp->GetEnd() )
- aEnd.Insert( *pTmp->GetEnd(), aEnd.Count() );
- else if( aEnd.Count() > 1 )
- aEnd.Remove( aEnd.Count()-1, 1 );
+ if( aEnd.back() > *pTmp->GetEnd() )
+ aEnd.push_back( *pTmp->GetEnd() );
+ else if( aEnd.size() > 1 )
+ aEnd.pop_back();
else
- aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+ aEnd.back() = *pTmp->GetEnd();
}
}
}
- if( !bOn && aEnd.Count() )
- n2Start = aEnd[ aEnd.Count()-1 ];
+ if( !bOn && !aEnd.empty() )
+ n2Start = aEnd.back();
- if( aEnd.Count() )
- aEnd.Remove( 0, aEnd.Count() );
+ if( !aEnd.empty() )
+ aEnd.clear();
bOn = sal_True;
if( nRotate < nCount )
{
pRet->pItem = NULL;
pRet->pAttr = (*pHints)[nRotate];
- aEnd.Insert( *pRet->pAttr->GetEnd(), 0 );
+ aEnd.push_front( *pRet->pAttr->GetEnd() );
if( pRotItem )
{
- aEnd[ 0 ] = GetTxt().Len();
+ aEnd.front() = GetTxt().Len();
bOn = ((SvxCharRotateItem*)pRotItem)->GetValue() ==
pRotate->GetValue();
}
@@ -1208,7 +1208,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
{
pRet->pItem = pRotItem;
pRet->pAttr = NULL;
- aEnd.Insert( GetTxt().Len(), 0 );
+ aEnd.push_front( GetTxt().Len() );
}
i = 0;
while( i < nCount )
@@ -1218,17 +1218,17 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
continue;
if( rPos < *pTmp->GetStart() )
{
- if( !bOn || aEnd[ aEnd.Count()-1 ] < *pTmp->GetStart() )
+ if( !bOn || aEnd.back() < *pTmp->GetStart() )
break;
rPos = *pTmp->GetStart();
- while( aEnd.Count() && aEnd[ aEnd.Count()-1 ] <= rPos )
+ while( !aEnd.empty() && aEnd.back() <= rPos )
{
bOn = !bOn;
- aEnd.Remove( aEnd.Count()-1, 1 );
+ aEnd.pop_back();
}
- if( !aEnd.Count() )
+ if( aEnd.empty() )
{
- aEnd.Insert( rPos, 0 );
+ aEnd.push_front( rPos );
bOn = sal_True;
}
}
@@ -1241,23 +1241,23 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
{
if( bTwo == bOn )
{
- if( aEnd[ aEnd.Count()-1 ] < *pTmp->GetEnd() )
- aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+ if( aEnd.back() < *pTmp->GetEnd() )
+ aEnd.back() = *pTmp->GetEnd();
}
else
{
bOn = bTwo;
- if( aEnd[ aEnd.Count()-1 ] > *pTmp->GetEnd() )
- aEnd.Insert( *pTmp->GetEnd(), aEnd.Count() );
- else if( aEnd.Count() > 1 )
- aEnd.Remove( aEnd.Count()-1, 1 );
+ if( aEnd.back() > *pTmp->GetEnd() )
+ aEnd.push_back( *pTmp->GetEnd() );
+ else if( aEnd.size() > 1 )
+ aEnd.pop_back();
else
- aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+ aEnd.back() = *pTmp->GetEnd();
}
}
}
- if( bOn && aEnd.Count() )
- rPos = aEnd[ aEnd.Count()-1 ];
+ if( bOn && !aEnd.empty() )
+ rPos = aEnd.back();
if( rPos > n2Start )
rPos = n2Start;
return pRet;
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 526dbe74c4d9..514ac96d3d46 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -106,6 +106,8 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
}
ViewShell *pSh = rInf.GetVsh();
+ SwDoc *const pDoc( (pSh) ? pSh->GetDoc() : 0 );
+ bool const bInClipboard( (pDoc) ? pDoc->IsClipBoard() : true );
sal_Bool bPlaceHolder = sal_False;
switch( pFld->GetTyp()->Which() )
@@ -117,16 +119,26 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
case RES_COMBINED_CHARS:
{
- String sStr( pFld->GetCntnt( bName ));
if( bName )
- pRet = new SwFldPortion( sStr );
+ {
+ String const sName( pFld->GetFieldName() );
+ pRet = new SwFldPortion(sName);
+ }
else
- pRet = new SwCombinedPortion( sStr );
+ {
+ String const sContent( pFld->ExpandField(bInClipboard) );
+ pRet = new SwCombinedPortion(sContent);
+ }
}
break;
case RES_HIDDENTXTFLD:
- pRet = new SwHiddenPortion(pFld->GetCntnt( bName ));
+ {
+ String const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwHiddenPortion(str);
+ }
break;
case RES_CHAPTERFLD:
@@ -135,13 +147,25 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
((SwChapterField*)pFld)->ChangeExpansion( pFrame,
&((SwTxtFld*)pHint)->GetTxtNode() );
}
- pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+ {
+ String const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion( str );
+ }
break;
case RES_DOCSTATFLD:
if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
+ {
((SwDocStatField*)pFld)->ChangeExpansion( pFrame );
- pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+ }
+ {
+ String const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion( str );
+ }
break;
case RES_PAGENUMBERFLD:
@@ -153,7 +177,6 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
const SwRootFrm* pTmpRootFrm = pSh->GetLayout();
const sal_Bool bVirt = pTmpRootFrm->IsVirtPageNum();
- SwDoc* pDoc = pSh->GetDoc();
MSHORT nVirtNum = pFrame->GetVirtPageNum();
MSHORT nNumPages = pTmpRootFrm->GetPageNum();
sal_Int16 nNumFmt = -1;
@@ -163,7 +186,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
pPageNr->ChangeExpansion( pDoc, nVirtNum, nNumPages,
bVirt, nNumFmt > -1 ? &nNumFmt : 0);
}
- pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+ {
+ String const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion( str );
+ }
break;
}
case RES_GETEXPFLD:
@@ -183,7 +211,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
pExpFld->ChgBodyTxtFlag( sal_True );
}
}
- pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+ {
+ String const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion( str );
+ }
break;
}
case RES_DBFLD:
@@ -207,13 +240,25 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
}
*/
}
- pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+ {
+ String const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion(str);
+ }
break;
}
case RES_REFPAGEGETFLD:
if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
+ {
((SwRefPageGetField*)pFld)->ChangeExpansion( pFrame, (SwTxtFld*)pHint );
- pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+ }
+ {
+ String const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion(str);
+ }
break;
case RES_JUMPEDITFLD:
@@ -224,9 +269,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
break;
default:
- {
- pRet = new SwFldPortion(pFld->GetCntnt( bName ) );
- }
+ {
+ String const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion(str);
+ }
}
if( bNewFlyPor )
@@ -249,7 +297,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
else
pTmpFnt->SetDiffFnt( &pChFmt->GetAttrSet(), pFrm->GetTxtNode()->getIDocumentSettingAccess() );
}
- pRet = new SwFldPortion( pFld->GetCntnt( bName ), pTmpFnt, bPlaceHolder );
+ {
+ String const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion(str, pTmpFnt, bPlaceHolder);
+ }
}
return pRet;
@@ -488,13 +541,7 @@ SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const
}
else
{
- // --> OD 2006-06-02 #b6432095#
- // use method <SwNumRule::MakeNumString(..)> instead of
- // method <SwTxtNode::GetNumString()>, because for levels with
- // numbering none the prefix and the suffix strings have to be provided.
-// XubString aTxt( pTxtNd->GetNumString() );
- XubString aTxt( pNumRule->MakeNumString( *(pTxtNd->GetNum()) ) );
- // <--
+ XubString aTxt( pTxtNd->GetNumString() );
// --> OD 2008-01-23 #newlistlevelattrs#
if ( aTxt.Len() > 0 )
{