Bugzilla – Attachment 78666 Details for
Bug 57215
Wrong text rotation in SVG Export (rotated text appears as non-rotated)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Not-quite-perfect patch
0001-Fix-fdo-57215-rotate-text-one-level-higher.patch (text/plain), 5.15 KB, created by
Thorsten Behrens (allotropia)
on 2013-04-30 19:39:57 UTC
(
hide
)
Description:
Not-quite-perfect patch
Filename:
MIME Type:
Creator:
Thorsten Behrens (allotropia)
Created:
2013-04-30 19:39:57 UTC
Size:
5.15 KB
patch
obsolete
>From 90b789dd0653cbf3fed5de7beac42351af92acbc Mon Sep 17 00:00:00 2001 >From: Thorsten Behrens <tbehrens@suse.com> >Date: Tue, 30 Apr 2013 21:24:47 +0200 >Subject: [PATCH] Fix fdo#57215 - rotate text one level higher > >This rotates the text on the level of the <text> element. > >Change-Id: I87207690b38fa526822f01b15b3559e20ff109fc >--- > filter/source/svg/svgwriter.cxx | 49 +++++++++++++++++++++++---------------- > filter/source/svg/svgwriter.hxx | 6 +++++ > 2 files changed, 35 insertions(+), 20 deletions(-) > >diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx >index 2febabd..6020748 100644 >--- a/filter/source/svg/svgwriter.cxx >+++ b/filter/source/svg/svgwriter.cxx >@@ -447,6 +447,7 @@ SVGTextWriter::SVGTextWriter( SVGExport& rExport, SVGFontExport& rFontExport ) > mpVDev( NULL ), > mbIsTextShapeStarted( sal_False ), > mrTextShape(), >+ mrShape(), > msShapeId(), > mrParagraphEnumeration(), > mrCurrentTextParagraph(), >@@ -1237,6 +1238,29 @@ void SVGTextWriter::startTextShape() > mbIsTextShapeStarted = sal_True; > maParentFont = Font(); > mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "TextShape" ) ); >+ >+ // if text is rotated, set transform matrix >+ Reference < XPropertySet > xPropSet( mrShape, UNO_QUERY ); >+ sal_Int32 nRotationAngle; >+ if( (xPropSet->getPropertyValue( B2UCONST( "RotateAngle" ) ) >>= nRotationAngle) >+ && nRotationAngle ) >+ { >+ Point aRot( maTextPos ); >+ OUString aTransform( "translate(" ); >+ aTransform += OUString::valueOf( aRot.X() ) + ","; >+ aTransform += OUString::valueOf( aRot.Y() ) + ")"; >+ >+ aTransform += " rotate("; >+ aTransform += OUString::valueOf( nRotationAngle * -0.01 ); >+ aTransform += ")"; >+ >+ aTransform += " translate("; >+ aTransform += OUString::valueOf( -aRot.X() ) + ","; >+ aTransform += OUString::valueOf( -aRot.Y() ) + ")"; >+ >+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform ); >+ } >+ > mpTextShapeElem = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, mbIWS ); > startTextParagraph(); > } >@@ -1247,6 +1271,8 @@ void SVGTextWriter::startTextShape() > void SVGTextWriter::endTextShape() > { > endTextParagraph(); >+ if( mrShape.is() ) >+ mrShape.clear(); > if( mrTextShape.is() ) > mrTextShape.clear(); > if( mrParagraphEnumeration.is() ) >@@ -1333,26 +1359,6 @@ void SVGTextWriter::startTextPosition( sal_Bool bExportX, sal_Bool bExportY ) > if( bExportY ) > mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( maTextPos.Y() ) ); > >- // if text is rotated, set transform matrix at new tspan element >- const Font& rFont = mpVDev->GetFont(); >- if( rFont.GetOrientation() ) >- { >- Point aRot( maTextPos ); >- OUString aTransform( "translate(" ); >- aTransform += OUString::valueOf( aRot.X() ) + ","; >- aTransform += OUString::valueOf( aRot.Y() ) + ")"; >- >- aTransform += " rotate("; >- aTransform += OUString::valueOf( rFont.GetOrientation() * -0.1 ); >- aTransform += ")"; >- >- aTransform += " translate("; >- aTransform += OUString::valueOf( -aRot.X() ) + ","; >- aTransform += OUString::valueOf( -aRot.Y() ) + ")"; >- >- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform ); >- } >- > mpTextPositionElem = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); > } > >@@ -3338,7 +3344,10 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, > { > Reference< XText > xText( *pxShape, UNO_QUERY ); > if( xText.is() ) >+ { >+ maTextWriter.setShape( *pxShape ); > maTextWriter.setTextShape( xText, pTextEmbeddedBitmapMtf ); >+ } > } > maTextWriter.createParagraphEnumeration(); > { >diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx >index 0e2d7a5..dfa0a06 100644 >--- a/filter/source/svg/svgwriter.hxx >+++ b/filter/source/svg/svgwriter.hxx >@@ -201,6 +201,7 @@ class SVGTextWriter > VirtualDevice* mpVDev; > sal_Bool mbIsTextShapeStarted; > Reference<XText> mrTextShape; >+ Reference<XShape> mrShape; > ::rtl::OUString msShapeId; > Reference<XEnumeration> mrParagraphEnumeration; > Reference<XTextContent> mrCurrentTextParagraph; >@@ -271,6 +272,11 @@ class SVGTextWriter > mpContext = pContext; > } > >+ void setShape( const Reference<XShape>& rxShape ) >+ { >+ mrShape.set( rxShape ); >+ } >+ > void setTextShape( const Reference<XText>& rxText, > const GDIMetaFile* pTextEmbeddedBitmapMtf ) > { >-- >1.7.10.4 >
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 57215
:
71132
| 78666 |
98959