summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-12-14 18:16:56 +0100
committerAndras Timar <atimar@suse.com>2013-01-22 11:36:55 +0100
commit22f8333ea6ca8e5c74b8be8a9900136e13874d7c (patch)
treef5ec010ad0c5f9c3850c34a590be0a3f40b87ec1 /sw
parentfb286e44b862c12d0e84632f9d0a9ae6fd3ea2c1 (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 Signed-off-by: Andras Timar <atimar@suse.com>
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;