summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-12-14 18:16:56 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-12-17 11:25:31 +0100
commitd5c934d150cb6cea5f96cbbee4fb5e8312bf027e (patch)
treeabc28f93d2a11ed40976ae36032b9c1b296e0e6d /sw
parent2bbb4b9c5bf9c61c5b0b7fdfcce5b97e04a63a8a (diff)
n#792778 DOCX import: parse group shapes in oox only
Previously textframes inside groupshapes were tried to be imported as TextFrames, but then their addition to a GroupShape failed, so the text simply ended up as a normal paragraph. Fix this by importing members of groupshapes as drawinglayer objects, just like how the WW8 import does. Also fix two testcases, which implicitely tested that the groupshape VML element is ignored on import. Change-Id: I1a9fba8a5fd532203a825e55b1d5996277ea12fa
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx27
1 files changed, 15 insertions, 12 deletions
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 7f78cfeb68d3..11fcd11ed785 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -317,26 +317,28 @@ void Test::testFdo49940()
void Test::testN751077()
{
/*
-enum = ThisComponent.Text.createEnumeration
-enum.NextElement
-para = enum.NextElement
-xray para.String
-xray para.PageStyleName
+xray ThisComponent.DrawPage(1).getByIndex(0).String
+xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName
*/
- uno::Reference<uno::XInterface> paragraph(getParagraph( 2, "TEXT1" ));
- // we want to test the paragraph is on the first page (it was put onto another page without the fix),
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xTextDocument, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ uno::Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xShape(xShapes->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("TEXT1"), xShape->getString());
+ // we want to test the textbox is on the first page (it was put onto another page without the fix),
// use a small trick and instead of checking the page layout, check the page style
- OUString pageStyle = getProperty< OUString >( paragraph, "PageStyleName" );
- CPPUNIT_ASSERT_EQUAL( OUString( "First Page" ), pageStyle );
+ uno::Reference<text::XTextContent> xTextContent(xShape, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty<OUString>(xTextContent->getAnchor(), "PageStyleName"));
}
void Test::testN705956_1()
{
/*
Get the first image in the document and check it's the one image in the document.
-It should be also anchored inline (as character).
+It should be also anchored inline (as character) and be inside a groupshape.
image = ThisComponent.DrawPage.getByIndex(0)
-graphic = image.Graphic
+graphic = image(0).Graphic
xray graphic.Size
xray image.AnchorType
*/
@@ -344,8 +346,9 @@ xray image.AnchorType
uno::Reference<drawing::XDrawPageSupplier> drawPageSupplier(textDocument, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> drawPage = drawPageSupplier->getDrawPage();
CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), drawPage->getCount());
+ uno::Reference<drawing::XShapes> shapes(drawPage->getByIndex(0), uno::UNO_QUERY);
uno::Reference<drawing::XShape> image;
- drawPage->getByIndex(0) >>= image;
+ shapes->getByIndex(0) >>= image;
uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
uno::Reference<graphic::XGraphic> graphic;
imageProperties->getPropertyValue( "Graphic" ) >>= graphic;