diff options
author | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-12-09 10:13:55 +0100 |
---|---|---|
committer | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-12-09 10:13:55 +0100 |
commit | 75b47018bbe9e37d00ae2af2e6011b463a60a21e (patch) | |
tree | 0639b2f8d521e807ca7c20d03b07175d8ac4c200 /editeng | |
parent | 13bc9463db8c6968925b11a8c1c1c710b3a5c58b (diff) | |
parent | 5e5f32868925e3fc20bad2b7cc1c23b77b524d5e (diff) |
mib19: rebase to DEV300m95
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/svxrtf.hxx | 24 | ||||
-rw-r--r-- | editeng/inc/helpid.hrc | 71 | ||||
-rw-r--r-- | editeng/inc/pch/precompiled_editeng.hxx | 1 | ||||
-rw-r--r-- | editeng/source/editeng/editattr.cxx | 9 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.hxx | 7 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc2.cxx | 10 | ||||
-rw-r--r-- | editeng/source/editeng/eertfpar.cxx | 1 | ||||
-rwxr-xr-x | editeng/source/editeng/impedit2.cxx | 74 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 6 | ||||
-rwxr-xr-x | editeng/source/editeng/impedit4.cxx | 16 | ||||
-rw-r--r-- | editeng/source/items/flditem.cxx | 109 | ||||
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 30 | ||||
-rw-r--r-- | editeng/source/misc/txtrange.cxx | 30 | ||||
-rw-r--r-- | editeng/source/rtf/makefile.mk | 5 | ||||
-rw-r--r-- | editeng/source/rtf/rtfgrf.cxx | 36 | ||||
-rw-r--r-- | editeng/source/rtf/rtfitem.cxx | 18 | ||||
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 50 | ||||
-rw-r--r-- | editeng/util/editeng.dxp | 1 |
19 files changed, 238 insertions, 264 deletions
diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx index 25d20fe0fdcd..62bc6efcd4bf 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.empty() ? 0 : aAttrStack.back()) ) pTmp = _GetAttrSet(); return pTmp->aAttrSet; } diff --git a/editeng/inc/helpid.hrc b/editeng/inc/helpid.hrc index 204f97842bf9..6d6c4822b037 100644 --- a/editeng/inc/helpid.hrc +++ b/editeng/inc/helpid.hrc @@ -30,52 +30,31 @@ #ifndef _EDITENG_HELPID_HRC #define _EDITENG_HELPID_HRC -// include --------------------------------------------------------------- - -#include <svl/solar.hrc> - -// Help-Ids -------------------------------------------------------------- -#define HID_EDITENG_SPELLER_WORDLANGUAGE (HID_EDIT_START) -#define HID_EDITENG_SPELLER_PARALANGUAGE (HID_EDIT_START + 1) -#define HID_EDITENG_SPELLER_ADDWORD (HID_EDIT_START + 2) -#define HID_EDITENG_SPELLER_AUTOCORRECT (HID_EDIT_START + 3) -#define HID_EDITENG_SPELLER_IGNORE (HID_EDIT_START + 4) -#define HID_EDITENG_SPELLER_START (HID_EDIT_START + 5) -#define HID_AUTOCORR_HELP_END (HID_EDIT_START + 6) -#define HID_AUTOCORR_HELP_START (HID_EDIT_START + 7) -#define HID_AUTOCORR_HELP_WORD HID_AUTOCORR_HELP_START - -#define HID_AUTOCORR_HELP_SENT (HID_AUTOCORR_HELP_START+1) -#define HID_AUTOCORR_HELP_SENTWORD (HID_AUTOCORR_HELP_START+2) -#define HID_AUTOCORR_HELP_ACORWORD (HID_AUTOCORR_HELP_START+3) - -#define HID_AUTOCORR_HELP_ACORSENTWORD (HID_AUTOCORR_HELP_START+5) - -#define HID_AUTOCORR_HELP_CHGTOENEMDASH (HID_AUTOCORR_HELP_START+7) -#define HID_AUTOCORR_HELP_WORDENEMDASH (HID_AUTOCORR_HELP_START+8) -#define HID_AUTOCORR_HELP_SENTENEMDASH (HID_AUTOCORR_HELP_START+9) -#define HID_AUTOCORR_HELP_SENTWORDENEMDASH (HID_AUTOCORR_HELP_START+10) -#define HID_AUTOCORR_HELP_ACORWORDENEMDASH (HID_AUTOCORR_HELP_START+11) - -#define HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH (HID_AUTOCORR_HELP_START+13) -#define HID_AUTOCORR_HELP_CHGQUOTES (HID_AUTOCORR_HELP_START+15) -#define HID_AUTOCORR_HELP_CHGSGLQUOTES (HID_AUTOCORR_HELP_START+16) -#define HID_AUTOCORR_HELP_SETINETATTR (HID_AUTOCORR_HELP_START+17) -#define HID_AUTOCORR_HELP_INGNOREDOUBLESPACE (HID_AUTOCORR_HELP_START+18) -#define HID_AUTOCORR_HELP_CHGWEIGHTUNDERL (HID_AUTOCORR_HELP_START+19) -#define HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL (HID_AUTOCORR_HELP_START+20) -#define HID_AUTOCORR_HELP_CHGORDINALNUMBER (HID_AUTOCORR_HELP_START+21) // HID_EDIT_START + 28 - -// please adjust ACT_SVX_HID_END2 below if you add entries here! - -// ----------------------------------------------------------------------- -// Overrun check --------------------------------------------------------- -// ----------------------------------------------------------------------- - -#define ACT_SVX_HID_END (HID_EDIT_START+28) -#if ACT_SVX_HID_END > HID_EDIT_END -#error Resource-Ueberlauf in #line, #file -#endif +#define HID_EDITENG_SPELLER_WORDLANGUAGE "EDITENG_HID_EDITENG_SPELLER_WORDLANGUAGE" +#define HID_EDITENG_SPELLER_PARALANGUAGE "EDITENG_HID_EDITENG_SPELLER_PARALANGUAGE" +#define HID_EDITENG_SPELLER_ADDWORD "EDITENG_HID_EDITENG_SPELLER_ADDWORD" +#define HID_EDITENG_SPELLER_AUTOCORRECT "EDITENG_HID_EDITENG_SPELLER_AUTOCORRECT" +#define HID_EDITENG_SPELLER_IGNORE "EDITENG_HID_EDITENG_SPELLER_IGNORE" +#define HID_EDITENG_SPELLER_START "EDITENG_HID_EDITENG_SPELLER_START" + +#define HID_AUTOCORR_HELP_WORD "EDITENG_HID_AUTOCORR_HELP_START" +#define HID_AUTOCORR_HELP_SENT "EDITENG_HID_AUTOCORR_HELP_SENT" +#define HID_AUTOCORR_HELP_SENTWORD "EDITENG_HID_AUTOCORR_HELP_SENTWORD" +#define HID_AUTOCORR_HELP_ACORWORD "EDITENG_HID_AUTOCORR_HELP_ACORWORD" +#define HID_AUTOCORR_HELP_ACORSENTWORD "EDITENG_HID_AUTOCORR_HELP_ACORSENTWORD" +#define HID_AUTOCORR_HELP_CHGTOENEMDASH "EDITENG_HID_AUTOCORR_HELP_CHGTOENEMDASH" +#define HID_AUTOCORR_HELP_WORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_WORDENEMDASH" +#define HID_AUTOCORR_HELP_SENTENEMDASH "EDITENG_HID_AUTOCORR_HELP_SENTENEMDASH" +#define HID_AUTOCORR_HELP_SENTWORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_SENTWORDENEMDASH" +#define HID_AUTOCORR_HELP_ACORWORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_ACORWORDENEMDASH" +#define HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH" +#define HID_AUTOCORR_HELP_CHGQUOTES "EDITENG_HID_AUTOCORR_HELP_CHGQUOTES" +#define HID_AUTOCORR_HELP_CHGSGLQUOTES "EDITENG_HID_AUTOCORR_HELP_CHGSGLQUOTES" +#define HID_AUTOCORR_HELP_SETINETATTR "EDITENG_HID_AUTOCORR_HELP_SETINETATTR" +#define HID_AUTOCORR_HELP_INGNOREDOUBLESPACE "EDITENG_HID_AUTOCORR_HELP_INGNOREDOUBLESPACE" +#define HID_AUTOCORR_HELP_CHGWEIGHTUNDERL "EDITENG_HID_AUTOCORR_HELP_CHGWEIGHTUNDERL" +#define HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL "EDITENG_HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL" +#define HID_AUTOCORR_HELP_CHGORDINALNUMBER "EDITENG_HID_AUTOCORR_HELP_CHGORDINALNUMBER" #endif diff --git a/editeng/inc/pch/precompiled_editeng.hxx b/editeng/inc/pch/precompiled_editeng.hxx index d82ecc6cb6b5..9d432f73a731 100644 --- a/editeng/inc/pch/precompiled_editeng.hxx +++ b/editeng/inc/pch/precompiled_editeng.hxx @@ -739,7 +739,6 @@ #include "svtools/parhtml.hxx" #include "svtools/parrtf.hxx" #include "unotools/pathoptions.hxx" -#include "svl/pickerhelper.hxx" #include "svl/poolitem.hxx" #include "unotools/printwarningoptions.hxx" #include "svl/ptitem.hxx" diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx index a1d4a66b8fb1..81e211988a09 100644 --- a/editeng/source/editeng/editattr.cxx +++ b/editeng/source/editeng/editattr.cxx @@ -266,10 +266,6 @@ EditCharAttribEscapement::EditCharAttribEscapement( const SvxEscapementItem& rAt DBG_ASSERT( rAttr.Which() == EE_CHAR_ESCAPEMENT, "Kein Escapementattribut!" ); } -#if defined( WIN ) && !defined( WNT ) -#pragma optimize ("", off) -#endif - void EditCharAttribEscapement::SetFont( SvxFont& rFont, OutputDevice* ) { USHORT nProp = ((const SvxEscapementItem*)GetItem())->GetProp(); @@ -283,11 +279,6 @@ void EditCharAttribEscapement::SetFont( SvxFont& rFont, OutputDevice* ) rFont.SetEscapement( nEsc ); } -#if defined( WIN ) && !defined( WNT ) -#pragma optimize ("", on) -#endif - - // ------------------------------------------------------------------------- // class EditCharAttribOutline // ------------------------------------------------------------------------- diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 9ac179a2a47f..a8b9efd1fff7 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 bf2e3d01852b..16b4da6f8429 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 b2a83ffd6274..3610423ba3c0 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 9f919afb39d6..817949294444 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 148ca08816ae..fe20464eb905 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 08f50a0da884..14f3f35c66b1 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 46a0668394f2..b5225751a8cb 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/items/flditem.cxx b/editeng/source/items/flditem.cxx index 5cb45144abab..132a6d0ee38c 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -377,83 +377,46 @@ int SvxURLField::operator==( const SvxFieldData& rOther ) const // ----------------------------------------------------------------------- -void SvxURLField::Load( SvPersistStream & rStm ) +static void write_unicode( SvPersistStream & rStm, const String& rString ) { - USHORT nFormat; - sal_uInt32 nFrameMarker, nCharSetMarker; - long nUlongSize = (long)sizeof(sal_uInt32); - String aTmpURL; - - rStm >> nFormat; - - // UNICODE: rStm >> aTmpURL; - rStm.ReadByteString(aTmpURL); - - // UNICODE: rStm >> aRepresentation; - // read to a temp string first, read text encoding and - // convert later to stay compatible to fileformat - ByteString aTempString; - rtl_TextEncoding aTempEncoding = RTL_TEXTENCODING_MS_1252; // #101493# Init for old documents - rStm.ReadByteString(aTempString); + USHORT nL = rString.Len(); + rStm << nL; + rStm.Write( rString.GetBuffer(), nL*sizeof(sal_Unicode) ); +} - rStm >> nFrameMarker; - if ( nFrameMarker == FRAME_MARKER ) +static void read_unicode( SvPersistStream & rStm, String& rString ) +{ + USHORT nL = 0; + rStm >> nL; + if ( nL ) { - // UNICODE: rStm >> aTargetFrame; - rStm.ReadByteString(aTargetFrame); - - rStm >> nCharSetMarker; - if ( nCharSetMarker == CHARSET_MARKER ) - { - USHORT nCharSet; - rStm >> nCharSet; - - // remember encoding - aTempEncoding = (rtl_TextEncoding)nCharSet; - } - else - rStm.SeekRel( -nUlongSize ); + rString.AllocBuffer( nL ); + rStm.Read( rString.GetBufferAccess(), nL*sizeof(sal_Unicode) ); + rString.ReleaseBufferAccess( nL ); } - else - rStm.SeekRel( -nUlongSize ); +} - // now build representation string due to known encoding - aRepresentation = String(aTempString, aTempEncoding); +void SvxURLField::Load( SvPersistStream & rStm ) +{ + USHORT nFormat = 0; + rStm >> nFormat; eFormat= (SvxURLFormat)nFormat; - // Relatives Speichern => Beim laden absolut machen. - DBG_ERROR("No BaseURL!"); - // TODO/MBA: no BaseURL - aURL = INetURLObject::GetAbsURL( String(), aTmpURL ); + read_unicode( rStm, aURL ); + read_unicode( rStm, aRepresentation ); + read_unicode( rStm, aTargetFrame ); } // ----------------------------------------------------------------------- void SvxURLField::Save( SvPersistStream & rStm ) { - // Relatives Speichern der URL - DBG_ERROR("No BaseURL!"); - // TODO/MBA: no BaseURL - String aTmpURL = INetURLObject::GetRelURL( String(), aURL ); - rStm << (USHORT)eFormat; - // UNICODE: rStm << aTmpURL; - rStm.WriteByteString(aTmpURL); - - // UNICODE: rStm << aRepresentation; - rStm.WriteByteString(aRepresentation); - - rStm << FRAME_MARKER; - - // UNICODE: rStm << aTargetFrame; - rStm.WriteByteString(aTargetFrame); - - rStm << CHARSET_MARKER; - - // #90477# rStm << (USHORT)GetStoreCharSet(gsl_getSystemTextEncoding(), rStm.GetVersion()); - rStm << (USHORT)GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rStm.GetVersion()); + write_unicode( rStm, aURL ); + write_unicode( rStm, aRepresentation ); + write_unicode( rStm, aTargetFrame ); } MetaAction* SvxURLField::createBeginComment() const @@ -921,16 +884,11 @@ int SvxAuthorField::operator==( const SvxFieldData& rOther ) const void SvxAuthorField::Load( SvPersistStream & rStm ) { - USHORT nType, nFormat; - - // UNICODE: rStm >> aName; - rStm.ReadByteString(aName); + USHORT nType = 0, nFormat = 0; - // UNICODE: rStm >> aFirstName; - rStm.ReadByteString(aFirstName); - - // UNICODE: rStm >> aShortName; - rStm.ReadByteString(aShortName); + read_unicode( rStm, aName ); + read_unicode( rStm, aFirstName ); + read_unicode( rStm, aShortName ); rStm >> nType; rStm >> nFormat; @@ -943,14 +901,9 @@ void SvxAuthorField::Load( SvPersistStream & rStm ) void SvxAuthorField::Save( SvPersistStream & rStm ) { - // UNICODE: rStm << aName; - rStm.WriteByteString(aName); - - // UNICODE: rStm << aFirstName; - rStm.WriteByteString(aFirstName); - - // UNICODE: rStm << aShortName; - rStm.WriteByteString(aShortName); + write_unicode( rStm, aName ); + write_unicode( rStm, aFirstName ); + write_unicode( rStm, aShortName ); rStm << (USHORT) eType; rStm << (USHORT) eFormat; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index b7124881c90e..f2481e79eb22 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1387,6 +1387,32 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, if( nRet ) { + const char* aHelpIds[] = + { + HID_AUTOCORR_HELP_WORD, + HID_AUTOCORR_HELP_SENT, + HID_AUTOCORR_HELP_SENTWORD, + HID_AUTOCORR_HELP_ACORWORD, + "", + HID_AUTOCORR_HELP_ACORSENTWORD, + "", + HID_AUTOCORR_HELP_CHGTOENEMDASH, + HID_AUTOCORR_HELP_WORDENEMDASH, + HID_AUTOCORR_HELP_SENTENEMDASH, + HID_AUTOCORR_HELP_SENTWORDENEMDASH, + HID_AUTOCORR_HELP_ACORWORDENEMDASH, + "", + HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH, + "", + HID_AUTOCORR_HELP_CHGQUOTES, + HID_AUTOCORR_HELP_CHGSGLQUOTES, + HID_AUTOCORR_HELP_SETINETATTR, + HID_AUTOCORR_HELP_INGNOREDOUBLESPACE, + HID_AUTOCORR_HELP_CHGWEIGHTUNDERL, + HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL, + HID_AUTOCORR_HELP_CHGORDINALNUMBER + }; + ULONG nHelpId = 0; if( nRet & ( Autocorrect|CptlSttSntnc|CptlSttWrd|ChgToEnEmDash ) ) { @@ -1413,8 +1439,8 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, if( nHelpId ) { - nHelpId += HID_AUTOCORR_HELP_START - 1; - Application::GetHelp()->OpenHelpAgent( nHelpId ); + nHelpId -= 1; + Application::GetHelp()->OpenHelpAgent( aHelpIds[nHelpId] ); } } diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index 2bc219e9b69c..a69fd59439c2 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -45,10 +45,6 @@ |* *************************************************************************/ -#ifdef WIN -#pragma optimize ( "", off ) -#endif - TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon, USHORT nCacheSz, USHORT nLft, USHORT nRght, BOOL bSimpl, BOOL bInnr, BOOL bVert ) : @@ -97,10 +93,6 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const baseg mpLinePolyPolygon = NULL; } -#ifdef WIN -#pragma optimize ( "", on ) -#endif - /************************************************************************* |* |* TextRanger::~TextRanger() @@ -204,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() ) @@ -299,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; @@ -308,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 ... @@ -340,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; } } @@ -487,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 ) { @@ -505,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 @@ -516,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" ); } } @@ -546,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 ef1c5f44b196..081cd5b506cd 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 24fd4465b031..4b0051cd3c81 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 89b44be23ba8..58789fab2106 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.empty(); 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.empty() ? 0 : 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.empty() ? 0 : 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.empty() ? 0 : 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.empty() ) // 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.empty() ? 0 : 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 61ae8e256c67..2788d2fd4b10 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.empty() ? 0 : 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.empty() ? 0 : aAttrStack.back(); + aAttrStack.pop_back(); + SvxRTFItemStackType *pAkt = aAttrStack.empty() ? 0 : 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.empty() ? 0 : 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.empty() ? 0 : aAttrStack.back(); return !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pAkt->nSttCnt == pInsPos->GetCntIdx()); } diff --git a/editeng/util/editeng.dxp b/editeng/util/editeng.dxp index 9630d7e06768..f0e1c69934bc 100644 --- a/editeng/util/editeng.dxp +++ b/editeng/util/editeng.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory |