[Libreoffice-commits] .: 5 commits - sw/inc sw/source
Nigel Hawkins
nhawkins at kemper.freedesktop.org
Thu Feb 24 09:53:10 PST 2011
sw/inc/authfld.hxx | 8 -
sw/source/core/fields/authfld.cxx | 14 -
sw/source/core/layout/dbg_lay.cxx | 12 -
sw/source/core/text/itrform2.cxx | 279 +++++++++++++++++++-------------------
sw/source/core/text/itrform2.hxx | 4
sw/source/ui/envelp/envfmt.cxx | 20 +-
6 files changed, 169 insertions(+), 168 deletions(-)
New commits:
commit 686d672f3adbf174bf4bd2cf32add1d69107a11b
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Thu Feb 24 17:34:08 2011 +0000
Refactor itrform2.[ch]xx a bit for better insulation.
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 339baab..d2409c3 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -60,10 +60,10 @@
#include <tgrditem.hxx>
#include <doc.hxx> // SwDoc
#include <pormulti.hxx> // SwMultiPortion
-#define _SVSTDARR_LONGS
-#include <svl/svstdarr.hxx>
#include <unotools/charclass.hxx>
+#include <vector>
+
#if OSL_DEBUG_LEVEL > 1
#include <ndtxt.hxx> // pSwpHints, Ausgabeoperator
#endif
@@ -71,7 +71,16 @@
using namespace ::com::sun::star;
extern sal_Bool IsUnderlineBreak( const SwLinePortion& rPor, const SwFont& rFnt );
-bool lcl_BuildHiddenPortion( const SwTxtSizeInfo& rInf, xub_StrLen &rPos );
+
+namespace {
+ //! Calculates and sets optimal repaint offset for the current line
+ static long lcl_CalcOptRepaint( SwTxtFormatter &rThis,
+ SwLineLayout &rCurr,
+ const xub_StrLen nOldLineEnd,
+ const std::vector<long> &rFlyStarts );
+ //! Determine if we need to build hidden portions
+ static bool lcl_BuildHiddenPortion( const SwTxtSizeInfo& rInf, xub_StrLen &rPos );
+}
#define MAX_TXTPORLEN 300
@@ -1220,7 +1229,7 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf )
if ( !pPor )
{
xub_StrLen nEnd = rInf.GetIdx();
- if ( lcl_BuildHiddenPortion( rInf, nEnd ) )
+ if ( ::lcl_BuildHiddenPortion( rInf, nEnd ) )
pPor = new SwHiddenTextPortion( nEnd - rInf.GetIdx() );
}
@@ -1613,7 +1622,7 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos )
// calculate optimal repaint rectangle
if ( bOptimizeRepaint )
{
- GetInfo().SetPaintOfst( CalcOptRepaint( nOldLineEnd, flyStarts ) );
+ GetInfo().SetPaintOfst( ::lcl_CalcOptRepaint( *this, *pCurr, nOldLineEnd, flyStarts ) );
flyStarts.clear();
}
else
@@ -2006,141 +2015,148 @@ sal_Bool SwTxtFormatter::AllowRepaintOpt() const
return bOptimizeRepaint;
}
-/*************************************************************************
- * SwTxtFormatter::CalcOptRepaint()
- *
- * calculates an optimal repaint offset for the current line
- *************************************************************************/
-long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd,
- const std::vector<long> &rFlyStarts )
-{
- if ( GetInfo().GetIdx() < GetInfo().GetReformatStart() )
- // the reformat position is behind our new line, that means
- // something of our text has moved to the next line
- return 0;
-
- xub_StrLen nReformat = Min( GetInfo().GetReformatStart(), nOldLineEnd );
-
- // in case we do not have any fly in our line, our repaint position
- // is the changed position - 1
- if ( rFlyStarts.empty() && ! pCurr->IsFly() )
+namespace {
+ /*************************************************************************
+ * ::CalcOptRepaint()
+ *
+ * calculates and sets optimal repaint offset for the current line
+ *************************************************************************/
+ long lcl_CalcOptRepaint( SwTxtFormatter &rThis,
+ SwLineLayout &rCurr,
+ const xub_StrLen nOldLineEnd,
+ const std::vector<long> &rFlyStarts )
{
- // this is the maximum repaint offset determined during formatting
- // for example: the beginning of the first right tab stop
- // if this value is 0, this means that we do not have an upper
- // limit for the repaint offset
- const long nFormatRepaint = GetInfo().GetPaintOfst();
-
- if ( nReformat < GetInfo().GetLineStart() + 3 )
+ SwTxtFormatInfo txtFmtInfo = rThis.GetInfo();
+ if ( txtFmtInfo.GetIdx() < txtFmtInfo.GetReformatStart() )
+ // the reformat position is behind our new line, that means
+ // something of our text has moved to the next line
return 0;
- // step back two positions for smoother repaint
- nReformat -= 2;
-
-#ifndef QUARTZ
-#ifndef ENABLE_GRAPHITE
- // --> FME 2004-09-27 #i28795#, #i34607#, #i38388#
- // step back six(!) more characters for complex scripts
- // this is required e.g., for Khmer (thank you, Javier!)
- const SwScriptInfo& rSI = GetInfo().GetParaPortion()->GetScriptInfo();
- xub_StrLen nMaxContext = 0;
- if( ::i18n::ScriptType::COMPLEX == rSI.ScriptType( nReformat ) )
- nMaxContext = 6;
-#else
- // Some Graphite fonts need context for scripts not marked as complex
- static const xub_StrLen nMaxContext = 10;
-#endif
-#else
- // some fonts like Quartz's Zapfino need more context
- // TODO: query FontInfo for maximum unicode context
- static const xub_StrLen nMaxContext = 8;
-#endif
- if( nMaxContext > 0 )
- {
- if ( nReformat > GetInfo().GetLineStart() + nMaxContext )
- nReformat = nReformat - nMaxContext;
- else
- nReformat = GetInfo().GetLineStart();
- }
- // <--
-
- // Weird situation: Our line used to end with a hole portion
- // and we delete some characters at the end of our line. We have
- // to take care for repainting the blanks which are not anymore
- // covered by the hole portion
- while ( nReformat > GetInfo().GetLineStart() &&
- CH_BLANK == GetInfo().GetChar( nReformat ) )
- --nReformat;
-
- OSL_ENSURE( nReformat < GetInfo().GetIdx(), "Reformat too small for me!" );
- SwRect aRect;
-
- // Note: GetChareRect is not const. It definitely changes the
- // bMulti flag. We have to save and resore the old value.
- sal_Bool bOldMulti = GetInfo().IsMulti();
- GetCharRect( &aRect, nReformat );
- GetInfo().SetMulti( bOldMulti );
-
- return nFormatRepaint ? Min( aRect.Left(), nFormatRepaint ) :
- aRect.Left();
- }
- else
- {
- // nReformat may be wrong, if something around flys has changed:
- // we compare the former and the new fly positions in this line
- // if anything has changed, we carefully have to adjust the right
- // repaint position
- long nPOfst = 0;
- USHORT nCnt = 0;
- USHORT nX = 0;
- USHORT nIdx = GetInfo().GetLineStart();
- SwLinePortion* pPor = pCurr->GetFirstPortion();
+ xub_StrLen nReformat = Min( txtFmtInfo.GetReformatStart(), nOldLineEnd );
- while ( pPor )
+ // in case we do not have any fly in our line, our repaint position
+ // is the changed position - 1
+ if ( rFlyStarts.empty() && ! rCurr.IsFly() )
{
- if ( pPor->IsFlyPortion() )
+ // this is the maximum repaint offset determined during formatting
+ // for example: the beginning of the first right tab stop
+ // if this value is 0, this means that we do not have an upper
+ // limit for the repaint offset
+ const long nFormatRepaint = txtFmtInfo.GetPaintOfst();
+
+ if ( nReformat < txtFmtInfo.GetLineStart() + 3 )
+ return 0;
+
+ // step back two positions for smoother repaint
+ nReformat -= 2;
+
+ #ifndef QUARTZ
+ #ifndef ENABLE_GRAPHITE
+ // --> FME 2004-09-27 #i28795#, #i34607#, #i38388#
+ // step back six(!) more characters for complex scripts
+ // this is required e.g., for Khmer (thank you, Javier!)
+ const SwScriptInfo& rSI = txtFmtInfo.GetParaPortion()->GetScriptInfo();
+ xub_StrLen nMaxContext = 0;
+ if( ::i18n::ScriptType::COMPLEX == rSI.ScriptType( nReformat ) )
+ nMaxContext = 6;
+ #else
+ // Some Graphite fonts need context for scripts not marked as complex
+ static const xub_StrLen nMaxContext = 10;
+ #endif
+ #else
+ // some fonts like Quartz's Zapfino need more context
+ // TODO: query FontInfo for maximum unicode context
+ static const xub_StrLen nMaxContext = 8;
+ #endif
+ if( nMaxContext > 0 )
{
- // compare start of fly with former start of fly
- if (nCnt < rFlyStarts.size() &&
- nX == rFlyStarts[ nCnt ] &&
- nIdx < nReformat
- )
- // found fix position, nothing has changed left from nX
- nPOfst = nX + pPor->Width();
+ if ( nReformat > txtFmtInfo.GetLineStart() + nMaxContext )
+ nReformat = nReformat - nMaxContext;
else
- break;
-
- nCnt++;
+ nReformat = txtFmtInfo.GetLineStart();
}
- nX = nX + pPor->Width();
- nIdx = nIdx + pPor->GetLen();
- pPor = pPor->GetPortion();
+ // <--
+
+ // Weird situation: Our line used to end with a hole portion
+ // and we delete some characters at the end of our line. We have
+ // to take care for repainting the blanks which are not anymore
+ // covered by the hole portion
+ while ( nReformat > txtFmtInfo.GetLineStart() &&
+ CH_BLANK == txtFmtInfo.GetChar( nReformat ) )
+ --nReformat;
+
+ OSL_ENSURE( nReformat < txtFmtInfo.GetIdx(), "Reformat too small for me!" );
+ SwRect aRect;
+
+ // Note: GetChareRect is not const. It definitely changes the
+ // bMulti flag. We have to save and resore the old value.
+ sal_Bool bOldMulti = txtFmtInfo.IsMulti();
+ rThis.GetCharRect( &aRect, nReformat );
+ txtFmtInfo.SetMulti( bOldMulti );
+
+ return nFormatRepaint ? Min( aRect.Left(), nFormatRepaint ) :
+ aRect.Left();
}
+ else
+ {
+ // nReformat may be wrong, if something around flys has changed:
+ // we compare the former and the new fly positions in this line
+ // if anything has changed, we carefully have to adjust the right
+ // repaint position
+ long nPOfst = 0;
+ USHORT nCnt = 0;
+ USHORT nX = 0;
+ USHORT nIdx = txtFmtInfo.GetLineStart();
+ SwLinePortion* pPor = rCurr.GetFirstPortion();
+
+ while ( pPor )
+ {
+ if ( pPor->IsFlyPortion() )
+ {
+ // compare start of fly with former start of fly
+ if (nCnt < rFlyStarts.size() &&
+ nX == rFlyStarts[ nCnt ] &&
+ nIdx < nReformat
+ )
+ // found fix position, nothing has changed left from nX
+ nPOfst = nX + pPor->Width();
+ else
+ break;
- return nPOfst + GetLeftMargin();
- }
-}
+ nCnt++;
+ }
+ nX = nX + pPor->Width();
+ nIdx = nIdx + pPor->GetLen();
+ pPor = pPor->GetPortion();
+ }
-bool lcl_BuildHiddenPortion( const SwTxtSizeInfo& rInf, xub_StrLen &rPos )
-{
- // Only if hidden text should not be shown:
-// if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() )
- const bool bShowInDocView = rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar();
- const bool bShowForPrinting = rInf.GetOpt().IsShowHiddenChar( TRUE ) && rInf.GetOpt().IsPrinting();
- if (bShowInDocView || bShowForPrinting)
- return false;
+ return nPOfst + rThis.GetLeftMargin();
+ }
+ }
- const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
- xub_StrLen nHiddenStart;
- xub_StrLen nHiddenEnd;
- rSI.GetBoundsOfHiddenRange( rPos, nHiddenStart, nHiddenEnd );
- if ( nHiddenEnd )
+ // Determine if we need to build hidden portions
+ bool lcl_BuildHiddenPortion( const SwTxtSizeInfo& rInf, xub_StrLen &rPos )
{
- rPos = nHiddenEnd;
- return true;
+ // Only if hidden text should not be shown:
+ // if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() )
+ const bool bShowInDocView = rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar();
+ const bool bShowForPrinting = rInf.GetOpt().IsShowHiddenChar( TRUE ) && rInf.GetOpt().IsPrinting();
+ if (bShowInDocView || bShowForPrinting)
+ return false;
+
+ const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
+ xub_StrLen nHiddenStart;
+ xub_StrLen nHiddenEnd;
+ rSI.GetBoundsOfHiddenRange( rPos, nHiddenStart, nHiddenEnd );
+ if ( nHiddenEnd )
+ {
+ rPos = nHiddenEnd;
+ return true;
+ }
+
+ return false;
}
- return false;
-}
+} //end unnamed namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx
index d2c14bc..70d4d1e 100644
--- a/sw/source/core/text/itrform2.hxx
+++ b/sw/source/core/text/itrform2.hxx
@@ -29,8 +29,6 @@
#define _ITRFORM2_HXX
#include "itrpaint.hxx"
-#include <vector>
-
class SwFlyCntPortion;
class SwInterHyphInfo;
class SwDropPortion;
@@ -102,9 +100,6 @@ class SwTxtFormatter : public SwTxtPainter
// determines, if a optimized repaint rectange is allowed
sal_Bool AllowRepaintOpt() const;
- // calculates and sets the optimized repaint offset
- long CalcOptRepaint( xub_StrLen nOldLineEnd, const std::vector<long> &rFlyStarts );
-
// wird von FormatLine gerufen.
void FormatReset( SwTxtFormatInfo &rInf );
commit 30812089f1c5c6756c12a52a6a8f410673798362
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Thu Feb 24 15:14:53 2011 +0000
Remove use of SvLongs in itrform2.[ch]xx
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 9d3acb2..339baab 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1511,21 +1511,18 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos )
// before and after the BuildPortions call
const sal_Bool bOptimizeRepaint = AllowRepaintOpt();
const xub_StrLen nOldLineEnd = nStartPos + pCurr->GetLen();
- SvLongs* pFlyStart = 0;
+ std::vector<long> flyStarts;
// these are the conditions for a fly position comparison
if ( bOptimizeRepaint && pCurr->IsFly() )
{
- pFlyStart = new SvLongs;
SwLinePortion* pPor = pCurr->GetFirstPortion();
long nPOfst = 0;
- USHORT nCnt = 0;
-
while ( pPor )
{
if ( pPor->IsFlyPortion() )
// insert start value of fly portion
- pFlyStart->Insert( nPOfst, nCnt++ );
+ flyStarts.push_back( nPOfst );
nPOfst += pPor->Width();
pPor = pPor->GetPortion();
@@ -1616,9 +1613,8 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos )
// calculate optimal repaint rectangle
if ( bOptimizeRepaint )
{
- GetInfo().SetPaintOfst( CalcOptRepaint( nOldLineEnd, pFlyStart ) );
- if ( pFlyStart )
- delete pFlyStart;
+ GetInfo().SetPaintOfst( CalcOptRepaint( nOldLineEnd, flyStarts ) );
+ flyStarts.clear();
}
else
// Special case: We do not allow an optimitation of the repaint
@@ -2016,7 +2012,7 @@ sal_Bool SwTxtFormatter::AllowRepaintOpt() const
* calculates an optimal repaint offset for the current line
*************************************************************************/
long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd,
- const SvLongs* pFlyStart )
+ const std::vector<long> &rFlyStarts )
{
if ( GetInfo().GetIdx() < GetInfo().GetReformatStart() )
// the reformat position is behind our new line, that means
@@ -2027,7 +2023,7 @@ long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd,
// in case we do not have any fly in our line, our repaint position
// is the changed position - 1
- if ( ! pFlyStart && ! pCurr->IsFly() )
+ if ( rFlyStarts.empty() && ! pCurr->IsFly() )
{
// this is the maximum repaint offset determined during formatting
// for example: the beginning of the first right tab stop
@@ -2105,9 +2101,8 @@ long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd,
if ( pPor->IsFlyPortion() )
{
// compare start of fly with former start of fly
- if ( pFlyStart &&
- nCnt < pFlyStart->Count() &&
- nX == (*pFlyStart)[ nCnt ] &&
+ if (nCnt < rFlyStarts.size() &&
+ nX == rFlyStarts[ nCnt ] &&
nIdx < nReformat
)
// found fix position, nothing has changed left from nX
diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx
index 05a4d85..d2c14bc 100644
--- a/sw/source/core/text/itrform2.hxx
+++ b/sw/source/core/text/itrform2.hxx
@@ -29,6 +29,8 @@
#define _ITRFORM2_HXX
#include "itrpaint.hxx"
+#include <vector>
+
class SwFlyCntPortion;
class SwInterHyphInfo;
class SwDropPortion;
@@ -39,7 +41,6 @@ class SwErgoSumPortion;
class SwExpandPortion;
class SwMultiPortion;
class SwFtnPortion;
-class SvLongs;
/*************************************************************************
* class SwTxtFormatter
@@ -102,7 +103,7 @@ class SwTxtFormatter : public SwTxtPainter
sal_Bool AllowRepaintOpt() const;
// calculates and sets the optimized repaint offset
- long CalcOptRepaint( xub_StrLen nOldLineEnd, const SvLongs* pFlyStart );
+ long CalcOptRepaint( xub_StrLen nOldLineEnd, const std::vector<long> &rFlyStarts );
// wird von FormatLine gerufen.
void FormatReset( SwTxtFormatInfo &rInf );
commit d143b3dc964ec4f6f5935c810544946575c0d8f9
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Thu Feb 24 14:22:57 2011 +0000
Remove use of SvLongs in dbg_lay.cxx
diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx
index 44cafd0..301bb9c 100644
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -151,7 +151,7 @@ class SwImplProtocol
{
SvFileStream *pStream; // Ausgabestream
SvUShortsSort *pFrmIds; // welche FrmIds sollen aufgezeichnet werden ( NULL == alle )
- SvLongs *pVar; // Variables
+ std::vector<long> aVars; // Variables
ByteString aLayer; // Einrueckung der Ausgabe (" " pro Start/End)
USHORT nTypes; // welche Typen sollen aufgezeichnet werden
USHORT nLineCount; // Ausgegebene Zeilen
@@ -175,7 +175,7 @@ public:
void ChkStream() { if( !pStream ) NewStream(); }
void SnapShot( const SwFrm* pFrm, ULONG nFlags );
void GetVar( const USHORT nNo, long& rVar )
- { if( pVar && nNo < pVar->Count() ) rVar = (*pVar)[ nNo ]; }
+ { if( nNo < aVars.size() ) rVar = aVars[ nNo ]; }
};
/* --------------------------------------------------
@@ -301,7 +301,7 @@ void SwProtocol::GetVar( const USHORT nNo, long& rVar )
}
SwImplProtocol::SwImplProtocol()
- : pStream( NULL ), pFrmIds( NULL ), pVar( NULL ), nTypes( 0xffff ),
+ : pStream( NULL ), pFrmIds( NULL ), nTypes( 0xffff ),
nLineCount( 0 ), nMaxLines( USHRT_MAX ), nTestMode( 0 )
{
NewStream();
@@ -328,7 +328,7 @@ SwImplProtocol::~SwImplProtocol()
delete pStream;
}
delete pFrmIds;
- delete pVar;
+ aVars.clear();
}
/* --------------------------------------------------
@@ -374,8 +374,6 @@ void SwImplProtocol::CheckLine( ByteString& rLine )
else if( "[var" == aTmp )// variables
{
nInitFile = 6;
- if( !pVar )
- pVar = new SvLongs( 5, 5 );
}
else
nInitFile = 0; // Nanu: Unbekannter Bereich?
@@ -426,7 +424,7 @@ void SwImplProtocol::CheckLine( ByteString& rLine )
break;
case 5: nMaxLines = (USHORT)nVal;
break;
- case 6: pVar->Insert( (long)nVal, pVar->Count() );
+ case 6: aVars.push_back( (long)nVal );
break;
}
}
commit 186d0fc5decc499fe19fdba8fe32a0df036a77e9
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Thu Feb 24 14:11:48 2011 +0000
Remove use of SvLongs in envfmt.cxx
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 827961a..e01b532 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -64,6 +64,8 @@
#include <envfmt.hrc>
+#include <vector>
+
#include "swabstdlg.hxx"
#include "chrdlg.hrc"
@@ -386,31 +388,29 @@ SfxItemSet *SwEnvFmtPage::GetCollItemSet(SwTxtFmtColl* pColl, BOOL bSender)
}
// Ranges kompaktieren
- SvLongs aCompactedRanges( 0, 10 );
+ std::vector<USHORT> aCompactedRanges;
- aCompactedRanges.Insert(aMergedRanges[0], aCompactedRanges.Count());
+ aCompactedRanges.push_back(aMergedRanges[0]);
- for (i = 0; i < aMergedRanges.Count(); i++)
+ for (i = 0; i < aMergedRanges.Count(); ++i)
{
while (i + 1 < aMergedRanges.Count() &&
aMergedRanges[i+1] - aMergedRanges[i] == 1)
{
i++;
}
- long nEnd = aMergedRanges[i];
- aCompactedRanges.Insert(nEnd, aCompactedRanges.Count());
+ aCompactedRanges.push_back( aMergedRanges[i] );
if (i + 1 < aMergedRanges.Count())
{
- long nStart = aMergedRanges[i+1];
- aCompactedRanges.Insert(nStart, aCompactedRanges.Count());
+ aCompactedRanges.push_back( aMergedRanges[i+1] );
}
}
// Neue Ranges erzeugen
- USHORT *pNewRanges = new USHORT[aCompactedRanges.Count() + 1];
- for (i = 0; i < aCompactedRanges.Count(); i++)
- pNewRanges[i] = (USHORT)aCompactedRanges[i];
+ USHORT *pNewRanges = new USHORT[aCompactedRanges.size() + 1];
+ for (i = 0; i < aCompactedRanges.size(); ++i)
+ pNewRanges[i] = aCompactedRanges[i];
pNewRanges[i] = 0;
commit 2b133d86b95ec5b348cf735c5ddcf5816ee0032f
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Thu Feb 24 11:36:36 2011 +0000
Remove use of SvLongs in authfld.[ch]xx
diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index a6dd5cf..af956cf 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -31,9 +31,7 @@
#include "swdllapi.h"
#include <fldbas.hxx>
#include <toxe.hxx>
-
-#define _SVSTDARR_LONGS
-#include <svl/svstdarr.hxx>
+#include <vector>
class SwAuthDataArr;
@@ -71,7 +69,7 @@ class SW_DLLPUBLIC SwAuthorityFieldType : public SwFieldType
{
SwDoc* m_pDoc;
SwAuthDataArr* m_pDataArr;
- SvLongs* m_pSequArr;
+ std::vector<long> m_SequArr;
SortKeyArr* m_pSortKeyArr;
sal_Unicode m_cPrefix;
sal_Unicode m_cSuffix;
@@ -101,7 +99,7 @@ public:
BOOL AddField(long nHandle);
void DelSequenceArray()
{
- m_pSequArr->Remove(0, m_pSequArr->Count());
+ m_SequArr.clear();
}
const SwAuthEntry* GetEntryByHandle(long nHandle) const;
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 3e52fcd..15fb13a 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -93,7 +93,6 @@ SwAuthorityFieldType::SwAuthorityFieldType(SwDoc* pDoc)
: SwFieldType( RES_AUTHORITY ),
m_pDoc(pDoc),
m_pDataArr(new SwAuthDataArr ),
- m_pSequArr(new SvLongs(5, 5)),
m_pSortKeyArr(new SortKeyArr(3, 3)),
m_cPrefix('['),
m_cSuffix(']'),
@@ -106,7 +105,6 @@ SwAuthorityFieldType::SwAuthorityFieldType(SwDoc* pDoc)
SwAuthorityFieldType::SwAuthorityFieldType( const SwAuthorityFieldType& rFType)
: SwFieldType( RES_AUTHORITY ),
m_pDataArr(new SwAuthDataArr ),
- m_pSequArr(new SvLongs(5, 5)),
m_pSortKeyArr(new SortKeyArr(3, 3)),
m_cPrefix(rFType.m_cPrefix),
m_cSuffix(rFType.m_cSuffix),
@@ -123,7 +121,7 @@ SwAuthorityFieldType::~SwAuthorityFieldType()
{
m_pSortKeyArr->DeleteAndDestroy(0, m_pSortKeyArr->Count());
delete m_pSortKeyArr;
- delete m_pSequArr;
+ m_SequArr.clear();
delete m_pDataArr;
}
@@ -314,9 +312,9 @@ USHORT SwAuthorityFieldType::GetSequencePos(long nHandle)
#if OSL_DEBUG_LEVEL > 1
sal_Bool bCurrentFieldWithoutTextNode = sal_False;
#endif
- if(m_pSequArr->Count() && m_pSequArr->Count() != m_pDataArr->Count())
+ if(!m_SequArr.empty() && m_SequArr.size() != m_pDataArr->Count())
DelSequenceArray();
- if(!m_pSequArr->Count())
+ if(m_SequArr.empty())
{
SwTOXSortTabBases aSortArr;
SwClientIter aIter( *this );
@@ -387,15 +385,15 @@ USHORT SwAuthorityFieldType::GetSequencePos(long nHandle)
const SwTOXSortTabBase& rBase = *aSortArr[i];
SwFmtFld& rFmtFld = ((SwTOXAuthority&)rBase).GetFldFmt();
SwAuthorityField* pAFld = (SwAuthorityField*)rFmtFld.GetFld();
- m_pSequArr->Insert(pAFld->GetHandle(), i);
+ m_SequArr.push_back(pAFld->GetHandle());
}
aSortArr.DeleteAndDestroy(0, aSortArr.Count());
}
//find nHandle
USHORT nRet = 0;
- for(USHORT i = 0; i < m_pSequArr->Count(); i++)
+ for(USHORT i = 0; i < m_SequArr.size(); ++i)
{
- if((*m_pSequArr)[i] == nHandle)
+ if(m_SequArr[i] == nHandle)
{
nRet = i + 1;
break;
More information about the Libreoffice-commits
mailing list