summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-11-22 10:17:18 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-11-22 10:17:18 +0100
commit145c5a89c75b3860cb1c73a29d27bed42c55ce6e (patch)
tree60f0e8410c8b1e311881ac6d30b5210546b181d5 /editeng
parent727ab20e98ed9b806e5d2fb97d89e7d62ac8c8ed (diff)
parentafd1b3a9ac844273b5c2c59016102c7eb594b5d0 (diff)
undoapi: merge after pulling DEV300.m94
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/editeng/svxrtf.hxx24
-rw-r--r--editeng/source/editeng/editdoc.cxx4
-rw-r--r--editeng/source/editeng/editdoc.hxx7
-rw-r--r--editeng/source/editeng/editdoc2.cxx10
-rw-r--r--editeng/source/editeng/eertfpar.cxx1
-rwxr-xr-xediteng/source/editeng/impedit2.cxx74
-rw-r--r--editeng/source/editeng/impedit3.cxx6
-rwxr-xr-xediteng/source/editeng/impedit4.cxx16
-rw-r--r--editeng/source/misc/txtrange.cxx22
-rw-r--r--editeng/source/rtf/makefile.mk5
-rw-r--r--editeng/source/rtf/rtfgrf.cxx36
-rw-r--r--editeng/source/rtf/rtfitem.cxx18
-rw-r--r--editeng/source/rtf/svxrtf.cxx50
13 files changed, 154 insertions, 119 deletions
diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx
index 45195c2acb..c74f6c2a2a 100644
--- a/editeng/inc/editeng/svxrtf.hxx
+++ b/editeng/inc/editeng/svxrtf.hxx
@@ -37,6 +37,9 @@
#include <svl/svstdarr.hxx>
#include <editeng/editengdllapi.h>
+#include <deque>
+#include <utility>
+#include <vector>
class Font;
class Color;
class Graphic;
@@ -82,12 +85,15 @@ 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;
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
@@ -104,7 +110,7 @@ struct SvxRTFStyleType
// Bitmap - Mode
-
+typedef ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > PictPropertyNameValuePairs;
struct EDITENG_DLLPUBLIC SvxRTFPictureType
{
// Format der Bitmap
@@ -135,7 +141,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();
@@ -376,7 +382,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;
@@ -451,12 +457,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;
}
@@ -464,7 +470,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/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 7b34d931e2..4d8a8273dd 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -255,10 +255,6 @@ 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..1da0b0b0b5 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -40,6 +40,8 @@
#include <svl/itempool.hxx>
#include <tools/table.hxx>
+#include <deque>
+
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
{
@@ -112,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 1c277845a2..9f23dcba44 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() );
- aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() );
-// aExtraCharInfos.Remove( 0, aExtraCharInfos.Count() );
+ aScriptInfos.clear();
+ aWritingDirectionInfos.clear();
}
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() );
- aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() );
-// aExtraCharInfos.Remove( 0, aExtraCharInfos.Count() );
+ aScriptInfos.clear();
+ aWritingDirectionInfos.clear();
}
USHORT ParaPortion::GetLineNumber( USHORT nIndex )
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/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index fedfb0d367..e489b04d0a 100755
--- 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,26 +1791,26 @@ 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() )
+ 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;
@@ -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;
@@ -1985,11 +1983,11 @@ 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;
- for ( USHORT n = 0; n < rTypes.Count(); n++ )
+ for ( size_t n = 0; n < rTypes.size(); n++ )
{
if ( rTypes[n].nScriptType == i18n::ScriptType::COMPLEX )
{
@@ -2014,16 +2012,16 @@ void ImpEditEngine::InitWritingDirections( USHORT nPara )
ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(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 ( USHORT nIdx = 0; nIdx < nCount; ++nIdx )
+ for ( size_t nIdx = 0; nIdx < 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;
}
@@ -2031,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() ) );
}
@@ -2096,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 01d36c223c..ea0c31aa61 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2294,15 +2294,15 @@ 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;
- 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 ) )
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index e15b7e7d1c..a2ff143495 100755
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -397,8 +397,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;
@@ -411,7 +411,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 );
}
}
@@ -467,17 +467,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) ), i );
rOutput << '{' << OOO_STRING_SVTOOLS_RTF_COLORTBL;
for ( j = 0; j < aColorList.Count(); j++ )
diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx
index 7f66d10d17..244cefd2b1 100644
--- a/editeng/source/misc/txtrange.cxx
+++ b/editeng/source/misc/txtrange.cxx
@@ -196,7 +196,7 @@ 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() )
@@ -291,7 +291,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;
@@ -300,7 +300,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 ...
@@ -332,9 +332,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() + (nMaxIdx + nDiff) );
}
- DBG_ASSERT( nMaxIdx < aBoolArr.Count(), "NoteRange: Too much deleted" );
+ DBG_ASSERT( nMaxIdx < aBoolArr.size(), "NoteRange: Too much deleted" );
aBoolArr[ nMaxIdx ] ^= bToggle;
}
}
@@ -479,13 +479,13 @@ 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 ];
+ 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 )
{
@@ -497,7 +497,7 @@ void SvxBoundArgs::Add()
next /= 2;
nBoolIdx = nBoolIdx - next;
nCount = nCount - next;
- aBoolArr.Remove( nBoolIdx, next );
+ aBoolArr.erase( aBoolArr.begin() + nBoolIdx, aBoolArr.begin() + (nBoolIdx + next) );
if( nBoolIdx )
aBoolArr[ nBoolIdx - 1 ] = FALSE;
#if OSL_DEBUG_LEVEL > 1
@@ -508,7 +508,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" );
}
}
@@ -538,7 +538,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();
diff --git a/editeng/source/rtf/makefile.mk b/editeng/source/rtf/makefile.mk
index ef1c5f44b1..081cd5b506 100644
--- a/editeng/source/rtf/makefile.mk
+++ b/editeng/source/rtf/makefile.mk
@@ -29,20 +29,19 @@ PRJ=..$/..
PRJNAME=editeng
TARGET=rtf
-
+ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/util$/makefile.pmk
-
# --- Files --------------------------------------------------------
EXCEPTIONSFILES= \
+ $(SLO)$/rtfitem.obj \
$(SLO)$/svxrtf.obj
SLOFILES= \
$(EXCEPTIONSFILES) \
- $(SLO)$/rtfitem.obj \
$(SLO)$/rtfgrf.obj
# ==========================================================================
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 <editeng/svxrtf.hxx>
+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
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..1fc96e45d7 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,13 +122,13 @@ void SvxRTFParser::ResetPard()
SvxRTFParser::~SvxRTFParser()
{
- if( aColorTbl.Count() )
+ if( !aColorTbl.empty() )
ClearColorTbl();
if( aFontTbl.Count() )
ClearFontTbl();
if( aStyleTbl.Count() )
ClearStyleTbl();
- if( aAttrStack.Count() )
+ if( !aAttrStack.empty() )
ClearAttrStack();
delete pRTFDefaults;
@@ -149,18 +147,18 @@ void SvxRTFParser::SetInsPos( const SvxPosition& rNew )
SvParserState SvxRTFParser::CallParser()
{
- DBG_ASSERT( pInsPos, "keine Einfuegeposition" );
+ DBG_ASSERT( pInsPos, "no insertion" );
if( !pInsPos )
return SVPAR_ERROR;
- if( aColorTbl.Count() )
+ if( !aColorTbl.empty() )
ClearColorTbl();
if( aFontTbl.Count() )
ClearFontTbl();
if( aStyleTbl.Count() )
ClearStyleTbl();
- if( aAttrStack.Count() )
+ if( !aAttrStack.empty() )
ClearAttrStack();
bIsSetDfltTab = FALSE;
@@ -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() );
+ while ( !aColorTbl.empty() )
+ {
+ delete aColorTbl.back();
+ aColorTbl.pop_back();
+ }
}
void SvxRTFParser::ClearFontTbl()
@@ -836,9 +838,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 +875,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 +884,7 @@ SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr )
*pInsPos );
pNew->SetRTFDefaults( GetRTFDefaults() );
- aAttrStack.Push( pNew );
+ aAttrStack.push_back( pNew );
bNewGroup = FALSE;
return pNew;
}
@@ -936,10 +939,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 +1118,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 +1148,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 +1178,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());
}