Kaydet (Commit) ee45d881 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Szymon Kłos

tdf#114845 sd: only shift rotated group items

fixes 6.0 commit  9ae1e094
> PPTX export: correct position of rotated groups

However, there was nothing excluding the re-positioning
to only group items.

Change-Id: I62e36b46c0d2ac3e41f8d7d4ed82df11e6eb1ee5
Reviewed-on: https://gerrit.libreoffice.org/56386
Tested-by: Jenkins
Reviewed-by: 's avatarSzymon Kłos <szymon.klos@collabora.com>
üst 82e5b2ba
......@@ -252,6 +252,8 @@ public:
void WriteShape3DEffects( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
void WriteArtisticEffect( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
OString WriteWdpPicture( const OUString& rFileId, const css::uno::Sequence< sal_Int8 >& rPictureData );
bool IsInGroupShape() const;
bool IsGroupShape( const css::uno::Reference< css::drawing::XShape >& rXShape, bool bOrChildShape = false ) const;
sal_Int32 getBulletMarginIndentation (const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, const OUString& propName);
static void ResetCounters();
......
......@@ -1369,7 +1369,7 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa
aPos.X-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Width/2-facsin*sin(nRotation*F_PI18000)*aSize.Height/2;
aPos.Y-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Height/2+facsin*sin(nRotation*F_PI18000)*aSize.Width/2;
}
else if(nRotation == 18000)
else if ( nRotation == 18000 && IsGroupShape( rXShape, /*bOrChildShape=*/true ) )
{
if (!bFlipV && bPositiveX)
{
......@@ -1392,11 +1392,8 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa
if(bFlipH != bFlipV)
nRotation = nRotation * -1 + 36000;
uno::Reference<lang::XServiceInfo> xServiceInfo(rXShape, uno::UNO_QUERY_THROW);
bool bIsGroupShape = xServiceInfo->supportsService("com.sun.star.drawing.GroupShape");
WriteTransformation(tools::Rectangle(Point(aPos.X, aPos.Y), Size(aSize.Width, aSize.Height)), nXmlNamespace,
bFlipHWrite, bFlipVWrite, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), bIsGroupShape);
bFlipHWrite, bFlipVWrite, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), IsGroupShape( rXShape ));
}
void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool bCheckDirect,
......@@ -2079,6 +2076,28 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
}
}
bool DrawingML::IsInGroupShape () const
{
bool bRet = m_xParent.is();
if ( bRet )
{
uno::Reference<lang::XServiceInfo> xServiceInfo(m_xParent, uno::UNO_QUERY_THROW);
bRet = xServiceInfo->supportsService("com.sun.star.drawing.GroupShape");
}
return bRet;
}
bool DrawingML::IsGroupShape( const Reference< XShape >& rXShape, bool bOrChildShape ) const
{
bool bRet = bOrChildShape && IsInGroupShape();
if ( !bRet )
{
uno::Reference<lang::XServiceInfo> xServiceInfo(rXShape, uno::UNO_QUERY_THROW);
bRet = xServiceInfo->supportsService("com.sun.star.drawing.GroupShape");
}
return bRet;
}
sal_Int32 DrawingML::getBulletMarginIndentation (const Reference< XPropertySet >& rXPropSet,sal_Int16 nLevel, const OUString& propName)
{
if( nLevel < 0 || !GETA( NumberingRules ) )
......
......@@ -122,6 +122,7 @@ public:
void testGroupRotation();
void testTdf104788();
void testSmartartRotation2();
void testTdf114845_rotateShape();
void testGroupsPosition();
void testGroupsRotatedPosition();
void testAccentColor();
......@@ -189,6 +190,7 @@ public:
CPPUNIT_TEST(testGroupRotation);
CPPUNIT_TEST(testTdf104788);
CPPUNIT_TEST(testSmartartRotation2);
CPPUNIT_TEST(testTdf114845_rotateShape);
CPPUNIT_TEST(testGroupsPosition);
CPPUNIT_TEST(testGroupsRotatedPosition);
CPPUNIT_TEST(testAccentColor);
......@@ -1298,6 +1300,20 @@ void SdOOXMLExportTest2::testSmartartRotation2()
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "y", "3158280");
}
void SdOOXMLExportTest2::testTdf114845_rotateShape()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf114845_rotateShape.pptx"), PPTX);
utl::TempFile tempFile;
xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
xDocShRef->DoClose();
xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:nvSpPr/p:cNvPr", "name", "CustomShape 5");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm", "flipV", "1");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm/a:off", "x", "4059000");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm/a:off", "y", "3287520");
}
void SdOOXMLExportTest2::testGroupsPosition()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/group.pptx"), PPTX);
......
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