tdf#56321 - .doc import image flipped status

Although LO was exporting whether an image was flipped
horizontally or vertically, it wasn't reading it in during
an import.

Change-Id: Ia85e3459d00f40d852bbcd3fcfe15e7b53d518ba
Reviewed-on: https://gerrit.libreoffice.org/22344
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
This commit is contained in:
Justin Luth 2016-02-13 16:28:48 +03:00 committed by Michael Stahl
parent 393c1a62f2
commit aa03fd09c0
3 changed files with 38 additions and 0 deletions

View File

@ -23,7 +23,9 @@
#include <com/sun/star/view/DocumentZoomType.hpp>
#include <com/sun/star/rdf/URI.hpp>
#include <com/sun/star/rdf/Statement.hpp>
#include <grfatr.hxx>
#include <pagedesc.hxx>
#include <ndgrf.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/request.hxx>
@ -567,6 +569,24 @@ DECLARE_WW8EXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustment.
CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_BLOCK, nVA );
}
DECLARE_WW8EXPORT_TEST(testRES_MIRROR_GRAPH_BOTH, "tdf56321_flipImage_both.doc")
{
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
CPPUNIT_ASSERT(pDoc);
for (int n = 0; ; n++)
{
SwNode* pNode = pDoc->GetNodes()[ n ];
if (SwGrfNode *pGrfNode = pNode->GetGrfNode())
{
CPPUNIT_ASSERT(pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue() == 3);
break;
}
}
}
DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt")
{
struct TextPortionInfo {

View File

@ -2094,6 +2094,24 @@ SwWW8ImplReader::SetAttributesAtGrfNode(SvxMSDffImportRec const*const pRecord,
pGrfNd->SetAttr( aCrop );
}
bool bFlipH = pRecord->nFlags & SHAPEFLAG_FLIPH;
bool bFlipV = pRecord->nFlags & SHAPEFLAG_FLIPV;
if ( bFlipH || bFlipV )
{
SwMirrorGrf aMirror = pGrfNd->GetSwAttrSet().GetMirrorGrf();
if( bFlipH )
{
if( bFlipV )
aMirror.SetValue(RES_MIRROR_GRAPH_BOTH);
else
aMirror.SetValue(RES_MIRROR_GRAPH_VERT);
}
else
aMirror.SetValue(RES_MIRROR_GRAPH_HOR);
pGrfNd->SetAttr( aMirror );
}
if (pRecord->pObj)
{
const SfxItemSet& rOldSet = pRecord->pObj->GetMergedItemSet();