[Libreoffice-commits] core.git: 10 commits - editeng/source svx/source sw/inc sw/source
Caolán McNamara
caolanm at redhat.com
Fri Nov 8 18:19:30 CET 2013
editeng/source/misc/svxacorr.cxx | 12 ++++--------
svx/source/unodraw/unoshape.cxx | 21 ++++++++++++++++++---
sw/inc/anchoredobject.hxx | 7 ++-----
sw/inc/expfld.hxx | 2 +-
sw/inc/txatbase.hxx | 2 +-
sw/source/core/crsr/findtxt.cxx | 19 ++++++++++---------
sw/source/core/edit/edlingu.cxx | 4 ++--
sw/source/core/frmedt/fecopy.cxx | 2 +-
sw/source/core/inc/layfrm.hxx | 14 ++++++++++++++
sw/source/core/inc/txtfrm.hxx | 20 ++++++++++----------
sw/source/core/layout/anchoredobject.cxx | 12 ++++++++++++
sw/source/core/layout/ssfrm.cxx | 8 ++++++++
sw/source/core/text/itratr.cxx | 4 ++--
sw/source/core/txtnode/ndtxt.cxx | 2 +-
sw/source/core/txtnode/txatritr.cxx | 4 ++--
sw/source/core/unocore/unochart.cxx | 2 +-
sw/source/filter/ww8/wrtw8nds.cxx | 8 ++++----
sw/source/ui/vba/vbafield.cxx | 24 ++++++++++++------------
18 files changed, 105 insertions(+), 62 deletions(-)
New commits:
commit 02f80eef3c60385582f1bc2d8f2fbccb8d55b7ff
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 8 15:32:06 2013 +0000
longparas: these sal_uInt16s are really xub_StrLens
Change-Id: I54ecd08c4073f1de6dd28e7d6824d8cfde98254a
diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index 978a891..4599911 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -124,7 +124,7 @@ public:
virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
- static sal_uInt16 GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc, unsigned nHint = 0);
+ static xub_StrLen GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc, unsigned nHint = 0);
// #i82544#
void SetLateInitialization() { bLateInitialization = true;}
};
diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx
index 2b14a2e..a5836b5 100644
--- a/sw/inc/txatbase.hxx
+++ b/sw/inc/txatbase.hxx
@@ -126,7 +126,7 @@ protected:
xub_StrLen m_nEnd;
public:
- SwTxtAttrEnd( SfxPoolItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
+ SwTxtAttrEnd( SfxPoolItem& rAttr, xub_StrLen nStart, xub_StrLen nEnd );
using SwTxtAttr::GetEnd;
virtual xub_StrLen* GetEnd();
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index f6a1c70..2770ab1 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -469,8 +469,8 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
(rSTxt.*fnMove->fnSearch)( sCleanStr, &nProxyStart, &nProxyEnd, 0 ) &&
!(bZeroMatch = (nProxyStart == nProxyEnd)))
{
- nStart = (sal_uInt16)nProxyStart;
- nEnd = (sal_uInt16)nProxyEnd;
+ nStart = (xub_StrLen)nProxyStart;
+ nEnd = (xub_StrLen)nProxyEnd;
// set section correctly
*GetPoint() = *pPam->GetPoint();
SetMark();
@@ -478,24 +478,25 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
// adjust start and end
if( !aFltArr.empty() )
{
- xub_StrLen n, nNew;
// if backward search, switch positions temporarily
- if( !bSrchForward ) { n = nStart; nStart = nEnd; nEnd = n; }
+ if( !bSrchForward ) { std::swap(nStart, nEnd); }
- for( n = 0, nNew = nStart;
+ xub_StrLen nNew(nStart);
+ for (size_t n = 0;
n < aFltArr.size() && aFltArr[ n ] <= nStart;
++n, ++nNew )
;
nStart = nNew;
- for( n = 0, nNew = nEnd;
+ nNew = nEnd;
+ for(size_t n = 0;
n < aFltArr.size() && aFltArr[ n ] < nEnd;
++n, ++nNew )
;
nEnd = nNew;
// if backward search, switch positions temporarily
- if( !bSrchForward ) { n = nStart; nStart = nEnd; nEnd = n; }
+ if( !bSrchForward ) { std::swap(nStart, nEnd); }
}
GetMark()->nContent = nStart;
GetPoint()->nContent = nEnd;
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 11c9a11..0e5540e 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -100,8 +100,8 @@ public:
// the content positions of each portion need to be saved
struct SpellContentPosition
{
- sal_uInt16 nLeft;
- sal_uInt16 nRight;
+ xub_StrLen nLeft;
+ xub_StrLen nRight;
};
typedef std::vector<SpellContentPosition> SpellContentPositions;
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 6bde38b..bc0559b 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -51,7 +51,7 @@ class SwTxtFrm: public SwCntntFrm
friend class SwTestFormat;
friend class WidowsAndOrphans;
friend class SwTxtFrmLocker; // duerfen Lock()/Unlock()
- friend bool sw_ChangeOffset( SwTxtFrm* pFrm, sal_uInt16 nNew );
+ friend bool sw_ChangeOffset( SwTxtFrm* pFrm, xub_StrLen nNew );
static SwCache *pTxtCache; //Pointer auf den Line-Cache
static long nMinPrtLine; //Diese Linie darf beim Drucken nicht
@@ -219,11 +219,11 @@ public:
void Init();
// Wird von FormatSpelling( ) gerufen
- SwRect _AutoSpell( const SwCntntNode*, const SwViewOption&, sal_uInt16 );
+ SwRect _AutoSpell( const SwCntntNode*, const SwViewOption&, xub_StrLen );
// is called from the FormatSpelling( ) method
- SwRect SmartTagScan( SwCntntNode* , sal_uInt16 );
+ SwRect SmartTagScan( SwCntntNode* , xub_StrLen );
// Wird vom CollectAutoCmplWords gerufen
- void CollectAutoCmplWrds( SwCntntNode* , sal_uInt16 );
+ void CollectAutoCmplWrds( SwCntntNode* , xub_StrLen );
// Returns the screen position of rPos. The values are relative to the upper
// left position of the page frame.
@@ -302,10 +302,10 @@ public:
// Methoden zur Verwaltung von FolgeFrames
SwCntntFrm *SplitFrm( const xub_StrLen nTxtPos );
SwCntntFrm *JoinFrm();
- inline sal_uInt16 GetOfst() const { return nOfst; }
- void _SetOfst( const sal_uInt16 nNewOfst );
- inline void SetOfst ( const sal_uInt16 nNewOfst );
- inline void ManipOfst ( const sal_uInt16 nNewOfst ){ nOfst = nNewOfst; }
+ inline xub_StrLen GetOfst() const { return nOfst; }
+ void _SetOfst( const xub_StrLen nNewOfst );
+ inline void SetOfst ( const xub_StrLen nNewOfst );
+ inline void ManipOfst ( const xub_StrLen nNewOfst ){ nOfst = nNewOfst; }
SwTxtFrm *GetFrmAtPos ( const SwPosition &rPos);
inline const SwTxtFrm *GetFrmAtPos ( const SwPosition &rPos) const;
// OD 07.10.2003 #110978# - return <reference> instead of <pointer>
@@ -503,10 +503,10 @@ public:
sal_uInt16 FirstLineHeight() const;
// Haengt FlyInCntFrm um, wenn nEnd > Index >= nStart ist.
- void MoveFlyInCnt( SwTxtFrm *pNew, sal_uInt16 nStart, sal_uInt16 nEnd );
+ void MoveFlyInCnt( SwTxtFrm *pNew, xub_StrLen nStart, xub_StrLen nEnd );
// Berechnet die Position von FlyInCntFrms
- sal_uInt16 CalcFlyPos( SwFrmFmt* pSearch );
+ xub_StrLen CalcFlyPos( SwFrmFmt* pSearch );
// Ermittelt die Startposition und Schrittweite des Registers
sal_Bool FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff );
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 9fc42da..47c99f9 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -337,8 +337,8 @@ xub_StrLen SwAttrIter::GetNextAttr( ) const
}
if (m_pTxtNode!=NULL) {
//TODO maybe use hints like FieldHints for this instead of looking at the text...
- int l=(nNext<m_pTxtNode->Len()?nNext:m_pTxtNode->Len());
- sal_uInt16 p=nPos;
+ xub_StrLen l=(nNext<m_pTxtNode->Len()?nNext:m_pTxtNode->Len());
+ xub_StrLen p=nPos;
while (p<l && m_pTxtNode->GetTxt()[p] != CH_TXT_ATR_FIELDSTART
&& m_pTxtNode->GetTxt()[p] != CH_TXT_ATR_FIELDEND
&& m_pTxtNode->GetTxt()[p] != CH_TXT_ATR_FORMELEMENT)
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 8dfa6a3..e463548 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2320,7 +2320,7 @@ void SwTxtNode::GCAttr()
return;
bool bChanged = false;
- sal_uInt16 nMin = m_Text.getLength(),
+ xub_StrLen nMin = m_Text.getLength(),
nMax = 0;
bool bAll = nMin != 0; // Bei leeren Absaetzen werden nur die
// INet-Formate entfernt.
diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx
index 6223046..c824a3b 100644
--- a/sw/source/core/txtnode/txatritr.cxx
+++ b/sw/source/core/txtnode/txatritr.cxx
@@ -205,8 +205,8 @@ void SwTxtAttrIterator::SearchNextChg()
for( ; nAttrPos < pHts->Count(); ++nAttrPos )
{
const SwTxtAttr* pHt = (*pHts)[ nAttrPos ];
- const sal_uInt16* pEnd = pHt->GetEnd();
- const sal_uInt16 nHtStt = *pHt->GetStart();
+ const xub_StrLen* pEnd = pHt->GetEnd();
+ const xub_StrLen nHtStt = *pHt->GetStart();
if( nHtStt < nStt && ( !pEnd || *pEnd <= nStt ))
continue;
commit 3fa85c871637ee378450c12f10219f94dd692525
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 8 15:24:15 2013 +0000
longparas: these sal_uLongs are really xub_StrLens
Change-Id: Iebe3d5edccb6737da64aba5c3d61b9509ce7ec9d
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index dd01534..f6a1c70 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -47,7 +47,7 @@ OUString *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam );
static OUString
lcl_CleanStr(const SwTxtNode& rNd, xub_StrLen const nStart, xub_StrLen& rEnd,
- std::vector<sal_uLong> &rArr, bool const bRemoveSoftHyphen)
+ std::vector<xub_StrLen> &rArr, bool const bRemoveSoftHyphen)
{
OUStringBuffer buf(rNd.GetTxt());
rArr.clear();
@@ -392,7 +392,7 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
SwNodeIndex& rNdIdx = pPam->GetPoint()->nNode;
const SwNode* pSttNd = &rNdIdx.GetNode();
OUString sCleanStr;
- std::vector<sal_uLong> aFltArr;
+ std::vector<xub_StrLen> aFltArr;
LanguageType eLastLang = 0;
// if the search string contains a soft hypen,
// we don't strip them from the text:
commit 4536eefa32f634658a939f747e4791a678032bcb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 8 15:27:16 2013 +0000
longparas: these sal_uInt64s are really xub_StrLens
Change-Id: I5d6222372e79e6ccbcd6529ce5c88b3f082934c6
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 9c5c007..e695fcb 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1055,7 +1055,7 @@ sal_Bool SwFEShell::Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames )
SwNodes &rDestNodes = GetDoc()->GetNodes();
xub_StrLen nDestStart = PCURCRSR->GetPoint()->nNode.GetIndex() - nNodesCnt;
- for ( sal_uInt64 nIdx = 0; nIdx <= nNodesCnt; nIdx++ )
+ for (xub_StrLen nIdx = 0; nIdx <= nNodesCnt; ++nIdx)
{
SwTxtNode *pTxtNode = rDestNodes[ nDestStart + nIdx ]->GetTxtNode();
if ( pTxtNode )
commit cc7deac7054709fada9b0867d25644f3fdbe2d06
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 8 15:30:40 2013 +0000
longparas: same variable used for two different loops of different types
Change-Id: I1efdeb3f9bbda47d8f465a04fb36164e7ffc347b
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index fb3e00b..e9ed157 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -359,7 +359,6 @@ sal_Bool SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const OUString& rTx
// Is the word a compounded word separated by delimiters?
// If so, keep track of all delimiters so each constituent
// word can be checked for two initial capital letters.
- xub_StrLen n = 0;
std::deque<xub_StrLen> aDelimiters;
// Always check for two capitals at the beginning
@@ -367,13 +366,12 @@ sal_Bool SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const OUString& rTx
aDelimiters.push_back(nSttPos);
// Find all compound word delimiters
- for (n = nSttPos; n < nEndPos; n++)
+ for (xub_StrLen n = nSttPos; n < nEndPos; ++n)
{
if (IsAutoCorrectChar(rTxt[ n ]))
{
aDelimiters.push_back( n + 1 ); // Get position of char after delimiter
}
-
}
// Decide where to put the terminating delimiter.
@@ -386,10 +384,10 @@ sal_Bool SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const OUString& rTx
// Iterate through the word and all words that compose it.
// Two capital letters at the beginning of word?
- for(n = 0; n < aDelimiters.size() - 1; n++)
+ for (size_t nI = 0; nI < aDelimiters.size() - 1; ++nI)
{
- nSttPos = aDelimiters[n];
- nEndPos = aDelimiters[n + 1];
+ nSttPos = aDelimiters[nI];
+ nEndPos = aDelimiters[nI + 1];
if( nSttPos+2 < nEndPos &&
IsUpperLetter( rCC.getCharacterType( rTxt, nSttPos )) &&
commit aa92403a2b8336c5317f0fc95fac23fb7e540c89
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 8 12:39:45 2013 +0000
longparas: disentangle same variable used over two different loops
Change-Id: I22bbd777cb86decbbf714f71ff0477053ae3b757
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index ed80643..3df10ff 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -268,13 +268,13 @@ xub_StrLen SwWW8AttrIter::SearchNext( xub_StrLen nStartPos )
if ( nCurRedlinePos < m_rExport.pDoc->GetRedlineTbl().size() )
{
// nCurRedlinePos point to the next redline
- nPos = nCurRedlinePos;
+ sal_uInt16 nRedLinePos = nCurRedlinePos;
if( pCurRedline )
- ++nPos;
+ ++nRedLinePos;
- for ( ; nPos < m_rExport.pDoc->GetRedlineTbl().size(); ++nPos )
+ for ( ; nRedLinePos < m_rExport.pDoc->GetRedlineTbl().size(); ++nRedLinePos )
{
- const SwRedline* pRedl = m_rExport.pDoc->GetRedlineTbl()[ nPos ];
+ const SwRedline* pRedl = m_rExport.pDoc->GetRedlineTbl()[ nRedLinePos ];
const SwPosition* pStt = pRedl->Start();
const SwPosition* pEnd = pStt == pRedl->GetPoint()
commit ea4fd6d5ca9fb8757cf1cba9c2f419947d87e8fb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 8 15:28:59 2013 +0000
n is immediately overwritten
Change-Id: I51c511efcfaf2d97cefa42abea1d3e42c023fbbd
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 3c4302f..fb3e00b 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -385,8 +385,6 @@ sal_Bool SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const OUString& rTx
aDelimiters.push_back(nEndPos);
// Iterate through the word and all words that compose it.
- n = aDelimiters.size();
-
// Two capital letters at the beginning of word?
for(n = 0; n < aDelimiters.size() - 1; n++)
{
commit 5a792cefec8a5b47c1956b8736097668fd895a61
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 8 10:20:37 2013 +0000
safe xub_StrLen -> sal_Int32 conversion
Change-Id: I43c6ee0b794b1b77b790e5c36c852a0746437164
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index f5c86aa..965c332 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -209,7 +209,7 @@ bool FillRangeDescriptor(
SwRangeDescriptor &rDesc,
const OUString &rCellRangeName )
{
- xub_StrLen nToken = -1 == rCellRangeName.indexOf('.') ? 0 : 1;
+ sal_Int32 nToken = -1 == rCellRangeName.indexOf('.') ? 0 : 1;
OUString aCellRangeNoTableName( rCellRangeName.getToken( nToken, '.' ) );
OUString aTLName( aCellRangeNoTableName.getToken(0, ':') ); // name of top left cell
OUString aBRName( aCellRangeNoTableName.getToken(1, ':') ); // name of bottom right cell
commit 64ed6187e6315f56f4ef8e0d802cb532c8ce0128
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Nov 7 17:25:06 2013 +0000
safe STRING_NOTFOUND -> -1 conversion
Change-Id: Id66b9ff49289d90f2d0714bed84e886598f103ad
diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx
index b2c34d0..0eb5db1 100644
--- a/sw/source/ui/vba/vbafield.cxx
+++ b/sw/source/ui/vba/vbafield.cxx
@@ -74,16 +74,16 @@ class SwVbaReadFieldParams
{
private:
OUString aData;
- xub_StrLen nLen, nFnd, nNext, nSavPtr;
+ sal_Int32 nLen, nFnd, nNext, nSavPtr;
OUString aFieldName;
public:
SwVbaReadFieldParams( const OUString& rData );
~SwVbaReadFieldParams();
long SkipToNextToken();
- xub_StrLen GetTokenSttPtr() const { return nFnd; }
+ sal_Int32 GetTokenSttPtr() const { return nFnd; }
- xub_StrLen FindNextStringPiece( xub_StrLen _nStart = STRING_NOTFOUND );
+ sal_Int32 FindNextStringPiece( sal_Int32 _nStart = -1 );
OUString GetResult() const;
OUString GetFieldName()const { return aFieldName; }
@@ -119,7 +119,7 @@ SwVbaReadFieldParams::~SwVbaReadFieldParams()
OUString SwVbaReadFieldParams::GetResult() const
{
- return (STRING_NOTFOUND == nFnd)
+ return (-1 == nFnd)
? OUString()
: aData.copy( nFnd, (nSavPtr - nFnd) );
}
@@ -129,8 +129,8 @@ long SwVbaReadFieldParams::SkipToNextToken()
{
long nRet = -1; // end
if (
- (STRING_NOTFOUND != nNext) && (nLen > nNext) &&
- STRING_NOTFOUND != (nFnd = FindNextStringPiece(nNext))
+ (-1 != nNext) && (nLen > nNext) &&
+ -1 != (nFnd = FindNextStringPiece(nNext))
)
{
nSavPtr = nNext;
@@ -144,7 +144,7 @@ long SwVbaReadFieldParams::SkipToNextToken()
{
nRet = -2;
if (
- (STRING_NOTFOUND != nSavPtr ) &&
+ (-1 != nSavPtr ) &&
(
('"' == aData[nSavPtr - 1]) ||
(0x201d == aData[nSavPtr - 1])
@@ -166,18 +166,18 @@ long SwVbaReadFieldParams::SkipToNextToken()
//
// Return value: 0 if String-End reached, otherwise begin of the paramater or the string
-xub_StrLen SwVbaReadFieldParams::FindNextStringPiece(const xub_StrLen nStart)
+sal_Int32 SwVbaReadFieldParams::FindNextStringPiece(const sal_Int32 nStart)
{
- xub_StrLen n = ( STRING_NOTFOUND == nStart ) ? nFnd : nStart; // Start
- xub_StrLen n2; // End
+ sal_Int32 n = ( -1 == nStart ) ? nFnd : nStart; // Start
+ sal_Int32 n2; // End
- nNext = STRING_NOTFOUND; // Default for not found
+ nNext = -1; // Default for not found
while( (nLen > n) && (aData[ n ] == ' ') )
++n;
if( nLen == n )
- return STRING_NOTFOUND; // String End reached!
+ return -1; // String End reached!
if( (aData[ n ] == '"') // quotation marks are in front of parenthesis?
|| (aData[ n ] == 0x201c)
commit b376eacdfae11f5d39eb7011efe67390d9f495e7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 8 14:53:42 2013 +0000
Access by AnchoredObject of a deleted SwLayoutFrm
as demonstrated by abi10075-1.doc
just register the AnchoredObjects in the SwLayoutFrm and
inform them when the SwLayoutFrm goes away.
This crash was triggered by "1e113cb7604e1509e7d598a9be329f1f7b6e9322" import
different first page header/footer from doc. But that commit is blameless.
Change-Id: Ia079cc635a81dff1ccbf740641f441aa784328a4
diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx
index 7e304fd..da66dca 100644
--- a/sw/inc/anchoredobject.hxx
+++ b/sw/inc/anchoredobject.hxx
@@ -269,15 +269,12 @@ class SW_DLLPUBLIC SwAnchoredObject
// accessors to data of position calculation:
// frame vertical position is orient at
- inline const SwLayoutFrm* GetVertPosOrientFrm() const
+ const SwLayoutFrm* GetVertPosOrientFrm() const
{
return mpVertPosOrientFrm;
}
// method to clear member <mpVertPosOrientFrm>
- inline void ClearVertPosOrientFrm()
- {
- mpVertPosOrientFrm = 0L;
- }
+ void ClearVertPosOrientFrm();
/** check anchor character rectangle and top of line
diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx
index 30af36c..87c823d 100644
--- a/sw/source/core/inc/layfrm.hxx
+++ b/sw/source/core/inc/layfrm.hxx
@@ -21,6 +21,7 @@
#include "frame.hxx"
+class SwAnchoredObject;
class SwCntntFrm;
class SwFlowFrm;
class SwFmtCol;
@@ -53,6 +54,7 @@ protected:
virtual void MakeAll();
SwFrm *pLower;
+ std::vector<SwAnchoredObject*> aVertPosOrientFrmsFor;
virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
@@ -164,6 +166,18 @@ public:
inline SwFrm* GetLastLower();
virtual void PaintBreak() const;
+
+ void SetVertPosOrientFrmFor(SwAnchoredObject *pObj)
+ {
+ aVertPosOrientFrmsFor.push_back(pObj);
+ }
+
+ void ClearVertPosOrientFrmFor(SwAnchoredObject *pObj)
+ {
+ aVertPosOrientFrmsFor.erase(
+ std::remove(aVertPosOrientFrmsFor.begin(),
+ aVertPosOrientFrmsFor.end(), pObj), aVertPosOrientFrmsFor.end());
+ }
};
//Um doppelte Implementierung zu sparen wird hier ein bischen gecasted
diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx
index b737998..157c346 100644
--- a/sw/source/core/layout/anchoredobject.cxx
+++ b/sw/source/core/layout/anchoredobject.cxx
@@ -98,8 +98,18 @@ SwAnchoredObject::SwAnchoredObject() :
{
}
+void SwAnchoredObject::ClearVertPosOrientFrm()
+{
+ if (mpVertPosOrientFrm)
+ {
+ const_cast<SwLayoutFrm*>(mpVertPosOrientFrm)->ClearVertPosOrientFrmFor(this);
+ mpVertPosOrientFrm = NULL;
+ }
+}
+
SwAnchoredObject::~SwAnchoredObject()
{
+ ClearVertPosOrientFrm();
}
// =============================================================================
@@ -229,6 +239,8 @@ void SwAnchoredObject::SetVertPosOrientFrm( const SwLayoutFrm& _rVertPosOrientFr
{
mpVertPosOrientFrm = &_rVertPosOrientFrm;
+ const_cast<SwLayoutFrm*>(mpVertPosOrientFrm)->SetVertPosOrientFrmFor(this);
+
// #i28701# - take over functionality of deleted method
// <SwFlyAtCntFrm::AssertPage()>: assure for at-paragraph and at-character
// an anchored object, that it is registered at the correct page frame
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index ffd6da9..e44893b 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -557,6 +557,14 @@ void SwCntntFrm::DelFrms( const SwCntntNode& rNode )
void SwLayoutFrm::Destroy()
{
+ while (!aVertPosOrientFrmsFor.empty())
+ {
+ SwAnchoredObject *pObj = *aVertPosOrientFrmsFor.begin();
+ pObj->ClearVertPosOrientFrm();
+ }
+
+ assert(aVertPosOrientFrmsFor.empty());
+
SwFrm *pFrm = pLower;
if( GetFmt() && !GetFmt()->GetDoc()->IsInDtor() )
commit 050d2ceb534f17f3e865f5f8118bb95a4749de9c
Author: Armin Le Grand <alg at apache.org>
Date: Fri Nov 8 12:44:22 2013 +0000
Resolves: #i123616# be more flexible regarding the data type for polygon data
(cherry picked from commit 66c81c1a26d6d09c75c8b8ced44e4a0cf43819ee)
Conflicts:
svx/source/unodraw/unoshape.cxx
Change-Id: I5ebb7b39a083bb6e007853f205bb39d434eb94ad
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index e580014..77fa691 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -82,6 +82,7 @@
#include <editeng/outlobj.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/tools/unotools.hxx>
#include "shapeimpl.hxx"
#include <sal/log.hxx>
@@ -2330,10 +2331,24 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl
}
case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
{
- drawing::PolyPolygonBezierCoords aPolyPoly;
- if ( rValue >>= aPolyPoly )
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+
+ // #123616# be a little bit more flexible regardin gthe data type used
+ if( rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0))
+ {
+ // get polygpon data from PointSequenceSequence
+ aNewPolyPolygon = basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(
+ *(const drawing::PointSequenceSequence*)rValue.getValue());
+ }
+ else if( rValue.getValueType() == ::getCppuType(( const drawing::PolyPolygonBezierCoords*)0))
+ {
+ // get polygpon data from PolyPolygonBezierCoords
+ aNewPolyPolygon = basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
+ *(const drawing::PolyPolygonBezierCoords*)rValue.getValue());
+ }
+
+ if(aNewPolyPolygon.count())
{
- basegfx::B2DPolyPolygon aNewPolyPolygon( basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( aPolyPoly ) );
// Reintroduction of fix for issue i59051 (#i108851#)
ForceMetricToItemPoolMetric( aNewPolyPolygon );
if( mpModel->IsWriter() )
More information about the Libreoffice-commits
mailing list