[Libreoffice-commits] core.git: oox/source sw/qa sw/source writerfilter/source
YogeshBharate
yogesh.bharate at synerzip.com
Mon Jan 13 09:04:08 PST 2014
oox/source/drawingml/shape.cxx | 23 +++++++++++++-
sw/qa/extras/ooxmlexport/data/fdo73247.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 9 +++++
sw/source/filter/ww8/docxattributeoutput.cxx | 36 +++++++++++++++++++++-
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 8 +++-
5 files changed, 72 insertions(+), 4 deletions(-)
New commits:
commit b23867abd8427da361dfa5edb9b41fbbd064ae10
Author: YogeshBharate <yogesh.bharate at synerzip.com>
Date: Fri Jan 10 19:15:10 2014 +0530
fdo#73247: Code fixed for Shape rotation not preserved in RT
Problem Description:
- When we create the shape with text, rotated it with some angle,
the rotation angle is not preserved after roundtrip.
Implementation:
- Use the FrameInteroGrabBag to preserve the rotation angle.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7367
Change-Id: I8a44e82d21f08ecb221cdbfef73f02a652f2bad3
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index b191762..9437f02 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -657,7 +657,28 @@ Reference< XShape > Shape::createAndInsert(
}
aShapeProps.erase(PROP_LineColor);
}
-
+ if(mnRotation)
+ {
+ uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
+ const OUString aGrabBagPropName = "FrameInteropGrabBag";
+ uno::Sequence<beans::PropertyValue> aGrabBag;
+ xPropertySet->getPropertyValue(aGrabBagPropName) >>= aGrabBag;
+ beans::PropertyValue aPair;
+ aPair.Name = "mso-rotation-angle";
+ aPair.Value = uno::makeAny(mnRotation);
+ if (aGrabBag.hasElements())
+ {
+ sal_Int32 nLength = aGrabBag.getLength();
+ aGrabBag.realloc(nLength + 1);
+ aGrabBag[nLength] = aPair;
+ }
+ else
+ {
+ aGrabBag.realloc(1);
+ aGrabBag[0] = aPair;
+ }
+ xPropertySet->setPropertyValue(aGrabBagPropName, uno::makeAny(aGrabBag));
+ }
// TextFrames have ShadowFormat, not individual shadow properties.
boost::optional<sal_Int32> oShadowDistance;
if (aShapeProps.hasProperty(PROP_ShadowXDistance))
diff --git a/sw/qa/extras/ooxmlexport/data/fdo73247.docx b/sw/qa/extras/ooxmlexport/data/fdo73247.docx
new file mode 100644
index 0000000..63ad782
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo73247.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 46488de..d4f5e3f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2404,6 +2404,15 @@ DECLARE_OOXMLEXPORT_TEST(testFdo65833, "fdo65833.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:group", "editas", "canvas");
}
+DECLARE_OOXMLEXPORT_TEST(testFdo73247, "fdo73247.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:xfrm",
+ "rot", "1969698");
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index a94cd68..e498c09 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -304,9 +304,43 @@ void DocxAttributeOutput::WriteDMLTextFrame(sw::Frame* pParentFrame)
XML_txBox, "1",
FSEND);
+ uno::Any aRotation ;
+ const SdrObject* pSdrObj = rFrmFmt.FindRealSdrObject();
+ uno::Reference< drawing::XShape > xShape( ((SdrObject*)pSdrObj)->getUnoShape(), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropertySet->getPropertySetInfo();
+ OUString pName = "FrameInteropGrabBag";
+ sal_Int32 nRotation = 0;
+
+ if ( xPropSetInfo->hasPropertyByName( pName ) )
+ {
+ uno::Sequence< beans::PropertyValue > propList;
+ xPropertySet->getPropertyValue( pName ) >>= propList;
+ for ( sal_Int32 nProp=0; nProp < propList.getLength(); ++nProp )
+ {
+ OUString propName = propList[nProp].Name;
+ if ( propName == "mso-rotation-angle")
+ {
+ aRotation = propList[nProp].Value ;
+ break;
+ }
+ }
+ }
+ aRotation >>= nRotation ;
+ OString sRotation(OString::number(nRotation));
// Shape properties
m_pSerializer->startElementNS(XML_wps, XML_spPr, FSEND);
- m_pSerializer->startElementNS(XML_a, XML_xfrm, FSEND);
+ if(nRotation)
+ {
+ m_pSerializer->startElementNS(XML_a, XML_xfrm,
+ XML_rot, sRotation.getStr(),
+ FSEND);
+
+ }
+ else
+ {
+ m_pSerializer->startElementNS(XML_a, XML_xfrm, FSEND);
+ }
m_pSerializer->singleElementNS(XML_a, XML_off,
XML_x, "0",
XML_y, "0",
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 57255088..226dc5c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1820,9 +1820,9 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
if (xSInfo->supportsService("com.sun.star.text.TextFrame"))
{
// Extract the special "btLr text frame" mode, requested by oox, if needed.
- uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aGrabBag;
- xPropertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
+ xShapePropertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
for (int i = 0; i < aGrabBag.getLength(); ++i)
{
if (aGrabBag[i].Name == "mso-layout-flow-alt")
@@ -1835,6 +1835,10 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
uno::Reference<text::XTextContent> xTextContent(xShape, uno::UNO_QUERY_THROW);
uno::Reference<text::XTextRange> xTextRange(xTextAppend->createTextCursorByRange(xTextAppend->getEnd()), uno::UNO_QUERY_THROW);
xTextAppend->insertTextContent(xTextRange, xTextContent, sal_False);
+
+ uno::Reference<beans::XPropertySet> xPropertySet(xTextContent, uno::UNO_QUERY);
+ // we need to re-set this value to xTextContent, then only values are preserved.
+ xPropertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aGrabBag));
}
else if (nAnchorType != text::TextContentAnchorType_AS_CHARACTER)
{
More information about the Libreoffice-commits
mailing list