diff options
author | Nigel Hawkins <n.hawkins@gmx.com> | 2011-08-08 11:34:59 +0100 |
---|---|---|
committer | Nigel Hawkins <n.hawkins@gmx.com> | 2011-08-08 20:23:05 +0100 |
commit | b090fcf34f105f7937ddd1d5e814fce3970b5894 (patch) | |
tree | 0cc8343db85a7d18b0ff195d0feadb5ff94615f9 /editeng | |
parent | 7d2cea2bc9a9463db8e6b6e82cb8aa9504ba9b8e (diff) |
Replace SvUShorts with vector in editeng.hxx and cascade changes.
LGPLv3+/MPL
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/editeng.hxx | 3 | ||||
-rw-r--r-- | editeng/inc/editeng/unoedprx.hxx | 2 | ||||
-rw-r--r-- | editeng/inc/editeng/unoedsrc.hxx | 3 | ||||
-rw-r--r-- | editeng/inc/editeng/unofored.hxx | 2 | ||||
-rw-r--r-- | editeng/inc/editeng/unoforou.hxx | 2 | ||||
-rw-r--r-- | editeng/inc/editeng/unotext.hxx | 10 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/editview.cxx | 15 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 16 | ||||
-rw-r--r-- | editeng/source/uno/unoedprx.cxx | 2 | ||||
-rw-r--r-- | editeng/source/uno/unofored.cxx | 2 | ||||
-rw-r--r-- | editeng/source/uno/unoforou.cxx | 2 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 2 | ||||
-rw-r--r-- | editeng/source/uno/unotext2.cxx | 17 |
14 files changed, 37 insertions, 47 deletions
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx index eccc1c4f0b6f..babe1644f52c 100644 --- a/editeng/inc/editeng/editeng.hxx +++ b/editeng/inc/editeng/editeng.hxx @@ -54,7 +54,6 @@ class SvStream; class Link; class OutputDevice; class Window; -class SvUShorts; class SfxPoolItem; class SvxNumBulletItem; class SvxBulletItem; @@ -293,7 +292,7 @@ public: void StopSelectionMode(); void StripPortions(); - void GetPortions( sal_uInt16 nPara, SvUShorts& rList ); + void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ); long GetFirstLineStartX( sal_uInt16 nParagraph ); Point GetDocPosTopLeft( sal_uInt16 nParagraph ); diff --git a/editeng/inc/editeng/unoedprx.hxx b/editeng/inc/editeng/unoedprx.hxx index 4dde5a9688b5..573b23c35035 100644 --- a/editeng/inc/editeng/unoedprx.hxx +++ b/editeng/inc/editeng/unoedprx.hxx @@ -49,7 +49,7 @@ public: virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); - virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const; + virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const; virtual sal_Int32 CalcLogicalIndex( sal_uInt16 nPara, sal_uInt16 nEEIndex ); virtual sal_uInt16 CalcEditEngineIndex( sal_uInt16 nPara, sal_Int32 nLogicalIndex ); diff --git a/editeng/inc/editeng/unoedsrc.hxx b/editeng/inc/editeng/unoedsrc.hxx index b522155264cc..3f45bae909c6 100644 --- a/editeng/inc/editeng/unoedsrc.hxx +++ b/editeng/inc/editeng/unoedsrc.hxx @@ -50,7 +50,6 @@ struct EBulletInfo; class OutputDevice; class String; class SfxItemSet; -class SvUShorts; class SvxTextForwarder; class SvxViewForwarder; class SvxEditViewForwarder; @@ -159,7 +158,7 @@ public: virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const = 0; virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) = 0; virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ) = 0; - virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const = 0; + virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const = 0; virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0; virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const = 0; diff --git a/editeng/inc/editeng/unofored.hxx b/editeng/inc/editeng/unofored.hxx index 2daa4d8a2bd8..964fe6557090 100644 --- a/editeng/inc/editeng/unofored.hxx +++ b/editeng/inc/editeng/unofored.hxx @@ -51,7 +51,7 @@ public: virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); - virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const; + virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const; virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const; virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const; diff --git a/editeng/inc/editeng/unoforou.hxx b/editeng/inc/editeng/unoforou.hxx index f5987d23edbc..d1c5325c92a3 100644 --- a/editeng/inc/editeng/unoforou.hxx +++ b/editeng/inc/editeng/unoforou.hxx @@ -69,7 +69,7 @@ public: virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); - virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const; + virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const; virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const; virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const; diff --git a/editeng/inc/editeng/unotext.hxx b/editeng/inc/editeng/unotext.hxx index 4fd80927518d..0395e4d9afda 100644 --- a/editeng/inc/editeng/unotext.hxx +++ b/editeng/inc/editeng/unotext.hxx @@ -196,7 +196,7 @@ public: virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); - virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const; + virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const; sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const; sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const; @@ -600,10 +600,10 @@ class SvxUnoTextRangeEnumeration : public ::cppu::WeakAggImplHelper1< ::com::sun private: SvxEditSource* mpEditSource; ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText; - const SvxUnoTextBase& mrParentText; - sal_uInt16 mnParagraph; - SvUShorts* mpPortions; - sal_uInt16 mnNextPortion; + const SvxUnoTextBase& mrParentText; + sal_uInt16 mnParagraph; + std::vector<sal_uInt16>* mpPortions; + sal_uInt16 mnNextPortion; public: SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw(); diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 64591310d7dd..800a60dd6178 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -36,8 +36,6 @@ #define USE_SVXFONT -#define _SVSTDARR_sal_uInt16S -#include <svl/svstdarr.hxx> #include <svl/ctloptions.hxx> #include <svtools/ctrltool.hxx> @@ -1694,7 +1692,7 @@ void EditEngine::StripPortions() pImpEditEngine->Paint( &aTmpDev, aBigRec, Point(), sal_True ); } -void EditEngine::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) +void EditEngine::GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) { if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatFullDoc(); @@ -1707,7 +1705,7 @@ void EditEngine::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) for ( sal_uInt16 n = 0; n < nTextPortions; n++ ) { nEnd = nEnd + pParaPortion->GetTextPortions()[n]->GetLen(); - rList.Insert( nEnd, rList.Count() ); + rList.push_back( nEnd ); } } } diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index e324b7beca1d..9f7b2c494d7d 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -46,9 +46,6 @@ #include <svl/srchitem.hxx> -#define _SVSTDARR_sal_uIt16S -#include <svl/svstdarr.hxx> - #include <impedit.hxx> #include <editeng/editeng.hxx> #include <editeng/editview.hxx> @@ -1455,19 +1452,19 @@ void EditView::ChangeFontSize( bool bGrow, const FontList* pFontList ) { for( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { - SvUShorts aPortions; + std::vector<sal_uInt16> aPortions; rEditEngine.GetPortions( nPara, aPortions ); - if( aPortions.Count() == 0 ) - aPortions.Insert( rEditEngine.GetTextLen(nPara), 0 ); + if( aPortions.empty() ) + aPortions.push_back( rEditEngine.GetTextLen(nPara) ); const sal_uInt16 nBeginPos = (nPara == aSel.nStartPara) ? aSel.nStartPos : 0; const sal_uInt16 nEndPos = (nPara == aSel.nEndPara) ? aSel.nEndPos : 0xffff; - for ( sal_uInt16 nPos = 0; nPos < aPortions.Count(); ++nPos ) + for ( size_t nPos = 0; nPos < aPortions.size(); ++nPos ) { - sal_uInt16 nPortionEnd = aPortions.GetObject( nPos ); - sal_uInt16 nPortionStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0; + sal_uInt16 nPortionEnd = aPortions[ nPos ]; + sal_uInt16 nPortionStart = nPos > 0 ? aPortions[ nPos - 1 ] : 0; if( (nPortionEnd < nBeginPos) || (nPortionStart > nEndPos) ) continue; diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 9b86411d8cf1..d3f78ef0c3fb 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -1484,12 +1484,12 @@ sal_Bool ImpEditEngine::HasConvertibleTextPortion( LanguageType nSrcLang ) sal_uInt16 nParas = pEditEngine->GetParagraphCount(); for (sal_uInt16 k = 0; k < nParas; ++k) { - SvUShorts aPortions; + std::vector<sal_uInt16> aPortions; pEditEngine->GetPortions( k, aPortions ); - for ( sal_uInt16 nPos = 0; nPos < aPortions.Count(); ++nPos ) + for ( size_t nPos = 0; nPos < aPortions.size(); ++nPos ) { - sal_uInt16 nEnd = aPortions.GetObject( nPos ); - sal_uInt16 nStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0; + sal_uInt16 nEnd = aPortions[ nPos ]; + sal_uInt16 nStart = nPos > 0 ? aPortions[ nPos - 1 ] : 0; // if the paragraph is not empty we need to increase the index // by one since the attribute of the character left to the @@ -1675,12 +1675,12 @@ void ImpEditEngine::ImpConvert( rtl::OUString &rConvTxt, LanguageType &rConvTxtL sal_uInt16 nAttribEnd = USHRT_MAX; sal_uInt16 nCurPos = USHRT_MAX; EPaM aCurStart = CreateEPaM( aCurSel.Min() ); - SvUShorts aPortions; + std::vector<sal_uInt16> aPortions; pEditEngine->GetPortions( (sal_uInt16)aCurStart.nPara, aPortions ); - for ( sal_uInt16 nPos = 0; nPos < aPortions.Count(); ++nPos ) + for ( size_t nPos = 0; nPos < aPortions.size(); ++nPos ) { - sal_uInt16 nEnd = aPortions.GetObject( nPos ); - sal_uInt16 nStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0; + sal_uInt16 nEnd = aPortions[ nPos ]; + sal_uInt16 nStart = nPos > 0 ? aPortions[ nPos - 1 ] : 0; // the language attribute is obtained from the left character // (like usually all other attributes) diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 45abc3f4a459..245241595af1 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -591,7 +591,7 @@ void SvxAccessibleTextAdapter::RemoveAttribs( const ESelection& , sal_Bool , sal DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); } -void SvxAccessibleTextAdapter::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const +void SvxAccessibleTextAdapter::GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index b994e46c404d..b91227545da7 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -135,7 +135,7 @@ SfxItemPool* SvxEditEngineForwarder::GetPool() const return rEditEngine.GetEmptyItemSet().GetPool(); } -void SvxEditEngineForwarder::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const +void SvxEditEngineForwarder::GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const { rEditEngine.GetPortions( nPara, rList ); } diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index 8f3d7593efca..5561d740dee2 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -201,7 +201,7 @@ SfxItemPool* SvxOutlinerForwarder::GetPool() const return rOutliner.GetEmptyItemSet().GetPool(); } -void SvxOutlinerForwarder::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const +void SvxOutlinerForwarder::GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const { ((EditEngine&)rOutliner.GetEditEngine()).GetPortions( nPara, rList ); } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 0d097884b588..680b0f9f27fe 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -2486,7 +2486,7 @@ void SvxDummyTextSource::RemoveAttribs( const ESelection& , sal_Bool , sal_uInt1 { } -void SvxDummyTextSource::GetPortions( sal_uInt16, SvUShorts& ) const +void SvxDummyTextSource::GetPortions( sal_uInt16, std::vector<sal_uInt16>& ) const { } diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index af227be6b673..33fcf225eb2d 100644 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -32,9 +32,6 @@ #include <osl/mutex.hxx> #include <rtl/instance.hxx> -#define _SVSTDARR_sal_uIt16S -#include <svl/svstdarr.hxx> - #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> #include <editeng/unofield.hxx> @@ -321,9 +318,9 @@ sal_Bool SAL_CALL SvxUnoTextContent::hasElements() SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL; if( pForwarder ) { - SvUShorts aPortions; + std::vector<sal_uInt16> aPortions; pForwarder->GetPortions( mnParagraph, aPortions ); - return aPortions.Count() > 0; + return !aPortions.empty(); } else { @@ -426,7 +423,7 @@ SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rT if( mpEditSource && mpEditSource->GetTextForwarder() ) { - mpPortions = new SvUShorts; + mpPortions = new std::vector<sal_uInt16>; mpEditSource->GetTextForwarder()->GetPortions( nPara, *mpPortions ); } else @@ -448,7 +445,7 @@ sal_Bool SAL_CALL SvxUnoTextRangeEnumeration::hasMoreElements() { SolarMutexGuard aGuard; - return mpPortions && mnNextPortion < mpPortions->Count(); + return mpPortions && mnNextPortion < mpPortions->size(); } uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement() @@ -456,13 +453,13 @@ uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement() { SolarMutexGuard aGuard; - if( mpPortions == NULL || mnNextPortion >= mpPortions->Count() ) + if( mpPortions == NULL || mnNextPortion >= mpPortions->size() ) throw container::NoSuchElementException(); sal_uInt16 nStartPos = 0; if (mnNextPortion > 0) - nStartPos = mpPortions->GetObject(mnNextPortion-1); - sal_uInt16 nEndPos = mpPortions->GetObject(mnNextPortion); + nStartPos = mpPortions->at(mnNextPortion-1); + sal_uInt16 nEndPos = mpPortions->at(mnNextPortion); ESelection aSel( mnParagraph, nStartPos, mnParagraph, nEndPos ); uno::Reference< text::XTextRange > xRange; |