diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-07-18 18:21:12 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-07-20 22:10:59 +0200 |
commit | cd3d26b7edbce67805259a71e4118223e02ebdd4 (patch) | |
tree | fbb103d9877275f80eab075f22a8e0753fccf151 /editeng/source | |
parent | 8e21a02520cbd2fdc09df1ca675f4aa46a02d5f6 (diff) |
vcl consitent use of long for corrdinate
most of length in vcl are calculated in 'long'
but array of X position tend to be in sal_Int32.
As a prep work to be able to support 'double'
as the base type of Device Coordinate, harmonize
the use of 'long' for non-float coordinate.
Change-Id: I7cb33301ff6a5e2c62247b36a4e07e168a58a323
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/accessibility/AccessibleStringWrap.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.hxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 16 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 3 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 46 | ||||
-rw-r--r-- | editeng/source/items/svxfont.cxx | 4 | ||||
-rw-r--r-- | editeng/source/outliner/outleeng.cxx | 18 | ||||
-rw-r--r-- | editeng/source/outliner/outleeng.hxx | 10 | ||||
-rw-r--r-- | editeng/source/outliner/outliner.cxx | 23 |
11 files changed, 70 insertions, 66 deletions
diff --git a/editeng/source/accessibility/AccessibleStringWrap.cxx b/editeng/source/accessibility/AccessibleStringWrap.cxx index e98f77e86de5..ecddbd32a75f 100644 --- a/editeng/source/accessibility/AccessibleStringWrap.cxx +++ b/editeng/source/accessibility/AccessibleStringWrap.cxx @@ -56,7 +56,7 @@ void AccessibleStringWrap::GetCharacterBounds( sal_Int32 nIndex, Rectangle& rRec } else { - sal_Int32 aXArray[2]; + long aXArray[2]; mrDev.GetCaretPositions( maText, aXArray, static_cast< sal_uInt16 >(nIndex), 1 ); rRect.Left() = 0; rRect.Top() = 0; diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 162491fa2707..97073c072d2c 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -548,13 +548,13 @@ ExtraPortionInfo::~ExtraPortionInfo() delete[] pOrgDXArray; } -void ExtraPortionInfo::SaveOrgDXArray( const sal_Int32* pDXArray, sal_Int32 nLen ) +void ExtraPortionInfo::SaveOrgDXArray( const long* pDXArray, sal_Int32 nLen ) { delete[] pOrgDXArray; if (pDXArray) { - pOrgDXArray = new sal_Int32[nLen]; - memcpy( pOrgDXArray, pDXArray, nLen*sizeof(sal_Int32) ); + pOrgDXArray = new long[nLen]; + memcpy( pOrgDXArray, pDXArray, nLen * sizeof(long) ); } else pOrgDXArray = NULL; diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index c9ba4496c3ce..3db2ac3e88c9 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -351,14 +351,14 @@ struct ExtraPortionInfo bool bFirstCharIsRightPunktuation; bool bCompressed; - sal_Int32* pOrgDXArray; + long* pOrgDXArray; ::std::vector< sal_Int32 > lineBreaksList; ExtraPortionInfo(); ~ExtraPortionInfo(); - void SaveOrgDXArray( const sal_Int32* pDXArray, sal_Int32 nLen ); + void SaveOrgDXArray( const long* pDXArray, sal_Int32 nLen ); }; @@ -465,7 +465,7 @@ class ParaPortion; class EditLine { public: - typedef std::vector<sal_Int32> CharPosArrayType; + typedef std::vector<long> CharPosArrayType; private: CharPosArrayType aPositions; diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 7b4d94a8074f..86ebf835d1e5 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -2424,19 +2424,19 @@ ParagraphInfos EditEngine::GetParagraphInfos( sal_Int32 nPara ) // ====================== Virtual Methods ======================== void EditEngine::DrawingText( const Point&, const OUString&, sal_Int32, sal_Int32, - const sal_Int32*, const SvxFont&, sal_Int32, sal_Int32, sal_uInt8, - const EEngineData::WrongSpellVector*, const SvxFieldData*, bool, bool, bool, - const ::com::sun::star::lang::Locale*, const Color&, const Color&) + const long*, const SvxFont&, sal_Int32, sal_Int32, sal_uInt8, + const EEngineData::WrongSpellVector*, const SvxFieldData*, bool, bool, bool, + const ::com::sun::star::lang::Locale*, const Color&, const Color&) { } void EditEngine::DrawingTab( const Point& /*rStartPos*/, long /*nWidth*/, - const OUString& /*rChar*/, const SvxFont& /*rFont*/, - sal_Int32 /*nPara*/, sal_Int32 /*nIndex*/, - sal_uInt8 /*nRightToLeft*/, bool /*bEndOfLine*/, - bool /*bEndOfParagraph*/, const Color& /*rOverlineColor*/, - const Color& /*rTextLineColor*/) + const OUString& /*rChar*/, const SvxFont& /*rFont*/, + sal_Int32 /*nPara*/, sal_Int32 /*nIndex*/, + sal_uInt8 /*nRightToLeft*/, bool /*bEndOfLine*/, + bool /*bEndOfParagraph*/, const Color& /*rOverlineColor*/, + const Color& /*rTextLineColor*/) { } diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index b1e64b1a5f86..e406a67692f4 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -602,7 +602,8 @@ private: bool IsScriptChange( const EditPaM& rPaM ) const; bool HasScriptType( sal_Int32 nPara, sal_uInt16 nType ) const; - bool ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_Int32 nStartPos, sal_Int32* pDXArray, sal_uInt16 n100thPercentFromMax, bool bManipulateDXArray ); + bool ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_Int32 nStartPos, + long* pDXArray, sal_uInt16 n100thPercentFromMax, bool bManipulateDXArray ); void ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* pParaPortion, long nRemainingWidth ); void ImplInitLayoutMode( OutputDevice* pOutDev, sal_Int32 nPara, sal_Int32 nIndex ); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index a1bac55cf2b0..339b102e9299 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -3978,7 +3978,7 @@ long ImpEditEngine::GetXPos( if ( nType == CHAR_PUNCTUATIONRIGHT && !pLine->GetCharPosArray().empty() ) { sal_Int32 n = nIndex - nTextPortionStart; - const sal_Int32* pDXArray = &pLine->GetCharPosArray()[0]+( nTextPortionStart-pLine->GetStart() ); + const long* pDXArray = &pLine->GetCharPosArray()[0]+( nTextPortionStart-pLine->GetStart() ); sal_Int32 nCharWidth = ( ( (n+1) < pPortion->GetLen() ) ? pDXArray[n] : pPortion->GetSize().Width() ) - ( n ? pDXArray[n-1] : 0 ); if ( (n+1) < pPortion->GetLen() ) diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index adbc9feb2628..f6961f775224 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -151,18 +151,17 @@ sal_uInt8 GetCharTypeForCompression( sal_Unicode cChar ) } } -static void lcl_DrawRedLines( - OutputDevice* pOutDev, - long nFontHeight, - const Point& rPnt, - size_t nIndex, - size_t nMaxEnd, - const sal_Int32* pDXArray, - WrongList* pWrongs, - short nOrientation, - const Point& rOrigin, - bool bVertical, - bool bIsRightToLeft ) +static void lcl_DrawRedLines( OutputDevice* pOutDev, + long nFontHeight, + const Point& rPnt, + size_t nIndex, + size_t nMaxEnd, + const long* pDXArray, + WrongList* pWrongs, + short nOrientation, + const Point& rOrigin, + bool bVertical, + bool bIsRightToLeft ) { // But only if font is not too small ... long nHght = pOutDev->LogicToPixel( Size( 0, nFontHeight ) ).Height(); @@ -733,7 +732,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) SvxFont aTmpFont( pNode->GetCharAttribs().GetDefFont() ); bool bCalcCharPositions = true; - boost::scoped_array<sal_Int32> pBuf(new sal_Int32[ pNode->Len() ]); + boost::scoped_array<long> pBuf(new long[ pNode->Len() ]); bool bSameLineAgain = false; // For TextRanger, if the height changes. TabInfo aCurrentTab; @@ -1079,7 +1078,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) if ( pPortion->GetLen() && GetAsianCompressionMode() ) { EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray(); - sal_Int32* pDXArray = &rArray[0] + nTmpPos - pLine->GetStart(); + long* pDXArray = &rArray[0] + nTmpPos - pLine->GetStart(); bCompressedChars |= ImplCalcAsianCompression( pNode, pPortion, nTmpPos, pDXArray, 10000, false); } @@ -1255,9 +1254,11 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed ) { // I need the manipulated DXArray for determining the break position... - sal_Int32* pDXArray = NULL; + long* pDXArray = NULL; if (!pLine->GetCharPosArray().empty()) + { pDXArray = &pLine->GetCharPosArray()[0] + (nPortionStart - pLine->GetStart()); + } ImplCalcAsianCompression( pNode, pPortion, nPortionStart, pDXArray, 10000, true); } @@ -3038,8 +3039,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt OUString aText; sal_Int32 nTextStart = 0; sal_Int32 nTextLen = 0; - const sal_Int32* pDXArray = 0; - boost::scoped_array<sal_Int32> pTmpDXArray; + const long* pDXArray = 0; + boost::scoped_array<long> pTmpDXArray; if ( pTextPortion->GetKind() == PORTIONKIND_TEXT ) { @@ -3183,7 +3184,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt } } - pTmpDXArray.reset(new sal_Int32[ aText.getLength() ]); + pTmpDXArray.reset(new long[ aText.getLength() ]); pDXArray = pTmpDXArray.get(); Font _aOldFont( GetRefDevice()->GetFont() ); aTmpFont.SetPhysFont( GetRefDevice() ); @@ -3213,7 +3214,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt nTextLen = aText.getLength(); // crash when accessing 0 pointer in pDXArray - pTmpDXArray.reset(new sal_Int32[ aText.getLength() ]); + pTmpDXArray.reset(new long[ aText.getLength() ]); pDXArray = pTmpDXArray.get(); Font _aOldFont( GetRefDevice()->GetFont() ); aTmpFont.SetPhysFont( GetRefDevice() ); @@ -4390,8 +4391,9 @@ Color ImpEditEngine::GetAutoColor() const bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode, - TextPortion* pTextPortion, sal_Int32 nStartPos, sal_Int32* pDXArray, - sal_uInt16 n100thPercentFromMax, bool bManipulateDXArray) + TextPortion* pTextPortion, sal_Int32 nStartPos, + long* pDXArray, sal_uInt16 n100thPercentFromMax, + bool bManipulateDXArray) { DBG_ASSERT( GetAsianCompressionMode(), "ImplCalcAsianCompression - Why?" ); DBG_ASSERT( pTextPortion->GetLen(), "ImplCalcAsianCompression - Empty Portion?" ); @@ -4557,7 +4559,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* sal_Int32 nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP ); sal_Int32 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion ); DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" ); - sal_Int32* pDXArray = NULL; + long* pDXArray = NULL; if (!pLine->GetCharPosArray().empty()) { pDXArray = &pLine->GetCharPosArray()[0]+( nTxtPortionStart-pLine->GetStart() ); diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 895eef60291c..d4c2de04ec56 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -404,7 +404,7 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, const OUString &rTxt ) } Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt, - const sal_Int32 nIdx, const sal_Int32 nLen, sal_Int32* pDXArray ) const + const sal_Int32 nIdx, const sal_Int32 nLen, long* pDXArray ) const { if ( !IsCaseMap() && !IsKern() ) return Size( pOut->GetTextArray( rTxt, pDXArray, nIdx, nLen ), @@ -454,7 +454,7 @@ Size SvxFont::GetTxtSize( const OutputDevice *pOut, const OUString &rTxt, void SvxFont::QuickDrawText( OutputDevice *pOut, const Point &rPos, const OUString &rTxt, - const sal_Int32 nIdx, const sal_Int32 nLen, const sal_Int32* pDXArray ) const + const sal_Int32 nIdx, const sal_Int32 nLen, const long* pDXArray ) const { // Font has to be selected in OutputDevice... diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx index bac8437de7c6..db90fda6c41e 100644 --- a/editeng/source/outliner/outleeng.cxx +++ b/editeng/source/outliner/outleeng.cxx @@ -147,15 +147,15 @@ OUString OutlinerEditEng::GetUndoComment( sal_uInt16 nUndoId ) const } void OutlinerEditEng::DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, sal_Int32 nTextLen, - const sal_Int32* pDXArray, const SvxFont& rFont, sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, - const EEngineData::WrongSpellVector* pWrongSpellVector, - const SvxFieldData* pFieldData, - bool bEndOfLine, - bool bEndOfParagraph, - bool bEndOfBullet, - const ::com::sun::star::lang::Locale* pLocale, - const Color& rOverlineColor, - const Color& rTextLineColor) + const long* pDXArray, const SvxFont& rFont, sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, + const EEngineData::WrongSpellVector* pWrongSpellVector, + const SvxFieldData* pFieldData, + bool bEndOfLine, + bool bEndOfParagraph, + bool bEndOfBullet, + const ::com::sun::star::lang::Locale* pLocale, + const Color& rOverlineColor, + const Color& rTextLineColor) { pOwner->DrawingText(rStartPos,rText,nTextStart,nTextLen,pDXArray,rFont,nPara,nIndex,nRightToLeft, pWrongSpellVector, pFieldData, bEndOfLine, bEndOfParagraph, bEndOfBullet, pLocale, rOverlineColor, rTextLineColor); diff --git a/editeng/source/outliner/outleeng.hxx b/editeng/source/outliner/outleeng.hxx index dae743f8f7d5..a802eedf1fb8 100644 --- a/editeng/source/outliner/outleeng.hxx +++ b/editeng/source/outliner/outleeng.hxx @@ -44,11 +44,11 @@ public: virtual void ParagraphDeleted( sal_Int32 nDeletedParagraph ) SAL_OVERRIDE; virtual void ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph ) SAL_OVERRIDE; - virtual void DrawingText( - const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, sal_Int32 nTextLen, const sal_Int32* pDXArray, const SvxFont& rFont, - sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, - const EEngineData::WrongSpellVector* pWrongSpellVector, - const SvxFieldData* pFieldData, + virtual void DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, + sal_Int32 nTextLen, const long* pDXArray, const SvxFont& rFont, + sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, + const EEngineData::WrongSpellVector* pWrongSpellVector, + const SvxFieldData* pFieldData, bool bEndOfLine, bool bEndOfParagraph, bool bEndOfBullet, diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index aaa843da69c0..ace9482001b5 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -1005,7 +1005,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos, if(bStrippingPortions) { const Font aSvxFont(pOutDev->GetFont()); - boost::scoped_array<sal_Int32> pBuf(new sal_Int32[ pPara->GetText().getLength() ]); + boost::scoped_array<long> pBuf(new long[ pPara->GetText().getLength() ]); pOutDev->GetTextArray( pPara->GetText(), pBuf.get() ); if(bSymbol) @@ -1738,16 +1738,17 @@ void Outliner::StripPortions() bStrippingPortions = false; } -void Outliner::DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, sal_Int32 nTextLen, const sal_Int32* pDXArray,const SvxFont& rFont, - sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, - const EEngineData::WrongSpellVector* pWrongSpellVector, - const SvxFieldData* pFieldData, - bool bEndOfLine, - bool bEndOfParagraph, - bool bEndOfBullet, - const ::com::sun::star::lang::Locale* pLocale, - const Color& rOverlineColor, - const Color& rTextLineColor) +void Outliner::DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, + sal_Int32 nTextLen, const long* pDXArray,const SvxFont& rFont, + sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, + const EEngineData::WrongSpellVector* pWrongSpellVector, + const SvxFieldData* pFieldData, + bool bEndOfLine, + bool bEndOfParagraph, + bool bEndOfBullet, + const ::com::sun::star::lang::Locale* pLocale, + const Color& rOverlineColor, + const Color& rTextLineColor) { if(aDrawPortionHdl.IsSet()) |