1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 #define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
14 #include <AppKit/AppKit.h>
18 #include <swmodeltestbase.hxx>
20 #include <IDocumentSettingAccess.hxx>
21 #include <com/sun/star/awt/XBitmap.hpp>
22 #include <com/sun/star/drawing/XControlShape.hpp>
23 #include <com/sun/star/text/RelOrientation.hpp>
24 #include <com/sun/star/text/TableColumnSeparator.hpp>
25 #include <com/sun/star/text/VertOrientation.hpp>
26 #include <com/sun/star/text/WrapTextMode.hpp>
27 #include <com/sun/star/text/WritingMode2.hpp>
28 #include <com/sun/star/style/BreakType.hpp>
29 #include <com/sun/star/table/ShadowFormat.hpp>
30 #include <com/sun/star/table/TableBorder2.hpp>
32 #include <tools/UnitConversion.hxx>
33 #include <unotools/fltrcfg.hxx>
34 #include <comphelper/sequenceashashmap.hxx>
35 #include <oox/drawingml/drawingmltypes.hxx>
36 #include <xmloff/odffields.hxx>
37 #include <basegfx/polygon/b2dpolypolygontools.hxx>
38 #include <o3tl/string_view.hxx>
40 #include <IDocumentMarkAccess.hxx>
41 #include <bordertest.hxx>
42 #include <unotxdoc.hxx>
45 class Test
: public SwModelTestBase
48 Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
50 virtual std::unique_ptr
<Resetter
> preTest(const char* filename
) override
52 if (filename
== std::string_view("smartart.docx")
53 || filename
== std::string_view("strict-smartart.docx") )
55 std::unique_ptr
<Resetter
> pResetter(new Resetter(
57 SvtFilterOptions::Get().SetSmartArt2Shape(false);
59 SvtFilterOptions::Get().SetSmartArt2Shape(true);
66 DECLARE_OOXMLEXPORT_TEST(testN751054
, "n751054.docx")
68 text::TextContentAnchorType eValue
= getProperty
<text::TextContentAnchorType
>(getShape(1), "AnchorType");
69 CPPUNIT_ASSERT(eValue
!= text::TextContentAnchorType_AS_CHARACTER
);
72 CPPUNIT_TEST_FIXTURE(Test
, testTdf48569
)
74 loadAndReload("tdf48569.odt");
75 CPPUNIT_ASSERT_EQUAL(2, getShapes());
76 CPPUNIT_ASSERT_EQUAL(1, getPages());
77 // File crashing while saving in LO
78 text::TextContentAnchorType eValue
= getProperty
<text::TextContentAnchorType
>(getShape(1), "AnchorType");
79 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER
, eValue
);
82 DECLARE_OOXMLEXPORT_TEST(testN750935
, "n750935.docx")
84 // Some page break types were ignores, resulting in less pages.
85 CPPUNIT_ASSERT_EQUAL(5, getPages());
88 * The problem was that the header and footer was not shared.
90 * xray ThisComponent.StyleFamilies.PageStyles.Default.FooterIsShared
92 uno::Reference
<beans::XPropertySet
> xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY
);
94 xPropertySet
->getPropertyValue("HeaderIsShared") >>= bValue
;
95 CPPUNIT_ASSERT_EQUAL(true, bValue
);
96 xPropertySet
->getPropertyValue("FooterIsShared") >>= bValue
;
97 CPPUNIT_ASSERT_EQUAL(true, bValue
);
100 DECLARE_OOXMLEXPORT_TEST(testN751117
, "n751117.docx")
102 // First shape: the end should be an arrow, should be rotated and should be flipped.
103 uno::Reference
<beans::XPropertySet
> xPropertySet(getShape(1), uno::UNO_QUERY
);
105 xPropertySet
->getPropertyValue("LineEndName") >>= aValue
;
106 CPPUNIT_ASSERT(aValue
.indexOf("Arrow") != -1);
108 // Rotating & Flipping will cause the angle to change from 90 degrees to 270 degrees
109 sal_Int32 nValue
= 0;
110 xPropertySet
->getPropertyValue("RotateAngle") >>= nValue
;
111 CPPUNIT_ASSERT_EQUAL(sal_Int32(270 * 100), nValue
);
113 uno::Reference
<drawing::XShape
> xShape(xPropertySet
, uno::UNO_QUERY
);
114 awt::Size
aActualSize(xShape
->getSize());
115 CPPUNIT_ASSERT(aActualSize
.Width
> 0);
117 // The second shape should be a line
118 uno::Reference
<lang::XServiceInfo
> xServiceInfo(getShape(2), uno::UNO_QUERY
);
119 CPPUNIT_ASSERT(xServiceInfo
->supportsService("com.sun.star.drawing.LineShape"));
122 DECLARE_OOXMLEXPORT_TEST(testFdo74745
, "fdo74745.docx")
124 uno::Reference
<text::XTextRange
> paragraph
= getParagraph(3);
125 CPPUNIT_ASSERT_EQUAL(OUString("09/02/2014"), paragraph
->getString());
128 DECLARE_OOXMLEXPORT_TEST(testFdo81486
, "fdo81486.docx")
130 uno::Reference
<text::XTextRange
> paragraph
= getParagraph(1);
131 CPPUNIT_ASSERT_EQUAL(OUString("CustomTitle"), paragraph
->getString());
134 DECLARE_OOXMLEXPORT_TEST(testFdo79738
, "fdo79738.docx")
136 uno::Reference
< style::XStyleFamiliesSupplier
> xStylesSupplier( mxComponent
, uno::UNO_QUERY_THROW
);
137 uno::Reference
< container::XNameAccess
> xStyleFamilies
= xStylesSupplier
->getStyleFamilies();
138 uno::Reference
<container::XNameContainer
> xStyles
;
139 xStyleFamilies
->getByName("ParagraphStyles") >>= xStyles
;
140 uno::Reference
<beans::XPropertySet
> xPropertySetHeader( xStyles
->getByName("Header"), uno::UNO_QUERY
);
141 CPPUNIT_ASSERT_EQUAL(false, xPropertySetHeader
->getPropertyValue("ParaLineNumberCount").get
<bool>());
142 uno::Reference
<beans::XPropertySet
> xPropertySetFooter( xStyles
->getByName("Footer"), uno::UNO_QUERY
);
143 CPPUNIT_ASSERT_EQUAL(false, xPropertySetFooter
->getPropertyValue("ParaLineNumberCount").get
<bool>());
146 DECLARE_OOXMLEXPORT_TEST(testN705956_1
, "n705956-1.docx")
149 Get the first image in the document and check it's the one image in the document.
150 It should be also anchored inline (as character) and be inside a groupshape.
151 image = ThisComponent.DrawPage.getByIndex(0)
152 graphic = image(0).Graphic
154 xray image.AnchorType
156 CPPUNIT_ASSERT_EQUAL(1, getShapes());
157 uno::Reference
<drawing::XShapes
> shapes(getShape(1), uno::UNO_QUERY
);
158 uno::Reference
<drawing::XShape
> image
;
159 shapes
->getByIndex(0) >>= image
;
160 uno::Reference
<beans::XPropertySet
> imageProperties(image
, uno::UNO_QUERY
);
161 uno::Reference
<graphic::XGraphic
> graphic
;
162 imageProperties
->getPropertyValue( "Graphic" ) >>= graphic
;
163 uno::Reference
<awt::XBitmap
> bitmap(graphic
, uno::UNO_QUERY
);
164 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32
>(120), bitmap
->getSize().Width
);
165 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32
>(106), bitmap
->getSize().Height
);
166 text::TextContentAnchorType anchorType
;
167 imageProperties
->getPropertyValue( "AnchorType" ) >>= anchorType
;
168 CPPUNIT_ASSERT_EQUAL( text::TextContentAnchorType_AS_CHARACTER
, anchorType
);
171 DECLARE_OOXMLEXPORT_TEST(testN705956_2
, "n705956-2.docx")
174 <v:shapetype> must be global, reachable even from <v:shape> inside another <w:pict>
175 image = ThisComponent.DrawPage.getByIndex(0)
178 uno::Reference
<drawing::XShape
> image
= getShape(1);
179 uno::Reference
<beans::XPropertySet
> imageProperties(image
, uno::UNO_QUERY
);
181 imageProperties
->getPropertyValue( "FillColor" ) >>= fillColor
;
182 CPPUNIT_ASSERT_EQUAL( Color( 0xc0504d ), fillColor
);
185 DECLARE_OOXMLEXPORT_TEST(testN747461
, "n747461.docx")
188 The document contains 3 images (Red, Black, Green, in this order), with explicit
189 w:relativeHeight (300, 0, 225763766). Check that they are in the right ZOrder
190 after they are loaded.
192 uno::Reference
<drawing::XShape
> image1
= getShape(1), image2
= getShape(2), image3
= getShape(3);
193 sal_Int32 zOrder1
, zOrder2
, zOrder3
;
194 OUString descr1
, descr2
, descr3
;
195 uno::Reference
<beans::XPropertySet
> imageProperties1(image1
, uno::UNO_QUERY
);
196 imageProperties1
->getPropertyValue( "ZOrder" ) >>= zOrder1
;
197 imageProperties1
->getPropertyValue( "Description" ) >>= descr1
;
198 uno::Reference
<beans::XPropertySet
> imageProperties2(image2
, uno::UNO_QUERY
);
199 imageProperties2
->getPropertyValue( "ZOrder" ) >>= zOrder2
;
200 imageProperties2
->getPropertyValue( "Description" ) >>= descr2
;
201 uno::Reference
<beans::XPropertySet
> imageProperties3(image3
, uno::UNO_QUERY
);
202 imageProperties3
->getPropertyValue( "ZOrder" ) >>= zOrder3
;
203 imageProperties3
->getPropertyValue( "Description" ) >>= descr3
;
204 CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), zOrder1
);
205 CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), zOrder2
);
206 CPPUNIT_ASSERT_EQUAL( sal_Int32( 2 ), zOrder3
);
207 CPPUNIT_ASSERT_EQUAL( OUString( "Black" ), descr1
);
208 CPPUNIT_ASSERT_EQUAL( OUString( "Red" ), descr2
);
209 CPPUNIT_ASSERT_EQUAL( OUString( "Green" ), descr3
);
212 DECLARE_OOXMLEXPORT_TEST(testN750255
, "n750255.docx")
216 Column break without columns on the page is a page break, so check those paragraphs
217 are on page 2 and page 3
219 CPPUNIT_ASSERT_EQUAL( OUString("one"), parseDump("/root/page[2]/body/txt/text()") );
220 CPPUNIT_ASSERT_EQUAL( OUString("two"), parseDump("/root/page[3]/body/txt/text()") );
223 DECLARE_OOXMLEXPORT_TEST(testN652364
, "n652364.docx")
226 Related to 750255 above, column break with columns on the page however should be a column break.
227 enum = ThisComponent.Text.createEnumeration
229 para1 = enum.nextElement
231 xray para1.PageStyleName
233 para2 = enum.nextElement
235 xray para2.PageStyleName
237 // get the 2nd and 4th paragraph
238 uno::Reference
<uno::XInterface
> paragraph1(getParagraph( 2, "text1" ));
239 uno::Reference
<uno::XInterface
> paragraph2(getParagraph( 4, "text2" ));
240 OUString pageStyle1
= getProperty
< OUString
>( paragraph1
, "PageStyleName" );
241 OUString pageStyle2
= getProperty
< OUString
>( paragraph2
, "PageStyleName" );
242 // "Standard" is the style for the first page (2nd is "Converted1").
243 CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle1
);
244 CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle2
);
247 DECLARE_OOXMLEXPORT_TEST(testN764005
, "n764005.docx")
249 uno::Reference
<beans::XPropertySet
> xPropertySet(getShape(1), uno::UNO_QUERY
);
251 // The picture in the header wasn't absolutely positioned and wasn't in the background.
252 text::TextContentAnchorType eValue
;
253 xPropertySet
->getPropertyValue("AnchorType") >>= eValue
;
254 CPPUNIT_ASSERT(eValue
!= text::TextContentAnchorType_AS_CHARACTER
);
256 xPropertySet
->getPropertyValue("Opaque") >>= bValue
;
257 CPPUNIT_ASSERT_EQUAL(false, bValue
);
260 DECLARE_OOXMLEXPORT_TEST(testN766481
, "n766481.docx")
263 * The problem was that we had an additional paragraph before the pagebreak.
265 * oParas = ThisComponent.Text.createEnumeration
266 * oPara = oParas.nextElement
267 * oPara = oParas.nextElement
268 * xray oParas.hasMoreElements ' should be false
270 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
271 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextDocument
->getText(), uno::UNO_QUERY
);
272 uno::Reference
<container::XEnumeration
> xParaEnum(xParaEnumAccess
->createEnumeration());
273 for (int i
= 0; i
< 2; ++i
)
274 xParaEnum
->nextElement();
275 CPPUNIT_ASSERT_EQUAL(sal_False
, xParaEnum
->hasMoreElements());
278 DECLARE_OOXMLEXPORT_TEST(testN766487
, "n766487.docx")
281 * The problem was that 1) the font size of the first para was too large 2) numbering had no first-line-indent.
283 * oParas = ThisComponent.Text.createEnumeration
284 * oPara = oParas.nextElement
285 * oRuns = oPara.createEnumeration
286 * oRun = oRuns.nextElement
287 * xray oRun.CharHeight ' 11, was larger
288 * oPara = oParas.nextElement
289 * xray oPara.ParaFirstLineIndent ' -635, was 0
291 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
292 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextDocument
->getText(), uno::UNO_QUERY
);
293 uno::Reference
<container::XEnumeration
> xParaEnum(xParaEnumAccess
->createEnumeration());
295 uno::Reference
<container::XEnumerationAccess
> xRunEnumAccess(xParaEnum
->nextElement(), uno::UNO_QUERY
);
296 uno::Reference
<container::XEnumeration
> xRunEnum(xRunEnumAccess
->createEnumeration());
297 uno::Reference
<beans::XPropertySet
> xPropertySet(xRunEnum
->nextElement(), uno::UNO_QUERY
);
299 xPropertySet
->getPropertyValue("CharHeight") >>= fValue
;
300 CPPUNIT_ASSERT_EQUAL(11.f
, fValue
);
302 xPropertySet
.set(xParaEnum
->nextElement(), uno::UNO_QUERY
);
303 sal_Int32 nValue
= 0;
304 xPropertySet
->getPropertyValue("ParaFirstLineIndent") >>= nValue
;
305 CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-360)), nValue
);
308 DECLARE_OOXMLEXPORT_TEST(testN693238
, "n693238.docx")
311 * The problem was that a continuous section break at the end of the doc caused the margins to be ignored.
313 * xray ThisComponent.StyleFamilies.PageStyles.Default.LeftMargin ' was 2000, should be 635
315 uno::Reference
<beans::XPropertySet
> xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY
);
316 sal_Int32 nValue
= 0;
317 xPropertySet
->getPropertyValue("LeftMargin") >>= nValue
;
318 CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nValue
);
321 DECLARE_OOXMLEXPORT_TEST(testNumbering1
, "numbering1.docx")
323 /* <w:numPr> in the paragraph itself was overridden by <w:numpr> introduced by the paragraph's <w:pStyle>
324 enum = ThisComponent.Text.createEnumeration
325 para = enum.NextElement
326 xray para.NumberingStyleName
327 numberingstyle = ThisComponent.NumberingRules.getByIndex(6)
328 xray numberingstyle.name - should match name above
329 numbering = numberingstyle.getByIndex(0)
330 xray numbering(11) - should be 4, arabic
331 note that the indexes may get off as the implementation evolves, C++ code searches in loops
333 uno::Reference
< text::XTextRange
> paragraph(getParagraph( 1, "Text1." ));
334 OUString numberingStyleName
= getProperty
< OUString
>( paragraph
, "NumberingStyleName" );
335 uno::Reference
<text::XNumberingRulesSupplier
> xNumberingRulesSupplier(mxComponent
, uno::UNO_QUERY
);
336 uno::Reference
<container::XIndexAccess
> numberingRules
= xNumberingRulesSupplier
->getNumberingRules();
337 uno::Reference
<container::XIndexAccess
> numberingRule
;
339 i
< numberingRules
->getCount();
342 OUString name
= getProperty
< OUString
>( numberingRules
->getByIndex( i
), "Name" );
343 if( name
== numberingStyleName
)
345 numberingRule
.set( numberingRules
->getByIndex( i
), uno::UNO_QUERY
);
349 CPPUNIT_ASSERT( numberingRule
.is());
350 uno::Sequence
< beans::PropertyValue
> numbering
;
351 numberingRule
->getByIndex( 0 ) >>= numbering
;
352 sal_Int16 numberingType
= style::NumberingType::NUMBER_NONE
;
354 i
< numbering
.getLength();
357 if( numbering
[ i
].Name
== "NumberingType" )
359 numbering
[ i
].Value
>>= numberingType
;
363 CPPUNIT_ASSERT_EQUAL( style::NumberingType::ARABIC
, numberingType
);
366 DECLARE_OOXMLEXPORT_TEST(testAllGapsWord
, "all_gaps_word.docx")
368 BorderTest borderTest
;
369 BorderTest::testTheBorders(mxComponent
, false);
372 DECLARE_OOXMLEXPORT_TEST(testN775906
, "n775906.docx")
375 * The problem was that right margin (via direct formatting) erased the left/first margin (inherited from numbering style).
377 * oParas = ThisComponent.Text.createEnumeration
378 * oPara = oParas.nextElement
379 * xray oPara.ParaFirstLineIndent ' was 0
380 * xray oPara.ParaLeftMargin ' was 0
382 CPPUNIT_ASSERT_EQUAL(sal_Int32(-635), getProperty
<sal_Int32
>(getParagraph(1), "ParaFirstLineIndent"));
383 CPPUNIT_ASSERT_EQUAL(sal_Int32(1905), getProperty
<sal_Int32
>(getParagraph(1), "ParaLeftMargin"));
386 DECLARE_OOXMLEXPORT_TEST(testTdf59699
, "tdf59699.docx")
388 uno::Reference
<beans::XPropertySet
> xImage(getShape(1), uno::UNO_QUERY
);
389 auto xGraphic
= getProperty
<uno::Reference
<graphic::XGraphic
> >(xImage
, "Graphic");
390 // This was false: the referenced graphic data wasn't imported.
391 CPPUNIT_ASSERT(xGraphic
.is());
394 DECLARE_OOXMLEXPORT_TEST(testN777337
, "n777337.docx")
396 // The problem was that the top and bottom margin on the first page was only 0.1cm instead of 1.7cm.
397 uno::Reference
<beans::XPropertySet
> xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY
);
398 CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty
<sal_Int32
>(xPropertySet
, "TopMargin"));
399 CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty
<sal_Int32
>(xPropertySet
, "BottomMargin"));
402 DECLARE_OOXMLEXPORT_TEST(testN778836
, "n778836.docx")
405 * The problem was that the paragraph inherited margins from the numbering
406 * and parent paragraph styles and the result was incorrect.
408 CPPUNIT_ASSERT_EQUAL(sal_Int32(1270), getProperty
<sal_Int32
>(getParagraph(1), "ParaRightMargin"));
409 CPPUNIT_ASSERT_EQUAL(sal_Int32(3810), getProperty
<sal_Int32
>(getParagraph(1), "ParaLeftMargin"));
410 CPPUNIT_ASSERT_EQUAL(sal_Int32(-635), getProperty
<sal_Int32
>(getParagraph(1), "ParaFirstLineIndent"));
413 DECLARE_OOXMLEXPORT_TEST(testN778828
, "n778828.docx")
416 * The problem was that a page break after a continuous section break caused
417 * double page break on title page.
419 CPPUNIT_ASSERT_EQUAL(2, getPages());
422 DECLARE_OOXMLEXPORT_TEST(testTdf106724
, "tdf106724.docx")
424 // This document simply crashed the importer.
427 DECLARE_OOXMLEXPORT_TEST(testN779834
, "n779834.docx")
429 // This document simply crashed the importer.
432 DECLARE_OOXMLEXPORT_TEST(testRHBZ1180114
, "rhbz1180114.docx")
434 // This document simply crashed the importer.
437 DECLARE_OOXMLEXPORT_TEST(testTdf66496
, "tdf66496.docx")
439 // This document simply crashed the importer.
442 DECLARE_OOXMLEXPORT_TEST(testTDF91122
, "tdf91122.docx")
445 * OLE object shape: default vertical position is top in MSO, not bottom
447 { // Check first shape
448 uno::Reference
<beans::XPropertySet
> xShapeProperties( getShape(1), uno::UNO_QUERY
);
449 uno::Reference
<drawing::XShapeDescriptor
> xShapeDescriptor(xShapeProperties
, uno::UNO_QUERY
);
450 CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), xShapeDescriptor
->getShapeType());
452 xShapeProperties
->getPropertyValue("VertOrient") >>= nValue
;
453 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation", text::VertOrientation::TOP
, nValue
);
456 { // Check second shape
457 uno::Reference
<beans::XPropertySet
> xShapeProperties( getShape(2), uno::UNO_QUERY
);
458 uno::Reference
<drawing::XShapeDescriptor
> xShapeDescriptor(xShapeProperties
, uno::UNO_QUERY
);
459 CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), xShapeDescriptor
->getShapeType());
461 xShapeProperties
->getPropertyValue("VertOrient") >>= nValue
;
462 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation", text::VertOrientation::TOP
, nValue
);
466 CPPUNIT_TEST_FIXTURE(Test
, testFdo76803
)
468 loadAndReload("fdo76803.docx");
469 // The ContourPolyPolygon was wrong
470 uno::Reference
<beans::XPropertySet
> xPropertySet(getShape(1), uno::UNO_QUERY
);
472 drawing::PointSequenceSequence rContour
= getProperty
<drawing::PointSequenceSequence
>(xPropertySet
, "ContourPolyPolygon");
473 basegfx::B2DPolyPolygon
aPolyPolygon(basegfx::utils::UnoPointSequenceSequenceToB2DPolyPolygon(rContour
));
475 // We've got exactly one polygon inside
476 CPPUNIT_ASSERT_EQUAL(sal_uInt32(1), aPolyPolygon
.count());
478 // Now check it deeply
479 basegfx::B2DPolygon
aPolygon(aPolyPolygon
.getB2DPolygon(0));
481 CPPUNIT_ASSERT_EQUAL(sal_uInt32(4), aPolygon
.count());
483 CPPUNIT_ASSERT_EQUAL(double(-149), aPolygon
.getB2DPoint(0).getX());
484 // Without the accompanying fix in place, this test would have failed with:
487 // i.e. the cropping did not influence the wrap polygon during export.
488 CPPUNIT_ASSERT_EQUAL(double(-35), aPolygon
.getB2DPoint(0).getY());
490 CPPUNIT_ASSERT_EQUAL(double(-149), aPolygon
.getB2DPoint(1).getX());
491 CPPUNIT_ASSERT_EQUAL(double(3511), aPolygon
.getB2DPoint(1).getY());
493 CPPUNIT_ASSERT_EQUAL(double(16889), aPolygon
.getB2DPoint(2).getX());
494 CPPUNIT_ASSERT_EQUAL(double(3511), aPolygon
.getB2DPoint(2).getY());
496 CPPUNIT_ASSERT_EQUAL(double(16889), aPolygon
.getB2DPoint(3).getX());
497 CPPUNIT_ASSERT_EQUAL(double(-35), aPolygon
.getB2DPoint(3).getY());
500 DECLARE_OOXMLEXPORT_TEST(testTDF91260
, "tdf91260.docx")
502 uno::Reference
<text::XTextRange
> xFrame(getShape(1), uno::UNO_QUERY
);
503 CPPUNIT_ASSERT(xFrame
->getString().startsWith( "Lorem ipsum" ) );
505 //Check the textbox doesn't get shrunk
506 CPPUNIT_ASSERT_GREATER(sal_Int32(10900), getProperty
<sal_Int32
>(xFrame
, "Height"));
508 uno::Reference
<drawing::XShape
> xShape(getShape(1), uno::UNO_QUERY
);
509 CPPUNIT_ASSERT_EQUAL(sal_Int32(5450), xShape
->getPosition().X
);
510 CPPUNIT_ASSERT_EQUAL(sal_Int32(21946), xShape
->getPosition().Y
);
513 DECLARE_OOXMLEXPORT_TEST(testFdo74357
, "fdo74357.docx")
515 // Normal outer table, floating inner table.
516 uno::Reference
<text::XTextTablesSupplier
> xTextTablesSupplier(mxComponent
, uno::UNO_QUERY
);
517 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
518 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess
->getCount());
520 // Bottom margin of the first paragraph was too large, causing a layout problem.
522 CPPUNIT_ASSERT_EQUAL(sal_Int32(86), getProperty
<sal_Int32
>(getParagraph(1), "ParaBottomMargin"));
525 DECLARE_OOXMLEXPORT_TEST(testFdo55187
, "fdo55187.docx")
527 // 0x010d was imported as a newline.
528 getParagraph(1, OUString(u
"lup\u010Dka"));
531 DECLARE_OOXMLEXPORT_TEST(testN780563
, "n780563.docx")
534 * Make sure we have the table in the fly frame created
536 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
537 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
538 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables
->getCount( ));
541 DECLARE_OOXMLEXPORT_TEST(testN780853
, "n780853.docx")
544 * The problem was that the table was not imported.
546 * xray ThisComponent.TextTables.Count 'was 0
548 uno::Reference
<text::XTextTablesSupplier
> xTextTablesSupplier(mxComponent
, uno::UNO_QUERY
);
549 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
550 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess
->getCount());
552 //tdf#102619 - I would have expected this to be "Standard", but MSO 2013/2010/2003 all give FollowStyle==Date
553 uno::Reference
< beans::XPropertySet
> properties(getStyles("ParagraphStyles")->getByName("Date"), uno::UNO_QUERY
);
554 CPPUNIT_ASSERT_EQUAL(OUString("Date"), getProperty
<OUString
>(properties
, "FollowStyle"));
557 DECLARE_OOXMLEXPORT_TEST(testN780843
, "n780843.docx")
559 CPPUNIT_ASSERT_EQUAL(OUString("shown footer"), parseDump("/root/page[2]/footer/txt/text()"));
561 //tdf64372 this document should only have one page break (2 pages, not 3)
562 CPPUNIT_ASSERT_EQUAL(2, getPages());
565 DECLARE_OOXMLEXPORT_TEST(testN780843b
, "n780843b.docx")
567 // Same document as testN780843 except there is more text before the continuous break. Now the opposite footer results should happen.
568 uno::Reference
< text::XTextRange
> xPara
= getParagraph(3);
569 OUString aStyleName
= getProperty
<OUString
>(xPara
, "PageStyleName");
570 uno::Reference
<beans::XPropertySet
> xPageStyle(getStyles("PageStyles")->getByName(aStyleName
), uno::UNO_QUERY
);
571 uno::Reference
<text::XTextRange
> xFooterText
= getProperty
< uno::Reference
<text::XTextRange
> >(xPageStyle
, "FooterText");
572 CPPUNIT_ASSERT_EQUAL( OUString("hidden footer"), xFooterText
->getString() );
574 CPPUNIT_ASSERT_EQUAL( 7, getParagraphs() );
577 DECLARE_OOXMLEXPORT_TEST(testShadow
, "imgshadow.docx")
580 * The problem was that drop shadows on inline images were not being
581 * imported and applied.
583 uno::Reference
<beans::XPropertySet
> xPropertySet(getShape(2), uno::UNO_QUERY
);
585 bool bShadow
= getProperty
<bool>(xPropertySet
, "Shadow");
586 CPPUNIT_ASSERT(bShadow
);
588 sal_Int32 nShadowXDistance
= getProperty
<sal_Int32
>(xPropertySet
, "ShadowXDistance");
589 CPPUNIT_ASSERT(nShadowXDistance
!= 0);
592 DECLARE_OOXMLEXPORT_TEST(testN782345
, "n782345.docx")
595 * The problem was that the page break was inserted before the 3rd para, instead of before the 2nd para.
597 CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE
, getProperty
<style::BreakType
>(getParagraph(2), "BreakType"));
600 DECLARE_OOXMLEXPORT_TEST(testN779941
, "n779941.docx")
603 * Make sure top/bottom margins of tables are set to 0 (problem was: bottom margin set to 0.35cm)
605 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
606 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
607 uno::Reference
<beans::XPropertySet
> xTableProperties(xTables
->getByIndex(0), uno::UNO_QUERY
);
609 uno::Any aValue
= xTableProperties
->getPropertyValue("TopMargin");
610 sal_Int32 nTopMargin
;
611 aValue
>>= nTopMargin
;
612 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nTopMargin
);
615 uno::Any aValue
= xTableProperties
->getPropertyValue("BottomMargin");
616 sal_Int32 nBottomMargin
;
617 aValue
>>= nBottomMargin
;
618 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nBottomMargin
);
622 DECLARE_OOXMLEXPORT_TEST(testN783638
, "n783638.docx")
624 // The problem was that the margins of inline images were not zero.
625 uno::Reference
<beans::XPropertySet
> xPropertySet(getShape(1), uno::UNO_QUERY
);
626 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xPropertySet
, "LeftMargin"));
629 DECLARE_OOXMLEXPORT_TEST(testFdo52208
, "fdo52208.docx")
631 // The problem was that the document had 2 pages instead of 1.
632 CPPUNIT_ASSERT_EQUAL(1, getPages());
635 DECLARE_OOXMLEXPORT_TEST(testN785767
, "n785767.docx")
637 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
638 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
639 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
640 uno::Reference
<table::XTableRows
> xTableRows
= xTextTable
->getRows();
641 // Check the A1 and B1 cells, the width of both of them was the default value (10000 / 9, as there were 9 cells in the row).
642 CPPUNIT_ASSERT_MESSAGE("A1 must not have default width", sal_Int16(10000 / 9) != getProperty
< uno::Sequence
<text::TableColumnSeparator
> >(xTableRows
->getByIndex(0), "TableColumnSeparators")[0].Position
);
643 CPPUNIT_ASSERT_MESSAGE("B1 must not have default width", sal_Int16(10000 / 9) != getProperty
< uno::Sequence
<text::TableColumnSeparator
> >(xTableRows
->getByIndex(1), "TableColumnSeparators")[0].Position
);
646 DECLARE_OOXMLEXPORT_TEST(testFineTableDash
, "tableborder-finedash.docx")
648 // The problem was that finely dashed borders on tables were unsupported
649 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
650 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
651 uno::Reference
<beans::XPropertySet
> xTableProperties(xTables
->getByIndex(0), uno::UNO_QUERY
);
652 table::TableBorder2 aBorder
;
653 xTableProperties
->getPropertyValue("TableBorder2") >>= aBorder
;
654 CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::FINE_DASHED
, aBorder
.RightLine
.LineStyle
);
657 DECLARE_OOXMLEXPORT_TEST(testN792778
, "n792778.docx")
660 * The problem was that the importer didn't handle complex groupshapes with groupshapes, textboxes and graphics inside.
662 * xray ThisComponent.DrawPage.Count ' 1 groupshape
663 * xray ThisComponent.DrawPage(0).Count ' 2 sub-groupshapes
664 * xray ThisComponent.DrawPage(0).getByIndex(0).Count ' first sub-groupshape: 1 pic
665 * xray ThisComponent.DrawPage(0).getByIndex(1).Count ' second sub-groupshape: 1 pic
666 * xray ThisComponent.DrawPage(0).getByIndex(0).getByIndex(0).Position.Y ' 11684, the vertical position of the shapes were also wrong
667 * xray ThisComponent.DrawPage(0).getByIndex(1).getByIndex(0).Position.Y ' 11684
669 CPPUNIT_ASSERT_EQUAL(1, getShapes());
671 uno::Reference
<drawing::XShapes
> xGroupShape(getShape(1), uno::UNO_QUERY
);
672 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupShape
->getCount());
674 uno::Reference
<drawing::XShapes
> xInnerGroupShape(xGroupShape
->getByIndex(0), uno::UNO_QUERY
);
675 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xInnerGroupShape
->getCount());
677 uno::Reference
<drawing::XShape
> xInnerShape(xInnerGroupShape
->getByIndex(0), uno::UNO_QUERY
);
678 CPPUNIT_ASSERT_EQUAL(sal_Int32(11684), xInnerShape
->getPosition().Y
);
680 xInnerGroupShape
.set(xGroupShape
->getByIndex(1), uno::UNO_QUERY
);
681 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xInnerGroupShape
->getCount());
683 xInnerShape
.set(xInnerGroupShape
->getByIndex(0), uno::UNO_QUERY
);
684 CPPUNIT_ASSERT_EQUAL(sal_Int32(11684), xInnerShape
->getPosition().Y
);
687 DECLARE_OOXMLEXPORT_TEST(testGroupshapeSmarttag
, "groupshape-smarttag.docx")
689 uno::Reference
<drawing::XShapes
> xGroupShape(getShape(1), uno::UNO_QUERY
);
690 uno::Reference
<text::XTextRange
> xShape(xGroupShape
->getByIndex(0), uno::UNO_QUERY
);
691 // First run of shape text was missing due to the w:smartTag wrapper around it.
692 CPPUNIT_ASSERT_EQUAL(OUString("Box 2"), xShape
->getString());
694 // Font size of the shape text was 10.
695 CPPUNIT_ASSERT_EQUAL(12.f
, getProperty
<float>(getParagraphOfText(1, xShape
->getText()), "CharHeight"));
698 DECLARE_OOXMLEXPORT_TEST(testN793262
, "n793262.docx")
700 uno::Reference
<container::XEnumerationAccess
> xHeaderText
= getProperty
< uno::Reference
<container::XEnumerationAccess
> >(getStyles("PageStyles")->getByName("Standard"), "HeaderText");
701 uno::Reference
<container::XEnumeration
> xHeaderParagraphs(xHeaderText
->createEnumeration());
702 xHeaderParagraphs
->nextElement();
703 // Font size of the last empty paragraph in the header was ignored, this was 11.
704 CPPUNIT_ASSERT_EQUAL(16.f
, getProperty
<float>(xHeaderParagraphs
->nextElement(), "CharHeight"));
706 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
707 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
708 uno::Reference
<text::XTextTable
> xTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
709 // Cell margins as direct formatting were ignored, this was 0.
710 CPPUNIT_ASSERT_EQUAL(sal_Int32(76), getProperty
<sal_Int32
>(xTable
->getCellByName("A1"), "TopBorderDistance"));
713 DECLARE_OOXMLEXPORT_TEST(testN793998
, "n793998.docx")
715 sal_Int32 nTextPortion
= parseDump("/root/page/body/txt/SwParaPortion/SwLineLayout/child::*[1]", "width").toInt32(); // Width of the first (text) portion
716 sal_Int32 nTabPortion
= parseDump("/root/page/body/txt/SwParaPortion/SwLineLayout/child::*[2]", "width").toInt32(); // Width of the second (tab) portion
717 sal_Int32 nParagraph
= parseDump("/root/page/body/txt/infos/bounds", "width").toInt32(); // Width of the paragraph
718 sal_Int32
const nRightMargin
= 3000;
719 // The problem was that the tab portion didn't ignore the right margin, so text + tab width wasn't larger than body (paragraph - right margin) width.
720 CPPUNIT_ASSERT(nTextPortion
+ nTabPortion
> nParagraph
- nRightMargin
);
723 CPPUNIT_TEST_FIXTURE(Test
, testN779642
)
725 auto verify
= [this]() {
726 uno::Reference
<text::XTextTablesSupplier
> xTextTablesSupplier(mxComponent
, uno::UNO_QUERY
);
728 // First problem: check that we have 2 tables, nesting caused the
729 // creation of outer one to fail
730 uno::Reference
<container::XIndexAccess
> xTables(xTextTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
731 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong number of imported tables", sal_Int32(2), xTables
->getCount());
733 // Second problem: check that the outer table is in a frame, at the bottom of the page
734 uno::Reference
<text::XTextTable
> xTextTable(xTextTablesSupplier
->getTextTables()->getByName("Table2"), uno::UNO_QUERY
);
735 uno::Reference
<beans::XPropertySet
> xAnchor(xTextTable
->getAnchor(), uno::UNO_QUERY
);
736 uno::Any aFrame
= xAnchor
->getPropertyValue("TextFrame");
737 uno::Reference
<beans::XPropertySet
> xFrame
;
740 xFrame
->getPropertyValue("VertOrient") >>= nValue
;
741 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation", text::VertOrientation::BOTTOM
, nValue
);
742 xFrame
->getPropertyValue("VertOrientRelation") >>= nValue
;
743 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation relation", text::RelOrientation::PAGE_PRINT_AREA
, nValue
);
745 // tdf#106572 - perhaps not the best test to hijack since this file
746 // produces an error in Word, but it nicely matches danger points,
747 // and has a different first footer, so nice visual confirmation.
748 discardDumpedLayout();
749 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
750 // There is no footer text on the first page.
751 assertXPath(pXmlDoc
, "/root/page[1]/footer/txt", 0);
753 createSwDoc("n779642.docx");
755 saveAndReload("Office Open XML Text");
759 DECLARE_OOXMLEXPORT_TEST(testTbLrHeight
, "tblr-height.docx")
761 uno::Reference
<text::XTextTablesSupplier
> xTextTablesSupplier(mxComponent
, uno::UNO_QUERY
);
762 uno::Reference
<container::XIndexAccess
> xTables(xTextTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
763 uno::Reference
<text::XTextTable
> xTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
764 uno::Reference
<table::XCell
> xCell
= xTable
->getCellByName("B1");
765 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR
, getProperty
<sal_Int16
>(xCell
, "WritingMode"));
768 DECLARE_OOXMLEXPORT_TEST(testBnc865381
, "bnc865381.docx")
770 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
771 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
772 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
773 uno::Reference
<table::XCell
> xCell
= xTextTable
->getCellByName("A2");
774 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR
, getProperty
<sal_Int16
>(xCell
, "WritingMode"));
777 DECLARE_OOXMLEXPORT_TEST(testFdo53985
, "fdo53985.docx")
779 // Unhandled exception prevented import of the rest of the document.
781 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
782 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
783 CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTables
->getCount()); // Only 4 tables were imported.
785 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
786 CPPUNIT_ASSERT(pTextDoc
);
787 SwDoc
* pDoc
= pTextDoc
->GetDocShell()->GetDoc();
788 CPPUNIT_ASSERT_MESSAGE("Compatibility: Protect form", pDoc
->getIDocumentSettingAccess().get( DocumentSettingId::PROTECT_FORM
) );
790 uno::Reference
<text::XTextSectionsSupplier
> xTextSectionsSupplier(mxComponent
, uno::UNO_QUERY
);
791 uno::Reference
<container::XIndexAccess
> xSections(xTextSectionsSupplier
->getTextSections(), uno::UNO_QUERY
);
792 CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xSections
->getCount()); // The first paragraph wasn't counted as a section.
794 uno::Reference
<beans::XPropertySet
> xSect(xSections
->getByIndex(0), uno::UNO_QUERY
);
795 CPPUNIT_ASSERT_EQUAL_MESSAGE("TextSection is protected", true, getProperty
<bool>(xSect
, "IsProtected"));
796 xSect
.set(xSections
->getByIndex(3), uno::UNO_QUERY
);
797 CPPUNIT_ASSERT_EQUAL_MESSAGE("Section3 is protected", false, getProperty
<bool>(xSect
, "IsProtected"));
799 // This was increasing by 3 every round-trip - an extra paragraph after each table in sections
800 CPPUNIT_ASSERT_EQUAL(9, getParagraphs());
803 DECLARE_OOXMLEXPORT_TEST(testFdo59638
, "fdo59638.docx")
805 // The problem was that w:lvlOverride inside w:num was ignores by dmapper.
807 uno::Reference
<beans::XPropertySet
> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY
);
808 uno::Reference
<container::XIndexAccess
> xLevels(xPropertySet
->getPropertyValue("NumberingRules"), uno::UNO_QUERY
);
809 uno::Sequence
<beans::PropertyValue
> aProps
;
810 xLevels
->getByIndex(0) >>= aProps
; // 1st level
812 for (beans::PropertyValue
const & rProp
: std::as_const(aProps
))
814 if (rProp
.Name
== "BulletChar")
816 // Was '*', should be 'o'.
817 CPPUNIT_ASSERT_EQUAL(OUString(u
"\uF0B7"), rProp
.Value
.get
<OUString
>());
821 CPPUNIT_FAIL("no BulletChar property");
824 DECLARE_OOXMLEXPORT_TEST(testFdo61343
, "fdo61343.docx")
826 // The problem was that there were a groupshape in the doc, followed by an
827 // OLE object, and this lead to a crash.
828 CPPUNIT_ASSERT_EQUAL(1, getShapes());
831 DECLARE_OOXMLEXPORT_TEST(testToolsLineNumbering
, "tools-line-numbering.docx")
834 * Test the line numbering feature import (Tools->Line Numbering ...)
836 * xray ThisComponent.getLineNumberingProperties().IsOn == True
837 * xray ThisComponent.getLineNumberingProperties().CountEmptyLines == True
838 * xray ThisComponent.getLineNumberingProperties().NumberPosition == 0
839 * xray ThisComponent.getLineNumberingProperties().NumberingType == 4
840 * xray ThisComponent.getLineNumberingProperties().SeparatorInterval == 3
844 sal_Int32 nValue
= -1;
846 uno::Reference
< text::XTextDocument
> xtextDocument(mxComponent
, uno::UNO_QUERY
);
847 uno::Reference
< text::XLineNumberingProperties
> xLineProperties( xtextDocument
, uno::UNO_QUERY_THROW
);
848 uno::Reference
< beans::XPropertySet
> xPropertySet
= xLineProperties
->getLineNumberingProperties();
850 xPropertySet
->getPropertyValue("IsOn") >>= bValue
;
851 CPPUNIT_ASSERT_EQUAL(true, bValue
);
853 xPropertySet
->getPropertyValue("CountEmptyLines") >>= bValue
;
854 CPPUNIT_ASSERT_EQUAL(true, bValue
);
856 xPropertySet
->getPropertyValue("NumberPosition") >>= nValue
;
857 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nValue
);
859 xPropertySet
->getPropertyValue("NumberingType") >>= nValue
;
860 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), nValue
);
862 xPropertySet
->getPropertyValue("SeparatorInterval") >>= nValue
;
863 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nValue
);
866 DECLARE_OOXMLEXPORT_TEST(testfdo78904
, "fdo78904.docx")
868 uno::Reference
<text::XTextFramesSupplier
> xTextFramesSupplier(mxComponent
, uno::UNO_QUERY
);
869 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
870 if (xIndexAccess
->getCount())
872 uno::Reference
<beans::XPropertySet
> xFrame(xIndexAccess
->getByIndex(0), uno::UNO_QUERY
);
873 CPPUNIT_ASSERT_EQUAL(oox::drawingml::convertEmuToHmm(0), getProperty
<sal_Int32
>(xFrame
, "HoriOrientPosition"));
877 DECLARE_OOXMLEXPORT_TEST(testFdo60922
, "fdo60922.docx")
879 // This was 0, not 100, due to wrong import of w:position w:val="0"
880 CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty
<sal_Int32
>(getRun(getParagraph(1), 1), "CharEscapementHeight"));
883 DECLARE_OOXMLEXPORT_TEST(testFdo59273
, "fdo59273.docx")
885 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
886 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
887 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
888 // Was 115596 (i.e. 10 times wider than necessary), as w:tblW was missing and the importer didn't set it.
889 CPPUNIT_ASSERT_EQUAL(sal_Int32(12963), getProperty
<sal_Int32
>(xTextTable
, "Width"));
891 uno::Reference
<table::XTableRows
> xTableRows
= xTextTable
->getRows();
892 // Was 9997, so the 4th column had ~zero width
893 CPPUNIT_ASSERT_LESSEQUAL(2, (sal_Int16(7500)
894 - getProperty
<uno::Sequence
<text::TableColumnSeparator
>>(
895 xTableRows
->getByIndex(0), "TableColumnSeparators")[2]
899 DECLARE_OOXMLEXPORT_TEST(testConditionalstylesTablelook
, "conditionalstyles-tbllook.docx")
901 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
902 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
903 uno::Reference
<text::XTextTable
> xTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
904 // Background was -1.
905 CPPUNIT_ASSERT_EQUAL(Color(0x7F7F7F), getProperty
<Color
>(xTable
->getCellByName("A1"), "BackColor"));
908 DECLARE_OOXMLEXPORT_TEST(testFdo63685
, "fdo63685.docx")
910 // An inline image's wrapping should be always zero, even if the doc model has a non-zero value.
911 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(getShape(1), "TopMargin"));
914 DECLARE_OOXMLEXPORT_TEST(testN592908_Frame
, "n592908-frame.docx")
916 uno::Reference
<beans::XPropertySet
> xPropertySet(getShape(1), uno::UNO_QUERY
);
917 text::WrapTextMode eValue
;
918 xPropertySet
->getPropertyValue("Surround") >>= eValue
;
919 CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_PARALLEL
, eValue
);
922 DECLARE_OOXMLEXPORT_TEST(testN592908_Picture
, "n592908-picture.docx")
924 uno::Reference
<beans::XPropertySet
> xPropertySet(getShape(1), uno::UNO_QUERY
);
925 text::WrapTextMode eValue
;
926 xPropertySet
->getPropertyValue("Surround") >>= eValue
;
927 CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_PARALLEL
, eValue
);
930 DECLARE_OOXMLEXPORT_TEST(testN779630
, "n779630.docx")
932 // A combo box is imported
935 uno::Reference
<drawing::XControlShape
> xControlShape(getShape(1), uno::UNO_QUERY
);
936 uno::Reference
<beans::XPropertySet
> xPropertySet(xControlShape
->getControl(), uno::UNO_QUERY
);
937 uno::Reference
<lang::XServiceInfo
> xServiceInfo(xPropertySet
, uno::UNO_QUERY
);
938 CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo
->supportsService("com.sun.star.form.component.ComboBox")));
939 CPPUNIT_ASSERT_EQUAL(OUString("dropdown default text"), getProperty
<OUString
>(xPropertySet
, "DefaultText"));
940 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty
< uno::Sequence
<OUString
> >(xPropertySet
, "StringItemList").getLength());
941 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xPropertySet
, "Dropdown"));
945 // Inline SDT: dropdown is imported as content control.
946 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
947 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
948 uno::Reference
<text::XTextTable
> xTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
949 uno::Reference
<table::XCell
> xCell
= xTable
->getCellByName("B1");
950 uno::Reference
<container::XEnumerationAccess
> xParagraphsAccess(xCell
, uno::UNO_QUERY
);
951 uno::Reference
<container::XEnumeration
> xParagraphs
= xParagraphsAccess
->createEnumeration();
952 uno::Reference
<container::XEnumerationAccess
> xParagraph(xParagraphs
->nextElement(),
954 uno::Reference
<container::XEnumeration
> xPortions
= xParagraph
->createEnumeration();
956 xPortions
->nextElement();
958 xPortions
->nextElement();
960 uno::Reference
<beans::XPropertySet
> xTextPortion(xPortions
->nextElement(), uno::UNO_QUERY
);
961 OUString aPortionType
;
962 xTextPortion
->getPropertyValue("TextPortionType") >>= aPortionType
;
963 CPPUNIT_ASSERT_EQUAL(OUString("ContentControl"), aPortionType
);
964 uno::Reference
<text::XTextContent
> xContentControl
;
965 xTextPortion
->getPropertyValue("ContentControl") >>= xContentControl
;
966 uno::Reference
<beans::XPropertySet
> xContentControlProps(xContentControl
, uno::UNO_QUERY
);
967 uno::Sequence
<beans::PropertyValues
> aListItems
;
968 xContentControlProps
->getPropertyValue("ListItems") >>= aListItems
;
969 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(2), aListItems
.getLength());
970 uno::Reference
<container::XEnumerationAccess
> xContentEnumAccess(xContentControl
, uno::UNO_QUERY
);
971 uno::Reference
<container::XEnumeration
> xContentEnum
= xContentEnumAccess
->createEnumeration();
972 uno::Reference
<text::XTextRange
> xContent(xContentEnum
->nextElement(), uno::UNO_QUERY
);
973 CPPUNIT_ASSERT_EQUAL(OUString("dropdown default text"), xContent
->getString());
977 DECLARE_OOXMLEXPORT_TEST(testIndentation
, "indentation.docx")
979 uno::Reference
<uno::XInterface
> xParaLTRTitle(getParagraph( 1, "Title aligned"));
980 uno::Reference
<uno::XInterface
> xParaLTRNormal(getParagraph( 2, ""));
982 // this will test the text direction for paragraphs
983 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB
, getProperty
<sal_Int16
>( xParaLTRTitle
, "WritingMode" ));
984 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB
, getProperty
<sal_Int16
>( xParaLTRNormal
, "WritingMode" ));
987 DECLARE_OOXMLEXPORT_TEST(testPageBorderShadow
, "page-border-shadow.docx")
989 // The problem was that in w:pgBorders, child elements had a w:shadow attribute, but that was ignored.
990 table::ShadowFormat aShadow
= getProperty
<table::ShadowFormat
>(getStyles("PageStyles")->getByName("Standard"), "ShadowFormat");
991 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(ColorTransparency
, aShadow
.Color
));
992 CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT
, aShadow
.Location
);
993 // w:sz="48" is in eights of a point, 1 pt is 20 twips.
994 CPPUNIT_ASSERT_EQUAL(sal_Int16(convertTwipToMm100(48/8*20)), aShadow
.ShadowWidth
);
997 DECLARE_OOXMLEXPORT_TEST(testN816593
, "n816593.docx")
999 // Two consecutive <w:tbl> without any paragraph in between, but with different tblpPr. In this
1000 // case we need to have 2 different tables instead of 1
1001 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1002 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
1003 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables
->getCount());
1006 DECLARE_OOXMLEXPORT_TEST(testN820509
, "n820509.docx")
1008 // M.d.yyyy date format was unhandled.
1009 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
1010 CPPUNIT_ASSERT(pTextDoc
);
1013 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1014 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1015 uno::Reference
<text::XTextTable
> xTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1016 uno::Reference
<table::XCell
> xCell
= xTable
->getCellByName("A1");
1017 uno::Reference
<container::XEnumerationAccess
> xParagraphsAccess(xCell
, uno::UNO_QUERY
);
1018 uno::Reference
<container::XEnumeration
> xParagraphs
= xParagraphsAccess
->createEnumeration();
1019 uno::Reference
<container::XEnumerationAccess
> xParagraph(xParagraphs
->nextElement(),
1021 uno::Reference
<container::XEnumeration
> xPortions
= xParagraph
->createEnumeration();
1022 uno::Reference
<beans::XPropertySet
> xTextPortion(xPortions
->nextElement(), uno::UNO_QUERY
);
1023 OUString aPortionType
;
1024 xTextPortion
->getPropertyValue("TextPortionType") >>= aPortionType
;
1025 CPPUNIT_ASSERT_EQUAL(OUString("ContentControl"), aPortionType
);
1026 uno::Reference
<text::XTextContent
> xContentControl
;
1027 xTextPortion
->getPropertyValue("ContentControl") >>= xContentControl
;
1028 uno::Reference
<beans::XPropertySet
> xContentControlProps(xContentControl
, uno::UNO_QUERY
);
1030 xContentControlProps
->getPropertyValue("Date") >>= bDate
;
1031 CPPUNIT_ASSERT(bDate
);
1032 OUString aDateFormat
;
1033 xContentControlProps
->getPropertyValue("DateFormat") >>= aDateFormat
;
1034 CPPUNIT_ASSERT_EQUAL(OUString("M.d.yyyy"), aDateFormat
);
1038 SwDoc
* pDoc
= pTextDoc
->GetDocShell()->GetDoc();
1039 IDocumentMarkAccess
* pMarkAccess
= pDoc
->getIDocumentMarkAccess();
1040 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pMarkAccess
->getAllMarksCount());
1042 ::sw::mark::IFieldmark
* pFieldmark
= dynamic_cast<::sw::mark::IFieldmark
*>(*pMarkAccess
->getAllMarksBegin());
1044 CPPUNIT_ASSERT(pFieldmark
);
1045 CPPUNIT_ASSERT_EQUAL(OUString(ODF_FORMDATE
), pFieldmark
->GetFieldname());
1047 const sw::mark::IFieldmark::parameter_map_t
* const pParameters
= pFieldmark
->GetParameters();
1048 OUString sDateFormat
;
1049 auto pResult
= pParameters
->find(ODF_FORMDATE_DATEFORMAT
);
1050 if (pResult
!= pParameters
->end())
1052 pResult
->second
>>= sDateFormat
;
1054 CPPUNIT_ASSERT_EQUAL(OUString("M.d.yyyy"), sDateFormat
);
1058 DECLARE_OOXMLEXPORT_TEST(testTdf151548_activeContentDemo
, "tdf151548_activeContentDemo.docm")
1060 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
1061 SwDoc
* pDoc
= pTextDoc
->GetDocShell()->GetDoc();
1062 IDocumentMarkAccess
* pMarkAccess
= pDoc
->getIDocumentMarkAccess();
1063 for(auto aIter
= pMarkAccess
->getFieldmarksBegin(); aIter
!= pMarkAccess
->getFieldmarksEnd(); ++aIter
)
1065 const OUString sName
= (*aIter
)->GetName();
1066 CPPUNIT_ASSERT(sName
== "Check1" || sName
== "Text1" || sName
== "Dropdown1");
1070 DECLARE_OOXMLEXPORT_TEST(testN830205
, "n830205.docx")
1072 // Previously import just crashed (due to infinite recursion).
1073 getParagraph(1, "XXX");
1076 DECLARE_OOXMLEXPORT_TEST(tdf123705
, "tdf123705.docx")
1080 DECLARE_OOXMLEXPORT_TEST(testTableAutoColumnFixedSize
, "table-auto-column-fixed-size.docx")
1082 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1083 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1084 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1086 // Width was not recognized during import when table size was 'auto'
1087 CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(3996)), getProperty
<sal_Int32
>(xTextTable
, "Width"));
1090 DECLARE_OOXMLEXPORT_TEST(testTableAutoColumnFixedSize2
, "table-auto-column-fixed-size2.docx")
1092 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1093 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1094 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1095 // This was 17907, i.e. the sum of the width of the 3 cells (10152 twips each), which is too wide.
1096 CPPUNIT_ASSERT_EQUAL(sal_Int32(16891), getProperty
<sal_Int32
>(xTextTable
, "Width"));
1099 DECLARE_OOXMLEXPORT_TEST(testFdo46361
, "fdo46361.docx")
1101 uno::Reference
<container::XIndexAccess
> xGroupShape(getShape(1), uno::UNO_QUERY
);
1102 uno::Reference
<text::XTextRange
> xTextBox
;
1105 // uno::Reference<drawing::XShape> xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY);
1106 // CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xShape, "TextVerticalAdjust"));
1109 xTextBox
.set(xGroupShape
->getByIndex(0), uno::UNO_QUERY_THROW
);
1110 CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER
,
1111 static_cast<style::ParagraphAdjust
>(getProperty
<sal_Int16
>(
1112 getParagraphOfText(1, xTextBox
->getText()), "ParaAdjust")));
1114 CPPUNIT_ASSERT_EQUAL(
1116 getProperty
<Color
>(getRun(getParagraphOfText(1, xTextBox
->getText()), 1),
1118 // Count the paragraphs
1119 xTextBox
.set(xGroupShape
->getByIndex(1), uno::UNO_QUERY_THROW
);
1120 const auto& sText1
= xTextBox
->getString();
1122 xTextBox
.set(xGroupShape
->getByIndex(2), uno::UNO_QUERY_THROW
);
1123 const auto& sText2
= xTextBox
->getString();
1125 sal_Int32 nCount1
= 0;
1126 sal_Int32 nCount2
= 0;
1128 for (sal_Int32 i
= 0; i
< sText1
.getLength(); i
++)
1129 if (sText1
[i
] == '\n')
1131 for (sal_Int32 i
= 0; i
< sText2
.getLength(); i
++)
1132 if (sText2
[i
] == '\n')
1135 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nCount1
);
1136 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), nCount2
);
1139 CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER
,
1140 static_cast<style::ParagraphAdjust
>(getProperty
<sal_Int16
>(
1141 getParagraphOfText(2, xTextBox
->getText(), "text"), "ParaAdjust")));
1143 // This must not be left.
1144 CPPUNIT_ASSERT_MESSAGE("You FIXED me!", style::ParagraphAdjust_LEFT
!=
1145 static_cast<style::ParagraphAdjust
>(getProperty
<sal_Int16
>(
1146 getParagraphOfText(3, xTextBox
->getText(), ""), "ParaAdjust")));
1149 DECLARE_OOXMLEXPORT_TEST(testFdo65632
, "fdo65632.docx")
1151 // The problem was that the footnote text had fake redline: only the body
1152 // text has redline in fact.
1153 uno::Reference
<text::XFootnotesSupplier
> xFootnotesSupplier(mxComponent
, uno::UNO_QUERY
);
1154 uno::Reference
<container::XIndexAccess
> xFootnotes
= xFootnotesSupplier
->getFootnotes();
1155 uno::Reference
<text::XText
> xText(xFootnotes
->getByIndex(0), uno::UNO_QUERY
);
1156 //uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText);
1157 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(getRun(getParagraphOfText(1, xText
), 1), "TextPortionType"));
1160 DECLARE_OOXMLEXPORT_TEST(testFdo66474
, "fdo66474.docx")
1162 // The table width was too small, so the text in the second cell was unreadable: this was 1397.
1163 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1164 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
1165 CPPUNIT_ASSERT_EQUAL(sal_Int32(10492), getProperty
<sal_Int32
>(xTables
->getByIndex(0), "Width"));
1168 DECLARE_OOXMLEXPORT_TEST(testGroupshapeRotation
, "groupshape-rotation.docx")
1170 // Rotation on groupshapes wasn't handled at all by the VML importer.
1171 // Note: the shapes are still shifting on the page, so the rotation drifts after multiple round-trips.
1172 CPPUNIT_ASSERT_DOUBLES_EQUAL(31500.0, getProperty
<double>(getShape(1), "RotateAngle"), 100);
1175 DECLARE_OOXMLEXPORT_TEST(testBnc780044Spacing
, "bnc780044_spacing.docx")
1177 // The document has global w:spacing in styles.xml , and local w:spacing in w:pPr, which however
1178 // only applied to text runs, not to as-character pictures. So the picture made the line higher.
1179 CPPUNIT_ASSERT_EQUAL(1, getPages());
1182 DECLARE_OOXMLEXPORT_TEST(testTableAutoNested
, "table-auto-nested.docx")
1184 // This was 176, when compat option is not enabled, the auto paragraph bottom margin value was incorrect.
1185 CPPUNIT_ASSERT_EQUAL(sal_Int32(494), getProperty
<sal_Int32
>(getParagraph(1), "ParaBottomMargin"));
1187 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1188 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1189 // This was 115596, i.e. the width of the outer table was too large.
1190 CPPUNIT_ASSERT_EQUAL(sal_Int32(23051), getProperty
<sal_Int32
>(xTables
->getByIndex(1), "Width"));
1193 DECLARE_OOXMLEXPORT_TEST(testTableStyleParprop
, "table-style-parprop.docx")
1195 // The problem was that w:spacing's w:after=0 (a paragraph property) wasn't imported from table style.
1196 uno::Reference
<text::XTextTable
> xTable(getParagraphOrTable(1), uno::UNO_QUERY
);
1197 uno::Reference
<text::XTextRange
> xCell(xTable
->getCellByName("A1"), uno::UNO_QUERY
);
1198 // This was 353, the document default, i.e. paragraph property from table style had no effect.
1199 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(getParagraphOfText(1, xCell
->getText()), "ParaBottomMargin"));
1202 DECLARE_OOXMLEXPORT_TEST(testTablePagebreak
, "table-pagebreak.docx")
1204 // Page break inside table: should be ignored (was style::BreakType_PAGE_BEFORE before).
1205 CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE
, getProperty
<style::BreakType
>(getParagraphOrTable(2), "BreakType"));
1207 // This one is outside the table: should not be ignored.
1208 CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE
, getProperty
<style::BreakType
>(getParagraph(3), "BreakType"));
1211 DECLARE_OOXMLEXPORT_TEST(testFdo68607
, "fdo68607.docx")
1213 // Bugdoc was 8 pages in Word, 1 in Writer due to pointlessly wrapping the
1214 // table in a frame. Exact layout may depend on fonts available, etc. --
1215 // but at least make sure that our table spans over multiple pages now.
1216 CPPUNIT_ASSERT(getPages() > 1);
1219 DECLARE_OOXMLEXPORT_TEST(testVmlTextVerticalAdjust
, "vml-text-vertical-adjust.docx")
1221 uno::Reference
<drawing::XShapes
> xOuterGroupShape(getShape(1), uno::UNO_QUERY
);
1222 uno::Reference
<drawing::XShapes
> xInnerGroupShape(xOuterGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1223 uno::Reference
<drawing::XShape
> xShape(xInnerGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1225 CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP
, getProperty
<drawing::TextVerticalAdjust
>(xShape
, "TextVerticalAdjust"));
1228 DECLARE_OOXMLEXPORT_TEST(testFdo69636
, "fdo69636.docx")
1230 // The problem was that the mso-layout-flow-alt:bottom-to-top VML shape property wasn't handled for sw text frames.
1231 // Note: VML is no longer used on import. OOXML import uses WritingMode2::BT_LR now.
1232 uno::Reference
<beans::XPropertySet
> xPropertySet(getShape(1), uno::UNO_QUERY
);
1233 CPPUNIT_ASSERT_EQUAL(sal_Int16(text::WritingMode2::BT_LR
), getProperty
<sal_Int16
>(xPropertySet
, "WritingMode"));
1236 DECLARE_OOXMLEXPORT_TEST(testChartProp
, "chart-prop.docx")
1238 // The problem was that chart was not getting parsed in writer module.
1239 CPPUNIT_ASSERT_EQUAL(1, getShapes());
1241 uno::Reference
<beans::XPropertySet
> xPropertySet(getShape(1), uno::UNO_QUERY
);
1242 CPPUNIT_ASSERT_EQUAL(sal_Int32(15240), getProperty
<sal_Int32
>(xPropertySet
, "Width"));
1243 CPPUNIT_ASSERT_EQUAL(sal_Int32(8890), getProperty
<sal_Int32
>(xPropertySet
, "Height"));
1246 DECLARE_OOXMLEXPORT_TEST(testFdo43093
, "fdo43093b.docx")
1248 // The problem was that the direction and alignment are not correct for RTL paragraphs.
1249 uno::Reference
<uno::XInterface
> xParaRtlRight(getParagraph( 1, "Right and RTL in M$"));
1250 sal_Int32 nRtlRight
= getProperty
< sal_Int32
>( xParaRtlRight
, "ParaAdjust" );
1251 sal_Int16 nRRDir
= getProperty
< sal_Int32
>( xParaRtlRight
, "WritingMode" );
1253 uno::Reference
<uno::XInterface
> xParaRtlLeft(getParagraph( 2, "Left and RTL in M$"));
1254 sal_Int32 nRtlLeft
= getProperty
< sal_Int32
>( xParaRtlLeft
, "ParaAdjust" );
1255 sal_Int16 nRLDir
= getProperty
< sal_Int32
>( xParaRtlLeft
, "WritingMode" );
1257 uno::Reference
<uno::XInterface
> xParaLtrRight(getParagraph( 3, "Right and LTR in M$"));
1258 sal_Int32 nLtrRight
= getProperty
< sal_Int32
>( xParaLtrRight
, "ParaAdjust" );
1259 sal_Int16 nLRDir
= getProperty
< sal_Int32
>( xParaLtrRight
, "WritingMode" );
1261 uno::Reference
<uno::XInterface
> xParaLtrLeft(getParagraph( 4, "Left and LTR in M$"));
1262 sal_Int32 nLtrLeft
= getProperty
< sal_Int32
>( xParaLtrLeft
, "ParaAdjust" );
1263 sal_Int16 nLLDir
= getProperty
< sal_Int32
>( xParaLtrLeft
, "WritingMode" );
1265 // this will test the both the text direction and alignment for each paragraph
1266 CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_RIGHT
), nRtlRight
);
1267 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB
, nRRDir
);
1269 CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT
), nRtlLeft
);
1270 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB
, nRLDir
);
1272 CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_RIGHT
), nLtrRight
);
1273 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB
, nLRDir
);
1275 CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT
), nLtrLeft
);
1276 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB
, nLLDir
);
1279 CPPUNIT_PLUGIN_IMPLEMENT();
1281 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */