[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source
sushil_shinde
sushil.shinde at synerzip.com
Thu Jul 17 00:55:09 PDT 2014
include/oox/export/drawingml.hxx | 4 ++--
oox/source/export/drawingml.cxx | 2 +-
oox/source/vml/vmlshape.cxx | 6 ++++++
sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 11 +++++++++++
sw/source/filter/ww8/docxsdrexport.cxx | 17 +++++++++++------
sw/source/filter/ww8/docxsdrexport.hxx | 2 ++
7 files changed, 33 insertions(+), 9 deletions(-)
New commits:
commit 1bdd6d2129eecda564478d494fd46d14a54b6ac5
Author: sushil_shinde <sushil.shinde at synerzip.com>
Date: Thu Jul 10 11:46:22 2014 +0530
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 at collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 6f64fcf..bf46326 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 274453e..75b6cfe 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 879b462..f98c717 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
new file mode 100644
index 0000000..fde69c5
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a5aa50d..afc8242 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 bb923aa..363b5b9 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 5c98a42..1b8954d 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
More information about the Libreoffice-commits
mailing list