Bugzilla – Attachment 120321 Details for
Bug 92849
Text background is lost when exporting Impress to PDF, SVG, WMF or EMF
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
1st try to solve
tdf92849_1stTry (text/plain), 8.30 KB, created by
Armin Le Grand
on 2015-11-06 11:13:54 UTC
(
hide
)
Description:
1st try to solve
Filename:
MIME Type:
Creator:
Armin Le Grand
Created:
2015-11-06 11:13:54 UTC
Size:
8.30 KB
patch
obsolete
>diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx >index 43aaa2b..facdd7b 100644 >--- a/drawinglayer/source/primitive2d/textprimitive2d.cxx >+++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx >@@ -159,7 +159,8 @@ namespace drawinglayer > > if(nCount) > { >- // prepare object transformation for polygons >+ // prepare object transformation for range. Do not use getTextTransform(), aScale >+ // may have beed adapted by getCorrectedScaleAndFontScale > rTransformation = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( > aScale, fShearX, fRotate, aTranslate); > } >@@ -167,6 +168,48 @@ namespace drawinglayer > } > } > >+ basegfx::B2DRange TextSimplePortionPrimitive2D::getTextBackgroundRange(basegfx::B2DHomMatrix& rTransformation) const >+ { >+ basegfx::B2DRange aRetval; >+ >+ if(getTextLength()) >+ { >+ // decompose object transformation to single values >+ basegfx::B2DVector aScale, aTranslate; >+ double fRotate, fShearX; >+ >+ if(getTextTransform().decompose(aScale, aTranslate, fRotate, fShearX)) >+ { >+ // for the TextLayouterDevice, it is necessary to have a scaling representing >+ // the font size. Since we want to extract polygons here, it is okay to >+ // work just with scaling and to ignore shear, rotation and translation, >+ // all that can be applied to the polygons later >+ const basegfx::B2DVector aFontScale(getCorrectedScaleAndFontScale(aScale)); >+ >+ // prepare textlayoutdevice >+ TextLayouterDevice aTextLayouter; >+ aTextLayouter.setFontAttribute( >+ getFontAttribute(), >+ aFontScale.getX(), >+ aFontScale.getY(), >+ getLocale()); >+ >+ // get text range >+ aRetval = aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength()); >+ >+ if(!aRetval.isEmpty()) >+ { >+ // prepare object transformation for range. Do not use getTextTransform(), aScale >+ // may have beed adapted by getCorrectedScaleAndFontScale >+ rTransformation = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( >+ aScale, fShearX, fRotate, aTranslate); >+ } >+ } >+ } >+ >+ return aRetval; >+ } >+ > Primitive2DSequence TextSimplePortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const > { > Primitive2DSequence aRetval; >@@ -283,43 +326,18 @@ namespace drawinglayer > { > if(maB2DRange.isEmpty() && getTextLength()) > { >- // get TextBoundRect as base size >- // decompose object transformation to single values >- basegfx::B2DVector aScale, aTranslate; >- double fRotate, fShearX; >+ // get untransformed range and range transformation from helper >+ basegfx::B2DHomMatrix aRangeTransformation; >+ basegfx::B2DRange aNewRange = getTextBackgroundRange(aRangeTransformation); > >- if(getTextTransform().decompose(aScale, aTranslate, fRotate, fShearX)) >+ // only apply and set when range is not empty >+ if(!aNewRange.isEmpty()) > { >- // for the TextLayouterDevice, it is necessary to have a scaling representing >- // the font size. Since we want to extract polygons here, it is okay to >- // work just with scaling and to ignore shear, rotation and translation, >- // all that can be applied to the polygons later >- const basegfx::B2DVector aFontScale(getCorrectedScaleAndFontScale(aScale)); >- >- // prepare textlayoutdevice >- TextLayouterDevice aTextLayouter; >- aTextLayouter.setFontAttribute( >- getFontAttribute(), >- aFontScale.getX(), >- aFontScale.getY(), >- getLocale()); >+ // apply range transformation to it >+ aNewRange.transform(aRangeTransformation); > >- // get basic text range >- basegfx::B2DRange aNewRange(aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength())); >- >- // #i104432#, #i102556# take empty results into account >- if(!aNewRange.isEmpty()) >- { >- // prepare object transformation for range >- const basegfx::B2DHomMatrix aRangeTransformation(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( >- aScale, fShearX, fRotate, aTranslate)); >- >- // apply range transformation to it >- aNewRange.transform(aRangeTransformation); >- >- // assign to buffered value >- const_cast< TextSimplePortionPrimitive2D* >(this)->maB2DRange = aNewRange; >- } >+ // assign to buffered value >+ const_cast< TextSimplePortionPrimitive2D* >(this)->maB2DRange = aNewRange; > } > } > >diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx >index b50c836a..c9cc03b 100644 >--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx >+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx >@@ -268,6 +268,26 @@ namespace drawinglayer > mpOutputDevice->SetLayoutMode(nRTLLayoutMode); > } > >+ // tdf#92849 >+ static bool bOwnHandlingOfTextBackgroundColor = true; >+ >+ if(bOwnHandlingOfTextBackgroundColor && !aFont.IsTransparent()) >+ { >+ basegfx::B2DHomMatrix aTextRangeTransformation; >+ const basegfx::B2DRange aTextRange = rTextCandidate.getTextBackgroundRange(aTextRangeTransformation); >+ >+ if(!aTextRange.isEmpty()) >+ { >+ basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aTextRange)); >+ aOutline.transform(aTextRangeTransformation); >+ const primitive2d::PolyPolygonColorPrimitive2D aTextBackgroundColorPrimitive( >+ basegfx::B2DPolyPolygon(aOutline), >+ aFont.GetFillColor().getBColor()); >+ processBasePrimitive2D(aTextBackgroundColorPrimitive); >+ aFont.SetTransparent(true); >+ } >+ } >+ > mpOutputDevice->SetFont(aFont); > mpOutputDevice->SetTextColor(Color(aRGBFontColor)); > >diff --git a/include/drawinglayer/primitive2d/textprimitive2d.hxx b/include/drawinglayer/primitive2d/textprimitive2d.hxx >index bfd4f20..f620794 100644 >--- a/include/drawinglayer/primitive2d/textprimitive2d.hxx >+++ b/include/drawinglayer/primitive2d/textprimitive2d.hxx >@@ -159,6 +159,11 @@ namespace drawinglayer > */ > void getTextOutlinesAndTransformation(basegfx::B2DPolyPolygonVector& rTarget, basegfx::B2DHomMatrix& rTransformation) const; > >+ /** get the text background range and it's according ObjectTransformation. This is e.g. >+ used to visualize the area behind the text when it is filled with a color (TextBackgroundColor). >+ */ >+ basegfx::B2DRange getTextBackgroundRange(basegfx::B2DHomMatrix& rTransformation) const; >+ > /// data read access > const basegfx::B2DHomMatrix& getTextTransform() const { return maTextTransform; } > const OUString& getText() const { return maText; }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 92849
:
117349
|
117350
|
117351
| 120321 |
120404
|
122105
|
122106