diff options
author | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-10-01 03:21:59 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2019-01-07 17:49:44 +0100 |
commit | 3272c1eb5563f3bda2caa24f32b1018372622109 (patch) | |
tree | b4b948fd36ed53b1d8399babf2dbe701469da412 /sd | |
parent | 5dfd5755c709e91d2903bd7be4582f7832e89780 (diff) |
related tdf#100074: prepare group shapes text input via writerfilter
Put various preps into place, that enable us to read txbxContent from
group shape children via the writerfilter parser, which gets us much
more features
Also:
- store shapecontexthandler on wrapper class in writerfilter
- move adding children shapes to ctor, not dtor
- remove RuntimeException in Writer's XShapes::add(), aligns this
with Draw/Impress API semantics, and helps here when trying to
add the same shape a 2nd time (which we then simply ignore)
- make oox's Shape notion of 'inside group' less ad-hoc
- make SwTextBoxHelper::getTextRectangle() cope with more than
CustomShape - so passing in a group shape will also yield some
sensible bounding box
- have SwTextBoxHelper handle group content, too
- derive WpsContext from ShapeContext, so we can later substitute it
for that inside WpgContext
- keep WpgContext::onCreateContext() _for the moment_ with the old
delegation to ShapeContext (needs to use WpsContext to enable
writerfilter text input)
Change-Id: I2b0f0583e21137f3321a8dc13823058b14d19773
Reviewed-on: https://gerrit.libreoffice.org/65914
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/xml/n819614_0.xml | 16 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml1.cxx | 10 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 8 | ||||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 6 |
4 files changed, 20 insertions, 20 deletions
diff --git a/sd/qa/unit/data/xml/n819614_0.xml b/sd/qa/unit/data/xml/n819614_0.xml index e51b520d3130..8238da646086 100644 --- a/sd/qa/unit/data/xml/n819614_0.xml +++ b/sd/qa/unit/data/xml/n819614_0.xml @@ -14,6 +14,14 @@ <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> </Transformation> </XShape> + <XShape positionX="0" positionY="0" sizeX="100" sizeY="100" type="com.sun.star.drawing.GroupShape" name="Content Placeholder 4"> + <XShapes/> + <Transformation> + <Line1 column1="101.000000" column2="0.000000" column3="0.000000"/> + <Line2 column1="0.000000" column2="101.000000" column3="0.000000"/> + <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> + </Transformation> + </XShape> <XShape positionX="182" positionY="2544" sizeX="25125" sizeY="16293" type="com.sun.star.drawing.GroupShape"> <XShapes> <XShape positionX="10751" positionY="3496" sizeX="1563" sizeY="253" type="com.sun.star.drawing.CustomShape" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName=""> @@ -6824,12 +6832,4 @@ <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> </Transformation> </XShape> - <XShape positionX="0" positionY="0" sizeX="100" sizeY="100" type="com.sun.star.drawing.GroupShape" name="Content Placeholder 4"> - <XShapes/> - <Transformation> - <Line1 column1="101.000000" column2="0.000000" column3="0.000000"/> - <Line2 column1="0.000000" column2="101.000000" column3="0.000000"/> - <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> - </Transformation> - </XShape> </XShapes> diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 1a3a818f929d..109c5a3f2261 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -221,7 +221,7 @@ void SdOOXMLExportTest1::testBnc870233_2() // First smart art has blue font color (direct formatting) { - const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(0)); + const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(1)); CPPUNIT_ASSERT(pObjGroup); const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(0)); checkFontAttributes<Color, SvxColorItem>(pObj, Color(0x0000ff)); @@ -229,7 +229,7 @@ void SdOOXMLExportTest1::testBnc870233_2() // Second smart art has "dk2" font color (style) { - const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(2)); // FIXME should be 1, smartart import creates an additional empty group for some reason + const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(3)); // FIXME should be 1, smartart import creates an additional empty group for some reason CPPUNIT_ASSERT(pObjGroup); const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(0)); checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x1F497D) ); @@ -237,7 +237,7 @@ void SdOOXMLExportTest1::testBnc870233_2() // Third smart art has white font color (style) { - const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(4)); // FIXME should be 2, smartart import creates an additional empty group for some reason + const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(5)); // FIXME should be 2, smartart import creates an additional empty group for some reason CPPUNIT_ASSERT(pObjGroup); const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(0)); checkFontAttributes<Color, SvxColorItem>(pObj, Color(0xffffff)); @@ -365,7 +365,7 @@ void SdOOXMLExportTest1::testBnc880763() // Check z-order of the two shapes, use background color to identify them // First object in the background has blue background color - const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(0)); + const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(1)); CPPUNIT_ASSERT(pObjGroup); const SdrObject *pObj = pObjGroup->GetSubList()->GetObj(0); CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr); @@ -387,7 +387,7 @@ void SdOOXMLExportTest1::testBnc862510_5() const SdrPage *pPage = GetPage( 1, xDocShRef ); // Same as testBnc870237, but here we check the horizontal spacing - const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(0)); + const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(1)); CPPUNIT_ASSERT(pObjGroup); const SdrObject* pObj = pObjGroup->GetSubList()->GetObj(1); CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr); diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index a472b0ef20fa..503b913b1ce0 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -1410,10 +1410,10 @@ void SdOOXMLExportTest2::testGroupsPosition() xDocShRef->DoClose(); xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); - assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "x", "6796800"); - assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "y", "4273920"); - assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off", "x", "4040640"); - assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off", "y", "4273920"); + assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[2]/p:sp[1]/p:spPr/a:xfrm/a:off", "x", "4040640"); + assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[2]/p:sp[1]/p:spPr/a:xfrm/a:off", "y", "4273920"); + assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[2]/p:sp[3]/p:spPr/a:xfrm/a:off", "x", "6796800"); + assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[2]/p:sp[3]/p:spPr/a:xfrm/a:off", "y", "4273920"); } void SdOOXMLExportTest2::testGroupsRotatedPosition() diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index e8827df1b946..0234733fe697 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -435,7 +435,7 @@ void SdImportTest::testN862510_2() const SdrPage *pPage = GetPage( 1, xDocShRef ); { - SdrObjGroup *pGrpObj = dynamic_cast<SdrObjGroup *>( pPage->GetObj( 0 ) ); + SdrObjGroup *pGrpObj = dynamic_cast<SdrObjGroup *>( pPage->GetObj( 1 ) ); CPPUNIT_ASSERT( pGrpObj ); SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>( pGrpObj->GetSubList()->GetObj( 0 ) ); CPPUNIT_ASSERT( pObj ); @@ -815,7 +815,7 @@ void SdImportTest::testBnc870237() const SdrPage *pPage = GetPage( 1, xDocShRef ); // Simulate a:ext inside dsp:txXfrm with changing the lower distance - const SdrObjGroup* pObj = dynamic_cast<SdrObjGroup*>( pPage->GetObj( 0 ) ); + const SdrObjGroup* pObj = dynamic_cast<SdrObjGroup*>( pPage->GetObj( 1 ) ); CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr); CPPUNIT_ASSERT_EQUAL( sal_Int32(0), pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST).GetValue()); CPPUNIT_ASSERT_EQUAL( sal_Int32(9919), pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST).GetValue()); @@ -1262,7 +1262,7 @@ void SdImportTest::testTdf93830() uno::Reference< drawing::XDrawPage > xPage( getPage( 0, xDocShRef ) ); // Get the first text box from group shape - uno::Reference< container::XIndexAccess > xShape( xPage->getByIndex(0), uno::UNO_QUERY ); + uno::Reference< container::XIndexAccess > xShape( xPage->getByIndex(1), uno::UNO_QUERY ); uno::Reference< beans::XPropertySet > xPropSet( xShape->getByIndex(2), uno::UNO_QUERY ); CPPUNIT_ASSERT_MESSAGE( "no textbox shape", xPropSet.is() ); |