From 3a019a8830e7daea46389eb5595d4e356287d36f Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Tue, 21 Sep 2010 22:45:53 +0200 Subject: svarray: #i112395#: replace SV_DECL_PTRARR_STACK with deque --- editeng/inc/editeng/svxrtf.hxx | 9 +++++++-- editeng/source/rtf/rtfitem.cxx | 18 +++++++++--------- editeng/source/rtf/svxrtf.cxx | 34 ++++++++++++++++++---------------- 3 files changed, 34 insertions(+), 27 deletions(-) (limited to 'editeng') diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx index 45195c2acb..ef9527d6e8 100644 --- a/editeng/inc/editeng/svxrtf.hxx +++ b/editeng/inc/editeng/svxrtf.hxx @@ -37,6 +37,8 @@ #include #include +#include + class Font; class Color; class Graphic; @@ -87,7 +89,10 @@ DECLARE_TABLE( SvxRTFFontTbl, Font* ) DECLARE_TABLE( SvxRTFStyleTbl, SvxRTFStyleType* ) typedef SvxRTFItemStackType* SvxRTFItemStackTypePtr; SV_DECL_PTRARR_DEL( SvxRTFItemStackList, SvxRTFItemStackTypePtr, 1, 1 ) -SV_DECL_PTRARR_STACK( SvxRTFItemStack, SvxRTFItemStackTypePtr, 0, 1 ) + +// SvxRTFItemStack can't be "std::stack< SvxRTFItemStackTypePtr >" type, because +// the methods are using operator[] in sw/source/filter/rtf/rtftbl.cxx file +typedef std::deque< SvxRTFItemStackTypePtr > SvxRTFItemStack; // einige Hilfsklassen fuer den RTF-Parser struct SvxRTFStyleType @@ -464,7 +469,7 @@ inline const Color& SvxRTFParser::GetColor( USHORT nId ) const inline SfxItemSet& SvxRTFParser::GetAttrSet() { SvxRTFItemStackTypePtr pTmp; - if( bNewGroup || 0 == ( pTmp = aAttrStack.Top()) ) + if( bNewGroup || 0 == ( pTmp = aAttrStack.back()) ) pTmp = _GetAttrSet(); return pTmp->aAttrSet; } diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index ce2adc3ecb..4e68a841e7 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -228,7 +228,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) RTF_CharTypeDef eCharType = NOTDEF_CHARTYPE; USHORT nFontAlign; - int bChkStkPos = !bNewGroup && aAttrStack.Top(); + int bChkStkPos = !bNewGroup && aAttrStack.back(); while( bWeiter && IsParserWorking() ) // solange bekannte Attribute erkannt werden { @@ -250,7 +250,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( !bChkStkPos ) break; - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.back(); if( !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pAkt->nSttCnt == pInsPos->GetCntIdx() )) break; @@ -269,10 +269,10 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.Top(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); - aAttrStack.Push( pNew ); + aAttrStack.push_back( pNew ); pAkt = pNew; } else @@ -305,7 +305,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) nStyleNo = -1 == nTokenValue ? 0 : USHORT(nTokenValue); // setze am akt. auf dem AttrStack stehenden Style die // StyleNummer - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.back(); if( !pAkt ) break; @@ -1869,9 +1869,9 @@ void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet, // pard / plain abarbeiten void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) { - if( !bNewGroup && aAttrStack.Top() ) // nicht am Anfang einer neuen Gruppe + if( !bNewGroup && aAttrStack.back() ) // not at the beginning of a new group { - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.back(); int nLastToken = GetStackPtr(-1)->nTokenId; int bNewStkEntry = TRUE; @@ -1887,9 +1887,9 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.Top(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); - aAttrStack.Push( pNew ); + aAttrStack.push_back( pNew ); pAkt = pNew; } else diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index 676e96f173..b7ceeae317 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -130,7 +130,7 @@ SvxRTFParser::~SvxRTFParser() ClearFontTbl(); if( aStyleTbl.Count() ) ClearStyleTbl(); - if( aAttrStack.Count() ) + if( !aAttrStack.empty() ) ClearAttrStack(); delete pRTFDefaults; @@ -149,7 +149,7 @@ void SvxRTFParser::SetInsPos( const SvxPosition& rNew ) SvParserState SvxRTFParser::CallParser() { - DBG_ASSERT( pInsPos, "keine Einfuegeposition" ); + DBG_ASSERT( pInsPos, "no insertion" ); if( !pInsPos ) return SVPAR_ERROR; @@ -160,7 +160,7 @@ SvParserState SvxRTFParser::CallParser() ClearFontTbl(); if( aStyleTbl.Count() ) ClearStyleTbl(); - if( aAttrStack.Count() ) + if( !aAttrStack.empty() ) ClearAttrStack(); bIsSetDfltTab = FALSE; @@ -836,9 +836,10 @@ void SvxRTFParser::ClearStyleTbl() void SvxRTFParser::ClearAttrStack() { SvxRTFItemStackType* pTmp; - for( ULONG nCnt = aAttrStack.Count(); nCnt; --nCnt ) + for( size_t nCnt = aAttrStack.size(); nCnt; --nCnt ) { - pTmp = aAttrStack.Pop(); + pTmp = aAttrStack.back(); + aAttrStack.pop_back(); delete pTmp; } } @@ -872,7 +873,7 @@ const Font& SvxRTFParser::GetFont( USHORT nId ) SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr ) { - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.back(); SvxRTFItemStackType* pNew; if( pAkt ) pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, bCopyAttr ); @@ -881,7 +882,7 @@ SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr ) *pInsPos ); pNew->SetRTFDefaults( GetRTFDefaults() ); - aAttrStack.Push( pNew ); + aAttrStack.push_back( pNew ); bNewGroup = FALSE; return pNew; } @@ -936,10 +937,11 @@ void SvxRTFParser::_ClearStyleAttr( SvxRTFItemStackType& rStkType ) void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen { - if( aAttrStack.Count() ) + if( !aAttrStack.empty() ) { - SvxRTFItemStackType *pOld = aAttrStack.Pop(); - SvxRTFItemStackType *pAkt = aAttrStack.Top(); + SvxRTFItemStackType *pOld = aAttrStack.back(); + aAttrStack.pop_back(); + SvxRTFItemStackType *pAkt = aAttrStack.back(); do { // middle check loop ULONG nOldSttNdIdx = pOld->pSttNd->GetIdx(); @@ -1114,9 +1116,9 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.Top(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); - aAttrStack.Push( pNew ); + aAttrStack.push_back( pNew ); pAkt = pNew; } } @@ -1144,8 +1146,8 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen void SvxRTFParser::SetAllAttrOfStk() // end all Attr. and set it into doc { - // noch alle Attrbute vom Stack holen !! - while( aAttrStack.Count() ) + // repeat until all attributes will be taken from stack + while( !aAttrStack.empty() ) AttrGroupEnd(); for( USHORT n = aAttrSetList.Count(); n; ) @@ -1174,10 +1176,10 @@ void SvxRTFParser::SetAttrSet( SvxRTFItemStackType &rSet ) SetAttrSet( *(*rSet.pChildList)[ n ] ); } - // wurde noch kein Text eingefuegt ? (SttPos vom obersten StackEintrag!) + // Is text wasn't inserted? (Get SttPos from the top of stack!) int SvxRTFParser::IsAttrSttPos() { - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.back(); return !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pAkt->nSttCnt == pInsPos->GetCntIdx()); } -- cgit v1.2.3 From 762162eb262a7abcb022b9c2229ecdc23870401f Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Wed, 22 Sep 2010 18:17:35 +0200 Subject: svarray: #i112395#: fix editeng/inc/editeng/svxrtf file --- editeng/inc/editeng/svxrtf.hxx | 10 +++++----- editeng/source/rtf/svxrtf.cxx | 16 +++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'editeng') diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx index ef9527d6e8..39f3e7a673 100644 --- a/editeng/inc/editeng/svxrtf.hxx +++ b/editeng/inc/editeng/svxrtf.hxx @@ -84,7 +84,7 @@ public: typedef Color* ColorPtr; -SV_DECL_PTRARR( SvxRTFColorTbl, ColorPtr, 16, 4 ) +typedef std::deque< ColorPtr > SvxRTFColorTbl; DECLARE_TABLE( SvxRTFFontTbl, Font* ) DECLARE_TABLE( SvxRTFStyleTbl, SvxRTFStyleType* ) typedef SvxRTFItemStackType* SvxRTFItemStackTypePtr; @@ -381,7 +381,7 @@ public: virtual SvParserState CallParser(); // Aufruf des Parsers - inline const Color& GetColor( USHORT nId ) const; + inline const Color& GetColor( size_t nId ) const; const Font& GetFont( USHORT nId ); // aendert den dflt Font virtual int IsEndPara( SvxNodeIdx* pNd, xub_StrLen nCnt ) const = 0; @@ -456,12 +456,12 @@ public: }; -// ----------- Inline Implementierungen -------------- +// ----------- Inline Implementations -------------- -inline const Color& SvxRTFParser::GetColor( USHORT nId ) const +inline const Color& SvxRTFParser::GetColor( size_t nId ) const { ColorPtr pColor = (ColorPtr)pDfltColor; - if( nId < aColorTbl.Count() ) + if( nId < aColorTbl.size() ) pColor = aColorTbl[ nId ]; return *pColor; } diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index b7ceeae317..fbb25d406c 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -55,7 +55,6 @@ using namespace ::com::sun::star; -SV_IMPL_PTRARR( SvxRTFColorTbl, ColorPtr ) SV_IMPL_PTRARR( SvxRTFItemStackList, SvxRTFItemStackType* ) CharSet lcl_GetDefaultTextEncodingForRTF() @@ -83,7 +82,6 @@ SvxRTFParser::SvxRTFParser( SfxItemPool& rPool, SvStream& rIn, int bReadNewDoc ) : SvRTFParser( rIn, 5 ), rStrm(rIn), - aColorTbl( 16, 4 ), aFontTbl( 16, 4 ), pInsPos( 0 ), pAttrPool( &rPool ), @@ -124,7 +122,7 @@ void SvxRTFParser::ResetPard() SvxRTFParser::~SvxRTFParser() { - if( aColorTbl.Count() ) + if( !aColorTbl.empty() ) ClearColorTbl(); if( aFontTbl.Count() ) ClearFontTbl(); @@ -154,7 +152,7 @@ SvParserState SvxRTFParser::CallParser() if( !pInsPos ) return SVPAR_ERROR; - if( aColorTbl.Count() ) + if( !aColorTbl.empty() ) ClearColorTbl(); if( aFontTbl.Count() ) ClearFontTbl(); @@ -488,10 +486,10 @@ void SvxRTFParser::ReadColorTable() // eine Farbe ist Fertig, in die Tabelle eintragen // versuche die Werte auf SV interne Namen zu mappen ColorPtr pColor = new Color( nRed, nGreen, nBlue ); - if( !aColorTbl.Count() && + if( aColorTbl.empty() && BYTE(-1) == nRed && BYTE(-1) == nGreen && BYTE(-1) == nBlue ) pColor->SetColor( COL_AUTO ); - aColorTbl.Insert( pColor, aColorTbl.Count() ); + aColorTbl.push_back( pColor ); nRed = 0, nGreen = 0, nBlue = 0; // Color konnte vollstaendig gelesen werden, @@ -818,7 +816,11 @@ void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo ) void SvxRTFParser::ClearColorTbl() { - aColorTbl.DeleteAndDestroy( 0, aColorTbl.Count() ); + for( size_t n = 0; n < aColorTbl.size(); n++ ) + { + delete aColorTbl.back(); + aColorTbl.pop_back(); + } } void SvxRTFParser::ClearFontTbl() -- cgit v1.2.3 From 06b1f3b8fd5908a03d3c51c322d0e16e8c7d64ac Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 23 Sep 2010 07:11:42 +0200 Subject: svarray: #i112395#: apply deque to ScriptTypePosInfos --- editeng/source/editeng/editdoc.cxx | 2 -- editeng/source/editeng/editdoc.hxx | 4 ++- editeng/source/editeng/editdoc2.cxx | 6 ++--- editeng/source/editeng/impedit2.cxx | 54 ++++++++++++++++++------------------- editeng/source/editeng/impedit3.cxx | 4 +-- 5 files changed, 33 insertions(+), 37 deletions(-) mode change 100755 => 100644 editeng/source/editeng/impedit2.cxx (limited to 'editeng') diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 7b34d931e2..3163987d86 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -255,9 +255,7 @@ USHORT aV5Map[] = { }; SV_IMPL_PTRARR( DummyContentList, ContentNode* ); -SV_IMPL_VARARR( ScriptTypePosInfos, ScriptTypePosInfo ); SV_IMPL_VARARR( WritingDirectionInfos, WritingDirectionInfo ); -// SV_IMPL_VARARR( ExtraCharInfos, ExtraCharInfo ); int SAL_CALL CompareStart( const void* pFirst, const void* pSecond ) diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index e3ad32cfab..ea54227033 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -40,6 +40,8 @@ #include #include +#include + class ImpEditEngine; class SvxTabStop; class SvtCTLOptions; @@ -96,7 +98,7 @@ struct ScriptTypePosInfo } }; -SV_DECL_VARARR( ScriptTypePosInfos, ScriptTypePosInfo, 0, 4 ) +typedef std::deque< ScriptTypePosInfo > ScriptTypePosInfos; struct WritingDirectionInfo { diff --git a/editeng/source/editeng/editdoc2.cxx b/editeng/source/editeng/editdoc2.cxx index 1c277845a2..cb1b1de0aa 100644 --- a/editeng/source/editeng/editdoc2.cxx +++ b/editeng/source/editeng/editdoc2.cxx @@ -238,9 +238,8 @@ void ParaPortion::MarkInvalid( USHORT nStart, short nDiff ) } } bInvalid = TRUE; - aScriptInfos.Remove( 0, aScriptInfos.Count() ); + aScriptInfos.clear(); aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() ); -// aExtraCharInfos.Remove( 0, aExtraCharInfos.Count() ); } void ParaPortion::MarkSelectionInvalid( USHORT nStart, USHORT /* nEnd */ ) @@ -258,9 +257,8 @@ void ParaPortion::MarkSelectionInvalid( USHORT nStart, USHORT /* nEnd */ ) nInvalidDiff = 0; bInvalid = TRUE; bSimple = FALSE; - aScriptInfos.Remove( 0, aScriptInfos.Count() ); + aScriptInfos.clear(); aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() ); -// aExtraCharInfos.Remove( 0, aExtraCharInfos.Count() ); } USHORT ParaPortion::GetLineNumber( USHORT nIndex ) diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx old mode 100755 new mode 100644 index e0e780c784..9412bd62ed --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -1719,9 +1719,7 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - rTypes.Remove( 0, rTypes.Count() ); - -// pParaPortion->aExtraCharInfos.Remove( 0, pParaPortion->aExtraCharInfos.Count() ); + rTypes.clear(); ContentNode* pNode = pParaPortion->GetNode(); if ( pNode->Len() ) @@ -1770,19 +1768,19 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) sal_Int32 nPos = 0; short nScriptType = _xBI->getScriptType( aOUText, nPos ); - rTypes.Insert( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ), rTypes.Count() ); + rTypes.push_back( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ) ); nPos = _xBI->endOfScript( aOUText, nPos, nScriptType ); while ( ( nPos != (-1) ) && ( nPos < nTextLen ) ) { - rTypes[rTypes.Count()-1].nEndPos = (USHORT)nPos; + rTypes.back().nEndPos = (USHORT)nPos; nScriptType = _xBI->getScriptType( aOUText, nPos ); long nEndPos = _xBI->endOfScript( aOUText, nPos, nScriptType ); - if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == rTypes[rTypes.Count()-1].nScriptType ) ) + if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == rTypes.back().nScriptType ) ) { // Expand last ScriptTypePosInfo, don't create weak or unecessary portions - rTypes[rTypes.Count()-1].nEndPos = (USHORT)nEndPos; + rTypes.back().nEndPos = (USHORT)nEndPos; } else { @@ -1793,18 +1791,18 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) case U_ENCLOSING_MARK: case U_COMBINING_SPACING_MARK: --nPos; - rTypes[rTypes.Count()-1].nEndPos--; + rTypes.back().nEndPos--; break; } } - rTypes.Insert( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ), rTypes.Count() ); + rTypes.push_back( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ) ); } nPos = nEndPos; } if ( rTypes[0].nScriptType == i18n::ScriptType::WEAK ) - rTypes[0].nScriptType = ( rTypes.Count() > 1 ) ? rTypes[1].nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() ); + rTypes[0].nScriptType = ( rTypes.size() > 1 ) ? rTypes[1].nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() ); // create writing direction information: if ( !pParaPortion->aWritingDirectionInfos.Count() ) @@ -1821,30 +1819,30 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) if ( nCurrDirType % 2 == UBIDI_RTL || // text in RTL run ( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( aText, nStart, nEnd ) ) ) // non-strong text in embedded LTR run { - USHORT nIdx = 0; + size_t nIdx = 0; // Skip entries in ScriptArray which are not inside the RTL run: - while ( nIdx < rTypes.Count() && rTypes[nIdx].nStartPos < nStart ) + while ( nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart ) ++nIdx; // Remove any entries *inside* the current run: - while ( nIdx < rTypes.Count() && rTypes[nIdx].nEndPos <= nEnd ) - rTypes.Remove( nIdx ); + while ( nIdx < rTypes.size() && rTypes[nIdx].nEndPos <= nEnd ) + rTypes.erase( rTypes.begin()+nIdx ); // special case: - if(nIdx < rTypes.Count() && rTypes[nIdx].nStartPos < nStart && rTypes[nIdx].nEndPos > nEnd) + if(nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart && rTypes[nIdx].nEndPos > nEnd) { - rTypes.Insert( ScriptTypePosInfo( rTypes[nIdx].nScriptType, (USHORT)nEnd, rTypes[nIdx].nEndPos ), nIdx ); + rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( rTypes[nIdx].nScriptType, (USHORT)nEnd, rTypes[nIdx].nEndPos ) ); rTypes[nIdx].nEndPos = nStart; } if( nIdx ) rTypes[nIdx - 1].nEndPos = nStart; - rTypes.Insert( ScriptTypePosInfo( i18n::ScriptType::COMPLEX, (USHORT)nStart, (USHORT)nEnd), nIdx ); + rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( i18n::ScriptType::COMPLEX, (USHORT)nStart, (USHORT)nEnd) ); ++nIdx; - if( nIdx < rTypes.Count() ) + if( nIdx < rTypes.size() ) rTypes[nIdx].nStartPos = nEnd; } } @@ -1853,7 +1851,7 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) USHORT nDebugStt = 0; USHORT nDebugEnd = 0; short nDebugType = 0; - for ( USHORT n = 0; n < rTypes.Count(); ++n ) + for ( size_t n = 0; n < rTypes.size(); ++n ) { nDebugStt = rTypes[n].nStartPos; nDebugEnd = rTypes[n].nEndPos; @@ -1874,12 +1872,12 @@ USHORT ImpEditEngine::GetScriptType( const EditPaM& rPaM, USHORT* pEndPos ) cons { USHORT nPara = GetEditDoc().GetPos( rPaM.GetNode() ); ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; USHORT nPos = rPaM.GetIndex(); - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + for ( size_t n = 0; n < rTypes.size(); n++ ) { if ( ( rTypes[n].nStartPos <= nPos ) && ( rTypes[n].nEndPos >= nPos ) ) { @@ -1906,7 +1904,7 @@ USHORT ImpEditEngine::GetScriptType( const EditSelection& rSel ) const for ( USHORT nPara = nStartPara; nPara <= nEndPara; nPara++ ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; @@ -1916,7 +1914,7 @@ USHORT ImpEditEngine::GetScriptType( const EditSelection& rSel ) const // well as with just moving the cursor from char to char. USHORT nS = ( nPara == nStartPara ) ? aSel.Min().GetIndex() : 0; USHORT nE = ( nPara == nEndPara ) ? aSel.Max().GetIndex() : pParaPortion->GetNode()->Len(); - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + for ( size_t n = 0; n < rTypes.size(); n++ ) { if (rTypes[n].nStartPos <= nS && nE <= rTypes[n].nEndPos) { @@ -1947,12 +1945,12 @@ BOOL ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const { USHORT nPara = GetEditDoc().GetPos( rPaM.GetNode() ); ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; USHORT nPos = rPaM.GetIndex(); - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + for ( size_t n = 0; n < rTypes.size(); n++ ) { if ( rTypes[n].nStartPos == nPos ) { @@ -1969,11 +1967,11 @@ BOOL ImpEditEngine::HasScriptType( USHORT nPara, USHORT nType ) const BOOL bTypeFound = FALSE; ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - for ( USHORT n = rTypes.Count(); n && !bTypeFound; ) + for ( size_t n = rTypes.size(); n && !bTypeFound; ) { if ( rTypes[--n].nScriptType == nType ) bTypeFound = TRUE; @@ -1989,7 +1987,7 @@ void ImpEditEngine::InitWritingDirections( USHORT nPara ) BOOL bCTL = FALSE; ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + for ( size_t n = 0; n < rTypes.size(); n++ ) { if ( rTypes[n].nScriptType == i18n::ScriptType::COMPLEX ) { diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 01d36c223c..a919f6c8d6 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2294,11 +2294,11 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r } aPositions.Insert( pNode->Len() ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( GetParaPortions().GetPos( pParaPortion ) ); const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - for ( USHORT nT = 0; nT < rTypes.Count(); nT++ ) + for ( size_t nT = 0; nT < rTypes.size(); nT++ ) aPositions.Insert( rTypes[nT].nStartPos ); const WritingDirectionInfos& rWritingDirections = pParaPortion->aWritingDirectionInfos; -- cgit v1.2.3 From d71f7321610b24ff613f58684f5972e770922cc5 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 23 Sep 2010 07:28:37 +0200 Subject: svarray: #i112395#: apply deque to WritingDirectionInfos --- editeng/source/editeng/editdoc.cxx | 2 -- editeng/source/editeng/editdoc.hxx | 3 ++- editeng/source/editeng/editdoc2.cxx | 4 ++-- editeng/source/editeng/impedit2.cxx | 18 +++++++++--------- editeng/source/editeng/impedit3.cxx | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) (limited to 'editeng') diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 3163987d86..4d8a8273dd 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -255,8 +255,6 @@ USHORT aV5Map[] = { }; SV_IMPL_PTRARR( DummyContentList, ContentNode* ); -SV_IMPL_VARARR( WritingDirectionInfos, WritingDirectionInfo ); - int SAL_CALL CompareStart( const void* pFirst, const void* pSecond ) { diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index ea54227033..1da0b0b0b5 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -114,7 +114,8 @@ struct WritingDirectionInfo } }; -SV_DECL_VARARR( WritingDirectionInfos, WritingDirectionInfo, 0, 4 ) + +typedef std::deque< WritingDirectionInfo > WritingDirectionInfos; typedef EditCharAttrib* EditCharAttribPtr; SV_DECL_PTRARR( CharAttribArray, EditCharAttribPtr, 0, 4 ) diff --git a/editeng/source/editeng/editdoc2.cxx b/editeng/source/editeng/editdoc2.cxx index cb1b1de0aa..9f23dcba44 100644 --- a/editeng/source/editeng/editdoc2.cxx +++ b/editeng/source/editeng/editdoc2.cxx @@ -239,7 +239,7 @@ void ParaPortion::MarkInvalid( USHORT nStart, short nDiff ) } bInvalid = TRUE; aScriptInfos.clear(); - aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() ); + aWritingDirectionInfos.clear(); } void ParaPortion::MarkSelectionInvalid( USHORT nStart, USHORT /* nEnd */ ) @@ -258,7 +258,7 @@ void ParaPortion::MarkSelectionInvalid( USHORT nStart, USHORT /* nEnd */ ) bInvalid = TRUE; bSimple = FALSE; aScriptInfos.clear(); - aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() ); + aWritingDirectionInfos.clear(); } USHORT ParaPortion::GetLineNumber( USHORT nIndex ) diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 9412bd62ed..5f00d9e5cf 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -1805,12 +1805,12 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) rTypes[0].nScriptType = ( rTypes.size() > 1 ) ? rTypes[1].nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() ); // create writing direction information: - if ( !pParaPortion->aWritingDirectionInfos.Count() ) + if ( pParaPortion->aWritingDirectionInfos.empty() ) InitWritingDirections( nPara ); // i89825: Use CTL font for numbers embedded into an RTL run: WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos; - for ( USHORT n = 0; n < rDirInfos.Count(); ++n ) + for ( size_t n = 0; n < rDirInfos.size(); ++n ) { const xub_StrLen nStart = rDirInfos[n].nStartPos; const xub_StrLen nEnd = rDirInfos[n].nEndPos; @@ -1983,7 +1983,7 @@ void ImpEditEngine::InitWritingDirections( USHORT nPara ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); WritingDirectionInfos& rInfos = pParaPortion->aWritingDirectionInfos; - rInfos.Remove( 0, rInfos.Count() ); + rInfos.clear(); BOOL bCTL = FALSE; ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; @@ -2018,10 +2018,10 @@ void ImpEditEngine::InitWritingDirections( USHORT nPara ) int32_t nEnd; UBiDiLevel nCurrDir; - for ( USHORT nIdx = 0; nIdx < nCount; ++nIdx ) + for ( size_t nIdx = 0; nIdx < static_cast(nCount); ++nIdx ) { ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir ); - rInfos.Insert( WritingDirectionInfo( nCurrDir, (USHORT)nStart, (USHORT)nEnd ), rInfos.Count() ); + rInfos.push_back( WritingDirectionInfo( nCurrDir, (USHORT)nStart, (USHORT)nEnd ) ); nStart = nEnd; } @@ -2029,8 +2029,8 @@ void ImpEditEngine::InitWritingDirections( USHORT nPara ) } // No infos mean no CTL and default dir is L2R... - if ( !rInfos.Count() ) - rInfos.Insert( WritingDirectionInfo( 0, 0, (USHORT)pParaPortion->GetNode()->Len() ), rInfos.Count() ); + if ( rInfos.empty() ) + rInfos.push_back( WritingDirectionInfo( 0, 0, (USHORT)pParaPortion->GetNode()->Len() ) ); } @@ -2094,12 +2094,12 @@ BYTE ImpEditEngine::GetRightToLeft( USHORT nPara, USHORT nPos, USHORT* pStart, U if ( pNode && pNode->Len() ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aWritingDirectionInfos.Count() ) + if ( pParaPortion->aWritingDirectionInfos.empty() ) InitWritingDirections( nPara ); // BYTE nType = 0; WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos; - for ( USHORT n = 0; n < rDirInfos.Count(); n++ ) + for ( size_t n = 0; n < rDirInfos.size(); n++ ) { if ( ( rDirInfos[n].nStartPos <= nPos ) && ( rDirInfos[n].nEndPos >= nPos ) ) { diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index a919f6c8d6..ea0c31aa61 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2302,7 +2302,7 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r aPositions.Insert( rTypes[nT].nStartPos ); const WritingDirectionInfos& rWritingDirections = pParaPortion->aWritingDirectionInfos; - for ( USHORT nD = 0; nD < rWritingDirections.Count(); nD++ ) + for ( size_t nD = 0; nD < rWritingDirections.size(); nD++ ) aPositions.Insert( rWritingDirections[nD].nStartPos ); if ( mpIMEInfos && mpIMEInfos->nLen && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetNode() == pNode ) ) -- cgit v1.2.3 From 525ef45b9cbf55e8a557091f1c9de580aee0c3d7 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 23 Sep 2010 07:38:41 +0200 Subject: svarray: #i112395#: silent warning --- editeng/source/editeng/impedit2.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'editeng') diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 5f00d9e5cf..b956cc8fb2 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2012,13 +2012,13 @@ void ImpEditEngine::InitWritingDirections( USHORT nPara ) ubidi_setPara( pBidi, reinterpret_cast(aText.GetBuffer()), aText.Len(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW nError = U_ZERO_ERROR; - long nCount = ubidi_countRuns( pBidi, &nError ); + size_t nCount = ubidi_countRuns( pBidi, &nError ); int32_t nStart = 0; int32_t nEnd; UBiDiLevel nCurrDir; - for ( size_t nIdx = 0; nIdx < static_cast(nCount); ++nIdx ) + for ( size_t nIdx = 0; nIdx < nCount; ++nIdx ) { ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir ); rInfos.push_back( WritingDirectionInfo( nCurrDir, (USHORT)nStart, (USHORT)nEnd ) ); -- cgit v1.2.3 From 12a75c76c0dc4c0fbb0046f898488ef5904138b7 Mon Sep 17 00:00:00 2001 From: os Date: Thu, 23 Sep 2010 15:51:45 +0200 Subject: shape properties wzDescription and wzName support added --- editeng/inc/editeng/svxrtf.hxx | 7 ++++--- editeng/source/editeng/eertfpar.cxx | 1 + editeng/source/rtf/rtfgrf.cxx | 36 +++++++++++++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 6 deletions(-) (limited to 'editeng') diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx index 45195c2acb..8df5735f44 100644 --- a/editeng/inc/editeng/svxrtf.hxx +++ b/editeng/inc/editeng/svxrtf.hxx @@ -36,7 +36,8 @@ #define _SVSTDARR_USHORTS #include #include - +#include +#include class Font; class Color; class Graphic; @@ -104,7 +105,7 @@ struct SvxRTFStyleType // Bitmap - Mode - +typedef ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > PictPropertyNameValuePairs; struct EDITENG_DLLPUBLIC SvxRTFPictureType { // Format der Bitmap @@ -135,7 +136,7 @@ struct EDITENG_DLLPUBLIC SvxRTFPictureType USHORT nWidthBytes; USHORT nScalX, nScalY; short nCropT, nCropB, nCropL, nCropR; - + PictPropertyNameValuePairs aPropertyPairs; SvxRTFPictureType() { ResetValues(); } // alle Werte auf default; wird nach einlesen der Bitmap aufgerufen ! void ResetValues(); diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index 6301ecce7a..6ea9ea0b09 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -54,6 +54,7 @@ void SvxRTFPictureType::ResetValues() nBitsPerPixel = nPlanes = 1; nScalX = nScalY = 100; // Skalierung in Prozent nCropT = nCropB = nCropL = nCropR = 0; + aPropertyPairs.clear(); } ImportInfo::ImportInfo( ImportState eSt, SvParser* pPrsrs, const ESelection& rSel ) diff --git a/editeng/source/rtf/rtfgrf.cxx b/editeng/source/rtf/rtfgrf.cxx index d4c50fe922..f8053f03c7 100644 --- a/editeng/source/rtf/rtfgrf.cxx +++ b/editeng/source/rtf/rtfgrf.cxx @@ -39,6 +39,7 @@ #include +using namespace ::rtl; #ifndef DBG_UTIL #undef DEBUG_JP @@ -316,14 +317,26 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) if( RTF_SHPPICT == GetStackPtr(0)->nTokenId ) ++nValidDataBraket; - + OUString sShapePropertyName, sShapePropertyValue; + int nShapePropertyBracket = -1; while( _nOpenBrakets && IsParserWorking() && bValidBmp ) { nToken = GetNextToken(); USHORT nVal = USHORT( nTokenValue ); switch( nToken ) { - case '}': --_nOpenBrakets; break; + case '}': + --_nOpenBrakets; + if( nShapePropertyBracket > 0 && nShapePropertyBracket > _nOpenBrakets ) + { + nShapePropertyBracket = -1; + if( sShapePropertyName.getLength() ) + { + rPicType.aPropertyPairs.push_back( ::std::pair< OUString, OUString >( sShapePropertyName, sShapePropertyValue ) ); + sShapePropertyName = sShapePropertyValue = ::rtl::OUString(); + } + } + break; case '{': { if( RTF_IGNOREFLAG != GetNextToken() ) @@ -439,7 +452,24 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) case RTF_PICCROPB: rPicType.nCropB = (short)nTokenValue; break; case RTF_PICCROPL: rPicType.nCropL = (short)nTokenValue; break; case RTF_PICCROPR: rPicType.nCropR = (short)nTokenValue; break; - + case RTF_SP: + //read pairs of {\sn Name}{\sv Value} + nShapePropertyBracket = _nOpenBrakets; + break; + case RTF_SN: + nToken = GetNextToken(); + if( nToken != '}' ) + sShapePropertyName = aToken; + else + nToken = SkipToken( -1 ); + break; + case RTF_SV: + nToken = GetNextToken(); + if( nToken != '}' ) + sShapePropertyValue = aToken; + else + nToken = SkipToken( -1 ); + break; case RTF_TEXTTOKEN: // JP 26.06.98: Bug #51719# - nur TextToken auf 1. Ebene // auswerten. Alle anderen sind irgendwelche -- cgit v1.2.3 From 652a33bf101b865f2923b8120fcb767feeb45f85 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Sun, 26 Sep 2010 20:54:30 +0200 Subject: svarray: #i112395#: small upgrade --- editeng/source/rtf/svxrtf.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editeng') diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index fbb25d406c..1fc96e45d7 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -816,7 +816,7 @@ void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo ) void SvxRTFParser::ClearColorTbl() { - for( size_t n = 0; n < aColorTbl.size(); n++ ) + while ( !aColorTbl.empty() ) { delete aColorTbl.back(); aColorTbl.pop_back(); -- cgit v1.2.3 From bf2abd34065c54b5ec23213d6d784bd00783f547 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 30 Sep 2010 21:28:31 +0200 Subject: svarray: #i112395#: SvArray update --- editeng/source/misc/txtrange.cxx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'editeng') diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index e0440e424c..e0a9307b0e 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -204,11 +204,12 @@ public: SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, SvLongs *pLong, const Range& rRange ) - : aBoolArr( 4, 4 ), pLongArr( pLong ), pTextRanger( pRanger ), + : pLongArr( pLong ), pTextRanger( pRanger ), nTop( rRange.Min() ), nBottom( rRange.Max() ), bInner( pRanger->IsInner() ), bMultiple( bInner || !pRanger->IsSimple() ), bConcat( FALSE ), bRotate( pRanger->IsVertical() ) { + aBoolArr.reserve( 4 ); if( bRotate ) { nStart = pRanger->GetUpper(); @@ -299,7 +300,7 @@ void SvxBoundArgs::NoteRange( BOOL bToggle ) bToggle = FALSE; USHORT nIdx = 0; USHORT nCount = pLongArr->Count(); - DBG_ASSERT( nCount == 2 * aBoolArr.Count(), "NoteRange: Incompatible Sizes" ); + DBG_ASSERT( nCount == 2 * aBoolArr.size(), "NoteRange: Incompatible Sizes" ); while( nIdx < nCount && (*pLongArr)[ nIdx ] < nMin ) ++nIdx; BOOL bOdd = nIdx % 2 ? TRUE : FALSE; @@ -308,7 +309,7 @@ void SvxBoundArgs::NoteRange( BOOL bToggle ) { // Dann wird ein neues eingefuegt ... pLongArr->Insert( nMin, nIdx ); pLongArr->Insert( nMax, nIdx + 1 ); - aBoolArr.Insert( bToggle, nIdx / 2 ); + aBoolArr.insert( aBoolArr.begin() + nIdx / 2, bToggle ); } else { // ein vorhandes Intervall erweitern ... @@ -340,9 +341,9 @@ void SvxBoundArgs::NoteRange( BOOL bToggle ) USHORT nStop = nMaxIdx + nDiff; for( USHORT i = nMaxIdx; i < nStop; ++i ) bToggle ^= aBoolArr[ i ]; - aBoolArr.Remove( nMaxIdx, nDiff ); + aBoolArr.erase( aBoolArr.begin() + nMaxIdx, aBoolArr.begin() + nDiff ); } - DBG_ASSERT( nMaxIdx < aBoolArr.Count(), "NoteRange: Too much deleted" ); + DBG_ASSERT( nMaxIdx < aBoolArr.size(), "NoteRange: Too much deleted" ); aBoolArr[ nMaxIdx ] ^= bToggle; } } @@ -487,7 +488,7 @@ void SvxBoundArgs::Calc( const PolyPolygon& rPoly ) void SvxBoundArgs::Add() { USHORT nLongIdx = 1; - USHORT nCount = aBoolArr.Count(); + size_t nCount = aBoolArr.size(); if( nCount && ( !bInner || !pTextRanger->IsSimple() ) ) { BOOL bDelete = aBoolArr[ 0 ]; @@ -505,7 +506,7 @@ void SvxBoundArgs::Add() next /= 2; nBoolIdx = nBoolIdx - next; nCount = nCount - next; - aBoolArr.Remove( nBoolIdx, next ); + aBoolArr.erase( aBoolArr.begin() + nBoolIdx, aBoolArr.begin() + next ); if( nBoolIdx ) aBoolArr[ nBoolIdx - 1 ] = FALSE; #if OSL_DEBUG_LEVEL > 1 @@ -516,7 +517,7 @@ void SvxBoundArgs::Add() bDelete = nBoolIdx < nCount && aBoolArr[ nBoolIdx ]; nLongIdx += 2; DBG_ASSERT( nLongIdx == 2*nBoolIdx+1, "BoundArgs: Array-Idx Confusion" ); - DBG_ASSERT( aBoolArr.Count()*2 == pLongArr->Count(), + DBG_ASSERT( aBoolArr.size()*2 == pLongArr->Count(), "BoundArgs: Array-Count: Confusion" ); } } @@ -546,7 +547,7 @@ void SvxBoundArgs::Concat( const PolyPolygon* pPoly ) DBG_ASSERT( pPoly, "Nothing to do?" ); SvLongs *pOld = pLongArr; pLongArr = new SvLongs( 2, 8 ); - aBoolArr.Remove( 0, aBoolArr.Count() ); + aBoolArr.clear(); bInner = FALSE; Calc( *pPoly ); USHORT nCount = pLongArr->Count(); -- cgit v1.2.3 From 592d82e841d06344fe842760f139b16542f1a72d Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 30 Sep 2010 21:54:31 +0200 Subject: svarray: #i112395#: change SvBools from vector to deque --- editeng/source/misc/txtrange.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'editeng') diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index e0a9307b0e..b9a06cf962 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -341,7 +341,7 @@ void SvxBoundArgs::NoteRange( BOOL bToggle ) USHORT nStop = nMaxIdx + nDiff; for( USHORT i = nMaxIdx; i < nStop; ++i ) bToggle ^= aBoolArr[ i ]; - aBoolArr.erase( aBoolArr.begin() + nMaxIdx, aBoolArr.begin() + nDiff ); + aBoolArr.erase( aBoolArr.begin() + nMaxIdx, aBoolArr.begin() + nMaxIdx + nDiff ); } DBG_ASSERT( nMaxIdx < aBoolArr.size(), "NoteRange: Too much deleted" ); aBoolArr[ nMaxIdx ] ^= bToggle; @@ -491,7 +491,7 @@ void SvxBoundArgs::Add() size_t nCount = aBoolArr.size(); if( nCount && ( !bInner || !pTextRanger->IsSimple() ) ) { - BOOL bDelete = aBoolArr[ 0 ]; + BOOL bDelete = aBoolArr.front(); if( bInner ) bDelete = !bDelete; for( USHORT nBoolIdx = 1; nBoolIdx < nCount; ++nBoolIdx ) @@ -506,7 +506,7 @@ void SvxBoundArgs::Add() next /= 2; nBoolIdx = nBoolIdx - next; nCount = nCount - next; - aBoolArr.erase( aBoolArr.begin() + nBoolIdx, aBoolArr.begin() + next ); + aBoolArr.erase( aBoolArr.begin() + nBoolIdx, aBoolArr.begin() + nBoolIdx + next ); if( nBoolIdx ) aBoolArr[ nBoolIdx - 1 ] = FALSE; #if OSL_DEBUG_LEVEL > 1 -- cgit v1.2.3 From 3101bb9d6878b56a89301398b3607efee3b6122f Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 30 Sep 2010 23:12:15 +0200 Subject: svarray: #i112395#: small fix --- editeng/source/misc/txtrange.cxx | 1 - 1 file changed, 1 deletion(-) (limited to 'editeng') diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index b9a06cf962..0d22f351af 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -209,7 +209,6 @@ SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, SvLongs *pLong, bInner( pRanger->IsInner() ), bMultiple( bInner || !pRanger->IsSimple() ), bConcat( FALSE ), bRotate( pRanger->IsVertical() ) { - aBoolArr.reserve( 4 ); if( bRotate ) { nStart = pRanger->GetUpper(); -- cgit v1.2.3 From 9a193b6fb4c6f3f624d81fb78582ccc0f074ca8d Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Fri, 1 Oct 2010 01:57:06 +0200 Subject: svarray: #i112395#: fix bug with erase --- editeng/source/misc/txtrange.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'editeng') diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index 0d22f351af..b327791981 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -340,7 +340,7 @@ void SvxBoundArgs::NoteRange( BOOL bToggle ) USHORT nStop = nMaxIdx + nDiff; for( USHORT i = nMaxIdx; i < nStop; ++i ) bToggle ^= aBoolArr[ i ]; - aBoolArr.erase( aBoolArr.begin() + nMaxIdx, aBoolArr.begin() + nMaxIdx + nDiff ); + aBoolArr.erase( aBoolArr.begin() + nMaxIdx, aBoolArr.begin() + (nMaxIdx + nDiff) ); } DBG_ASSERT( nMaxIdx < aBoolArr.size(), "NoteRange: Too much deleted" ); aBoolArr[ nMaxIdx ] ^= bToggle; @@ -493,7 +493,7 @@ void SvxBoundArgs::Add() BOOL bDelete = aBoolArr.front(); if( bInner ) bDelete = !bDelete; - for( USHORT nBoolIdx = 1; nBoolIdx < nCount; ++nBoolIdx ) + for( size_t nBoolIdx = 1; nBoolIdx < nCount; ++nBoolIdx ) { if( bDelete ) { @@ -505,7 +505,7 @@ void SvxBoundArgs::Add() next /= 2; nBoolIdx = nBoolIdx - next; nCount = nCount - next; - aBoolArr.erase( aBoolArr.begin() + nBoolIdx, aBoolArr.begin() + nBoolIdx + next ); + aBoolArr.erase( aBoolArr.begin() + nBoolIdx, aBoolArr.begin() + (nBoolIdx + next) ); if( nBoolIdx ) aBoolArr[ nBoolIdx - 1 ] = FALSE; #if OSL_DEBUG_LEVEL > 1 -- cgit v1.2.3 From 8e039a99ae05717f19d4c1ecfd17a038e0863a90 Mon Sep 17 00:00:00 2001 From: os Date: Mon, 4 Oct 2010 16:15:24 +0200 Subject: enable exceptions --- editeng/source/rtf/makefile.mk | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'editeng') diff --git a/editeng/source/rtf/makefile.mk b/editeng/source/rtf/makefile.mk index ef1c5f44b1..bf32205afd 100644 --- a/editeng/source/rtf/makefile.mk +++ b/editeng/source/rtf/makefile.mk @@ -29,19 +29,16 @@ PRJ=..$/.. PRJNAME=editeng TARGET=rtf - +ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/makefile.pmk - # --- Files -------------------------------------------------------- -EXCEPTIONSFILES= \ - $(SLO)$/svxrtf.obj SLOFILES= \ - $(EXCEPTIONSFILES) \ + $(SLO)$/svxrtf.obj \ $(SLO)$/rtfitem.obj \ $(SLO)$/rtfgrf.obj -- cgit v1.2.3 From b9f991cb3dab337153ea69549eb5b9b514af7ed2 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Sat, 16 Oct 2010 21:21:14 +0200 Subject: svarray: #i112395# #i84159# handle 2^32 numbers --- editeng/source/editeng/impedit4.cxx | 16 ++++---- svx/source/unodraw/UnoNameItemTable.cxx | 30 +++++++-------- svx/source/unodraw/UnoNamespaceMap.cxx | 10 ++--- svx/source/unodraw/unomtabl.cxx | 44 +++++++++++----------- svx/source/unodraw/unoshape.cxx | 14 +++---- svx/source/xoutdev/xattr.cxx | 66 ++++++++++++++++----------------- 6 files changed, 90 insertions(+), 90 deletions(-) mode change 100755 => 100644 editeng/source/editeng/impedit4.cxx (limited to 'editeng') diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx old mode 100755 new mode 100644 index 6fc80acf06..e07a293670 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -392,8 +392,8 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) else if ( nScriptType == 2 ) nWhich = EE_CHAR_FONTINFO_CTL; - sal_uInt16 i = 0; - SvxFontItem* pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem( nWhich, i ); + sal_uInt32 i = 0; + SvxFontItem* pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem2( nWhich, i ); while ( pFontItem ) { bool bAlreadyExist = false; @@ -406,7 +406,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) if ( !bAlreadyExist ) aFontTable.Insert( aFontTable.Count(), new SvxFontItem( *pFontItem ) ); - pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem( nWhich, ++i ); + pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem2( nWhich, ++i ); } } @@ -462,17 +462,17 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) // ColorList rausschreiben... SvxColorList aColorList; - sal_uInt16 i = 0; - SvxColorItem* pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem( EE_CHAR_COLOR, i ); + sal_uInt32 i = 0; + SvxColorItem* pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem2( EE_CHAR_COLOR, i ); while ( pColorItem ) { - USHORT nPos = i; + sal_uInt32 nPos = i; if ( pColorItem->GetValue() == COL_AUTO ) nPos = 0; aColorList.Insert( new SvxColorItem( *pColorItem ), nPos ); - pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem( EE_CHAR_COLOR, ++i ); + pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem2( EE_CHAR_COLOR, ++i ); } - aColorList.Insert( new SvxColorItem( (const SvxColorItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_COLOR) ), (sal_uInt32)i ); + aColorList.Insert( new SvxColorItem( (const SvxColorItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_COLOR) ), static_cast (i) ); rOutput << '{' << OOO_STRING_SVTOOLS_RTF_COLORTBL; for ( j = 0; j < aColorList.Count(); j++ ) diff --git a/svx/source/unodraw/UnoNameItemTable.cxx b/svx/source/unodraw/UnoNameItemTable.cxx index 7c11806bec..3d3b594cbe 100644 --- a/svx/source/unodraw/UnoNameItemTable.cxx +++ b/svx/source/unodraw/UnoNameItemTable.cxx @@ -201,11 +201,11 @@ void SAL_CALL SvxUnoNameItemTable::replaceByName( const OUString& aApiName, cons // if it is not in our own sets, modify the pool! sal_Bool bFound = sal_False; - USHORT nSurrogate; - USHORT nCount = mpModelPool ? mpModelPool->GetItemCount( mnWhich ) : 0; + sal_uInt32 nSurrogate; + sal_uInt32 nCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0; for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem( mnWhich, nSurrogate); + pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate); if( pItem && pItem->GetName() == aSearchName ) { pItem->PutValue( aElement, mnMemberId ); @@ -238,12 +238,12 @@ uno::Any SAL_CALL SvxUnoNameItemTable::getByName( const OUString& aApiName ) { const String aSearchName( aName ); NameOrIndex *pItem; - sal_Int32 nSurrogate; + sal_uInt32 nSurrogate; - sal_Int32 nSurrogateCount = mpModelPool ? (sal_Int32)mpModelPool->GetItemCount( mnWhich ) : 0; + sal_uInt32 nSurrogateCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0; for( nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem( mnWhich, (USHORT)nSurrogate ); + pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate ); if( isValid( pItem ) && (pItem->GetName() == aSearchName) ) { @@ -266,11 +266,11 @@ uno::Sequence< OUString > SAL_CALL SvxUnoNameItemTable::getElementNames( ) NameOrIndex *pItem; OUString aApiName; - const sal_Int32 nSurrogateCount = mpModelPool ? (sal_Int32)mpModelPool->GetItemCount( mnWhich ) : 0; - sal_Int32 nSurrogate; + const sal_uInt32 nSurrogateCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0; + sal_uInt32 nSurrogate; for( nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem( mnWhich, (USHORT)nSurrogate ); + pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate ); if( !isValid( pItem ) ) continue; @@ -305,14 +305,14 @@ sal_Bool SAL_CALL SvxUnoNameItemTable::hasByName( const OUString& aApiName ) return sal_False; const String aSearchName( aName ); - USHORT nSurrogate; + sal_uInt32 nSurrogate; const NameOrIndex *pItem; - USHORT nCount = mpModelPool ? mpModelPool->GetItemCount( mnWhich ) : 0; + sal_uInt32 nCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0; for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem( mnWhich, nSurrogate ); + pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate ); if( isValid( pItem ) && (pItem->GetName() == aSearchName) ) return sal_True; } @@ -327,11 +327,11 @@ sal_Bool SAL_CALL SvxUnoNameItemTable::hasElements( ) const NameOrIndex *pItem; - sal_Int32 nSurrogate; - const sal_Int32 nSurrogateCount = mpModelPool ? (sal_Int32)mpModelPool->GetItemCount( mnWhich ) : 0; + sal_uInt32 nSurrogate; + const sal_uInt32 nSurrogateCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0; for( nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem( mnWhich, (USHORT)nSurrogate ); + pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate ); if( isValid( pItem ) ) return sal_True; diff --git a/svx/source/unodraw/UnoNamespaceMap.cxx b/svx/source/unodraw/UnoNamespaceMap.cxx index 14592ca38b..87372cb4ae 100644 --- a/svx/source/unodraw/UnoNamespaceMap.cxx +++ b/svx/source/unodraw/UnoNamespaceMap.cxx @@ -118,8 +118,8 @@ namespace svx sal_uInt16* mpWhichId; - sal_uInt16 mnItemCount; - sal_uInt16 mnItem; + sal_uInt32 mnItemCount; + sal_uInt32 mnItem; const SvXMLAttrContainerItem* mpCurrentAttr; sal_uInt16 mnCurrentAttr; @@ -145,7 +145,7 @@ NamespaceIteratorImpl::NamespaceIteratorImpl( sal_uInt16* pWhichIds, SfxItemPool mpWhichId = pWhichIds; mnItem = 0; - mnItemCount = (mpWhichId && (0 != *mpWhichId) && mpPool) ? mpPool->GetItemCount( *mpWhichId ) : 0; + mnItemCount = (mpWhichId && (0 != *mpWhichId) && mpPool) ? mpPool->GetItemCount2( *mpWhichId ) : 0; } sal_Bool NamespaceIteratorImpl::next( ::rtl::OUString& rPrefix, ::rtl::OUString& rURL ) @@ -165,7 +165,7 @@ sal_Bool NamespaceIteratorImpl::next( ::rtl::OUString& rPrefix, ::rtl::OUString& const SfxPoolItem* pItem = 0; // look for the next available item in the current pool - while( (mnItem < mnItemCount) && ( NULL == (pItem = mpPool->GetItem( *mpWhichId, mnItem ) ) ) ) + while( (mnItem < mnItemCount) && ( NULL == (pItem = mpPool->GetItem2( *mpWhichId, mnItem ) ) ) ) mnItem++; // are we finished with the current whichid? @@ -177,7 +177,7 @@ sal_Bool NamespaceIteratorImpl::next( ::rtl::OUString& rPrefix, ::rtl::OUString& if( 0 != *mpWhichId ) { mnItem = 0; - mnItemCount = (mpWhichId && (0 != *mpWhichId) && mpPool) ? mpPool->GetItemCount( *mpWhichId ) : 0; + mnItemCount = (mpWhichId && (0 != *mpWhichId) && mpPool) ? mpPool->GetItemCount2( *mpWhichId ) : 0; return next( rPrefix, rURL ); } diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx index 10fad8ba77..f2dadb69f4 100644 --- a/svx/source/unodraw/unomtabl.cxx +++ b/svx/source/unodraw/unomtabl.cxx @@ -276,11 +276,11 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const // if it is not in our own sets, modify the pool! sal_Bool bFound = sal_False; - USHORT nSurrogate; - const USHORT nStartCount = mpModelPool ? mpModelPool->GetItemCount( XATTR_LINESTART ) : 0; + sal_uInt32 nSurrogate; + const sal_uInt32 nStartCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINESTART ) : 0; for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem( XATTR_LINESTART, nSurrogate); + pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate); if( pItem && pItem->GetName() == aSearchName ) { pItem->PutValue( aElement ); @@ -289,10 +289,10 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const } } - const USHORT nEndCount = mpModelPool ? mpModelPool->GetItemCount( XATTR_LINEEND ) : 0; + const sal_uInt32 nEndCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINEEND ) : 0; for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem( XATTR_LINEEND, nSurrogate); + pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate); if( pItem && pItem->GetName() == aSearchName ) { pItem->PutValue( aElement ); @@ -310,10 +310,10 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const static sal_Bool getByNameFromPool( const String& rSearchName, SfxItemPool* pPool, USHORT nWhich, uno::Any& rAny ) { NameOrIndex *pItem; - const sal_Int32 nSurrogateCount = pPool ? (sal_Int32)pPool->GetItemCount( nWhich ) : 0; - for( sal_Int32 nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ ) + const sal_uInt32 nSurrogateCount = pPool ? pPool->GetItemCount2( nWhich ) : 0; + for( sal_uInt32 nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ ) { - pItem = (NameOrIndex*)pPool->GetItem( nWhich, (USHORT)nSurrogate ); + pItem = (NameOrIndex*)pPool->GetItem2( nWhich, nSurrogate ); if( pItem && pItem->GetName() == rSearchName ) { @@ -357,15 +357,15 @@ uno::Any SAL_CALL SvxUnoMarkerTable::getByName( const OUString& aApiName ) static void createNamesForPool( SfxItemPool* pPool, USHORT nWhich, std::set< OUString, comphelper::UStringLess >& rNameSet ) { - const sal_Int32 nSuroCount = pPool->GetItemCount( nWhich ); - sal_Int32 nSurrogate; + const sal_uInt32 nSuroCount = pPool->GetItemCount2( nWhich ); + sal_uInt32 nSurrogate; - NameOrIndex *pItem; + NameOrIndex* pItem; OUString aName; for( nSurrogate = 0; nSurrogate < nSuroCount; nSurrogate++ ) { - pItem = (NameOrIndex*)pPool->GetItem( nWhich, (USHORT)nSurrogate ); + pItem = (NameOrIndex*)pPool->GetItem2( nWhich, nSurrogate ); if( pItem == NULL || pItem->GetName().Len() == 0 ) continue; @@ -415,20 +415,20 @@ sal_Bool SAL_CALL SvxUnoMarkerTable::hasByName( const OUString& aName ) NameOrIndex *pItem; SvxUnogetInternalNameForItem( XATTR_LINESTART, aName, aSearchName ); - USHORT nStartCount = mpModelPool ? mpModelPool->GetItemCount( XATTR_LINESTART ) : 0; - USHORT nSurrogate; + sal_uInt32 nStartCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINESTART ) : 0; + sal_uInt32 nSurrogate; for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem( XATTR_LINESTART, nSurrogate); + pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate); if( pItem && pItem->GetName() == aSearchName ) return sal_True; } SvxUnogetInternalNameForItem( XATTR_LINEEND, aName, aSearchName ); - USHORT nEndCount = mpModelPool ? mpModelPool->GetItemCount( XATTR_LINEEND ) : 0; + sal_uInt32 nEndCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINEEND ) : 0; for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem( XATTR_LINEEND, nSurrogate); + pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate); if( pItem && pItem->GetName() == aSearchName ) return sal_True; } @@ -450,19 +450,19 @@ sal_Bool SAL_CALL SvxUnoMarkerTable::hasElements( ) NameOrIndex *pItem; - const USHORT nStartCount = mpModelPool ? mpModelPool->GetItemCount( XATTR_LINESTART ) : 0; - USHORT nSurrogate; + const sal_uInt32 nStartCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINESTART ) : 0; + sal_uInt32 nSurrogate; for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem( XATTR_LINESTART, nSurrogate); + pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate); if( pItem && pItem->GetName().Len() != 0 ) return sal_True; } - const USHORT nEndCount = mpModelPool ? mpModelPool->GetItemCount( XATTR_LINEEND ) : 0; + const sal_uInt32 nEndCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINEEND ) : 0; for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem( XATTR_LINEEND, nSurrogate); + pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate); if( pItem && pItem->GetName().Len() != 0 ) return sal_True; } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 8b5004334e..0172474b8e 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1721,12 +1721,12 @@ sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rN const SfxItemPool* pPool = rSet.GetPool(); const String aSearchName( aName ); - const USHORT nCount = pPool->GetItemCount((USHORT)nWID); - const NameOrIndex *pItem; + const sal_uInt32 nCount = pPool->GetItemCount2((USHORT)nWID); + const NameOrIndex* pItem; - for( USHORT nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) + for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - pItem = (NameOrIndex*)pPool->GetItem((USHORT)nWID, nSurrogate); + pItem = (NameOrIndex*)pPool->GetItem2((USHORT)nWID, nSurrogate); if( pItem && ( pItem->GetName() == aSearchName ) ) { rSet.Put( *pItem ); @@ -1755,11 +1755,11 @@ sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rN const SfxItemPool& rPool = pModel->GetItemPool(); const String aSearchName( rName ); - const USHORT nCount = rPool.GetItemCount((USHORT)nWhich); - const NameOrIndex *pItem = 0; + const sal_uInt32 nCount = rPool.GetItemCount((USHORT)nWhich); + const NameOrIndex* pItem = 0; bool bFound = false; - for( USHORT nSurrogate = 0; ! bFound && nSurrogate < nCount; nSurrogate++ ) + for( sal_uInt32 nSurrogate = 0; ! bFound && nSurrogate < nCount; nSurrogate++ ) { pItem = (NameOrIndex*)rPool.GetItem((USHORT)nWhich, nSurrogate); if( pItem && ( pItem->GetName() == aSearchName ) ) diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index e4aaa172c4..f69f6fd38d 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -250,12 +250,12 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn if( aUniqueName.Len() && pPool1 ) { - const sal_uInt16 nCount = pPool1->GetItemCount( nWhich ); + const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich ); const NameOrIndex *pItem; - for( sal_uInt16 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) + for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - pItem = (NameOrIndex*)pPool1->GetItem( nWhich, nSurrogate ); + pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate ); if( pItem && ( pItem->GetName() == pCheckItem->GetName() ) ) { @@ -332,11 +332,11 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn if( (aUniqueName.Len() == 0) && pPool1 ) { - const sal_uInt16 nCount = pPool1->GetItemCount( nWhich ); + const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich ); const NameOrIndex *pItem; - for( sal_uInt16 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) + for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - pItem = (NameOrIndex*)pPool1->GetItem( nWhich, nSurrogate ); + pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate ); if( pItem && pItem->GetName().Len() ) { @@ -2003,16 +2003,16 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const // 2. if we have a name check if there is already an item with the // same name in the documents pool with a different line end or start - sal_uInt16 nCount, nSurrogate; + sal_uInt32 nCount, nSurrogate; const SfxItemPool* pPool1 = &pModel->GetItemPool(); if( aUniqueName.Len() && pPool1 ) { - nCount = pPool1->GetItemCount( XATTR_LINESTART ); + nCount = pPool1->GetItemCount2( XATTR_LINESTART ); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem( XATTR_LINESTART, nSurrogate ); + const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate ); if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) ) { @@ -2030,11 +2030,11 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const if( !bForceNew ) { - nCount = pPool1->GetItemCount( XATTR_LINEEND ); + nCount = pPool1->GetItemCount2( XATTR_LINEEND ); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem( XATTR_LINEEND, nSurrogate ); + const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate ); if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) ) { @@ -2055,10 +2055,10 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL; if( aUniqueName.Len() && pPool2) { - nCount = pPool2->GetItemCount( XATTR_LINESTART ); + nCount = pPool2->GetItemCount2( XATTR_LINESTART ); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem( XATTR_LINESTART, nSurrogate ); + const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate ); if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) ) { @@ -2076,10 +2076,10 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const if( !bForceNew ) { - nCount = pPool2->GetItemCount( XATTR_LINEEND ); + nCount = pPool2->GetItemCount2( XATTR_LINEEND ); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem( XATTR_LINEEND, nSurrogate ); + const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate ); if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) ) { @@ -2109,12 +2109,12 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const if( pPool1 ) { - nCount = pPool1->GetItemCount( XATTR_LINESTART ); - sal_uInt16 nSurrogate2; + nCount = pPool1->GetItemCount2( XATTR_LINESTART ); + sal_uInt32 nSurrogate2; for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) { - const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem( XATTR_LINESTART, nSurrogate2 ); + const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 ); if( pItem && pItem->GetName().Len() ) { @@ -2134,10 +2134,10 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const } } - nCount = pPool1->GetItemCount( XATTR_LINEEND ); + nCount = pPool1->GetItemCount2( XATTR_LINEEND ); for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) { - const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem( XATTR_LINEEND, nSurrogate2 ); + const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 ); if( pItem && pItem->GetName().Len() ) { @@ -2406,11 +2406,11 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const const SfxItemPool* pPool1 = &pModel->GetItemPool(); if( aUniqueName.Len() && pPool1 ) { - nCount = pPool1->GetItemCount( XATTR_LINESTART ); + nCount = pPool1->GetItemCount2( XATTR_LINESTART ); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem( XATTR_LINESTART, nSurrogate ); + const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate ); if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) ) { @@ -2428,11 +2428,11 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const if( !bForceNew ) { - nCount = pPool1->GetItemCount( XATTR_LINEEND ); + nCount = pPool1->GetItemCount2( XATTR_LINEEND ); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem( XATTR_LINEEND, nSurrogate ); + const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate ); if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) ) { @@ -2453,10 +2453,10 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL; if( aUniqueName.Len() && pPool2) { - nCount = pPool2->GetItemCount( XATTR_LINESTART ); + nCount = pPool2->GetItemCount2( XATTR_LINESTART ); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem( XATTR_LINESTART, nSurrogate ); + const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate ); if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) ) { @@ -2474,10 +2474,10 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const if( !bForceNew ) { - nCount = pPool2->GetItemCount( XATTR_LINEEND ); + nCount = pPool2->GetItemCount2( XATTR_LINEEND ); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem( XATTR_LINEEND, nSurrogate ); + const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate ); if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) ) { @@ -2507,12 +2507,12 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const if( pPool1 ) { - nCount = pPool1->GetItemCount( XATTR_LINESTART ); - sal_uInt16 nSurrogate2; + nCount = pPool1->GetItemCount2( XATTR_LINESTART ); + sal_uInt32 nSurrogate2; for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) { - const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem( XATTR_LINESTART, nSurrogate2 ); + const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 ); if( pItem && pItem->GetName().Len() ) { @@ -2532,10 +2532,10 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const } } - nCount = pPool1->GetItemCount( XATTR_LINEEND ); + nCount = pPool1->GetItemCount2( XATTR_LINEEND ); for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) { - const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem( XATTR_LINEEND, nSurrogate2 ); + const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 ); if( pItem && pItem->GetName().Len() ) { -- cgit v1.2.3 From 41e33523b124e20def6ceaa5ec1c23fb2e225ab6 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Mon, 18 Oct 2010 22:00:21 +0200 Subject: svarray: #i112395# #i84159# increase max number of pools to 2^32 --- editeng/source/editeng/impedit4.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editeng') diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index e07a293670..b21a30267a 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -472,7 +472,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) aColorList.Insert( new SvxColorItem( *pColorItem ), nPos ); pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem2( EE_CHAR_COLOR, ++i ); } - aColorList.Insert( new SvxColorItem( (const SvxColorItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_COLOR) ), static_cast (i) ); + aColorList.Insert( new SvxColorItem( (const SvxColorItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_COLOR) ), i ); rOutput << '{' << OOO_STRING_SVTOOLS_RTF_COLORTBL; for ( j = 0; j < aColorList.Count(); j++ ) -- cgit v1.2.3 From a769f7d9d79865c6d1fea39c7c3aea98b16a4a5c Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Sat, 23 Oct 2010 15:48:00 +0200 Subject: svarray: #i112395#: fix warnings, enable exceptions, etc. --- editeng/source/rtf/makefile.mk | 2 +- svx/source/form/fmsrcimp.cxx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'editeng') diff --git a/editeng/source/rtf/makefile.mk b/editeng/source/rtf/makefile.mk index ef1c5f44b1..38b2ef7b45 100644 --- a/editeng/source/rtf/makefile.mk +++ b/editeng/source/rtf/makefile.mk @@ -38,11 +38,11 @@ TARGET=rtf # --- Files -------------------------------------------------------- EXCEPTIONSFILES= \ + $(SLO)$/rtfitem.obj \ $(SLO)$/svxrtf.obj SLOFILES= \ $(EXCEPTIONSFILES) \ - $(SLO)$/rtfitem.obj \ $(SLO)$/rtfgrf.obj # ========================================================================== diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx index 38fa7a9c72..65fae03f60 100644 --- a/svx/source/form/fmsrcimp.cxx +++ b/svx/source/form/fmsrcimp.cxx @@ -1268,7 +1268,10 @@ void FmSearchEngine::RebuildUsedFields(sal_Int32 nFieldIndex, sal_Bool bForce) return; // (da ich keinen Wechsel des Iterators von aussen zulasse, heisst selber ::com::sun::star::sdbcx::Index auch immer selbe Spalte, also habe ich nix zu tun) - DBG_ASSERT((nFieldIndex >= -1) && (nFieldIndex= 0) && + (static_cast(nFieldIndex) < m_arrFieldMapping.size())), + "FmSearchEngine::RebuildUsedFields : nFieldIndex is invalid!"); // alle Felder, die ich durchsuchen muss, einsammeln m_arrUsedFields.clear(); if (nFieldIndex == -1) -- cgit v1.2.3