diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-09-14 15:28:33 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-09-14 15:30:39 +0200 |
commit | 793905906980e77a9853a8dd01fab95b65ca4f02 (patch) | |
tree | 723f01ca67f818484f481fc68be3c8f7f3c51d0f /drawinglayer | |
parent | f8e1d2438199c4a76ceeb36352678c415e25272c (diff) |
filled-tab-editeng.diff: Filled tab wasn't filled in shapes
n#564454
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx | 8 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/textprimitive2d.cxx | 12 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclprocessor2d.cxx | 41 |
3 files changed, 50 insertions, 11 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx index 6c67bded2b17..94c7ee2c192b 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx @@ -129,6 +129,8 @@ namespace drawinglayer /// #i96669# internal: add simple range buffering for this primitive basegfx::B2DRange maB2DRange; + bool mbFilled; // Whether to fill a given width with the text + long mnWidthToFill; // the width to fill protected: /// local decomposition. @@ -144,7 +146,9 @@ namespace drawinglayer const ::std::vector< double >& rDXArray, const attribute::FontAttribute& rFontAttribute, const ::com::sun::star::lang::Locale& rLocale, - const basegfx::BColor& rFontColor); + const basegfx::BColor& rFontColor, + bool bFilled = false, + long nWidthToFill = 0); /// helpers /** get text outlines as polygons and their according ObjectTransformation. Handles all @@ -161,6 +165,8 @@ namespace drawinglayer const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; } const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; } const basegfx::BColor& getFontColor() const { return maFontColor; } + bool isFilled() const { return mbFilled; } + long getWidthToFill() const { return mnWidthToFill; } /// compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index f5566246ef91..5e85d5dc3654 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -237,7 +237,9 @@ namespace drawinglayer const ::std::vector< double >& rDXArray, const attribute::FontAttribute& rFontAttribute, const ::com::sun::star::lang::Locale& rLocale, - const basegfx::BColor& rFontColor) + const basegfx::BColor& rFontColor, + bool bFilled, + long nWidthToFill) : BufferedDecompositionPrimitive2D(), maTextTransform(rNewTransform), maText(rText), @@ -247,7 +249,9 @@ namespace drawinglayer maFontAttribute(rFontAttribute), maLocale(rLocale), maFontColor(rFontColor), - maB2DRange() + maB2DRange(), + mbFilled(bFilled), + mnWidthToFill(nWidthToFill) { #ifdef DBG_UTIL const xub_StrLen aStringLength(getText().Len()); @@ -276,7 +280,9 @@ namespace drawinglayer && getDXArray() == rCompare.getDXArray() && getFontAttribute() == rCompare.getFontAttribute() && LocalesAreEqual(getLocale(), rCompare.getLocale()) - && getFontColor() == rCompare.getFontColor()); + && getFontColor() == rCompare.getFontColor() + && mbFilled == rCompare.mbFilled + && mnWidthToFill == rCompare.mnWidthToFill); } return false; diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index e49e54fb751c..ca53ae07e916 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -250,22 +250,49 @@ namespace drawinglayer mpOutputDevice->SetFont(aFont); mpOutputDevice->SetTextColor(Color(aRGBFontColor)); + String aText( rTextCandidate.getText() ); + xub_StrLen nPos = rTextCandidate.getTextPosition(); + xub_StrLen nLen = rTextCandidate.getTextLength(); + + sal_Int32* pDXArray = aTransformedDXArray.size() ? &(aTransformedDXArray[0]) : NULL ; + + if ( rTextCandidate.isFilled() ) + { + basegfx::B2DVector aOldFontScaling, aOldTranslate; + double fOldRotate, fOldShearX; + rTextCandidate.getTextTransform().decompose(aOldFontScaling, aOldTranslate, fOldRotate, fOldShearX); + + long nWidthToFill = rTextCandidate.getWidthToFill( ) * aFontScaling.getX() / aOldFontScaling.getX(); + + long nWidth = mpOutputDevice->GetTextArray( + rTextCandidate.getText(), pDXArray, 0, 1 ); + long nChars = 2; + if ( nWidth ) + nChars = nWidthToFill / nWidth; + + String aFilled; + aFilled.Fill( (USHORT)nChars, aText.GetChar( 0 ) ); + aText = aFilled; + nPos = 0; + nLen = nChars; + } + if(aTransformedDXArray.size()) { mpOutputDevice->DrawTextArray( aStartPoint, - rTextCandidate.getText(), - &(aTransformedDXArray[0]), - rTextCandidate.getTextPosition(), - rTextCandidate.getTextLength()); + aText, + pDXArray, + nPos, + nLen); } else { mpOutputDevice->DrawText( aStartPoint, - rTextCandidate.getText(), - rTextCandidate.getTextPosition(), - rTextCandidate.getTextLength()); + aText, + nPos, + nLen); } if(rTextCandidate.getFontAttribute().getRTL()) |