include/vcl/pdfwriter.hxx | 8 ++++---- sfx2/source/bastyp/sfxhtml.cxx | 7 +------ vcl/source/control/field2.cxx | 20 ++++++++++---------- vcl/source/control/fixed.cxx | 2 +- vcl/source/gdi/outdev3.cxx | 9 ++++----- vcl/source/gdi/pdfwriter.cxx | 10 +++++----- vcl/source/gdi/pdfwriter_impl.cxx | 22 +++++++++++----------- vcl/source/gdi/pdfwriter_impl.hxx | 6 +++--- 8 files changed, 39 insertions(+), 45 deletions(-)
New commits: commit 2b7d8a50fe9f47d64af959aa170e47cb5c8ae5d4 Author: Caolán McNamara <[email protected]> Date: Mon Jan 13 11:55:14 2014 +0000 longparas: stop tuncating large html files Change-Id: I0ad9422d574c8629953fd95f0d334617c042c60f diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index bde8865..8c903b8 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -248,12 +248,7 @@ sal_Bool SfxHTMLParser::FinishFileDownload( OUString& rStr ) aStream << *pStream; aStream.Seek( STREAM_SEEK_TO_END ); - DBG_ASSERT( aStream.Tell() < STRING_MAXLEN, - "File too long for a string, cut off the end" ); - xub_StrLen nLen = aStream.Tell() < STRING_MAXLEN - ? (xub_StrLen)aStream.Tell() - : STRING_MAXLEN; - + sal_Size nLen = aStream.Tell(); aStream.Seek( 0 ); OString sBuffer = read_uInt8s_ToOString(aStream, nLen); rStr = OStringToOUString( sBuffer, RTL_TEXTENCODING_UTF8 ); commit 57ec4a841a9bb5c0db2f6eeb7aa5a6bde98de008 Author: Caolán McNamara <[email protected]> Date: Mon Jan 13 11:50:56 2014 +0000 longparas: drop xub_StrLen from fields Change-Id: Icd6dbc9b374df3e528dc22afa07be72d7fc89ca7 diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 2107bd9..585f81a 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -321,7 +321,7 @@ static OUString ImplPatternReformat( const OUString& rStr, static void ImplPatternMaxPos( const OUString& rStr, const OString& rEditMask, sal_uInt16 nFormatFlags, bool bSameMask, - sal_uInt16 nCursorPos, sal_Int32& rPos ) + sal_Int32 nCursorPos, sal_Int32& rPos ) { // last position must not be longer than the contained string @@ -394,7 +394,7 @@ static void ImplPatternProcessStrictModify( Edit* pEdit, if ( nMaxSel >= aText.getLength() ) { sal_Int32 nMaxPos = aNewText.getLength(); - ImplPatternMaxPos( aNewText, rEditMask, nFormatFlags, bSameMask, (xub_StrLen)nMaxSel, nMaxPos ); + ImplPatternMaxPos( aNewText, rEditMask, nFormatFlags, bSameMask, nMaxSel, nMaxPos ); if ( aSel.Min() == aSel.Max() ) { aSel.Min() = nMaxPos; @@ -409,11 +409,11 @@ static void ImplPatternProcessStrictModify( Edit* pEdit, } } -static xub_StrLen ImplPatternLeftPos(const OString& rEditMask, sal_Int32 nCursorPos) +static sal_Int32 ImplPatternLeftPos(const OString& rEditMask, sal_Int32 nCursorPos) { // search non-literal predecessor - xub_StrLen nNewPos = nCursorPos; - xub_StrLen nTempPos = nNewPos; + sal_Int32 nNewPos = nCursorPos; + sal_Int32 nTempPos = nNewPos; while ( nTempPos ) { if ( rEditMask[nTempPos-1] != EDITMASK_LITERAL ) @@ -426,7 +426,7 @@ static xub_StrLen ImplPatternLeftPos(const OString& rEditMask, sal_Int32 nCursor return nNewPos; } -static xub_StrLen ImplPatternRightPos( const OUString& rStr, const OString& rEditMask, +static sal_Int32 ImplPatternRightPos( const OUString& rStr, const OString& rEditMask, sal_uInt16 nFormatFlags, bool bSameMask, sal_Int32 nCursorPos ) { @@ -482,7 +482,7 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, // all was selected by the focus Selection aSel( aOldSel ); aSel.Justify(); - nCursorPos = (xub_StrLen)aSel.Min(); + nCursorPos = aSel.Min(); aSel.Max() = ImplPatternRightPos( pEdit->GetText(), rEditMask, nFormatFlags, bSameMask, nCursorPos ); if ( bShift ) aSel.Min() = aOldSel.Min(); @@ -605,7 +605,7 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, Selection aSel = aOldSel; aSel.Justify(); - nNewPos = (xub_StrLen)aSel.Min(); + nNewPos = aSel.Min(); if ( nNewPos < rEditMask.getLength() ) { @@ -669,7 +669,7 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, aStr.truncate( n ); if ( aSel.Len() ) - aStr.remove( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() ); + aStr.remove( aSel.Min(), aSel.Len() ); if ( aStr.getLength() < rEditMask.getLength() ) { @@ -690,7 +690,7 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, if ( aSel.Len() ) { // delete selection - OUString aRep = rLiteralMask.copy( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() ); + OUString aRep = rLiteralMask.copy( aSel.Min(), aSel.Len() ); aStr.remove( aSel.Min(), aRep.getLength() ); aStr.insert( aSel.Min(), aRep ); } commit 62b2451a1dff3b91c23a7083dbf6252984ee3d29 Author: Caolán McNamara <[email protected]> Date: Mon Jan 13 11:47:08 2014 +0000 longparas: weed out xub_StrLen in pdf writer Change-Id: I3570f653ec44edcf0a215ffcac2017b9a5a3544a diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 07d0f47..9971ebd 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -771,12 +771,12 @@ The following structure describes the permissions used in PDF security FontUnderline eOverline, sal_Bool bUnderlineAbove = sal_False ); void DrawTextArray( const Point& rStartPt, const OUString& rStr, - const sal_Int32* pDXAry = NULL, - xub_StrLen nIndex = 0, - xub_StrLen nLen = STRING_LEN ); + const sal_Int32* pDXAry, + sal_Int32 nIndex, + sal_Int32 nLen ); void DrawStretchText( const Point& rStartPt, sal_uLong nWidth, const OUString& rStr, - xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN ); + sal_Int32 nIndex, sal_Int32 nLen ); void DrawText( const Rectangle& rRect, const OUString& rStr, sal_uInt16 nStyle = 0 ); diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index fba8f18..610bfd5 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -65,7 +65,7 @@ void PDFWriter::SetFont( const Font& rFont ) void PDFWriter::DrawText( const Point& rPos, const OUString& rText ) { - pImplementation->drawText( rPos, rText ); + pImplementation->drawText( rPos, rText, 0, rText.getLength() ); } void PDFWriter::DrawTextLine( @@ -83,8 +83,8 @@ void PDFWriter::DrawTextArray( const Point& rStartPt, const OUString& rStr, const sal_Int32* pDXAry, - xub_StrLen nIndex, - xub_StrLen nLen ) + sal_Int32 nIndex, + sal_Int32 nLen ) { pImplementation->drawTextArray( rStartPt, rStr, pDXAry, nIndex, nLen ); } @@ -93,8 +93,8 @@ void PDFWriter::DrawStretchText( const Point& rStartPt, sal_uLong nWidth, const OUString& rStr, - xub_StrLen nIndex, - xub_StrLen nLen ) + sal_Int32 nIndex, + sal_Int32 nLen ) { pImplementation->drawStretchText( rStartPt, nWidth, rStr, nIndex, nLen ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6e4a420..8259cbf 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -7830,7 +7830,7 @@ void PDFWriterImpl::drawEmphasisMark( long nX, long nY, } } -void PDFWriterImpl::drawText( const Point& rPos, const OUString& rText, xub_StrLen nIndex, xub_StrLen nLen, bool bTextLines ) +void PDFWriterImpl::drawText( const Point& rPos, const OUString& rText, sal_Int32 nIndex, sal_Int32 nLen, bool bTextLines ) { MARK( "drawText" ); @@ -7846,7 +7846,7 @@ void PDFWriterImpl::drawText( const Point& rPos, const OUString& rText, xub_StrL } } -void PDFWriterImpl::drawTextArray( const Point& rPos, const OUString& rText, const sal_Int32* pDXArray, xub_StrLen nIndex, xub_StrLen nLen, bool bTextLines ) +void PDFWriterImpl::drawTextArray( const Point& rPos, const OUString& rText, const sal_Int32* pDXArray, sal_Int32 nIndex, sal_Int32 nLen, bool bTextLines ) { MARK( "drawText with array" ); @@ -7862,7 +7862,7 @@ void PDFWriterImpl::drawTextArray( const Point& rPos, const OUString& rText, con } } -void PDFWriterImpl::drawStretchText( const Point& rPos, sal_uLong nWidth, const OUString& rText, xub_StrLen nIndex, xub_StrLen nLen, bool bTextLines ) +void PDFWriterImpl::drawStretchText( const Point& rPos, sal_uLong nWidth, const OUString& rText, sal_Int32 nIndex, sal_Int32 nLen, bool bTextLines ) { MARK( "drawStretchText" ); @@ -7914,15 +7914,15 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr, OUString aLastLine; ImplMultiTextLineInfo aMultiLineInfo; ImplTextLineInfo* pLineInfo; - xub_StrLen i; - xub_StrLen nLines; - xub_StrLen nFormatLines; + sal_Int32 i; + sal_Int32 nLines; + sal_Int32 nFormatLines; if ( nTextHeight ) { ::vcl::DefaultTextLayout aLayout( *m_pReferenceDevice ); OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout ); - nLines = (xub_StrLen)(nHeight/nTextHeight); + nLines = nHeight/nTextHeight; nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) nLines = 1; @@ -7957,8 +7957,8 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr, aPos.X() += nWidth-pLineInfo->GetWidth(); else if ( nStyle & TEXT_DRAW_CENTER ) aPos.X() += (nWidth-pLineInfo->GetWidth())/2; - xub_StrLen nIndex = pLineInfo->GetIndex(); - xub_StrLen nLineLen = pLineInfo->GetLen(); + sal_Int32 nIndex = pLineInfo->GetIndex(); + sal_Int32 nLineLen = pLineInfo->GetLen(); drawText( aPos, aStr, nIndex, nLineLen, bTextLines ); // mnemonics should not appear in documents, // if the need arises, put them in here diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 4602044..8357e52 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -1195,10 +1195,10 @@ public: } /* actual drawing functions */ - void drawText( const Point& rPos, const OUString& rText, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true ); - void drawTextArray( const Point& rPos, const OUString& rText, const sal_Int32* pDXArray = NULL, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true ); + void drawText( const Point& rPos, const OUString& rText, sal_Int32 nIndex, sal_Int32 nLen, bool bTextLines = true ); + void drawTextArray( const Point& rPos, const OUString& rText, const sal_Int32* pDXArray, sal_Int32 nIndex, sal_Int32 nLen, bool bTextLines = true ); void drawStretchText( const Point& rPos, sal_uLong nWidth, const OUString& rText, - xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, + sal_Int32 nIndex, sal_Int32 nLen, bool bTextLines = true ); void drawText( const Rectangle& rRect, const OUString& rOrigStr, sal_uInt16 nStyle, bool bTextLines = true ); void drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bUnderlineAbove ); commit 9407f45186dde4be86ed6f8360098903da79b730 Author: Caolán McNamara <[email protected]> Date: Mon Jan 13 11:33:58 2014 +0000 longparas: STRING_LEN here means text len, so expand to just that Change-Id: Iec55f8976ca180e380c9679c561aae61c0607520 diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 1653916..76a5dc9 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -622,7 +622,7 @@ void FixedLine::ImplDraw( bool bLayout ) aStartPt.Y() -= (aOutSize.Height() - nWidth)/2; Point aTextPt( aStartPt ); aTextPt.X() -= GetTextHeight()/2; - DrawText( aTextPt, aText, 0, STRING_LEN, pVector, pDisplayText ); + DrawText( aTextPt, aText, 0, aText.getLength(), pVector, pDisplayText ); Pop(); if( aOutSize.Height() - aStartPt.Y() > FIXEDLINE_TEXT_BORDER ) aDecoView.DrawSeparator( Point( aStartPt.X(), aOutSize.Height()-1 ), diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 0ba187b..0509349 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -3918,7 +3918,7 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, // strikeout text has to be left aligned sal_uLong nOrigTLM = mnTextLayoutMode; mnTextLayoutMode = TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_COMPLEX_DISABLED; - pLayout = ImplLayout( aStrikeoutText, 0, STRING_LEN ); + pLayout = ImplLayout( aStrikeoutText, 0, aStrikeoutText.getLength() ); mnTextLayoutMode = nOrigTLM; if( !pLayout ) @@ -5501,7 +5501,6 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const OUString& rStr, long OutputDevice::GetTextArray( const OUString& rStr, sal_Int32* pDXAry, sal_Int32 nIndex, sal_Int32 nLen ) const { - // MEM: default nLen = STRING_LENGTH if(nLen == 0x0FFFF) { SAL_INFO("sal.rtl.xub", @@ -6247,7 +6246,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r // If there still is a last line, we output it left-aligned as the line would be clipped if ( !aLastLine.isEmpty() ) - _rLayout.DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText ); + _rLayout.DrawText( aPos, aLastLine, 0, aLastLine.getLength(), pVector, pDisplayText ); // Reset clipping if ( nStyle & TEXT_DRAW_CLIP ) @@ -6312,7 +6311,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r { rTargetDevice.Push( PUSH_CLIPREGION ); rTargetDevice.IntersectClipRegion( rRect ); - _rLayout.DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + _rLayout.DrawText( aPos, aStr, 0, aStr.getLength(), pVector, pDisplayText ); if ( bDrawMnemonics ) { if ( nMnemonicPos != -1 ) @@ -6322,7 +6321,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r } else { - _rLayout.DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + _rLayout.DrawText( aPos, aStr, 0, aStr.getLength(), pVector, pDisplayText ); if ( bDrawMnemonics ) { if ( nMnemonicPos != -1 ) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 14e92f5..6e4a420 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -7969,7 +7969,7 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr, // output last line left adjusted since it was shortened if (!aLastLine.isEmpty()) - drawText( aPos, aLastLine, 0, STRING_LEN, bTextLines ); + drawText( aPos, aLastLine, 0, aLastLine.getLength(), bTextLines ); } } else @@ -8002,7 +8002,7 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr, // mnemonics should be inserted here if the need arises // draw the actual text - drawText( aPos, aStr, 0, STRING_LEN, bTextLines ); + drawText( aPos, aStr, 0, aStr.getLength(), bTextLines ); } // reset clip region to original value
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
