diff options
author | sushil_shinde <sushil.shinde@synerzip.com> | 2014-07-10 11:46:22 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-07-17 07:54:35 +0000 |
commit | 1bdd6d2129eecda564478d494fd46d14a54b6ac5 (patch) | |
tree | 8da6476cd927645c6dfddf2151b238636361c76d | |
parent | b50953df9829ef13601b98ae217102b123affcd0 (diff) |
fdo#80894 : Rotation value for textframe was missing after RT.
- Rotation property is not available for TextFrame in LO.
- Hence grabbaged this value.
- Roundtripped rotation value by converting it properly for both dml and vml textbox.
- Added UT for it.
Change-Id: Ia040d55dc2ea79500df76877ba44a02971c872a8
Reviewed-on: https://gerrit.libreoffice.org/10190
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | include/oox/export/drawingml.hxx | 4 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 2 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 6 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx | bin | 0 -> 30563 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.cxx | 17 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.hxx | 2 |
7 files changed, 33 insertions, 9 deletions
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 6f64fcf5ac8f..bf46326b3ca4 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -29,10 +29,10 @@ #include <tools/poly.hxx> #include <filter/msfilter/escherex.hxx> #include "oox/drawingml/drawingmltypes.hxx" -#ifndef PPTX_EXPORT_ROTATE_CLOCKWISIFY +#ifndef OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY // Our rotation is counter-clockwise and is in 100ths of a degree. // drawingML rotation is clockwise and is in 60000ths of a degree. -#define PPTX_EXPORT_ROTATE_CLOCKWISIFY(input) ((21600000-input*600)%21600000) +#define OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(input) ((21600000-input*600)%21600000) #endif class Graphic; diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 274453e0726d..75b6cfe7dd23 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1102,7 +1102,7 @@ void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32 { if (bFlipV) {nRotation=(nRotation+18000)%36000;} } - WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, PPTX_EXPORT_ROTATE_CLOCKWISIFY(nRotation) ); + WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation) ); } void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsField ) diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 879b462c9c14..f98c717cb830 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -319,6 +319,12 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS aGrabBag.realloc( length+1 ); aGrabBag[length].Name = "VML-Z-ORDER"; aGrabBag[length].Value = uno::makeAny( maTypeModel.maZIndex.toInt32() ); + if(!(maTypeModel.maRotation).isEmpty()) + { + aGrabBag.realloc( length+2 ); + aGrabBag[length+1].Name = "mso-rotation-angle"; + aGrabBag[length+1].Value = uno::makeAny(sal_Int32(NormAngle360((maTypeModel.maRotation.toInt32()) * -100))); + } propertySet->setPropertyValue( "FrameInteropGrabBag", uno::makeAny(aGrabBag) ); } else diff --git a/sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx b/sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx Binary files differnew file mode 100644 index 000000000000..fde69c5a7546 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index a5aa50d31908..afc82427a051 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3741,6 +3741,17 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80898, "fdo80898.docx") "/word/embeddings/oleObject1.doc"); } +DECLARE_OOXMLEXPORT_TEST(testFdo80894, "TextFrameRotation.docx") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + + // Rotation value was not roundtripped for textframe. + assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:xfrm", + "rot","16200000"); +} + DECLARE_OOXMLEXPORT_TEST(test2colHeader, "2col-header.docx") { // Header was lost on export when the document had multiple columns. diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index bb923aa7ee37..363b5b9d5d23 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -203,7 +203,8 @@ struct DocxSdrExport::Impl }; DocxSdrExport::DocxSdrExport(DocxExport& rExport, sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML) - : m_pImpl(new Impl(*this, rExport, pSerializer, pDrawingML)) + : m_pImpl(new Impl(*this, rExport, pSerializer, pDrawingML)), + DMLandVMLTextFrameRotation(0) { } @@ -1272,7 +1273,7 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo FSEND); uno::Any aRotation ; - sal_Int32 nRotation = 0; + DMLandVMLTextFrameRotation = 0; if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("FrameInteropGrabBag")) { uno::Sequence< beans::PropertyValue > propList; @@ -1287,11 +1288,11 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo } } } - aRotation >>= nRotation ; - OString sRotation(OString::number(nRotation)); + aRotation >>= DMLandVMLTextFrameRotation ; + OString sRotation(OString::number((OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(DMLandVMLTextFrameRotation)))); // Shape properties pFS->startElementNS(XML_wps, XML_spPr, FSEND); - if (nRotation) + if (DMLandVMLTextFrameRotation) { pFS->startElementNS(XML_a, XML_xfrm, XML_rot, sRotation.getStr(), @@ -1465,6 +1466,11 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly m_pImpl->m_pFlyAttrList = pFS->createAttrList(); m_pImpl->m_pTextboxAttrList = pFS->createAttrList(); m_pImpl->m_aTextFrameStyle = "position:absolute"; + if(!bTextBoxOnly) + { + OString sRotation(OString::number(DMLandVMLTextFrameRotation / -100)); + m_pImpl->m_rExport.SdrExporter().getTextFrameStyle().append(";rotation:").append(sRotation); + } m_pImpl->m_rExport.OutputFormat(pParentFrame->GetFrmFmt(), false, false, true); m_pImpl->m_pFlyAttrList->add(XML_style, m_pImpl->m_aTextFrameStyle.makeStringAndClear()); @@ -1475,7 +1481,6 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly if (!sAnchorId.isEmpty()) m_pImpl->m_pFlyAttrList->addNS(XML_w14, XML_anchorId, OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8)); } - sax_fastparser::XFastAttributeListRef xFlyAttrList(m_pImpl->m_pFlyAttrList); m_pImpl->m_pFlyAttrList = NULL; m_pImpl->m_bFrameBtLr = checkFrameBtlr(m_pImpl->m_rExport.pDoc->GetNodes()[nStt], m_pImpl->m_pTextboxAttrList); diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx index 5c98a424dbb0..1b8954defe95 100644 --- a/sw/source/filter/ww8/docxsdrexport.hxx +++ b/sw/source/filter/ww8/docxsdrexport.hxx @@ -101,6 +101,8 @@ public: bool isTextBox(const SwFrmFmt& rFrmFmt); /// Writes text from Textbox for <w:framePr> void writeOnlyTextOfFrame(sw::Frame* pParentFrame); + + sal_Int32 DMLandVMLTextFrameRotation; }; #endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXSDREXPORT_HXX |