Kaydet (Commit) 4bdbb550 authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX import: handle horizontal flip of bitmaps

Horizontal mirror on the UNO API level, mirror on the vertical axis
internally.

Change-Id: If142274a8f81a6875059a2651af6d8470870a36a
Reviewed-on: https://gerrit.libreoffice.org/48843Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst f06d75ae
...@@ -170,6 +170,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx") ...@@ -170,6 +170,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx")
"HoriOrientPosition")); "HoriOrientPosition"));
} }
DECLARE_OOXMLEXPORT_TEST(testGraphicObjectFliph, "graphic-object-fliph.docx")
{
CPPUNIT_ASSERT(getProperty<bool>(getShape(1), "HoriMirroredOnEvenPages"));
CPPUNIT_ASSERT(getProperty<bool>(getShape(1), "HoriMirroredOnOddPages"));
}
DECLARE_OOXMLEXPORT_TEST(testTdf113547, "tdf113547.docx") DECLARE_OOXMLEXPORT_TEST(testTdf113547, "tdf113547.docx")
{ {
uno::Reference<beans::XPropertySet> xPropertySet( uno::Reference<beans::XPropertySet> xPropertySet(
......
...@@ -125,6 +125,7 @@ ...@@ -125,6 +125,7 @@
#include <IDocumentSettingAccess.hxx> #include <IDocumentSettingAccess.hxx>
#include <IDocumentStylePoolAccess.hxx> #include <IDocumentStylePoolAccess.hxx>
#include <IDocumentRedlineAccess.hxx> #include <IDocumentRedlineAccess.hxx>
#include <grfatr.hxx>
#include <osl/file.hxx> #include <osl/file.hxx>
#include <vcl/embeddedfontshelper.hxx> #include <vcl/embeddedfontshelper.hxx>
...@@ -4713,8 +4714,21 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size ...@@ -4713,8 +4714,21 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
m_pSerializer->startElementNS( XML_pic, XML_spPr, m_pSerializer->startElementNS( XML_pic, XML_spPr,
XML_bwMode, "auto", XML_bwMode, "auto",
FSEND ); FSEND );
m_pSerializer->startElementNS( XML_a, XML_xfrm,
FSEND ); rtl::Reference<sax_fastparser::FastAttributeList> xFrameAttributes(
FastSerializerHelper::createAttrList());
if (pGrfNode)
{
MirrorGraph eMirror = pGrfNode->GetSwAttrSet().Get(RES_GRFATR_MIRRORGRF).GetValue();
if (eMirror == MirrorGraph::Vertical || eMirror == MirrorGraph::Both)
// Mirror on the vertical axis is a horizontal flip.
xFrameAttributes->add(XML_flipH, "1");
}
m_pSerializer->startElementNS(
XML_a, XML_xfrm, uno::Reference<xml::sax::XFastAttributeList>(xFrameAttributes.get()));
m_pSerializer->singleElementNS( XML_a, XML_off, m_pSerializer->singleElementNS( XML_a, XML_off,
XML_x, "0", XML_y, "0", XML_x, "0", XML_y, "0",
FSEND ); FSEND );
......
...@@ -1334,6 +1334,17 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b ...@@ -1334,6 +1334,17 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
m_pImpl->applyMargins(xGraphicObjectProperties); m_pImpl->applyMargins(xGraphicObjectProperties);
m_pImpl->applyName(xGraphicObjectProperties); m_pImpl->applyName(xGraphicObjectProperties);
} }
// Handle horizontal flip.
bool bMirrored = false;
xShapeProps->getPropertyValue("IsMirrored") >>= bMirrored;
if (bMirrored)
{
xGraphicObjectProperties->setPropertyValue("HoriMirroredOnEvenPages",
uno::makeAny(true));
xGraphicObjectProperties->setPropertyValue("HoriMirroredOnOddPages",
uno::makeAny(true));
}
} }
} }
catch( const uno::Exception& e ) catch( const uno::Exception& e )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment