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 #include <swmodeltestbase.hxx>
14 #include <com/sun/star/awt/FontSlant.hpp>
15 #include <com/sun/star/awt/Gradient.hpp>
16 #include <com/sun/star/container/XIndexReplace.hpp>
17 #include <com/sun/star/drawing/FillStyle.hpp>
18 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
19 #include <com/sun/star/drawing/GraphicExportFilter.hpp>
20 #include <com/sun/star/drawing/XGraphicExportFilter.hpp>
21 #include <com/sun/star/drawing/BarCode.hpp>
22 #include <com/sun/star/drawing/BarCodeErrorCorrection.hpp>
23 #include <com/sun/star/table/ShadowFormat.hpp>
24 #include <com/sun/star/table/XCellRange.hpp>
25 #include <com/sun/star/text/RelOrientation.hpp>
26 #include <com/sun/star/text/XDocumentIndex.hpp>
27 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
28 #include <com/sun/star/graphic/XGraphic.hpp>
29 #include <officecfg/Office/Common.hxx>
30 #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
31 #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
32 #include <com/sun/star/text/XTextField.hpp>
33 #include <com/sun/star/text/WritingMode2.hpp>
34 #include <com/sun/star/util/XModifiable.hpp>
35 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
36 #include <com/sun/star/container/XIndexContainer.hpp>
37 #include <com/sun/star/document/XStorageBasedDocument.hpp>
38 #include <com/sun/star/text/XTextFramesSupplier.hpp>
39 #include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
40 #include <com/sun/star/text/XTextDocument.hpp>
41 #include <com/sun/star/util/XRefreshable.hpp>
42 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
43 #include <com/sun/star/text/XTextTable.hpp>
45 #include <comphelper/storagehelper.hxx>
46 #include <comphelper/fileformat.h>
47 #include <comphelper/propertysequence.hxx>
48 #include <comphelper/documentconstants.hxx>
49 #include <unotools/streamwrap.hxx>
50 #include <svl/PasswordHelper.hxx>
51 #include <comphelper/sequenceashashmap.hxx>
52 #include <vcl/filter/PDFiumLibrary.hxx>
53 #include <comphelper/scopeguard.hxx>
55 #include <docufld.hxx> // for SwHiddenTextField::ParseIfFieldDefinition() method call
56 #include <unoprnms.hxx>
57 #include <sortedobjs.hxx>
61 #include <unotxdoc.hxx>
63 #include <IDocumentLayoutAccess.hxx>
64 #include <rootfrm.hxx>
65 #include <o3tl/string_view.hxx>
67 class Test
: public SwModelTestBase
70 Test() : SwModelTestBase("/sw/qa/extras/odfexport/data/", "writer8") {}
72 bool mustValidate(const char* /*filename*/) const override
78 CPPUNIT_TEST_FIXTURE(Test
, testMathObjectFlatExport
)
80 comphelper::ScopeGuard
g([this]() {
82 std::shared_ptr
<comphelper::ConfigurationChanges
> pBatch(
83 comphelper::ConfigurationChanges::create());
84 officecfg::Office::Common::Cache::Writer::OLE_Objects::set(20, pBatch
);
85 return pBatch
->commit();
87 mpFilter
= "OpenDocument Text Flat XML"; // doesn't happen with ODF package
88 std::shared_ptr
<comphelper::ConfigurationChanges
> pBatch(
89 comphelper::ConfigurationChanges::create());
90 officecfg::Office::Common::Cache::Writer::OLE_Objects::set(1, pBatch
);
92 loadAndReload("2_MathType3.docx");
94 uno::Reference
<util::XModifiable
> xModifiable(mxComponent
, uno::UNO_QUERY
);
95 CPPUNIT_ASSERT(!xModifiable
->isModified());
96 // see preTest(), set the OLE cache to 1 for this test
97 // and the problem was that the formulas that were in the cache
98 // (the second one) were lost
99 OUString
formula1(getFormula(getRun(getParagraph(1), 1)));
100 CPPUNIT_ASSERT_EQUAL(OUString(" size 12{1+1=2} {}"), formula1
);
101 OUString
formula2(getFormula(getRun(getParagraph(2), 1)));
102 CPPUNIT_ASSERT_EQUAL(OUString(" size 12{2+2=4} {}"), formula2
);
105 DECLARE_ODFEXPORT_TEST(testTdf144319
, "tdf144319.odt")
107 CPPUNIT_ASSERT_EQUAL(7, getShapes());
108 CPPUNIT_ASSERT_EQUAL(1, getPages());
109 OUString
formula1(getFormula(getRun(getParagraph(3), 1)));
110 CPPUNIT_ASSERT_EQUAL(OUString("{ x = frac { { - b +- sqrt { b ^ 2 - 4 a c } } } { { 2 a } } }"), formula1
);
111 OUString
formula2(getFormula(getRun(getParagraph(4), 1)));
112 CPPUNIT_ASSERT_EQUAL(OUString("{ sum csup n csub { i = 1 } i ^ 3 = left ( frac { { n left ( { n + 1 } right ) } } { 2 } right ) ^ 2 }"), formula2
);
113 OUString
formula3(getFormula(getRun(getParagraph(5), 1)));
114 CPPUNIT_ASSERT_EQUAL(OUString("{ sum ^ n _ { i = 1 } i ^ 3 = left ( frac { { n left ( { n + 1 } right ) } } { 2 } right ) ^ 2 }"), formula3
);
115 OUString
formula4(getFormula(getRun(getParagraph(6), 1)));
116 CPPUNIT_ASSERT_EQUAL(OUString("{ sum ^ n _ { i = 1 } i ^ 3 = left ( frac { { n left ( { n + 1 } right ) } } { 2 } right ) ^ 2 }"), formula4
);
118 // Without the fix in place, this test would have failed with
119 // - the property is of unexpected type or void: Model
120 OUString
formula5(getFormula(getRun(getParagraph(7), 1)));
121 CPPUNIT_ASSERT_EQUAL(OUString("{ y ^ 2 { nitalic m p } = left ( { x ^ 3 + 7 } right ) { nitalic m p } }"), formula5
);
124 static void testTdf43569_CheckIfFieldParse()
127 OUString paramCondition
;
131 SwHiddenTextField::ParseIfFieldDefinition("IF A B C", paramCondition
, paramTrue
, paramFalse
);
133 CPPUNIT_ASSERT_EQUAL(OUString("A"), paramCondition
);
134 CPPUNIT_ASSERT_EQUAL(OUString("B"), paramTrue
);
135 CPPUNIT_ASSERT_EQUAL(OUString("C"), paramFalse
);
139 OUString paramCondition
;
143 SwHiddenTextField::ParseIfFieldDefinition(" IF AAA BBB CCC ", paramCondition
, paramTrue
, paramFalse
);
145 CPPUNIT_ASSERT_EQUAL(OUString("AAA"), paramCondition
);
146 CPPUNIT_ASSERT_EQUAL(OUString("BBB"), paramTrue
);
147 CPPUNIT_ASSERT_EQUAL(OUString("CCC"), paramFalse
);
151 OUString paramCondition
;
155 SwHiddenTextField::ParseIfFieldDefinition(" IF AAA \"BBB\" \"CCC\" ", paramCondition
, paramTrue
, paramFalse
);
157 CPPUNIT_ASSERT_EQUAL(OUString("AAA"), paramCondition
);
158 CPPUNIT_ASSERT_EQUAL(OUString("BBB"), paramTrue
);
159 CPPUNIT_ASSERT_EQUAL(OUString("CCC"), paramFalse
);
162 // true-case and false-case have spaces inside
164 OUString paramCondition
;
168 SwHiddenTextField::ParseIfFieldDefinition(" IF A A A \"B B B\" \"C C C\" ", paramCondition
, paramTrue
, paramFalse
);
170 CPPUNIT_ASSERT_EQUAL(OUString("A A A"), paramCondition
);
171 CPPUNIT_ASSERT_EQUAL(OUString("B B B"), paramTrue
);
172 CPPUNIT_ASSERT_EQUAL(OUString("C C C"), paramFalse
);
175 // true-case and false-case have leading/trailing space
177 OUString paramCondition
;
181 SwHiddenTextField::ParseIfFieldDefinition("IF A1 A2 A3 \"B1 B2 \" \" C1 C2\" ", paramCondition
, paramTrue
, paramFalse
);
183 CPPUNIT_ASSERT_EQUAL(OUString("A1 A2 A3"), paramCondition
);
184 CPPUNIT_ASSERT_EQUAL(OUString("B1 B2 "), paramTrue
);
185 CPPUNIT_ASSERT_EQUAL(OUString(" C1 C2"), paramFalse
);
188 // true-case and false-case are empty
190 OUString paramCondition
;
194 SwHiddenTextField::ParseIfFieldDefinition("IF condition \"\" \"\" ", paramCondition
, paramTrue
, paramFalse
);
196 CPPUNIT_ASSERT_EQUAL(OUString("condition"), paramCondition
);
197 CPPUNIT_ASSERT_EQUAL(OUString(""), paramTrue
);
198 CPPUNIT_ASSERT_EQUAL(OUString(""), paramFalse
);
202 // Input document contains only one IF-field,
203 // and it should be imported as com.sun.star.text.TextField.ConditionalText in any case,
204 // instead of insertion of the pair of two field-marks: <field:fieldmark-start> + <field:fieldmark-end>.
205 CPPUNIT_TEST_FIXTURE(Test
, testTdf43569
)
207 loadAndReload("tdf43569_conditionalfield.doc");
208 // check if our parser is valid
209 testTdf43569_CheckIfFieldParse();
211 // now check field creation during import
212 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(mxComponent
, uno::UNO_QUERY
);
213 uno::Reference
<container::XEnumerationAccess
> xFieldsAccess(xTextFieldsSupplier
->getTextFields());
214 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
216 // at least one field should be detected
217 CPPUNIT_ASSERT(xFields
->hasMoreElements());
220 CPPUNIT_TEST_FIXTURE(Test
, testTdf130314
)
222 loadAndReload("tdf130314.docx");
223 // Without the fix in place, this test would have hung
224 CPPUNIT_ASSERT_EQUAL(2, getPages());
227 CPPUNIT_TEST_FIXTURE(Test
, testTdf133487
)
229 loadAndReload("MadeByLO7.odt");
230 CPPUNIT_ASSERT_EQUAL(3, getShapes());
231 CPPUNIT_ASSERT_EQUAL(1, getPages());
232 xmlDocUniquePtr pXmlDoc
= parseExport("content.xml");
233 // shape in background has lowest index
234 assertXPath(pXmlDoc
, "/office:document-content/office:body/office:text/text:p[2]/draw:custom-shape", "z-index", "0");
235 assertXPath(pXmlDoc
, "/office:document-content/office:automatic-styles/style:style[@style:name = /office:document-content/office:body/office:text/text:p[2]/draw:custom-shape[@draw:z-index = '0']/attribute::draw:style-name]/style:graphic-properties", "run-through", "background");
236 // shape in foreground, previously index 1
237 assertXPath(pXmlDoc
, "/office:document-content/office:body/office:text/text:p[1]/draw:custom-shape", "z-index", "2");
238 assertXPath(pXmlDoc
, "/office:document-content/office:automatic-styles/style:style[@style:name = /office:document-content/office:body/office:text/text:p[1]/draw:custom-shape[@draw:z-index = '2']/attribute::draw:style-name]/style:graphic-properties", "run-through", "foreground");
239 // shape in foreground, previously index 0
240 assertXPath(pXmlDoc
, "/office:document-content/office:body/office:text/text:p[3]/draw:custom-shape", "z-index", "1");
241 assertXPath(pXmlDoc
, "/office:document-content/office:automatic-styles/style:style[@style:name = /office:document-content/office:body/office:text/text:p[3]/draw:custom-shape[@draw:z-index = '1']/attribute::draw:style-name]/style:graphic-properties", "run-through", "foreground");
244 CPPUNIT_TEST_FIXTURE(Test
, testTdf141467
)
246 loadAndReload("Formcontrol needs high z-index.odt");
247 CPPUNIT_ASSERT_EQUAL(2, getShapes());
248 CPPUNIT_ASSERT_EQUAL(1, getPages());
249 xmlDocUniquePtr pXmlDoc
= parseExport("content.xml");
250 // shape in foreground has lowest index
251 assertXPath(pXmlDoc
, "/office:document-content/office:body/office:text/text:p[2]/draw:custom-shape", "z-index", "0");
252 assertXPath(pXmlDoc
, "/office:document-content/office:automatic-styles/style:style[@style:name = /office:document-content/office:body/office:text/text:p[2]/draw:custom-shape[@draw:z-index = '0']/attribute::draw:style-name]/style:graphic-properties", "run-through", "foreground");
253 // form control, previously index 0
254 assertXPath(pXmlDoc
, "/office:document-content/office:body/office:text/text:p[2]/draw:control", "z-index", "1");
255 // no run-through on form's style
256 assertXPath(pXmlDoc
, "/office:document-content/office:automatic-styles/style:style[@style:name = /office:document-content/office:body/office:text/text:p[2]/draw:control[@draw:z-index = '1']/attribute::draw:style-name]/style:graphic-properties/attribute::run-through", 0);
259 DECLARE_ODFEXPORT_TEST(testTdf139126
, "tdf139126.odt")
261 CPPUNIT_ASSERT_EQUAL(1, getPages());
262 uno::Reference
<text::XTextTablesSupplier
> xSupplier(mxComponent
, uno::UNO_QUERY
);
263 uno::Reference
<container::XNameAccess
> xTables
= xSupplier
->getTextTables();
264 uno::Reference
<text::XTextTable
> xTable(xTables
->getByName("Table1"), uno::UNO_QUERY
);
266 uno::Reference
<text::XTextRange
> xD2(xTable
->getCellByName("D2"), uno::UNO_QUERY
);
267 CPPUNIT_ASSERT_EQUAL(OUString("4.0"), xD2
->getString());
269 // Without the fix in place, this test would have failed with
270 // - Expected: ** Expression is faulty **
271 // - Actual : 17976931348623200...
272 uno::Reference
<text::XTextRange
> xE2(xTable
->getCellByName("E2"), uno::UNO_QUERY
);
273 CPPUNIT_ASSERT_EQUAL(OUString("** Expression is faulty **"), xE2
->getString());
276 CPPUNIT_TEST_FIXTURE(Test
, testTdf125877
)
278 loadAndReload("tdf95806.docx");
279 CPPUNIT_ASSERT_EQUAL(1, getPages());
280 uno::Reference
<text::XTextTablesSupplier
> xSupplier(mxComponent
, uno::UNO_QUERY
);
281 uno::Reference
<container::XIndexAccess
> xTables(xSupplier
->getTextTables(), uno::UNO_QUERY
);
282 uno::Reference
<text::XTextTablesSupplier
> xTextTablesSupplier(mxComponent
, uno::UNO_QUERY
);
284 // This was 0 (lost table during ODT export in footnotes)
285 // Note: fix also tdf#95806: painting table layout is correct
286 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables
->getCount());
288 // floating table: there is a frame now
289 uno::Reference
<text::XTextFramesSupplier
> xTextFramesSupplier(mxComponent
, uno::UNO_QUERY
);
290 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
291 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess
->getCount());
294 DECLARE_ODFEXPORT_TEST(testTdf103567
, "tdf103567.odt")
296 CPPUNIT_ASSERT_EQUAL(1, getShapes());
297 CPPUNIT_ASSERT_EQUAL(1, getPages());
298 uno::Reference
<drawing::XShape
> const xShape(getShape(1));
300 // contour wrap polygon
301 css::drawing::PointSequenceSequence
const pointss(
302 getProperty
<css::drawing::PointSequenceSequence
>(xShape
, "ContourPolyPolygon"));
303 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pointss
.getLength());
304 // for some reason this property exists with 199 points if it wasn't
305 // imported, that would be a fail
306 CPPUNIT_ASSERT_EQUAL(sal_Int32(5), pointss
[0].getLength());
307 CPPUNIT_ASSERT_EQUAL(sal_Int32( 0), pointss
[0][0].X
);
308 CPPUNIT_ASSERT_EQUAL(sal_Int32(2672), pointss
[0][0].Y
);
309 CPPUNIT_ASSERT_EQUAL(sal_Int32( 0), pointss
[0][1].X
);
310 CPPUNIT_ASSERT_EQUAL(sal_Int32(1111), pointss
[0][1].Y
);
311 CPPUNIT_ASSERT_EQUAL(sal_Int32(2672), pointss
[0][2].X
);
312 CPPUNIT_ASSERT_EQUAL(sal_Int32(1111), pointss
[0][2].Y
);
313 CPPUNIT_ASSERT_EQUAL(sal_Int32(2672), pointss
[0][3].X
);
314 CPPUNIT_ASSERT_EQUAL(sal_Int32(2672), pointss
[0][3].Y
);
315 CPPUNIT_ASSERT_EQUAL(sal_Int32( 0), pointss
[0][4].X
);
316 CPPUNIT_ASSERT_EQUAL(sal_Int32(2672), pointss
[0][4].Y
);
318 // image map, one rectangle
319 uno::Reference
<container::XIndexContainer
> const xImageMap(
320 getProperty
<uno::Reference
<container::XIndexContainer
>>(xShape
, "ImageMap"));
322 uno::Reference
<beans::XPropertySet
> const xEntry(xImageMap
->getByIndex(0), uno::UNO_QUERY
);
323 CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/"), getProperty
<OUString
>(xEntry
, "URL"));
324 awt::Rectangle
const rect(getProperty
<awt::Rectangle
>(xEntry
, "Boundary"));
325 CPPUNIT_ASSERT_EQUAL(sal_Int32( 726), rect
.X
);
326 CPPUNIT_ASSERT_EQUAL(sal_Int32(1718), rect
.Y
);
327 CPPUNIT_ASSERT_EQUAL(sal_Int32(1347), rect
.Width
);
328 CPPUNIT_ASSERT_EQUAL(sal_Int32( 408), rect
.Height
);
331 CPPUNIT_TEST_FIXTURE(Test
, testUserFieldDecl
)
333 loadAndReload("user-field-decl.odt");
334 CPPUNIT_ASSERT_EQUAL(1, getPages());
335 xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml");
336 // Without the accompanying fix in place, this test would have failed with 'Expected: 2;
337 // Actual: 1', i.e. the in-table field had no declaration (in the header), while the
338 // outside-table one had the declaration.
339 assertXPath(pXmlDoc
, "//style:header/text:user-field-decls/text:user-field-decl", 2);
342 CPPUNIT_TEST_FIXTURE(Test
, testUserFieldDeclFly
)
344 loadAndReload("user-field-decl-fly.odt");
345 CPPUNIT_ASSERT_EQUAL(1, getShapes());
346 CPPUNIT_ASSERT_EQUAL(1, getPages());
347 xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml");
348 // Without the accompanying fix in place, this test would have failed with 'Expected: 2;
349 // Actual: 1', i.e. the in-textframe field had no declaration (in the header), while the
350 // outside-textframe one had the declaration.
351 assertXPath(pXmlDoc
, "//style:header/text:user-field-decls/text:user-field-decl", 2);
354 DECLARE_ODFEXPORT_TEST(testFramebackgrounds
, "framebackgrounds.odt")
356 CPPUNIT_ASSERT_EQUAL(16, getShapes());
357 CPPUNIT_ASSERT_EQUAL(1, getPages());
358 //Counting the Number of Frames and checking with the expected count
359 uno::Reference
<text::XTextFramesSupplier
> xTextFramesSupplier(mxComponent
, uno::UNO_QUERY
);
360 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
361 CPPUNIT_ASSERT_EQUAL(sal_Int32(16), xIndexAccess
->getCount());
362 uno::Reference
<drawing::XShape
> xTextFrame
;
363 awt::Gradient aGradientxTextFrame
;
365 xTextFrame
= getShape(1);
366 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
367 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillTransparence"));
369 xTextFrame
= getShape(2);
370 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
371 CPPUNIT_ASSERT_EQUAL(Color(0x006600), getProperty
<Color
>(xTextFrame
, "FillColor"));
372 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillTransparence"));
374 xTextFrame
= getShape(3);
375 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
376 CPPUNIT_ASSERT_EQUAL(Color(0x006600), getProperty
<Color
>(xTextFrame
, "FillColor"));
377 CPPUNIT_ASSERT_EQUAL(sal_Int32(45), getProperty
<sal_Int32
>(xTextFrame
, "FillTransparence"));
379 xTextFrame
= getShape(4);
380 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
381 CPPUNIT_ASSERT_EQUAL(Color(0x579D1C), getProperty
<Color
>(xTextFrame
, "FillColor"));
382 aGradientxTextFrame
= getProperty
<awt::Gradient
>(xTextFrame
, "FillTransparenceGradient");
383 CPPUNIT_ASSERT_EQUAL(css::awt::GradientStyle_LINEAR
, aGradientxTextFrame
.Style
);
385 xTextFrame
= getShape(5);
386 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
387 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillTransparence"));
388 CPPUNIT_ASSERT_EQUAL(OUString("Subtle Tango Green"), getProperty
<OUString
>(xTextFrame
, "FillGradientName"));
390 xTextFrame
= getShape(6);
391 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
392 CPPUNIT_ASSERT_EQUAL(OUString("Subtle Tango Green"), getProperty
<OUString
>(xTextFrame
, "FillGradientName"));
393 CPPUNIT_ASSERT_EQUAL(sal_Int32(45), getProperty
<sal_Int32
>(xTextFrame
, "FillTransparence"));
395 xTextFrame
= getShape(7);
396 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
397 CPPUNIT_ASSERT_EQUAL(OUString("Subtle Tango Green"), getProperty
<OUString
>(xTextFrame
, "FillGradientName"));
398 aGradientxTextFrame
= getProperty
<awt::Gradient
>(xTextFrame
, "FillTransparenceGradient");
399 CPPUNIT_ASSERT_EQUAL(css::awt::GradientStyle_LINEAR
, aGradientxTextFrame
.Style
);
401 xTextFrame
= getShape(8);
402 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
403 CPPUNIT_ASSERT_EQUAL(OUString("Black 0 Degrees"), getProperty
<OUString
>(xTextFrame
, "FillHatchName"));
404 CPPUNIT_ASSERT_EQUAL(false, getProperty
<bool>(xTextFrame
, "FillBackground"));
405 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillTransparence"));
407 xTextFrame
= getShape(9);
408 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
409 CPPUNIT_ASSERT_EQUAL(OUString("Black 0 Degrees"), getProperty
<OUString
>(xTextFrame
, "FillHatchName"));
410 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xTextFrame
, "FillBackground"));
411 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillTransparence"));
413 xTextFrame
= getShape(10);
414 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
415 CPPUNIT_ASSERT_EQUAL(OUString("Black 0 Degrees"), getProperty
<OUString
>(xTextFrame
, "FillHatchName"));
416 CPPUNIT_ASSERT_EQUAL(false, getProperty
<bool>(xTextFrame
, "FillBackground"));
417 CPPUNIT_ASSERT_EQUAL(sal_Int32(45), getProperty
<sal_Int32
>(xTextFrame
, "FillTransparence"));
419 xTextFrame
= getShape(11);
420 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
421 CPPUNIT_ASSERT_EQUAL(OUString("Black 0 Degrees"), getProperty
<OUString
>(xTextFrame
, "FillHatchName"));
422 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xTextFrame
, "FillBackground"));
423 CPPUNIT_ASSERT_EQUAL(sal_Int32(45), getProperty
<sal_Int32
>(xTextFrame
, "FillTransparence"));
425 xTextFrame
= getShape(12);
426 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
427 CPPUNIT_ASSERT_EQUAL(OUString("Black 0 Degrees"), getProperty
<OUString
>(xTextFrame
, "FillHatchName"));
428 CPPUNIT_ASSERT_EQUAL(false, getProperty
<bool>(xTextFrame
, "FillBackground"));
429 aGradientxTextFrame
= getProperty
<awt::Gradient
>(xTextFrame
, "FillTransparenceGradient");
430 CPPUNIT_ASSERT_EQUAL(css::awt::GradientStyle_LINEAR
, aGradientxTextFrame
.Style
);
432 xTextFrame
= getShape(13);
433 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
434 CPPUNIT_ASSERT_EQUAL(OUString("Black 0 Degrees"), getProperty
<OUString
>(xTextFrame
, "FillHatchName"));
435 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xTextFrame
, "FillBackground"));
436 aGradientxTextFrame
= getProperty
<awt::Gradient
>(xTextFrame
, "FillTransparenceGradient");
437 CPPUNIT_ASSERT_EQUAL(css::awt::GradientStyle_LINEAR
, aGradientxTextFrame
.Style
);
439 xTextFrame
= getShape(14);
440 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
441 CPPUNIT_ASSERT_EQUAL(OUString("Sky"), getProperty
<OUString
>(xTextFrame
, "FillBitmapName"));
442 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillTransparence"));
443 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapPositionOffsetX"));
444 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapPositionOffsetY"));
445 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapOffsetX"));
446 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapOffsetY"));
447 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xTextFrame
, "FillBitmapTile"));
449 xTextFrame
= getShape(15);
450 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
451 CPPUNIT_ASSERT_EQUAL(OUString("Sky"), getProperty
<OUString
>(xTextFrame
, "FillBitmapName"));
452 CPPUNIT_ASSERT_EQUAL(sal_Int32(45), getProperty
<sal_Int32
>(xTextFrame
, "FillTransparence"));
453 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapPositionOffsetX"));
454 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapPositionOffsetY"));
455 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapOffsetX"));
456 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapOffsetY"));
457 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xTextFrame
, "FillBitmapTile"));
459 xTextFrame
= getShape(16);
460 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP
, getProperty
<drawing::FillStyle
>(xTextFrame
, "FillStyle"));
461 CPPUNIT_ASSERT_EQUAL(OUString("Sky"), getProperty
<OUString
>(xTextFrame
, "FillBitmapName"));
462 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapPositionOffsetX"));
463 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapPositionOffsetY"));
464 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapOffsetX"));
465 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xTextFrame
, "FillBitmapOffsetY"));
466 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xTextFrame
, "FillBitmapTile"));
467 aGradientxTextFrame
= getProperty
<awt::Gradient
>(xTextFrame
, "FillTransparenceGradient");
468 CPPUNIT_ASSERT_EQUAL(css::awt::GradientStyle_LINEAR
, aGradientxTextFrame
.Style
);
470 if (xmlDocUniquePtr pXmlDoc
= parseExport("content.xml"))
472 // check that there are 3 background-image elements
473 assertXPath(pXmlDoc
, "//style:style[@style:parent-style-name='Frame' and @style:family='graphic']/style:graphic-properties[@draw:fill='bitmap']/style:background-image[@style:repeat='stretch']", 3);
474 // tdf#90640: check that one of them is 55% opaque
475 assertXPath(pXmlDoc
, "//style:style[@style:parent-style-name='Frame' and @style:family='graphic']/style:graphic-properties[@draw:fill='bitmap' and @fo:background-color='transparent' and @draw:opacity='55%']/style:background-image[@style:repeat='stretch' and @draw:opacity='55%']", 1);
476 // tdf#90640: check that one of them is 43% opaque
477 // (emulated - hopefully not with rounding errors)
478 assertXPath(pXmlDoc
, "//style:style[@style:parent-style-name='Frame' and @style:family='graphic']/style:graphic-properties[@draw:fill='bitmap' and @fo:background-color='transparent' and @draw:opacity-name='Transparency_20_1']/style:background-image[@style:repeat='stretch' and @draw:opacity='43%']", 1);
482 DECLARE_SW_ROUNDTRIP_TEST(testSHA1Correct
, "sha1_correct.odt", "1012345678901234567890123456789012345678901234567890", Test
)
483 { // tdf#114939 this has both an affected password as well as content.xml
484 CPPUNIT_ASSERT_EQUAL(1, getPages());
485 getParagraph(1, "012");
488 DECLARE_SW_ROUNDTRIP_TEST(testSHA1Wrong
, "sha1_wrong.odt", "1012345678901234567890123456789012345678901234567890", Test
)
489 { // tdf#114939 this has both an affected password as well as content.xml
490 CPPUNIT_ASSERT_EQUAL(1, getPages());
491 getParagraph(1, "012");
494 CPPUNIT_TEST_FIXTURE(Test
, testOOoxmlEmbedded
)
496 loadAndReload("oooxml_embedded.sxw");
497 uno::Reference
<text::XTextEmbeddedObjectsSupplier
> xTEOSupplier(mxComponent
, uno::UNO_QUERY
);
498 uno::Reference
<container::XNameAccess
> xAccess(xTEOSupplier
->getEmbeddedObjects());
499 uno::Sequence
<OUString
> aSeq(xAccess
->getElementNames());
500 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aSeq
.getLength());
501 uno::Reference
<document::XEmbeddedObjectSupplier
> xEOSupplier1(xAccess
->getByName("Object1"), uno::UNO_QUERY
);
502 uno::Reference
<lang::XComponent
> xObj1(xEOSupplier1
->getEmbeddedObject());
503 uno::Reference
<document::XEmbeddedObjectSupplier
> xEOSupplier2(xAccess
->getByName("Object2"), uno::UNO_QUERY
);
504 uno::Reference
<lang::XComponent
> xObj2(xEOSupplier2
->getEmbeddedObject());
505 uno::Reference
<document::XEmbeddedObjectSupplier
> xEOSupplier3(xAccess
->getByName("Object3"), uno::UNO_QUERY
);
506 uno::Reference
<lang::XComponent
> xObj3(xEOSupplier3
->getEmbeddedObject());
507 uno::Reference
<document::XEmbeddedObjectSupplier
> xEOSupplier4(xAccess
->getByName("Object4"), uno::UNO_QUERY
);
508 uno::Reference
<lang::XComponent
> xObj4(xEOSupplier4
->getEmbeddedObject());
509 //checking first object
510 uno::Reference
<document::XStorageBasedDocument
> xSBDoc1(xObj1
, uno::UNO_QUERY
);
511 uno::Reference
<embed::XStorage
> xStorage1(xSBDoc1
->getDocumentStorage());
512 CPPUNIT_ASSERT_EQUAL(sal_Int32(SOFFICE_FILEFORMAT_8
), comphelper::OStorageHelper::GetXStorageFormat(xStorage1
));
513 //checking second object
514 uno::Reference
<document::XStorageBasedDocument
> xSBDoc2(xObj2
, uno::UNO_QUERY
);
515 uno::Reference
<embed::XStorage
> xStorage2(xSBDoc2
->getDocumentStorage());
516 CPPUNIT_ASSERT_EQUAL(sal_Int32(SOFFICE_FILEFORMAT_8
), comphelper::OStorageHelper::GetXStorageFormat(xStorage2
));
517 //checking third object
518 uno::Reference
<document::XStorageBasedDocument
> xSBDoc3(xObj3
, uno::UNO_QUERY
);
519 uno::Reference
<embed::XStorage
> xStorage3(xSBDoc3
->getDocumentStorage());
520 CPPUNIT_ASSERT_EQUAL(sal_Int32(SOFFICE_FILEFORMAT_8
), comphelper::OStorageHelper::GetXStorageFormat(xStorage3
));
521 //checking fourth object
522 uno::Reference
<document::XStorageBasedDocument
> xSBDoc4(xObj4
, uno::UNO_QUERY
);
523 uno::Reference
<embed::XStorage
> xStorage4(xSBDoc4
->getDocumentStorage());
524 CPPUNIT_ASSERT_EQUAL(sal_Int32(SOFFICE_FILEFORMAT_8
), comphelper::OStorageHelper::GetXStorageFormat(xStorage4
));
527 DECLARE_ODFEXPORT_TEST(testredlineTextFrame
, "redlineTextFrame.odt")
529 CPPUNIT_ASSERT_EQUAL(2, getShapes());
530 CPPUNIT_ASSERT_EQUAL(1, getPages());
531 //Note this is for a crash test
532 //Counting the Number of Frames and checking with the expected count
533 uno::Reference
<text::XTextFramesSupplier
> xTextFramesSupplier(mxComponent
, uno::UNO_QUERY
);
534 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
535 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess
->getCount());
538 DECLARE_ODFEXPORT_TEST(testTdf107292
, "tdf107292.odt")
540 // tracked deletions at the same position were loaded in reverse order
541 CPPUNIT_ASSERT_EQUAL(1, getPages());
543 // Without this fix in place, this test would have failed with
544 // - Expected: Lorem ipsum dolor sit...
545 // - Actual : dolor ipsumLorem sit...
546 CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsum dolor sit..."), getParagraph(1)->getString());
549 DECLARE_ODFEXPORT_TEST(testTdf140437
, "tdf140437.odt")
551 // Without the fix in place, the document would have failed to load
552 CPPUNIT_ASSERT_EQUAL(1, getPages());
554 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(mxComponent
, uno::UNO_QUERY
);
555 uno::Reference
<container::XEnumerationAccess
> xFieldsAccess(xTextFieldsSupplier
->getTextFields());
556 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
558 // at least one field should be detected
559 CPPUNIT_ASSERT(xFields
->hasMoreElements());
562 CPPUNIT_TEST_FIXTURE(Test
, testTdf131621
)
564 loadAndReload("tdf131621.ott");
565 CPPUNIT_ASSERT_EQUAL(12, getShapes());
566 //Crash test, Check number of pages
567 CPPUNIT_ASSERT_EQUAL( 1, getPages() );
570 CPPUNIT_TEST_FIXTURE(Test
, testTdf135144
)
572 loadAndReload("tdf135144.docx");
573 //Crashes at import time after roundtrip
574 CPPUNIT_ASSERT_EQUAL(3, getPages());
575 CPPUNIT_ASSERT_EQUAL(4, getShapes());
578 DECLARE_ODFEXPORT_TEST(testTdf130950
, "tdf130950.odt")
580 //Crashes at import time
581 CPPUNIT_ASSERT_EQUAL(1, getPages());
582 CPPUNIT_ASSERT_EQUAL(2, getShapes());
585 DECLARE_ODFEXPORT_TEST(testFdo38244
, "fdo38244.odt")
587 CPPUNIT_ASSERT_EQUAL(1, getPages());
588 // See ooxmlexport's testFdo38244().
590 // Test comment range feature.
591 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
592 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextDocument
->getText(), uno::UNO_QUERY
);
593 uno::Reference
<container::XEnumeration
> xParaEnum
= xParaEnumAccess
->createEnumeration();
594 uno::Reference
<container::XEnumerationAccess
> xRunEnumAccess(xParaEnum
->nextElement(), uno::UNO_QUERY
);
595 uno::Reference
<container::XEnumeration
> xRunEnum
= xRunEnumAccess
->createEnumeration();
596 xRunEnum
->nextElement();
597 uno::Reference
<beans::XPropertySet
> xPropertySet(xRunEnum
->nextElement(), uno::UNO_QUERY
);
598 CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty
<OUString
>(xPropertySet
, "TextPortionType"));
599 xRunEnum
->nextElement();
600 xPropertySet
.set(xRunEnum
->nextElement(), uno::UNO_QUERY
);
601 CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty
<OUString
>(xPropertySet
, "TextPortionType"));
604 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(mxComponent
, uno::UNO_QUERY
);
605 uno::Reference
<container::XEnumerationAccess
> xFieldsAccess(xTextFieldsSupplier
->getTextFields());
606 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
607 xPropertySet
.set(xFields
->nextElement(), uno::UNO_QUERY
);
608 CPPUNIT_ASSERT_EQUAL(OUString("__Fieldmark__4_1833023242"), getProperty
<OUString
>(xPropertySet
, "Name"));
609 CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty
<OUString
>(xPropertySet
, "Initials"));
612 CPPUNIT_TEST_FIXTURE(Test
, testSenderInitials
)
614 loadAndReload("sender-initials.fodt");
615 // Test sender-initial properties (both annotation metadata and text field)
616 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(mxComponent
, uno::UNO_QUERY
);
617 uno::Reference
<container::XEnumerationAccess
> xFieldsAccess(xTextFieldsSupplier
->getTextFields());
618 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
619 // first 3 are annotations, last 2 are text fields
620 for (unsigned i
= 0; i
< 3; ++i
)
622 uno::Reference
<beans::XPropertySet
> xPropertySet(xFields
->nextElement(), uno::UNO_QUERY
);
623 CPPUNIT_ASSERT_EQUAL(OUString("I"), getProperty
<OUString
>(xPropertySet
, "Initials"));
625 for (unsigned i
= 0; i
< 2; ++i
)
627 uno::Reference
<beans::XPropertySet
> xPropertySet(xFields
->nextElement(), uno::UNO_QUERY
);
628 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xPropertySet
, "IsFixed"));
629 CPPUNIT_ASSERT_EQUAL(OUString("I"), getProperty
<OUString
>(xPropertySet
, "Content"));
633 DECLARE_ODFEXPORT_TEST(testResolvedComment
, "resolved-comment.odt")
635 CPPUNIT_ASSERT_EQUAL(1, getPages());
636 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(mxComponent
, uno::UNO_QUERY
);
637 uno::Reference
<container::XEnumerationAccess
> xFieldsAccess(xTextFieldsSupplier
->getTextFields());
638 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
639 uno::Reference
<beans::XPropertySet
> xPropertySet(xFields
->nextElement(), uno::UNO_QUERY
);
640 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xPropertySet
, "Resolved"));
641 xPropertySet
.set(xFields
->nextElement(), uno::UNO_QUERY
);
642 CPPUNIT_ASSERT_EQUAL(false, getProperty
<bool>(xPropertySet
, "Resolved"));
645 CPPUNIT_TEST_FIXTURE(Test
, testTdf92379
)
647 loadAndReload("tdf92379.fodt");
648 // frame style fo:background-color was not imported
649 uno::Reference
<container::XNameAccess
> xStyles(getStyles("FrameStyles"));
650 uno::Reference
<beans::XPropertySet
> xStyle(xStyles
->getByName("encarts"),
652 CPPUNIT_ASSERT_EQUAL(Color(0xffcc99), getProperty
<Color
>(xStyle
, "BackColorRGB"));
653 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xStyle
, "BackColorTransparency"));
654 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, getProperty
<drawing::FillStyle
>(xStyle
, "FillStyle"));
655 CPPUNIT_ASSERT_EQUAL(Color(0xffcc99), getProperty
<Color
>(xStyle
, "FillColor"));
656 CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty
<sal_Int16
>(xStyle
, "FillTransparence"));
658 uno::Reference
<beans::XPropertySet
> xFrameStyle2(xStyles
->getByName("Untitled1"),
660 CPPUNIT_ASSERT_EQUAL(COL_WHITE
, getProperty
<Color
>(xFrameStyle2
, "BackColorRGB"));
661 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xFrameStyle2
, "BackTransparent"));
662 CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty
<sal_Int32
>(xFrameStyle2
, "BackColorTransparency"));
663 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE
, getProperty
<drawing::FillStyle
>(xFrameStyle2
, "FillStyle"));
664 // unfortunately this is actually the pool default value, which would be hard to fix - but it isn't a problem because style is NONE
665 // CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xFrameStyle2, "FillColor"));
666 // CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xFrameStyle2, "FillTransparence"));
668 if (xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml"))
670 // check that fo:background-color attribute is exported properly
671 assertXPath(pXmlDoc
, "//style:style[@style:family='graphic' and @style:name='encarts']/style:graphic-properties[@fo:background-color='#ffcc99']", 1);
672 assertXPath(pXmlDoc
, "//style:style[@style:family='graphic' and @style:name='Untitled1']/style:graphic-properties[@fo:background-color='transparent']", 1);
675 // paragraph style fo:background-color was wrongly inherited despite being
676 // overridden in derived style
677 uno::Reference
<container::XNameAccess
> xParaStyles(getStyles("ParagraphStyles"));
678 uno::Reference
<beans::XPropertySet
> xStyle1(xParaStyles
->getByName(
679 "Titre Avis expert"), uno::UNO_QUERY
);
680 CPPUNIT_ASSERT_EQUAL(Color(0x661900), getProperty
<Color
>(xStyle1
, "ParaBackColor"));
681 CPPUNIT_ASSERT_EQUAL(false, getProperty
<bool>(xStyle1
, "ParaBackTransparent"));
682 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, getProperty
<drawing::FillStyle
>(xStyle1
, "FillStyle"));
683 CPPUNIT_ASSERT_EQUAL(Color(0x661900), getProperty
<Color
>(xStyle1
, "FillColor"));
684 CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty
<sal_Int16
>(xStyle1
, "FillTransparence"));
685 CPPUNIT_ASSERT_EQUAL(COL_WHITE
, getProperty
<Color
>(xStyle1
, "CharColor"));
687 uno::Reference
<beans::XPropertySet
> xStyle2(xParaStyles
->getByName(
688 "Avis expert questions"), uno::UNO_QUERY
);
689 CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT
, getProperty
<Color
>(xStyle2
, "ParaBackColor"));
690 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xStyle2
, "ParaBackTransparent"));
691 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE
, getProperty
<drawing::FillStyle
>(xStyle2
, "FillStyle"));
692 // unfortunately this is actually the pool default value, which would be hard to fix - but it isn't a problem because style is NONE
693 // CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle2, "FillColor"));
694 // CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle2, "FillTransparence"));
695 CPPUNIT_ASSERT_EQUAL(Color(0x661900), getProperty
<Color
>(xStyle2
, "CharColor"));
697 uno::Reference
<beans::XPropertySet
> xStyle31(xParaStyles
->getByName(
698 "avis expert questions non cadres"), uno::UNO_QUERY
);
699 CPPUNIT_ASSERT_EQUAL(Color(0x801900), getProperty
<Color
>(xStyle31
, "ParaBackColor"));
700 CPPUNIT_ASSERT_EQUAL(false, getProperty
<bool>(xStyle31
, "ParaBackTransparent"));
701 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, getProperty
<drawing::FillStyle
>(xStyle31
, "FillStyle"));
702 CPPUNIT_ASSERT_EQUAL(Color(0x801900), getProperty
<Color
>(xStyle31
, "FillColor"));
703 CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty
<sal_Int16
>(xStyle31
, "FillTransparence"));
704 CPPUNIT_ASSERT_EQUAL(Color(0x661900), getProperty
<Color
>(xStyle31
, "CharColor"));
706 uno::Reference
<beans::XPropertySet
> xStyle32(xParaStyles
->getByName(
707 "Avis expert rXponses"), uno::UNO_QUERY
);
708 CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT
, getProperty
<Color
>(xStyle32
, "ParaBackColor"));
709 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xStyle32
, "ParaBackTransparent"));
710 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE
, getProperty
<drawing::FillStyle
>(xStyle32
, "FillStyle"));
711 // unfortunately this is actually the pool default value, which would be hard to fix - but it isn't a problem because style is NONE
712 // CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle32, "FillColor"));
713 // CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle32, "FillTransparence"));
714 CPPUNIT_ASSERT_EQUAL(Color(0x461900), getProperty
<Color
>(xStyle32
, "CharColor"));
716 if (xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml"))
718 // check that fo:background-color attribute is exported properly
719 assertXPath(pXmlDoc
, "//style:style[@style:family='paragraph' and @style:display-name='Titre Avis expert']/style:paragraph-properties[@fo:background-color='#661900']", 1);
720 assertXPath(pXmlDoc
, "//style:style[@style:family='paragraph' and @style:display-name='Avis expert questions']/style:paragraph-properties[@fo:background-color='transparent']", 1);
721 assertXPath(pXmlDoc
, "//style:style[@style:family='paragraph' and @style:display-name='avis expert questions non cadres']/style:paragraph-properties[@fo:background-color='#801900']", 1);
722 assertXPath(pXmlDoc
, "//style:style[@style:family='paragraph' and @style:display-name='Avis expert rXponses']/style:paragraph-properties[@fo:background-color='transparent']", 1);
726 DECLARE_ODFEXPORT_TEST(testFdo79358
, "fdo79358.odt")
728 CPPUNIT_ASSERT_EQUAL(1, getPages());
729 // the boolean properties of the index were not exported properly
730 uno::Reference
<text::XDocumentIndexesSupplier
> xIndexSupplier(mxComponent
, uno::UNO_QUERY
);
731 uno::Reference
<container::XIndexAccess
> xIndexes
= xIndexSupplier
->getDocumentIndexes();
732 uno::Reference
<text::XDocumentIndex
> xTOCIndex(xIndexes
->getByIndex(0), uno::UNO_QUERY
);
733 uno::Reference
<beans::XPropertySet
> xTOCProps(xTOCIndex
, uno::UNO_QUERY
);
734 CPPUNIT_ASSERT_EQUAL(false, getProperty
<bool>(xTOCProps
, "CreateFromOutline"));
735 CPPUNIT_ASSERT_EQUAL(false, getProperty
<bool>(xTOCProps
, "CreateFromMarks"));
736 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xTOCProps
, "CreateFromLevelParagraphStyles"));
737 // check that the source styles are preserved too while at it
738 uno::Reference
<container::XIndexReplace
> xLevels(
739 getProperty
< uno::Reference
<container::XIndexReplace
> >(xTOCProps
,
740 "LevelParagraphStyles"));
741 uno::Sequence
<OUString
> seq
{ "Heading" };
742 CPPUNIT_ASSERT_EQUAL(uno::Any(seq
), xLevels
->getByIndex(1));
743 CPPUNIT_ASSERT_EQUAL(uno::Any(uno::Sequence
<OUString
>()), xLevels
->getByIndex(2));
746 DECLARE_ODFEXPORT_TEST(testFirstHeaderFooter
, "first-header-footer.odt")
748 CPPUNIT_ASSERT_EQUAL(6, getPages());
749 // Test import and export of the header-first token.
751 // The document has 6 pages, two page styles for the first and second half of pages.
752 CPPUNIT_ASSERT_EQUAL(OUString("First header"), parseDump("/root/page[1]/header/txt/text()"));
753 CPPUNIT_ASSERT_EQUAL(OUString("First footer"), parseDump("/root/page[1]/footer/txt/text()"));
754 CPPUNIT_ASSERT_EQUAL(OUString("Left header"), parseDump("/root/page[2]/header/txt/text()"));
755 CPPUNIT_ASSERT_EQUAL(OUString("Left footer"), parseDump("/root/page[2]/footer/txt/text()"));
756 CPPUNIT_ASSERT_EQUAL(OUString("Right header"), parseDump("/root/page[3]/header/txt/text()"));
757 CPPUNIT_ASSERT_EQUAL(OUString("Right footer"), parseDump("/root/page[3]/footer/txt/text()"));
758 CPPUNIT_ASSERT_EQUAL(OUString("First header2"), parseDump("/root/page[4]/header/txt/text()"));
759 CPPUNIT_ASSERT_EQUAL(OUString("First footer2"), parseDump("/root/page[4]/footer/txt/text()"));
760 CPPUNIT_ASSERT_EQUAL(OUString("Right header2"), parseDump("/root/page[5]/header/txt/text()"));
761 CPPUNIT_ASSERT_EQUAL(OUString("Right footer2"), parseDump("/root/page[5]/footer/txt/text()"));
762 CPPUNIT_ASSERT_EQUAL(OUString("Left header2"), parseDump("/root/page[6]/header/txt/text()"));
763 CPPUNIT_ASSERT_EQUAL(OUString("Left footer2"), parseDump("/root/page[6]/footer/txt/text()"));
766 DECLARE_ODFEXPORT_TEST(testTextframeGradient
, "textframe-gradient.odt")
768 CPPUNIT_ASSERT_EQUAL(2, getShapes());
769 CPPUNIT_ASSERT_EQUAL(1, getPages());
770 uno::Reference
<text::XTextFramesSupplier
> xTextFramesSupplier(mxComponent
, uno::UNO_QUERY
);
771 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
772 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess
->getCount());
774 uno::Reference
<beans::XPropertySet
> xFrame(xIndexAccess
->getByIndex(0), uno::UNO_QUERY
);
775 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT
, getProperty
<drawing::FillStyle
>(xFrame
, "FillStyle"));
776 awt::Gradient aGradient
= getProperty
<awt::Gradient
>(xFrame
, "FillGradient");
777 CPPUNIT_ASSERT_EQUAL(Color(0xC0504D), Color(ColorTransparency
, aGradient
.StartColor
));
778 CPPUNIT_ASSERT_EQUAL(Color(0xD99594), Color(ColorTransparency
, aGradient
.EndColor
));
779 CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL
, aGradient
.Style
);
781 xFrame
.set(xIndexAccess
->getByIndex(1), uno::UNO_QUERY
);
782 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT
, getProperty
<drawing::FillStyle
>(xFrame
, "FillStyle"));
783 aGradient
= getProperty
<awt::Gradient
>(xFrame
, "FillGradient");
784 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(ColorTransparency
, aGradient
.StartColor
));
785 CPPUNIT_ASSERT_EQUAL(Color(0x666666), Color(ColorTransparency
, aGradient
.EndColor
));
786 CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL
, aGradient
.Style
);
789 CPPUNIT_TEST_FIXTURE(Test
, testDuplicateCrossRefHeadingBookmark
)
791 loadAndReload("CrossRefHeadingBookmark.fodt");
792 // the file contains invalid duplicate heading cross reference bookmarks
793 // but we have to round trip them, tdf#94804
795 uno::Reference
<text::XBookmarksSupplier
> xBookmarksSupplier(mxComponent
,
797 uno::Reference
<container::XNameAccess
> xBookmarks
=
798 xBookmarksSupplier
->getBookmarks();
799 uno::Reference
<text::XTextContent
> xBookmark1(
800 xBookmarks
->getByName("__RefHeading__8284_1826734303"), uno::UNO_QUERY
);
801 CPPUNIT_ASSERT(xBookmark1
.is());
802 CPPUNIT_ASSERT_THROW(xBookmarks
->getByName("__RefHeading__1673_25705824"), container::NoSuchElementException
);
804 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(mxComponent
, uno::UNO_QUERY
);
805 uno::Reference
<util::XRefreshable
>(xTextFieldsSupplier
->getTextFields(), uno::UNO_QUERY_THROW
)->refresh();
807 uno::Reference
<container::XEnumerationAccess
> xFieldsAccess(xTextFieldsSupplier
->getTextFields());
808 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
809 uno::Any aField1
= xFields
->nextElement();
810 uno::Reference
<text::XTextField
> xField1(aField1
, uno::UNO_QUERY
);
811 CPPUNIT_ASSERT_EQUAL(OUString("1.1"), xField1
->getPresentation(false));
812 uno::Any aField2
= xFields
->nextElement();
813 uno::Reference
<text::XTextField
> xField2(aField2
, uno::UNO_QUERY
);
814 CPPUNIT_ASSERT_EQUAL(OUString("1.1"), xField2
->getPresentation(false));
817 DECLARE_ODFEXPORT_TEST(testFdo60769
, "fdo60769.odt")
819 CPPUNIT_ASSERT_EQUAL(1, getPages());
820 // Test multi-paragraph comment range feature.
821 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
822 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextDocument
->getText(), uno::UNO_QUERY
);
823 uno::Reference
<container::XEnumeration
> xParaEnum
= xParaEnumAccess
->createEnumeration();
824 uno::Reference
<container::XEnumerationAccess
> xRunEnumAccess(xParaEnum
->nextElement(), uno::UNO_QUERY
);
825 uno::Reference
<container::XEnumeration
> xRunEnum
= xRunEnumAccess
->createEnumeration();
826 while (xRunEnum
->hasMoreElements())
828 uno::Reference
<beans::XPropertySet
> xPropertySet(xRunEnum
->nextElement(), uno::UNO_QUERY
);
829 OUString aType
= getProperty
<OUString
>(xPropertySet
, "TextPortionType");
830 // First paragraph: no field end, no anchor
831 CPPUNIT_ASSERT(aType
== "Text" || aType
== "Annotation");
834 xRunEnumAccess
.set(xParaEnum
->nextElement(), uno::UNO_QUERY
);
835 while (xRunEnum
->hasMoreElements())
837 uno::Reference
<beans::XPropertySet
> xPropertySet(xRunEnum
->nextElement(), uno::UNO_QUERY
);
838 OUString aType
= getProperty
<OUString
>(xPropertySet
, "TextPortionType");
839 // Second paragraph: no field start
840 CPPUNIT_ASSERT(aType
== "Text" || aType
== "AnnotationEnd");
844 DECLARE_ODFEXPORT_TEST(testTdf115815
, "tdf115815.odt")
846 CPPUNIT_ASSERT_EQUAL(1, getPages());
847 // Test comment range feature on tracked deletion.
848 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
849 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextDocument
->getText(), uno::UNO_QUERY
);
850 uno::Reference
<container::XEnumeration
> xParaEnum
= xParaEnumAccess
->createEnumeration();
851 uno::Reference
<container::XEnumerationAccess
> xRunEnumAccess(xParaEnum
->nextElement(), uno::UNO_QUERY
);
852 uno::Reference
<container::XEnumeration
> xRunEnum
= xRunEnumAccess
->createEnumeration();
853 bool bAnnotationStart
= false;
854 bool bBeforeAnnotation
= true;
855 OUString sTextBeforeAnnotation
;
856 while (xRunEnum
->hasMoreElements())
858 uno::Reference
<beans::XPropertySet
> xPropertySet(xRunEnum
->nextElement(), uno::UNO_QUERY
);
859 OUString aType
= getProperty
<OUString
>(xPropertySet
, "TextPortionType");
860 // there is no AnnotationEnd with preceding AnnotationStart,
861 // i.e. annotation with lost range
862 CPPUNIT_ASSERT(aType
!= "AnnotationEnd" || !bAnnotationStart
);
864 bAnnotationStart
= (aType
== "Annotation");
866 // collect paragraph text before the first annotation
867 if (bBeforeAnnotation
)
869 if (bAnnotationStart
)
870 bBeforeAnnotation
= false;
871 else if (aType
== "Text")
873 uno::Reference
<text::XTextRange
> xRun(xPropertySet
, uno::UNO_QUERY
);
874 sTextBeforeAnnotation
+= xRun
->getString();
879 // This was "Lorem ipsum" (collapsed annotation range)
880 CPPUNIT_ASSERT_EQUAL(OUString("Lorem "), sTextBeforeAnnotation
);
883 CPPUNIT_TEST_FIXTURE(Test
, testFdo58949
)
885 comphelper::ScopeGuard
g([]() {
886 std::shared_ptr
<comphelper::ConfigurationChanges
> pBatch(
887 comphelper::ConfigurationChanges::create());
888 officecfg::Office::Common::Filter::Microsoft::Import::MathTypeToMath::set(true, pBatch
);
892 std::shared_ptr
<comphelper::ConfigurationChanges
> pBatch(
893 comphelper::ConfigurationChanges::create());
894 officecfg::Office::Common::Filter::Microsoft::Import::MathTypeToMath::set(false, pBatch
);
896 loadAndReload("fdo58949.docx");
899 * The problem was that the exporter didn't insert "Obj102" to the
900 * resulting zip file. No idea how to check for "broken" (missing OLE data
901 * and replacement image) OLE objects using UNO, so we'll check the zip file directly.
904 utl::TempFile aTempFile
;
905 save("writer8", aTempFile
);
907 uno::Sequence
<uno::Any
> aArgs
{ uno::Any(aTempFile
.GetURL()) };
908 uno::Reference
<container::XNameAccess
> xNameAccess(m_xSFactory
->createInstanceWithArguments("com.sun.star.packages.zip.ZipFileAccess", aArgs
), uno::UNO_QUERY
);
909 const css::uno::Sequence
<OUString
> aNames(xNameAccess
->getElementNames());
910 // The exported document must have three objects named ObjNNN. The names are assigned in
911 // OLEHandler::copyOLEOStream using a static counter, and actual numbers depend on previous
912 // tests; so just count the matching names here.
914 for (const OUString
& sName
: aNames
)
917 if (sName
.startsWith("Obj", &sRest
))
919 // all following characters must be decimal digits; minimal value is 100
920 bool bMatch
= sRest
.getLength() >= 3
921 && std::all_of(sRest
.getStr(), sRest
.getStr() + sRest
.getLength(),
922 [](sal_Unicode ch
) { return ch
>= '0' && ch
<= '9'; });
927 CPPUNIT_ASSERT_EQUAL(3, nMatches
);
930 CPPUNIT_TEST_FIXTURE(Test
, testTdf134987
)
932 loadAndReload("tdf134987.docx");
933 uno::Reference
<text::XTextEmbeddedObjectsSupplier
> xTEOSupplier(mxComponent
, uno::UNO_QUERY
);
934 uno::Reference
<container::XNameAccess
> xAccess(xTEOSupplier
->getEmbeddedObjects());
935 uno::Sequence
<OUString
> aSeq(xAccess
->getElementNames());
936 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aSeq
.getLength());
939 // checking first object (formula)
941 uno::Reference
<document::XEmbeddedObjectSupplier
> xEOSupplier(xAccess
->getByName("Object1"), uno::UNO_QUERY
);
942 uno::Reference
<lang::XComponent
> xObj(xEOSupplier
->getEmbeddedObject());
943 CPPUNIT_ASSERT(xObj
.is());
945 uno::Reference
<document::XStorageBasedDocument
> xSBDoc(xObj
, uno::UNO_QUERY
);
946 uno::Reference
<embed::XStorage
> xStorage(xSBDoc
->getDocumentStorage());
947 CPPUNIT_ASSERT(xStorage
.is());
949 uno::Reference
< beans::XPropertySet
> xStorProps(xStorage
, uno::UNO_QUERY_THROW
);
950 CPPUNIT_ASSERT(xStorProps
->getPropertyValue("MediaType") >>= aMediaType
);
951 CPPUNIT_ASSERT(aMediaType
.equalsIgnoreAsciiCase(MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII
));
953 // checking second object (chart)
955 uno::Reference
<document::XEmbeddedObjectSupplier
> xEOSupplier(xAccess
->getByName("Object2"), uno::UNO_QUERY
);
956 uno::Reference
<lang::XComponent
> xObj(xEOSupplier
->getEmbeddedObject());
957 CPPUNIT_ASSERT(xObj
.is());
959 uno::Reference
<document::XStorageBasedDocument
> xSBDoc(xObj
, uno::UNO_QUERY
);
960 uno::Reference
<embed::XStorage
> xStorage(xSBDoc
->getDocumentStorage());
961 CPPUNIT_ASSERT(xStorage
.is());
963 uno::Reference
< beans::XPropertySet
> xStorProps(xStorage
, uno::UNO_QUERY_THROW
);
964 CPPUNIT_ASSERT(xStorProps
->getPropertyValue("MediaType") >>= aMediaType
);
965 CPPUNIT_ASSERT(aMediaType
.equalsIgnoreAsciiCase(MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII
));
967 // checking third object (chart)
969 uno::Reference
<document::XEmbeddedObjectSupplier
> xEOSupplier(xAccess
->getByName("Object3"), uno::UNO_QUERY
);
970 uno::Reference
<lang::XComponent
> xObj(xEOSupplier
->getEmbeddedObject());
971 CPPUNIT_ASSERT(xObj
.is());
973 uno::Reference
<document::XStorageBasedDocument
> xSBDoc(xObj
, uno::UNO_QUERY
);
974 uno::Reference
<embed::XStorage
> xStorage(xSBDoc
->getDocumentStorage());
975 CPPUNIT_ASSERT(xStorage
.is());
977 uno::Reference
< beans::XPropertySet
> xStorProps(xStorage
, uno::UNO_QUERY_THROW
);
978 CPPUNIT_ASSERT(xStorProps
->getPropertyValue("MediaType") >>= aMediaType
);
979 CPPUNIT_ASSERT(aMediaType
.equalsIgnoreAsciiCase(MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII
));
983 DECLARE_ODFEXPORT_TEST(testStylePageNumber
, "ooo321_stylepagenumber.odt")
985 CPPUNIT_ASSERT_EQUAL(5, getPages());
986 uno::Reference
<text::XTextContent
> xTable1(getParagraphOrTable(1));
987 // actually no break attribute is written in this case
988 // CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, getProperty<style::BreakType>(xTable1, "BreakType"));
989 CPPUNIT_ASSERT_EQUAL(OUString("Left Page"), getProperty
<OUString
>(xTable1
, "PageDescName"));
990 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty
<sal_Int16
>(xTable1
, "PageNumberOffset"));
992 uno::Reference
<text::XTextContent
> xPara1(getParagraphOrTable(2));
993 CPPUNIT_ASSERT_EQUAL(OUString("Right Page"), getProperty
<OUString
>(xPara1
, "PageDescName"));
994 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty
<sal_Int16
>(xPara1
, "PageNumberOffset"));
996 // i#114163 tdf#77111: OOo < 3.3 bug, it wrote "auto" as "0" for tables
997 uno::Reference
<beans::XPropertySet
> xTable0(getParagraphOrTable(3), uno::UNO_QUERY
);
998 CPPUNIT_ASSERT_EQUAL(OUString("Left Page"), getProperty
<OUString
>(xTable0
, "PageDescName"));
999 CPPUNIT_ASSERT_EQUAL(uno::Any(), xTable0
->getPropertyValue("PageNumberOffset"));
1001 uno::Reference
<beans::XPropertySet
> xPara0(getParagraphOrTable(4), uno::UNO_QUERY
);
1002 CPPUNIT_ASSERT_EQUAL(OUString("Right Page"), getProperty
<OUString
>(xPara0
, "PageDescName"));
1003 CPPUNIT_ASSERT_EQUAL(uno::Any(), xPara0
->getPropertyValue("PageNumberOffset"));
1005 uno::Reference
<container::XNameAccess
> xParaStyles
= getStyles("ParagraphStyles");
1006 uno::Reference
<beans::XPropertySet
> xStyle1(xParaStyles
->getByName("stylewithbreak1"), uno::UNO_QUERY
);
1007 CPPUNIT_ASSERT_EQUAL(OUString("Right Page"), getProperty
<OUString
>(xStyle1
, "PageDescName"));
1008 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty
<sal_Int16
>(xStyle1
, "PageNumberOffset"));
1010 uno::Reference
<beans::XPropertySet
> xStyle0(xParaStyles
->getByName("stylewithbreak0"), uno::UNO_QUERY
);
1011 CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty
<OUString
>(xStyle0
, "PageDescName"));
1012 CPPUNIT_ASSERT_EQUAL(uno::Any(), xStyle0
->getPropertyValue("PageNumberOffset"));
1015 DECLARE_ODFEXPORT_TEST(testCharacterBorder
, "charborder.odt")
1017 CPPUNIT_ASSERT_EQUAL(1, getPages());
1018 // Make sure paragraph and character attributes don't interfere
1019 // First paragraph has a paragraph border and a character border included by the paragraph style
1021 // Paragraph border of first paragraph
1023 const table::BorderLine2
aFirstParTopBorder(0x6666FF,2,26,26,7,55);
1024 const sal_Int32
aFirstParTopPadding(150);
1025 uno::Reference
<beans::XPropertySet
> xSet(getParagraph(1), uno::UNO_QUERY
);
1028 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"TopBorder"));
1029 CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding
, getProperty
<sal_Int32
>(xSet
,"TopBorderDistance"));
1031 // Bottom border (same as top border)
1032 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"BottomBorder"));
1033 CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding
, getProperty
<sal_Int32
>(xSet
,"BottomBorderDistance"));
1035 // Left border (same as top border)
1036 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"LeftBorder"));
1037 CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding
, getProperty
<sal_Int32
>(xSet
,"LeftBorderDistance"));
1039 // Right border (same as top border)
1040 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"RightBorder"));
1041 CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding
, getProperty
<sal_Int32
>(xSet
,"RightBorderDistance"));
1044 const table::ShadowFormat aShadow
= getProperty
<table::ShadowFormat
>(xSet
,"ParaShadowFormat");
1045 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(ColorTransparency
, aShadow
.Color
));
1046 CPPUNIT_ASSERT_EQUAL(false, static_cast<bool>(aShadow
.IsTransparent
));
1047 CPPUNIT_ASSERT_EQUAL(table::ShadowLocation(0), aShadow
.Location
);
1048 CPPUNIT_ASSERT_EQUAL(sal_Int16(0), aShadow
.ShadowWidth
);
1051 // Character border for first paragraph
1053 const table::BorderLine2
aFirstParCharTopBorder(0xFF3333,0,37,0,2,37);
1054 const sal_Int32
aFirstParCharTopPadding(450);
1055 uno::Reference
<beans::XPropertySet
> xSet(getParagraph(1), uno::UNO_QUERY
);
1058 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"CharTopBorder"));
1059 CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding
, getProperty
<sal_Int32
>(xSet
,"CharTopBorderDistance"));
1061 // Bottom border (same as top border)
1062 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"CharBottomBorder"));
1063 CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding
, getProperty
<sal_Int32
>(xSet
,"CharBottomBorderDistance"));
1065 // Left border (same as top border)
1066 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"CharLeftBorder"));
1067 CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding
, getProperty
<sal_Int32
>(xSet
,"CharLeftBorderDistance"));
1069 // Right border (same as top border)
1070 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"CharRightBorder"));
1071 CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding
, getProperty
<sal_Int32
>(xSet
,"CharRightBorderDistance"));
1074 const table::ShadowFormat aShadow
= getProperty
<table::ShadowFormat
>(xSet
,"CharShadowFormat");
1075 CPPUNIT_ASSERT_EQUAL(Color(0xFF3333), Color(ColorTransparency
, aShadow
.Color
));
1076 CPPUNIT_ASSERT_EQUAL(false, static_cast<bool>(aShadow
.IsTransparent
));
1077 CPPUNIT_ASSERT_EQUAL(table::ShadowLocation(2), aShadow
.Location
);
1078 CPPUNIT_ASSERT_EQUAL(sal_Int16(280), aShadow
.ShadowWidth
);
1082 uno::Reference
< style::XAutoStyleFamily
> xAutoStyleFamily(getAutoStyles("ParagraphStyles"));
1083 uno::Reference
< container::XEnumeration
> xAutoStylesEnum( xAutoStyleFamily
->createEnumeration() );
1084 CPPUNIT_ASSERT_EQUAL(true, static_cast<bool>(xAutoStylesEnum
->hasMoreElements()));
1086 // First paragraph autostyle
1087 uno::Reference
< beans::XPropertySet
> xPSet( xAutoStylesEnum
->nextElement(), uno::UNO_QUERY
);
1090 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"CharTopBorder"));
1091 CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding
, getProperty
<sal_Int32
>(xSet
,"CharTopBorderDistance"));
1094 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"CharBottomBorder"));
1095 CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding
, getProperty
<sal_Int32
>(xSet
,"CharBottomBorderDistance"));
1098 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"CharLeftBorder"));
1099 CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding
, getProperty
<sal_Int32
>(xSet
,"CharLeftBorderDistance"));
1102 CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder
, getProperty
<table::BorderLine2
>(xSet
,"CharRightBorder"));
1103 CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding
, getProperty
<sal_Int32
>(xSet
,"CharRightBorderDistance"));
1107 // Second paragraph's second text portion has a character style named CharDiffBor
1108 // This style includes border with different sides
1111 table::BorderLine2 aBorderArray
[4] =
1113 table::BorderLine2(0xFF3333,0,37,0,14,37), // Top (fine dashed line)
1114 table::BorderLine2(0x99FF66,26,26,53,11,106), // Bottom
1115 table::BorderLine2(0x6666FF,9,26,9,12,71), // Left
1116 table::BorderLine2(0,0,0,0,table::BorderLineStyle::NONE
,0) // Right
1119 sal_Int32 aDistances
[4] = { 400 /*Top*/, 300 /*Bottom*/, 250 /*Left*/, 0 /*Right*/ };
1121 // Get second text portion of second paragraph
1122 uno::Reference
< beans::XPropertySet
> xSet( getRun(getParagraph(2),2), uno::UNO_QUERY
);
1125 CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray
[0], getProperty
<table::BorderLine2
>(xSet
,"CharTopBorder"));
1126 CPPUNIT_ASSERT_EQUAL(aDistances
[0], getProperty
<sal_Int32
>(xSet
,"CharTopBorderDistance"));
1129 CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray
[1], getProperty
<table::BorderLine2
>(xSet
,"CharBottomBorder"));
1130 CPPUNIT_ASSERT_EQUAL(aDistances
[1], getProperty
<sal_Int32
>(xSet
,"CharBottomBorderDistance"));
1133 CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray
[2], getProperty
<table::BorderLine2
>(xSet
,"CharLeftBorder"));
1134 CPPUNIT_ASSERT_EQUAL(aDistances
[2], getProperty
<sal_Int32
>(xSet
,"CharLeftBorderDistance"));
1137 CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray
[3], getProperty
<table::BorderLine2
>(xSet
,"CharRightBorder"));
1138 CPPUNIT_ASSERT_EQUAL(aDistances
[3], getProperty
<sal_Int32
>(xSet
,"CharRightBorderDistance"));
1141 const table::ShadowFormat aShadow
= getProperty
<table::ShadowFormat
>(xSet
,"CharShadowFormat");
1142 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(ColorTransparency
, aShadow
.Color
));
1143 CPPUNIT_ASSERT_EQUAL(false, static_cast<bool>(aShadow
.IsTransparent
));
1144 CPPUNIT_ASSERT_EQUAL(table::ShadowLocation(3), aShadow
.Location
);
1145 CPPUNIT_ASSERT_EQUAL(sal_Int16(79), aShadow
.ShadowWidth
);
1147 // Check character style
1149 uno::Reference
< container::XNameAccess
> xStyleFamily
= getStyles("CharacterStyles");
1150 uno::Reference
< beans::XPropertySet
> xStyleSet(xStyleFamily
->getByName("CharDiffBor"), uno::UNO_QUERY
);
1153 CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray
[0], getProperty
<table::BorderLine2
>(xStyleSet
,"CharTopBorder"));
1154 CPPUNIT_ASSERT_EQUAL(aDistances
[0], getProperty
<sal_Int32
>(xStyleSet
,"CharTopBorderDistance"));
1157 CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray
[1], getProperty
<table::BorderLine2
>(xStyleSet
,"CharBottomBorder"));
1158 CPPUNIT_ASSERT_EQUAL(aDistances
[1], getProperty
<sal_Int32
>(xStyleSet
,"CharBottomBorderDistance"));
1161 CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray
[2], getProperty
<table::BorderLine2
>(xStyleSet
,"CharLeftBorder"));
1162 CPPUNIT_ASSERT_EQUAL(aDistances
[2], getProperty
<sal_Int32
>(xStyleSet
,"CharLeftBorderDistance"));
1165 CPPUNIT_ASSERT_BORDER_EQUAL(aBorderArray
[3], getProperty
<table::BorderLine2
>(xStyleSet
,"CharRightBorder"));
1166 CPPUNIT_ASSERT_EQUAL(aDistances
[3], getProperty
<sal_Int32
>(xStyleSet
,"CharRightBorderDistance"));
1171 CPPUNIT_TEST_FIXTURE(Test
, testProtectionKey
)
1173 loadAndReload("protection-key.fodt");
1174 OUString
const password("1012345678901234567890123456789012345678901234567890");
1176 // check 1 invalid OOo legacy password and 3 valid ODF 1.2 passwords
1177 uno::Reference
<text::XTextSectionsSupplier
> xTextSectionsSupplier(mxComponent
, uno::UNO_QUERY
);
1178 uno::Reference
<container::XIndexAccess
> xSections(xTextSectionsSupplier
->getTextSections(), uno::UNO_QUERY
);
1179 uno::Reference
<beans::XPropertySet
> xSect0(xSections
->getByIndex(0), uno::UNO_QUERY
);
1180 uno::Sequence
<sal_Int8
> const key0(getProperty
<uno::Sequence
<sal_Int8
>>(xSect0
, "ProtectionKey"));
1181 CPPUNIT_ASSERT(SvPasswordHelper::CompareHashPassword(key0
, password
));
1182 uno::Reference
<beans::XPropertySet
> xSect1(xSections
->getByIndex(1), uno::UNO_QUERY
);
1183 uno::Sequence
<sal_Int8
> const key1(getProperty
<uno::Sequence
<sal_Int8
>>(xSect1
, "ProtectionKey"));
1184 CPPUNIT_ASSERT(SvPasswordHelper::CompareHashPassword(key1
, password
));
1185 uno::Reference
<beans::XPropertySet
> xSect2(xSections
->getByIndex(2), uno::UNO_QUERY
);
1186 uno::Sequence
<sal_Int8
> const key2(getProperty
<uno::Sequence
<sal_Int8
>>(xSect1
, "ProtectionKey"));
1187 CPPUNIT_ASSERT(SvPasswordHelper::CompareHashPassword(key2
, password
));
1188 uno::Reference
<beans::XPropertySet
> xSect3(xSections
->getByIndex(3), uno::UNO_QUERY
);
1189 uno::Sequence
<sal_Int8
> const key3(getProperty
<uno::Sequence
<sal_Int8
>>(xSect1
, "ProtectionKey"));
1190 CPPUNIT_ASSERT(SvPasswordHelper::CompareHashPassword(key3
, password
));
1192 // we can't assume that the user entered the password; check that we
1193 // round-trip the password as-is
1194 if (xmlDocUniquePtr pXmlDoc
= parseExport("content.xml"))
1196 assertXPath(pXmlDoc
, "//text:section[@text:name='Section0' and @text:protected='true' and @text:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=']");
1197 assertXPath(pXmlDoc
, "//text:section[@text:name='Section1' and @text:protected='true' and @text:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=']");
1198 assertXPath(pXmlDoc
, "//text:section[@text:name='Section2' and @text:protected='true' and @text:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256' and @text:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=']");
1199 assertXPath(pXmlDoc
, "//text:section[@text:name='Section3' and @text:protected='true' and @text:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256' and @text:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=']");
1203 CPPUNIT_TEST_FIXTURE(Test
, testTdf128188
)
1205 loadAndReload("footnote-collect-at-end-of-section.fodt");
1206 SwDoc
*const pDoc
= dynamic_cast<SwXTextDocument
&>(*mxComponent
).GetDocShell()->GetDoc();
1207 CPPUNIT_ASSERT(pDoc
);
1208 SwFootnoteIdxs
const& rFootnotes(pDoc
->GetFootnoteIdxs());
1210 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rFootnotes
[0]->GetFootnote().GetNumber());
1211 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rFootnotes
[0]->GetFootnote().GetNumberRLHidden());
1212 CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), rFootnotes
[1]->GetFootnote().GetNumber());
1213 CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), rFootnotes
[1]->GetFootnote().GetNumberRLHidden());
1215 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rFootnotes
[2]->GetFootnote().GetNumber());
1216 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rFootnotes
[2]->GetFootnote().GetNumberRLHidden());
1218 CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), rFootnotes
[3]->GetFootnote().GetNumber());
1219 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rFootnotes
[3]->GetFootnote().GetNumberRLHidden());
1221 CPPUNIT_ASSERT_EQUAL(sal_uInt16(3), rFootnotes
[4]->GetFootnote().GetNumber());
1222 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rFootnotes
[4]->GetFootnote().GetNumberRLHidden());
1223 CPPUNIT_ASSERT_EQUAL(sal_uInt16(4), rFootnotes
[5]->GetFootnote().GetNumber());
1224 CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), rFootnotes
[5]->GetFootnote().GetNumberRLHidden());
1227 DECLARE_ODFEXPORT_TEST(testFdo43807
, "fdo43807.odt")
1229 CPPUNIT_ASSERT_EQUAL(1, getPages());
1230 uno::Reference
<beans::XPropertySet
> xSet(getParagraph(1), uno::UNO_QUERY
);
1231 CPPUNIT_ASSERT_EQUAL(OUString("Drop Caps"),getProperty
<OUString
>(xSet
,"DropCapCharStyleName"));
1233 xSet
.set(getParagraph(2), uno::UNO_QUERY
);
1234 CPPUNIT_ASSERT_EQUAL(OUString("User Defined Drop Caps"),getProperty
<OUString
>(xSet
,"DropCapCharStyleName"));
1237 CPPUNIT_TEST_FIXTURE(Test
, testTdf103091
)
1239 loadAndReload("tdf103091.fodt");
1240 // check that all conditional paragraph style conditions are imported
1241 uno::Reference
<container::XNameAccess
> xParaStyles(getStyles("ParagraphStyles"));
1242 uno::Reference
<beans::XPropertySet
> xStyle1(xParaStyles
->getByName(
1243 "Text Body"), uno::UNO_QUERY
);
1244 auto conditions(getProperty
<uno::Sequence
<beans::NamedValue
>>(xStyle1
, "ParaStyleConditions"));
1246 CPPUNIT_ASSERT_EQUAL(sal_Int32(28), conditions
.getLength());
1247 CPPUNIT_ASSERT_EQUAL(OUString("TableHeader"), conditions
[0].Name
);
1248 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Addressee")), conditions
[0].Value
);
1249 CPPUNIT_ASSERT_EQUAL(OUString("Table"), conditions
[1].Name
);
1250 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Bibliography 1")), conditions
[1].Value
);
1251 CPPUNIT_ASSERT_EQUAL(OUString("Frame"), conditions
[2].Name
);
1252 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Bibliography Heading")), conditions
[2].Value
);
1253 CPPUNIT_ASSERT_EQUAL(OUString("Section"), conditions
[3].Name
);
1254 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Caption")), conditions
[3].Value
);
1255 CPPUNIT_ASSERT_EQUAL(OUString("Footnote"), conditions
[4].Name
);
1256 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Salutation")), conditions
[4].Value
);
1257 CPPUNIT_ASSERT_EQUAL(OUString("Endnote"), conditions
[5].Name
);
1258 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Contents 1")), conditions
[5].Value
);
1259 CPPUNIT_ASSERT_EQUAL(OUString("Header"), conditions
[6].Name
);
1260 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Contents 2")), conditions
[6].Value
);
1261 CPPUNIT_ASSERT_EQUAL(OUString("Footer"), conditions
[7].Name
);
1262 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Contents 3")), conditions
[7].Value
);
1263 CPPUNIT_ASSERT_EQUAL(OUString("OutlineLevel1"), conditions
[8].Name
);
1264 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Contents 4")), conditions
[8].Value
);
1265 CPPUNIT_ASSERT_EQUAL(OUString("OutlineLevel2"), conditions
[9].Name
);
1266 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Contents 5")), conditions
[9].Value
);
1267 CPPUNIT_ASSERT_EQUAL(OUString("OutlineLevel3"), conditions
[10].Name
);
1268 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Contents 6")), conditions
[10].Value
);
1269 CPPUNIT_ASSERT_EQUAL(OUString("OutlineLevel4"), conditions
[11].Name
);
1270 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Contents 7")), conditions
[11].Value
);
1271 CPPUNIT_ASSERT_EQUAL(OUString("OutlineLevel5"), conditions
[12].Name
);
1272 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Contents 8")), conditions
[12].Value
);
1273 CPPUNIT_ASSERT_EQUAL(OUString("OutlineLevel6"), conditions
[13].Name
);
1274 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Contents 9")), conditions
[13].Value
);
1275 CPPUNIT_ASSERT_EQUAL(OUString("OutlineLevel7"), conditions
[14].Name
);
1276 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Contents 10")), conditions
[14].Value
);
1277 CPPUNIT_ASSERT_EQUAL(OUString("OutlineLevel8"), conditions
[15].Name
);
1278 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Contents Heading")), conditions
[15].Value
);
1279 CPPUNIT_ASSERT_EQUAL(OUString("OutlineLevel9"), conditions
[16].Name
);
1280 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Standard")), conditions
[16].Value
);
1281 CPPUNIT_ASSERT_EQUAL(OUString("OutlineLevel10"), conditions
[17].Name
);
1282 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Drawing")), conditions
[17].Value
);
1283 CPPUNIT_ASSERT_EQUAL(OUString("NumberingLevel1"), conditions
[18].Name
);
1284 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Endnote")), conditions
[18].Value
);
1285 CPPUNIT_ASSERT_EQUAL(OUString("NumberingLevel2"), conditions
[19].Name
);
1286 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("First line indent")), conditions
[19].Value
);
1287 CPPUNIT_ASSERT_EQUAL(OUString("NumberingLevel3"), conditions
[20].Name
);
1288 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Footer")), conditions
[20].Value
);
1289 CPPUNIT_ASSERT_EQUAL(OUString("NumberingLevel4"), conditions
[21].Name
);
1290 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Footer left")), conditions
[21].Value
);
1291 CPPUNIT_ASSERT_EQUAL(OUString("NumberingLevel5"), conditions
[22].Name
);
1292 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Footer right")), conditions
[22].Value
);
1293 CPPUNIT_ASSERT_EQUAL(OUString("NumberingLevel6"), conditions
[23].Name
);
1294 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Footnote")), conditions
[23].Value
);
1295 CPPUNIT_ASSERT_EQUAL(OUString("NumberingLevel7"), conditions
[24].Name
);
1296 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Frame contents")), conditions
[24].Value
);
1297 CPPUNIT_ASSERT_EQUAL(OUString("NumberingLevel8"), conditions
[25].Name
);
1298 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Hanging indent")), conditions
[25].Value
);
1299 CPPUNIT_ASSERT_EQUAL(OUString("NumberingLevel9"), conditions
[26].Name
);
1300 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Header")), conditions
[26].Value
);
1301 CPPUNIT_ASSERT_EQUAL(OUString("NumberingLevel10"), conditions
[27].Name
);
1302 CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Header left")), conditions
[27].Value
);
1305 DECLARE_ODFEXPORT_TEST(testTextframeTransparentShadow
, "textframe-transparent-shadow.odt")
1307 CPPUNIT_ASSERT_EQUAL(1, getShapes());
1308 CPPUNIT_ASSERT_EQUAL(1, getPages());
1309 uno::Reference
<drawing::XShape
> xPicture
= getShape(1);
1310 // ODF stores opacity of 75%, that means 25% transparency.
1311 CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty
<sal_Int32
>(xPicture
, "ShadowTransparence"));
1314 DECLARE_ODFEXPORT_TEST(testRelhPage
, "relh-page.odt")
1316 CPPUNIT_ASSERT_EQUAL(1, getShapes());
1317 CPPUNIT_ASSERT_EQUAL(1, getPages());
1318 uno::Reference
<drawing::XShape
> xTextFrame
= getShape(1);
1319 // This was text::RelOrientation::FRAME (the default), RelativeHeightRelation was not handled in xmloff.
1320 CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME
, getProperty
<sal_Int16
>(xTextFrame
, "RelativeHeightRelation"));
1321 // Make sure rel-height-rel doesn't affect width.
1322 CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME
, getProperty
<sal_Int16
>(xTextFrame
, "RelativeWidthRelation"));
1324 // This was 2601, 20% height was relative from margin, not page.
1325 CPPUNIT_ASSERT_EQUAL(sal_Int32(3168), parseDump("/root/page/body/txt/anchored/fly/infos/bounds", "height").toInt32());
1328 DECLARE_ODFEXPORT_TEST(testRelhPageTdf80282
, "relh-page-tdf80282.odt")
1330 CPPUNIT_ASSERT_EQUAL(1, getShapes());
1331 CPPUNIT_ASSERT_EQUAL(1, getPages());
1332 uno::Reference
<drawing::XShape
> xTextFrame
= getShape(1);
1333 CPPUNIT_ASSERT_EQUAL_MESSAGE("Height", sal_Int32(8391), parseDump("//anchored/fly/infos/bounds", "height").toInt32());
1334 CPPUNIT_ASSERT_EQUAL_MESSAGE("Width", sal_Int32(5953), parseDump("//anchored/fly/infos/bounds", "width").toInt32());
1337 DECLARE_ODFEXPORT_TEST(testRelwPage
, "relw-page.odt")
1339 CPPUNIT_ASSERT_EQUAL(1, getShapes());
1340 CPPUNIT_ASSERT_EQUAL(1, getPages());
1341 uno::Reference
<drawing::XShape
> xTextFrame
= getShape(1);
1342 // This was text::RelOrientation::FRAME (the default), RelativeWidthRelation was not handled in xmloff.
1343 CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME
, getProperty
<sal_Int16
>(xTextFrame
, "RelativeWidthRelation"));
1344 // Make sure rel-width-rel doesn't affect height.
1345 CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME
, getProperty
<sal_Int16
>(xTextFrame
, "RelativeHeightRelation"));
1347 // This was 3762, 40% width was relative from margin, not page.
1348 CPPUNIT_ASSERT_EQUAL(sal_Int32(4896), parseDump("/root/page/body/txt/anchored/fly/infos/bounds", "width").toInt32());
1351 DECLARE_ODFEXPORT_TEST(testTextFrameVertAdjust
, "textframe-vertadjust.odt")
1353 CPPUNIT_ASSERT_EQUAL(3, getShapes());
1354 CPPUNIT_ASSERT_EQUAL(1, getPages());
1355 // Test import/export of new frame attribute called TextVerticalAdjust
1357 // 1st frame's context is adjusted to the top
1358 uno::Reference
<beans::XPropertySet
> xFrame(getTextFrameByName("Rectangle 1"), uno::UNO_QUERY
);
1359 CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP
, getProperty
<drawing::TextVerticalAdjust
>(xFrame
, "TextVerticalAdjust"));
1360 // 2nd frame's context is adjusted to the center
1361 xFrame
.set(getTextFrameByName("Rectangle 2"), uno::UNO_QUERY
);
1362 CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_CENTER
, getProperty
<drawing::TextVerticalAdjust
>(xFrame
, "TextVerticalAdjust"));
1363 // 3rd frame's context is adjusted to the bottom
1364 xFrame
.set(getTextFrameByName("Rectangle 3"), uno::UNO_QUERY
);
1365 CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM
, getProperty
<drawing::TextVerticalAdjust
>(xFrame
, "TextVerticalAdjust"));
1368 DECLARE_ODFEXPORT_TEST(testTdf111891_frameVertStyle
, "tdf111891_frameVertStyle.odt")
1370 CPPUNIT_ASSERT_EQUAL(1, getShapes());
1371 CPPUNIT_ASSERT_EQUAL(1, getPages());
1372 uno::Reference
<beans::XPropertySet
> xFrame(getShape(1), uno::UNO_QUERY
);
1373 CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM
, getProperty
<drawing::TextVerticalAdjust
>(xFrame
, "TextVerticalAdjust"));
1376 DECLARE_ODFEXPORT_TEST(testShapeRelsize
, "shape-relsize.odt")
1378 CPPUNIT_ASSERT_EQUAL(1, getShapes());
1379 CPPUNIT_ASSERT_EQUAL(1, getPages());
1380 uno::Reference
<drawing::XShape
> xShape
= getShape(1);
1381 // These were all 0, as style:rel-width/height was ignored on import for shapes.
1382 CPPUNIT_ASSERT_EQUAL(sal_Int16(40), getProperty
<sal_Int16
>(xShape
, "RelativeWidth"));
1383 CPPUNIT_ASSERT_EQUAL(sal_Int16(20), getProperty
<sal_Int16
>(xShape
, "RelativeHeight"));
1385 // Relation was "page" for both width and height, should be "paragraph" for width.
1386 CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME
, getProperty
<sal_Int16
>(xShape
, "RelativeWidthRelation"));
1387 // And make sure that height stays "page".
1388 CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME
, getProperty
<sal_Int16
>(xShape
, "RelativeHeightRelation"));
1391 DECLARE_ODFEXPORT_TEST(testTextboxRoundedCorners
, "textbox-rounded-corners.odt")
1393 CPPUNIT_ASSERT_EQUAL(1, getShapes());
1394 CPPUNIT_ASSERT_EQUAL(1, getPages());
1395 uno::Reference
<drawing::XShape
> xShape
= getShape(1);
1396 comphelper::SequenceAsHashMap
aCustomShapeGeometry(getProperty
< uno::Sequence
<beans::PropertyValue
> >(xShape
, "CustomShapeGeometry"));
1398 // Test that the shape is a rounded rectangle.
1399 CPPUNIT_ASSERT_EQUAL(OUString("round-rectangle"), aCustomShapeGeometry
["Type"].get
<OUString
>());
1401 // The shape text should start with a table, with "a" in its A1 cell.
1402 uno::Reference
<text::XText
> xText
= uno::Reference
<text::XTextRange
>(xShape
, uno::UNO_QUERY_THROW
)->getText();
1403 uno::Reference
<text::XTextTable
> xTable(getParagraphOrTable(1, xText
), uno::UNO_QUERY
);
1404 uno::Reference
<text::XTextRange
> xCell(xTable
->getCellByName("A1"), uno::UNO_QUERY
);
1405 CPPUNIT_ASSERT_EQUAL(OUString("a"), xCell
->getString());
1407 // Table inside a textbox should be in the extension namespace.
1408 if (xmlDocUniquePtr pXmlDoc
= parseExport("content.xml"))
1409 // This failed, as draw:custom-shape had a table:table child.
1410 assertXPath(pXmlDoc
, "//draw:custom-shape/loext:table", "name", "Table1");
1413 // test that import whitespace collapsing is compatible with old docs
1414 DECLARE_ODFEXPORT_TEST(testWhitespace
, "whitespace.odt")
1416 CPPUNIT_ASSERT_EQUAL(4, getShapes());
1417 CPPUNIT_ASSERT_EQUAL(1, getPages());
1418 uno::Reference
<container::XEnumerationAccess
> xPara
;
1419 uno::Reference
<container::XEnumeration
> xPortions
;
1420 uno::Reference
<text::XTextRange
> xPortion
;
1421 xPara
.set(getParagraphOrTable(1), uno::UNO_QUERY
);
1422 xPortions
.set(xPara
->createEnumeration());
1423 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1424 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1425 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1426 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1427 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1428 CPPUNIT_ASSERT_EQUAL(OUString(" "), xPortion
->getString());
1429 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1430 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1431 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1432 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1434 xPara
.set(getParagraphOrTable(2), uno::UNO_QUERY
);
1435 xPortions
.set(xPara
->createEnumeration());
1436 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1437 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1438 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1439 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1440 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1441 CPPUNIT_ASSERT_EQUAL(OUString(" "), xPortion
->getString());
1442 CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/"), getProperty
<OUString
>(xPortion
, "HyperLinkURL"));
1443 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1444 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1445 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1446 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1448 xPara
.set(getParagraphOrTable(3), uno::UNO_QUERY
);
1449 xPortions
.set(xPara
->createEnumeration());
1450 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1451 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1452 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1453 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1454 CPPUNIT_ASSERT_EQUAL(OUString("Ruby"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1455 CPPUNIT_ASSERT_EQUAL(OUString(), xPortion
->getString());
1456 CPPUNIT_ASSERT_EQUAL(OUString("foo"), getProperty
<OUString
>(xPortion
, "RubyText"));
1457 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1458 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1459 CPPUNIT_ASSERT_EQUAL(OUString(" "), xPortion
->getString());
1460 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1461 CPPUNIT_ASSERT_EQUAL(OUString("Ruby"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1462 CPPUNIT_ASSERT_EQUAL(OUString(), xPortion
->getString());
1463 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1464 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1465 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1466 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1468 xPara
.set(getParagraphOrTable(4), uno::UNO_QUERY
);
1469 xPortions
.set(xPara
->createEnumeration());
1470 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1471 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1472 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1473 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1474 CPPUNIT_ASSERT_EQUAL(OUString("InContentMetadata"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1476 // what a stupid idea to require recursively enumerating this
1477 uno::Reference
<container::XEnumerationAccess
> xMeta(
1478 getProperty
<uno::Reference
<text::XTextContent
>>(xPortion
, "InContentMetadata"), uno::UNO_QUERY
);
1479 uno::Reference
<container::XEnumeration
> xMetaPortions
=
1480 xMeta
->createEnumeration();
1481 uno::Reference
<text::XTextRange
> xMP(xMetaPortions
->nextElement(), uno::UNO_QUERY
);
1482 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xMP
, "TextPortionType"));
1483 CPPUNIT_ASSERT_EQUAL(OUString(" "), xMP
->getString());
1484 CPPUNIT_ASSERT(!xMetaPortions
->hasMoreElements());
1486 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1487 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1488 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1489 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1491 xPara
.set(getParagraphOrTable(5), uno::UNO_QUERY
);
1492 xPortions
.set(xPara
->createEnumeration());
1493 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1494 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1495 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1496 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1497 CPPUNIT_ASSERT_EQUAL(OUString("TextField"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1499 // what a stupid idea to require recursively enumerating this
1500 uno::Reference
<container::XEnumerationAccess
> xMeta(
1501 getProperty
<uno::Reference
<text::XTextContent
>>(xPortion
, "TextField"), uno::UNO_QUERY
);
1502 uno::Reference
<container::XEnumeration
> xMetaPortions
=
1503 xMeta
->createEnumeration();
1504 uno::Reference
<text::XTextRange
> xMP(xMetaPortions
->nextElement(), uno::UNO_QUERY
);
1505 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xMP
, "TextPortionType"));
1506 CPPUNIT_ASSERT_EQUAL(OUString(" "), xMP
->getString());
1507 CPPUNIT_ASSERT(!xMetaPortions
->hasMoreElements());
1509 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1510 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1511 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1512 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1514 xPara
.set(getParagraphOrTable(7), uno::UNO_QUERY
);
1515 xPortions
.set(xPara
->createEnumeration());
1516 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1517 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1518 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1519 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1520 CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1521 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1522 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1523 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1524 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1526 xPara
.set(getParagraphOrTable(8), uno::UNO_QUERY
);
1527 xPortions
.set(xPara
->createEnumeration());
1528 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1529 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1530 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1531 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1532 CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1533 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1534 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1535 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1536 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1538 xPara
.set(getParagraphOrTable(9), uno::UNO_QUERY
);
1539 xPortions
.set(xPara
->createEnumeration());
1540 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1541 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1542 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1543 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1544 CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1545 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1546 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1547 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1548 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1550 xPara
.set(getParagraphOrTable(10), uno::UNO_QUERY
);
1551 uno::Reference
<container::XContentEnumerationAccess
> xCEA(xPara
, uno::UNO_QUERY
);
1552 uno::Reference
<container::XEnumeration
> xFrames(
1553 xCEA
->createContentEnumeration("com.sun.star.text.TextContent"));
1554 xFrames
->nextElement(); // one at-paragraph frame
1555 CPPUNIT_ASSERT(!xFrames
->hasMoreElements());
1556 xPortions
.set(xPara
->createEnumeration());
1557 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1558 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1559 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1560 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1562 xPara
.set(getParagraphOrTable(11), uno::UNO_QUERY
);
1563 xPortions
.set(xPara
->createEnumeration());
1564 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1565 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1566 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1567 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1568 CPPUNIT_ASSERT_EQUAL(OUString("Footnote"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1569 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1570 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1571 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1572 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1574 xPara
.set(getParagraphOrTable(12), uno::UNO_QUERY
);
1575 xPortions
.set(xPara
->createEnumeration());
1576 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1577 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1578 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1579 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1580 CPPUNIT_ASSERT_EQUAL(OUString("TextField"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1581 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1582 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1583 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1584 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1586 xPara
.set(getParagraphOrTable(13), uno::UNO_QUERY
);
1587 xPortions
.set(xPara
->createEnumeration());
1588 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1589 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1590 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1591 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1592 CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1593 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1594 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1595 CPPUNIT_ASSERT_EQUAL(OUString(" "), xPortion
->getString());
1596 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1597 CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1598 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1599 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1600 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1601 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1603 xPara
.set(getParagraphOrTable(15), uno::UNO_QUERY
);
1604 xPortions
.set(xPara
->createEnumeration());
1605 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1606 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1607 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1608 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1609 CPPUNIT_ASSERT_EQUAL(OUString("Bookmark"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1610 CPPUNIT_ASSERT(getProperty
<bool>(xPortion
, "IsCollapsed"));
1611 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1612 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1613 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1614 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1616 xPara
.set(getParagraphOrTable(16), uno::UNO_QUERY
);
1617 xPortions
.set(xPara
->createEnumeration());
1618 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1619 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1620 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1621 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1622 CPPUNIT_ASSERT_EQUAL(OUString("Bookmark"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1623 CPPUNIT_ASSERT(!getProperty
<bool>(xPortion
, "IsCollapsed"));
1624 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1625 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1626 CPPUNIT_ASSERT_EQUAL(OUString(" "), xPortion
->getString());
1627 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1628 CPPUNIT_ASSERT_EQUAL(OUString("Bookmark"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1629 CPPUNIT_ASSERT(!getProperty
<bool>(xPortion
, "IsCollapsed"));
1630 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1631 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1632 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1633 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1635 xPara
.set(getParagraphOrTable(17), uno::UNO_QUERY
);
1636 xPortions
.set(xPara
->createEnumeration());
1637 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1638 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1639 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1640 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1641 CPPUNIT_ASSERT_EQUAL(OUString("Redline"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1642 CPPUNIT_ASSERT(!getProperty
<bool>(xPortion
, "IsCollapsed"));
1643 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1644 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1645 CPPUNIT_ASSERT_EQUAL(OUString(" "), xPortion
->getString());
1646 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1647 CPPUNIT_ASSERT_EQUAL(OUString("Redline"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1648 CPPUNIT_ASSERT(!getProperty
<bool>(xPortion
, "IsCollapsed"));
1649 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1650 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1651 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1652 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1654 xPara
.set(getParagraphOrTable(18), uno::UNO_QUERY
);
1655 xPortions
.set(xPara
->createEnumeration());
1656 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1657 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1658 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1659 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1660 CPPUNIT_ASSERT_EQUAL(OUString("Redline"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1661 CPPUNIT_ASSERT(!getProperty
<bool>(xPortion
, "IsCollapsed"));
1662 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1663 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1664 CPPUNIT_ASSERT_EQUAL(OUString(" "), xPortion
->getString());
1665 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1666 CPPUNIT_ASSERT_EQUAL(OUString("Redline"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1667 CPPUNIT_ASSERT(!getProperty
<bool>(xPortion
, "IsCollapsed"));
1668 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1669 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1670 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1671 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1673 xPara
.set(getParagraphOrTable(19), uno::UNO_QUERY
);
1674 xPortions
.set(xPara
->createEnumeration());
1675 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1676 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1677 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1678 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1679 CPPUNIT_ASSERT_EQUAL(OUString("ReferenceMark"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1680 CPPUNIT_ASSERT(getProperty
<bool>(xPortion
, "IsCollapsed"));
1681 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1682 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1683 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1684 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1686 xPara
.set(getParagraphOrTable(20), uno::UNO_QUERY
);
1687 xPortions
.set(xPara
->createEnumeration());
1688 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1689 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1690 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1691 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1692 CPPUNIT_ASSERT_EQUAL(OUString("ReferenceMark"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1693 CPPUNIT_ASSERT(!getProperty
<bool>(xPortion
, "IsCollapsed"));
1694 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1695 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1696 CPPUNIT_ASSERT_EQUAL(OUString(" "), xPortion
->getString());
1697 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1698 CPPUNIT_ASSERT_EQUAL(OUString("ReferenceMark"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1699 CPPUNIT_ASSERT(!getProperty
<bool>(xPortion
, "IsCollapsed"));
1700 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1701 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1702 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1703 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1705 xPara
.set(getParagraphOrTable(21), uno::UNO_QUERY
);
1706 xPortions
.set(xPara
->createEnumeration());
1707 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1708 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1709 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1710 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1711 CPPUNIT_ASSERT_EQUAL(OUString("DocumentIndexMark"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1712 CPPUNIT_ASSERT(getProperty
<bool>(xPortion
, "IsCollapsed"));
1713 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1714 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1715 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1716 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1718 xPara
.set(getParagraphOrTable(22), uno::UNO_QUERY
);
1719 xPortions
.set(xPara
->createEnumeration());
1720 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1721 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1722 CPPUNIT_ASSERT_EQUAL(OUString("X "), xPortion
->getString());
1723 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1724 CPPUNIT_ASSERT_EQUAL(OUString("DocumentIndexMark"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1725 CPPUNIT_ASSERT(!getProperty
<bool>(xPortion
, "IsCollapsed"));
1726 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1727 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1728 CPPUNIT_ASSERT_EQUAL(OUString(" "), xPortion
->getString());
1729 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1730 CPPUNIT_ASSERT_EQUAL(OUString("DocumentIndexMark"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1731 CPPUNIT_ASSERT(!getProperty
<bool>(xPortion
, "IsCollapsed"));
1732 xPortion
.set(xPortions
->nextElement(), uno::UNO_QUERY
);
1733 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(xPortion
, "TextPortionType"));
1734 CPPUNIT_ASSERT_EQUAL(OUString(" X"), xPortion
->getString());
1735 CPPUNIT_ASSERT(!xPortions
->hasMoreElements());
1738 DECLARE_ODFEXPORT_TEST(testTdf136645
, "tdf136645.odt")
1740 CPPUNIT_ASSERT_EQUAL(1, getPages());
1742 // Without the fix in place, this would have failed with
1745 CPPUNIT_ASSERT_EQUAL(sal_Int32(2640), parseDump("/root/page/body/section/column[1]/body/infos/bounds", "width").toInt32());
1749 CPPUNIT_ASSERT_EQUAL(sal_Int32(6000), parseDump("/root/page/body/section/column[2]/body/infos/bounds", "width").toInt32());
1752 DECLARE_ODFEXPORT_TEST(testBtlrCell
, "btlr-cell.odt")
1754 CPPUNIT_ASSERT_EQUAL(1, getPages());
1755 // Without the accompanying fix in place, this test would have failed, as
1756 // the btlr text direction in the A1 cell was lost on ODF import and
1758 uno::Reference
<text::XTextTablesSupplier
> xSupplier(mxComponent
, uno::UNO_QUERY
);
1759 uno::Reference
<container::XNameAccess
> xTables
= xSupplier
->getTextTables();
1760 uno::Reference
<text::XTextTable
> xTable(xTables
->getByName("Table1"), uno::UNO_QUERY
);
1761 uno::Reference
<beans::XPropertySet
> xA1(xTable
->getCellByName("A1"), uno::UNO_QUERY
);
1762 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR
, getProperty
<sal_Int16
>(xA1
, "WritingMode"));
1764 uno::Reference
<beans::XPropertySet
> xB1(xTable
->getCellByName("B1"), uno::UNO_QUERY
);
1765 auto nActual
= getProperty
<sal_Int16
>(xB1
, "WritingMode");
1766 CPPUNIT_ASSERT(nActual
== text::WritingMode2::LR_TB
|| nActual
== text::WritingMode2::CONTEXT
);
1768 uno::Reference
<beans::XPropertySet
> xC1(xTable
->getCellByName("C1"), uno::UNO_QUERY
);
1769 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL
, getProperty
<sal_Int16
>(xC1
, "WritingMode"));
1772 DECLARE_ODFEXPORT_TEST(testBtlrFrame
, "btlr-frame.odt")
1774 CPPUNIT_ASSERT_EQUAL(1, getShapes());
1775 CPPUNIT_ASSERT_EQUAL(1, getPages());
1776 // Without the accompanying fix in place, this test would have failed, as
1777 // the btlr text direction in the text frame was lost on ODF import and
1779 uno::Reference
<beans::XPropertySet
> xTextFrame(getShape(1), uno::UNO_QUERY
);
1780 CPPUNIT_ASSERT(xTextFrame
.is());
1782 auto nActual
= getProperty
<sal_Int16
>(xTextFrame
, "WritingMode");
1783 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR
, nActual
);
1785 // Without the accompanying fix in place, this test would have failed, as the fly frame had
1786 // mbVertical==true, but mbVertLRBT==false, even if the writing direction in the doc model was
1788 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
1789 CPPUNIT_ASSERT(pTextDoc
);
1791 SwDoc
* pDoc
= pTextDoc
->GetDocShell()->GetDoc();
1792 CPPUNIT_ASSERT(pDoc
);
1794 SwRootFrame
* pLayout
= pDoc
->getIDocumentLayoutAccess().GetCurrentLayout();
1795 CPPUNIT_ASSERT(pLayout
);
1797 SwFrame
* pPageFrame
= pLayout
->GetLower();
1798 CPPUNIT_ASSERT(pPageFrame
);
1799 CPPUNIT_ASSERT(pPageFrame
->IsPageFrame());
1801 SwFrame
* pBodyFrame
= pPageFrame
->GetLower();
1802 CPPUNIT_ASSERT(pBodyFrame
);
1803 CPPUNIT_ASSERT(pBodyFrame
->IsBodyFrame());
1805 SwFrame
* pBodyTextFrame
= pBodyFrame
->GetLower();
1806 CPPUNIT_ASSERT(pBodyTextFrame
);
1807 CPPUNIT_ASSERT(pBodyTextFrame
->IsTextFrame());
1809 CPPUNIT_ASSERT(pBodyTextFrame
->GetDrawObjs());
1810 const SwSortedObjs
& rAnchored
= *pBodyTextFrame
->GetDrawObjs();
1811 CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rAnchored
.size());
1813 auto* pFlyFrame
= dynamic_cast<SwFlyFrame
*>(rAnchored
[0]);
1814 CPPUNIT_ASSERT(pFlyFrame
);
1815 CPPUNIT_ASSERT(pFlyFrame
->IsVertLRBT());
1818 // Not yet exported, don't modify the doc model for test purposes.
1821 // Make sure that btlr -> tbrl transition clears the "BT" flag.
1822 xTextFrame
->setPropertyValue("WritingMode", uno::Any(text::WritingMode2::TB_LR
));
1823 pFlyFrame
= dynamic_cast<SwFlyFrame
*>(rAnchored
[0]);
1824 CPPUNIT_ASSERT(pFlyFrame
);
1825 CPPUNIT_ASSERT(!pFlyFrame
->IsVertLRBT());
1828 CPPUNIT_TEST_FIXTURE(Test
, testTdf129520
)
1830 loadAndReload("tdf129520.docx");
1831 CPPUNIT_ASSERT_EQUAL(1, getPages());
1832 CPPUNIT_ASSERT_EQUAL(OUString("M"), getParagraph(1)->getString());
1834 // Without this fix in place, this test would have failed with
1837 CPPUNIT_ASSERT_EQUAL(OUString("Ma"), getParagraph(2)->getString());
1838 CPPUNIT_ASSERT_EQUAL(OUString("1815"), getParagraph(3)->getString());
1841 DECLARE_ODFEXPORT_TEST(testFdo86963
, "fdo86963.odt")
1843 CPPUNIT_ASSERT_EQUAL(1, getPages());
1844 // Export of this document failed with beans::UnknownPropertyException.
1845 CPPUNIT_ASSERT_EQUAL(1, getShapes());
1848 // Check for correct header/footer with special first page with TOC inside:
1849 // - DECLARE_ODFEXPORT_TEST(testTdf118393, "tdf118393.odt")
1850 // - DECLARE_OOXMLEXPORT_TEST(testTdf118393, "tdf118393.odt")
1851 DECLARE_ODFEXPORT_TEST(testTdf118393
, "tdf118393.odt")
1853 CPPUNIT_ASSERT_EQUAL( 7, getPages() );
1855 // First page has no header/footer
1857 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1860 xmlXPathObjectPtr pXmlPage1Header
= getXPathNode(pXmlDoc
, "/root/page[1]/header");
1861 CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlPage1Header
->nodesetval
));
1863 xmlXPathObjectPtr pXmlPage1Footer
= getXPathNode(pXmlDoc
, "/root/page[1]/footer");
1864 CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlPage1Footer
->nodesetval
));
1866 // check second page in the same way
1867 xmlXPathObjectPtr pXmlPage2Header
= getXPathNode(pXmlDoc
, "/root/page[2]/header");
1868 CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlPage2Header
->nodesetval
));
1870 xmlXPathObjectPtr pXmlPage2Footer
= getXPathNode(pXmlDoc
, "/root/page[2]/footer");
1871 CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlPage2Footer
->nodesetval
));
1874 // All other pages should have header/footer
1876 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[2]/header/txt/text()"));
1877 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[2]/footer/txt/text()"));
1879 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[3]/header/txt/text()"));
1880 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[3]/footer/txt/text()"));
1882 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[4]/header/txt/text()"));
1883 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[4]/footer/txt/text()"));
1885 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[5]/header/txt/text()"));
1886 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[5]/footer/txt/text()"));
1888 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[6]/header/txt/text()"));
1889 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[6]/footer/txt/text()"));
1891 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[7]/header/txt/text()"));
1892 CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[7]/footer/txt/text()"));
1895 DECLARE_ODFEXPORT_TEST(testTdf135338_firstLeftPageFooter
, "tdf135338_firstLeftPageFooter.odt")
1897 CPPUNIT_ASSERT_EQUAL(6, getPages());
1898 // The first page is a left page only style, but it should still show the first page footer
1899 // instead of the left footer text "EVEN/LEFT (Left page only)"
1900 CPPUNIT_ASSERT_EQUAL(OUString("First (Left page only)"), parseDump("/root/page[2]/footer/txt/text()"));
1903 DECLARE_ODFEXPORT_TEST(testGerrit13858
, "gerrit13858.odt")
1905 CPPUNIT_ASSERT_EQUAL(1, getShapes());
1906 CPPUNIT_ASSERT_EQUAL(1, getPages());
1907 // Just make sure the output is valid.
1909 DECLARE_ODFEXPORT_TEST(testOdtBorderTypes
, "border_types.odt")
1911 CPPUNIT_ASSERT_EQUAL(1, getPages());
1912 static const sal_Int32 lineStyles
[] = { 0, 1, 2, 14, 16, 17, 3, 15 };
1913 uno::Reference
<text::XTextDocument
> textDocument(mxComponent
, uno::UNO_QUERY
);
1914 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(textDocument
->getText(), uno::UNO_QUERY
);
1915 // list of paragraphs
1916 uno::Reference
<container::XEnumeration
> xParaEnum
= xParaEnumAccess
->createEnumeration();
1919 uno::Reference
<lang::XServiceInfo
> xServiceInfo
;
1920 if (xParaEnum
->nextElement() >>= xServiceInfo
)
1922 if (xServiceInfo
->supportsService("com.sun.star.text.TextTable"))
1924 uno::Reference
<table::XCellRange
> const xCellRange(xServiceInfo
, uno::UNO_QUERY_THROW
);
1926 for (sal_Int32 row
= 0; row
< 15; row
+= 2)
1928 uno::Reference
<table::XCell
> xCell
= xCellRange
->getCellByPosition(1, row
);
1929 uno::Reference
< beans::XPropertySet
> xPropSet(xCell
, uno::UNO_QUERY_THROW
);
1931 uno::Any aTopBorder
= xPropSet
->getPropertyValue("TopBorder");
1932 table::BorderLine2 aTopBorderLine
;
1933 if (aTopBorder
>>= aTopBorderLine
)
1935 sal_Int32 lineStyle
= aTopBorderLine
.LineStyle
;
1936 CPPUNIT_ASSERT_EQUAL(lineStyles
[row
/ 2], lineStyle
);
1938 } //end of the 'for' loop
1941 } while (xParaEnum
->hasMoreElements());
1944 DECLARE_ODFEXPORT_TEST(testMasterPageWithDrawingPage
, "sw_hatch.odt")
1946 CPPUNIT_ASSERT_EQUAL(1, getPages());
1947 uno::Reference
<container::XNameAccess
> xStyles(getStyles("PageStyles"));
1948 uno::Reference
<beans::XPropertySet
> xStyle(xStyles
->getByName("Standard"), uno::UNO_QUERY
);
1949 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH
, getProperty
<drawing::FillStyle
>(xStyle
, "FillStyle"));
1950 CPPUNIT_ASSERT_EQUAL(OUString("Blue -45 Degrees"), getProperty
<OUString
>(xStyle
, "FillHatchName"));
1951 CPPUNIT_ASSERT(!getProperty
<sal_Bool
>(xStyle
, "FillBackground"));
1952 CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty
<sal_Int16
>(xStyle
, "FillTransparence"));
1955 CPPUNIT_TEST_FIXTURE(Test
, testPageStyleBackgroundFullSizeOOo
)
1957 loadAndReload("pagestyle_background_ooo33.odt");
1958 CPPUNIT_ASSERT_EQUAL(3, getPages());
1959 xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml");
1961 assertXPath(pXmlDoc
,
1962 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
1963 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
1964 "]/style:drawing-page-properties", "background-size", "border");
1965 assertXPath(pXmlDoc
,
1966 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
1967 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
1968 "]/style:drawing-page-properties", "fill", "solid");
1969 assertXPath(pXmlDoc
,
1970 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
1971 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
1972 "]/style:drawing-page-properties", "fill-color", "#99ccff");
1973 assertXPath(pXmlDoc
,
1974 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
1975 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
1976 "]/style:drawing-page-properties", "opacity", "100%");
1978 assertXPath(pXmlDoc
,
1979 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
1980 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
1981 "]/style:drawing-page-properties", "background-size", "border");
1982 assertXPath(pXmlDoc
,
1983 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
1984 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
1985 "]/style:drawing-page-properties", "fill", "bitmap");
1986 assertXPath(pXmlDoc
,
1987 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
1988 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
1989 "]/style:drawing-page-properties", "repeat", "repeat");
1990 assertXPath(pXmlDoc
,
1991 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
1992 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
1993 "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
1995 assertXPath(pXmlDoc
,
1996 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
1997 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
1998 "]/style:drawing-page-properties", "background-size", "border");
1999 assertXPath(pXmlDoc
,
2000 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2001 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
2002 "]/style:drawing-page-properties", "fill", "bitmap");
2003 assertXPath(pXmlDoc
,
2004 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2005 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
2006 "]/style:drawing-page-properties", "repeat", "stretch");
2007 assertXPath(pXmlDoc
,
2008 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2009 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
2010 "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
2013 CPPUNIT_TEST_FIXTURE(Test
, testPageStyleBackgroundFullSizeLO64
)
2015 loadAndReload("pagestyle_background_lo64.odt");
2016 CPPUNIT_ASSERT_EQUAL(6, getPages());
2017 xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml");
2019 assertXPath(pXmlDoc
,
2020 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2021 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
2022 "]/style:drawing-page-properties", "background-size", "full");
2023 assertXPath(pXmlDoc
,
2024 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2025 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
2026 "]/style:drawing-page-properties", "fill", "solid");
2027 assertXPath(pXmlDoc
,
2028 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2029 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
2030 "]/style:drawing-page-properties", "fill-color", "#99ccff");
2031 assertXPath(pXmlDoc
,
2032 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2033 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
2034 "]/style:drawing-page-properties", "opacity", "100%");
2036 assertXPath(pXmlDoc
,
2037 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2038 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
2039 "]/style:drawing-page-properties", "background-size", "full");
2040 assertXPath(pXmlDoc
,
2041 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2042 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
2043 "]/style:drawing-page-properties", "fill", "bitmap");
2044 assertXPath(pXmlDoc
,
2045 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2046 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
2047 "]/style:drawing-page-properties", "repeat", "repeat");
2048 assertXPath(pXmlDoc
,
2049 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2050 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
2051 "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
2053 assertXPath(pXmlDoc
,
2054 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2055 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
2056 "]/style:drawing-page-properties", "background-size", "border");
2057 assertXPath(pXmlDoc
,
2058 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2059 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
2060 "]/style:drawing-page-properties", "fill", "bitmap");
2061 assertXPath(pXmlDoc
,
2062 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2063 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
2064 "]/style:drawing-page-properties", "repeat", "stretch");
2065 assertXPath(pXmlDoc
,
2066 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2067 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
2068 "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
2070 assertXPath(pXmlDoc
,
2071 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2072 "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
2073 "]/style:drawing-page-properties", "background-size", "border");
2074 assertXPath(pXmlDoc
,
2075 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2076 "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
2077 "]/style:drawing-page-properties", "fill", "bitmap");
2078 assertXPath(pXmlDoc
,
2079 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2080 "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
2081 "]/style:drawing-page-properties", "repeat", "no-repeat");
2082 assertXPath(pXmlDoc
,
2083 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2084 "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
2085 "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
2087 assertXPath(pXmlDoc
,
2088 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2089 "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
2090 "]/style:drawing-page-properties", "background-size", "full");
2091 assertXPath(pXmlDoc
,
2092 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2093 "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
2094 "]/style:drawing-page-properties", "fill", "gradient");
2095 assertXPath(pXmlDoc
,
2096 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2097 "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
2098 "]/style:drawing-page-properties", "gradient-step-count", "0");
2099 assertXPath(pXmlDoc
,
2100 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2101 "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
2102 "]/style:drawing-page-properties", "opacity", "100%");
2104 assertXPath(pXmlDoc
,
2105 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2106 "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
2107 "]/style:drawing-page-properties", "background-size", "full");
2108 assertXPath(pXmlDoc
,
2109 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2110 "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
2111 "]/style:drawing-page-properties", "fill", "hatch");
2112 assertXPath(pXmlDoc
,
2113 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2114 "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
2115 "]/style:drawing-page-properties", "fill-hatch-solid", "false");
2116 assertXPath(pXmlDoc
,
2117 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2118 "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
2119 "]/style:drawing-page-properties", "opacity", "100%");
2122 CPPUNIT_TEST_FIXTURE(Test
, testPageStyleBackgroundFullSizeLO70
)
2124 loadAndReload("pagestyle_background_lo70.odt");
2125 CPPUNIT_ASSERT_EQUAL(6, getPages());
2126 xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml");
2128 assertXPath(pXmlDoc
,
2129 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2130 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
2131 "]/style:drawing-page-properties", "background-size", "full");
2132 assertXPath(pXmlDoc
,
2133 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2134 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
2135 "]/style:drawing-page-properties", "fill", "solid");
2136 assertXPath(pXmlDoc
,
2137 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2138 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
2139 "]/style:drawing-page-properties", "fill-color", "#99ccff");
2140 assertXPath(pXmlDoc
,
2141 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2142 "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
2143 "]/style:drawing-page-properties", "opacity", "100%");
2145 assertXPath(pXmlDoc
,
2146 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2147 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
2148 "]/style:drawing-page-properties", "background-size", "full");
2149 assertXPath(pXmlDoc
,
2150 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2151 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
2152 "]/style:drawing-page-properties", "fill", "bitmap");
2153 assertXPath(pXmlDoc
,
2154 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2155 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
2156 "]/style:drawing-page-properties", "repeat", "repeat");
2157 assertXPath(pXmlDoc
,
2158 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2159 "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
2160 "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
2162 assertXPath(pXmlDoc
,
2163 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2164 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
2165 "]/style:drawing-page-properties", "background-size", "border");
2166 assertXPath(pXmlDoc
,
2167 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2168 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
2169 "]/style:drawing-page-properties", "fill", "bitmap");
2170 assertXPath(pXmlDoc
,
2171 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2172 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
2173 "]/style:drawing-page-properties", "repeat", "stretch");
2174 assertXPath(pXmlDoc
,
2175 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2176 "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
2177 "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
2179 assertXPath(pXmlDoc
,
2180 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2181 "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
2182 "]/style:drawing-page-properties", "background-size", "border");
2183 assertXPath(pXmlDoc
,
2184 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2185 "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
2186 "]/style:drawing-page-properties", "fill", "bitmap");
2187 assertXPath(pXmlDoc
,
2188 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2189 "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
2190 "]/style:drawing-page-properties", "repeat", "no-repeat");
2191 assertXPath(pXmlDoc
,
2192 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2193 "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
2194 "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
2196 assertXPath(pXmlDoc
,
2197 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2198 "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
2199 "]/style:drawing-page-properties", "background-size", "full");
2200 assertXPath(pXmlDoc
,
2201 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2202 "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
2203 "]/style:drawing-page-properties", "fill", "gradient");
2204 assertXPath(pXmlDoc
,
2205 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2206 "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
2207 "]/style:drawing-page-properties", "gradient-step-count", "0");
2208 assertXPath(pXmlDoc
,
2209 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2210 "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
2211 "]/style:drawing-page-properties", "opacity", "100%");
2213 assertXPath(pXmlDoc
,
2214 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2215 "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
2216 "]/style:drawing-page-properties", "background-size", "full");
2217 assertXPath(pXmlDoc
,
2218 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2219 "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
2220 "]/style:drawing-page-properties", "fill", "hatch");
2221 assertXPath(pXmlDoc
,
2222 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2223 "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
2224 "]/style:drawing-page-properties", "fill-hatch-solid", "false");
2225 assertXPath(pXmlDoc
,
2226 "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
2227 "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
2228 "]/style:drawing-page-properties", "opacity", "100%");
2231 CPPUNIT_TEST_FIXTURE(Test
, testFillBitmapUnused
)
2233 loadAndReload("fillbitmap3.odt");
2234 CPPUNIT_ASSERT_EQUAL(4, getShapes());
2235 CPPUNIT_ASSERT_EQUAL(1, getPages());
2236 // nav_5f_home and all its references are completely gone
2237 xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml");
2240 assertXPath(pXmlDoc
,
2241 "/office:document-styles/office:styles/style:style[@style:name='Text_20_body']/loext:graphic-properties", "fill", "solid");
2242 assertXPath(pXmlDoc
,
2243 "/office:document-styles/office:styles/style:style[@style:name='Text_20_body']/loext:graphic-properties", "fill-color", "#c0c0c0");
2244 assertXPath(pXmlDoc
,
2245 "/office:document-styles/office:styles/style:style[@style:name='Text_20_body']/loext:graphic-properties[@draw:fill-image-name]", 0);
2247 // page style page-layout
2248 assertXPath(pXmlDoc
,
2249 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm1']/style:page-layout-properties", "fill", "bitmap");
2250 assertXPath(pXmlDoc
,
2251 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm1']/style:page-layout-properties", "fill-image-name", "nav_5f_up");
2252 assertXPath(pXmlDoc
,
2253 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm1']/style:header-style/style:header-footer-properties", "fill", "bitmap");
2254 assertXPath(pXmlDoc
,
2255 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm1']/style:header-style/style:header-footer-properties", "fill-image-name", "nav_5f_up");
2256 assertXPath(pXmlDoc
,
2257 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm1']/style:footer-style/style:header-footer-properties", "fill", "bitmap");
2258 assertXPath(pXmlDoc
,
2259 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm1']/style:footer-style/style:header-footer-properties", "fill-image-name", "nav_5f_up");
2261 assertXPath(pXmlDoc
,
2262 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm2']/style:page-layout-properties", "fill", "solid");
2263 assertXPath(pXmlDoc
,
2264 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm2']/style:page-layout-properties[@draw:fill-image-name]", 0);
2265 assertXPath(pXmlDoc
,
2266 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm2']/style:header-style/style:header-footer-properties", "fill", "solid");
2267 assertXPath(pXmlDoc
,
2268 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm2']/style:header-style/style:header-footer-properties[@draw:fill-image-name]", 0);
2269 assertXPath(pXmlDoc
,
2270 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm2']/style:footer-style/style:header-footer-properties", "fill", "solid");
2271 assertXPath(pXmlDoc
,
2272 "/office:document-styles/office:automatic-styles/style:page-layout[@style:name='Mpm2']/style:footer-style/style:header-footer-properties[@draw:fill-image-name]", 0);
2274 // page style drawing-page
2275 assertXPath(pXmlDoc
,
2276 "/office:document-styles/office:automatic-styles/style:style[@style:name='Mdp1']/style:drawing-page-properties", "fill", "bitmap");
2277 assertXPath(pXmlDoc
,
2278 "/office:document-styles/office:automatic-styles/style:style[@style:name='Mdp1']/style:drawing-page-properties", "fill-image-name", "nav_5f_up");
2279 assertXPath(pXmlDoc
,
2280 "/office:document-styles/office:automatic-styles/style:style[@style:name='Mdp2']/style:drawing-page-properties", "fill", "solid");
2281 assertXPath(pXmlDoc
,
2282 "/office:document-styles/office:automatic-styles/style:style[@style:name='Mdp2']/style:drawing-page-properties", "fill-color", "#c0c0c0");
2283 assertXPath(pXmlDoc
,
2284 "/office:document-styles/office:automatic-styles/style:style[@style:name='Mdp2']/style:drawing-page-properties[@draw:fill-image-name]", 0);
2287 assertXPath(pXmlDoc
,
2288 "/office:document-styles/office:styles/draw:fill-image", 1);
2289 assertXPath(pXmlDoc
,
2290 "/office:document-styles/office:styles/draw:fill-image", "name", "nav_5f_up");
2293 DECLARE_ODFEXPORT_TEST(testCellUserDefineAttr
, "userdefattr-tablecell.odt")
2295 CPPUNIT_ASSERT_EQUAL(1, getPages());
2296 uno::Reference
<text::XTextTable
> xTable(getParagraphOrTable(1), uno::UNO_QUERY
);
2297 uno::Reference
<table::XCell
> const xCellA1(xTable
->getCellByName("A1"), uno::UNO_SET_THROW
);
2298 uno::Reference
<table::XCell
> const xCellB1(xTable
->getCellByName("B1"), uno::UNO_SET_THROW
);
2299 uno::Reference
<table::XCell
> const xCellC1(xTable
->getCellByName("C1"), uno::UNO_SET_THROW
);
2300 getUserDefineAttribute(uno::Any(xCellA1
), "proName", "v1");
2301 getUserDefineAttribute(uno::Any(xCellB1
), "proName", "v2");
2302 getUserDefineAttribute(uno::Any(xCellC1
), "proName", "v3");
2305 DECLARE_ODFEXPORT_TEST(testEmbeddedPdf
, "embedded-pdf.odt")
2307 auto pPdfium
= vcl::pdf::PDFiumLibrary::get();
2313 CPPUNIT_ASSERT_EQUAL(1, getShapes());
2314 CPPUNIT_ASSERT_EQUAL(1, getPages());
2315 uno::Reference
<drawing::XShape
> xShape
= getShape(1);
2316 // This failed, pdf+png replacement graphics pair didn't survive an ODT roundtrip.
2317 auto xReplacementGraphic
= getProperty
<uno::Reference
<graphic::XGraphic
>>(xShape
, "ReplacementGraphic");
2318 CPPUNIT_ASSERT(xReplacementGraphic
.is());
2320 auto xGraphic
= getProperty
<uno::Reference
<graphic::XGraphic
>>(xShape
, "Graphic");
2321 CPPUNIT_ASSERT(xGraphic
.is());
2322 // This was image/x-vclgraphic, not exposing the info that the image is a PDF one.
2323 CPPUNIT_ASSERT_EQUAL(OUString("application/pdf"), getProperty
<OUString
>(xGraphic
, "MimeType"));
2327 uno::Sequence
<uno::Any
> aArgs
{ uno::Any(maTempFile
.GetURL()) };
2328 uno::Reference
<container::XNameAccess
> xNameAccess(m_xSFactory
->createInstanceWithArguments("com.sun.star.packages.zip.ZipFileAccess", aArgs
), uno::UNO_QUERY
);
2329 bool bHasBitmap
= false;
2330 const uno::Sequence
<OUString
> aNames
= xNameAccess
->getElementNames();
2331 for (const auto& rElementName
: aNames
)
2333 if (rElementName
.startsWith("Pictures") && rElementName
.endsWith("png"))
2339 // This failed, replacement was an svm file.
2340 CPPUNIT_ASSERT(bHasBitmap
);
2344 DECLARE_ODFEXPORT_TEST(testTableStyles1
, "table_styles_1.odt")
2346 CPPUNIT_ASSERT_EQUAL(1, getPages());
2347 // Table styles basic graphic test.
2348 // Doesn't cover all attributes.
2349 uno::Reference
<style::XStyleFamiliesSupplier
> XFamiliesSupplier(mxComponent
, uno::UNO_QUERY
);
2350 uno::Reference
<container::XNameAccess
> xFamilies(XFamiliesSupplier
->getStyleFamilies());
2351 uno::Reference
<container::XNameAccess
> xCellFamily(xFamilies
->getByName("CellStyles"), uno::UNO_QUERY
);
2352 uno::Reference
<beans::XPropertySet
> xCell1Style
;
2353 xCellFamily
->getByName("Test style.1") >>= xCell1Style
;
2355 sal_Int32 nInt32
= 0xF0F0F0;
2356 table::BorderLine2 oBorder
;
2358 CPPUNIT_ASSERT_EQUAL(Color(0xCC0000), getProperty
<Color
>(xCell1Style
, "BackColor"));
2359 xCell1Style
->getPropertyValue("WritingMode") >>= nInt32
;
2360 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), nInt32
);
2361 xCell1Style
->getPropertyValue("VertOrient") >>= nInt32
;
2362 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nInt32
);
2363 xCell1Style
->getPropertyValue("BorderDistance") >>= nInt32
;
2364 CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32
);
2365 xCell1Style
->getPropertyValue("LeftBorderDistance") >>= nInt32
;
2366 CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32
);
2367 xCell1Style
->getPropertyValue("RightBorderDistance") >>= nInt32
;
2368 CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32
);
2369 xCell1Style
->getPropertyValue("TopBorderDistance") >>= nInt32
;
2370 CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32
);
2371 xCell1Style
->getPropertyValue("BottomBorderDistance") >>= nInt32
;
2372 CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32
);
2373 xCell1Style
->getPropertyValue("RightBorder") >>= oBorder
;
2374 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), oBorder
.Color
);
2375 xCell1Style
->getPropertyValue("LeftBorder") >>= oBorder
;
2376 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(ColorTransparency
, oBorder
.Color
));
2377 xCell1Style
->getPropertyValue("TopBorder") >>= oBorder
;
2378 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(ColorTransparency
, oBorder
.Color
));
2379 xCell1Style
->getPropertyValue("BottomBorder") >>= oBorder
;
2380 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(ColorTransparency
, oBorder
.Color
));
2383 DECLARE_ODFEXPORT_TEST(testTableStyles2
, "table_styles_2.odt")
2385 CPPUNIT_ASSERT_EQUAL(1, getPages());
2386 // Table styles paragraph and char tests
2387 // Doesn't cover all attributes.
2388 // Problem: underline for table autoformat doesn't work.
2389 uno::Reference
<style::XStyleFamiliesSupplier
> XFamiliesSupplier(mxComponent
, uno::UNO_QUERY
);
2390 uno::Reference
<container::XNameAccess
> xFamilies(XFamiliesSupplier
->getStyleFamilies());
2391 uno::Reference
<container::XNameAccess
> xTableFamily(xFamilies
->getByName("TableStyles"), uno::UNO_QUERY
);
2392 uno::Reference
<container::XNameAccess
> xTableStyle(xTableFamily
->getByName("Test style2"), uno::UNO_QUERY
);
2393 uno::Reference
<beans::XPropertySet
> xCell1Style
;
2397 sal_Int16 nInt16
= 0xF0;
2398 sal_Int32 nInt32
= 0xF0F0F0;
2400 awt::FontSlant eCharPosture
;
2403 xTableStyle
->getByName("first-row-start-column") >>= xCell1Style
;
2404 xCell1Style
->getPropertyValue("ParaAdjust") >>= nInt32
;
2405 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nInt32
);
2406 CPPUNIT_ASSERT_EQUAL(Color(0xFF6600), getProperty
<Color
>(xCell1Style
, "CharColor"));
2407 xCell1Style
->getPropertyValue("CharContoured") >>= bBool
;
2408 CPPUNIT_ASSERT_EQUAL(false, bBool
);
2409 xCell1Style
->getPropertyValue("CharShadowed") >>= bBool
;
2410 CPPUNIT_ASSERT_EQUAL(true, bBool
);
2411 xCell1Style
->getPropertyValue("CharStrikeout") >>= nInt32
;
2412 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nInt32
);
2413 xCell1Style
->getPropertyValue("CharUnderline") >>= nInt32
;
2414 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nInt32
);
2415 // underline color is not working for table autoformats
2416 // xCell1Style->getPropertyValue("CharUnderlineHasColor") >>= bBool;
2417 // CPPUNIT_ASSERT_EQUAL(bool(false), bBool);
2418 // xCell1Style->getPropertyValue("CharUnderlineColor") >>= nInt64;
2419 // CPPUNIT_ASSERT_EQUAL(sal_Int64(-1), nInt64);
2421 xCell1Style
->getPropertyValue("CharHeight") >>= fFloat
;
2422 CPPUNIT_ASSERT_EQUAL(float(18.), fFloat
);
2423 xCell1Style
->getPropertyValue("CharWeight") >>= fFloat
;
2424 CPPUNIT_ASSERT_EQUAL(float(100.), fFloat
);
2425 xCell1Style
->getPropertyValue("CharPosture") >>= eCharPosture
;
2426 CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE
, eCharPosture
);
2427 xCell1Style
->getPropertyValue("CharFontName") >>= sString
;
2428 CPPUNIT_ASSERT_EQUAL(OUString("Courier"), sString
);
2429 xCell1Style
->getPropertyValue("CharFontStyleName") >>= sString
;
2430 CPPUNIT_ASSERT_EQUAL(OUString(), sString
);
2431 xCell1Style
->getPropertyValue("CharFontFamily") >>= nInt16
;
2432 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16
);
2433 xCell1Style
->getPropertyValue("CharFontPitch") >>= nInt16
;
2434 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nInt16
);
2436 xCell1Style
->getPropertyValue("CharHeightAsian") >>= fFloat
;
2437 CPPUNIT_ASSERT_EQUAL(float(18.), fFloat
);
2438 xCell1Style
->getPropertyValue("CharWeightAsian") >>= fFloat
;
2439 CPPUNIT_ASSERT_EQUAL(float(100.), fFloat
);
2440 xCell1Style
->getPropertyValue("CharPostureAsian") >>= eCharPosture
;
2441 CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE
, eCharPosture
);
2442 xCell1Style
->getPropertyValue("CharFontNameAsian") >>= sString
;
2443 CPPUNIT_ASSERT_EQUAL(OUString("Courier"), sString
);
2444 xCell1Style
->getPropertyValue("CharFontStyleNameAsian") >>= sString
;
2445 CPPUNIT_ASSERT_EQUAL(OUString("Regularna"), sString
);
2446 xCell1Style
->getPropertyValue("CharFontFamilyAsian") >>= nInt16
;
2447 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16
);
2448 xCell1Style
->getPropertyValue("CharFontPitchAsian") >>= nInt16
;
2449 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nInt16
);
2451 xCell1Style
->getPropertyValue("CharHeightComplex") >>= fFloat
;
2452 CPPUNIT_ASSERT_EQUAL(float(18.), fFloat
);
2453 xCell1Style
->getPropertyValue("CharWeightComplex") >>= fFloat
;
2454 CPPUNIT_ASSERT_EQUAL(float(100.), fFloat
);
2455 xCell1Style
->getPropertyValue("CharPostureComplex") >>= eCharPosture
;
2456 CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE
, eCharPosture
);
2457 xCell1Style
->getPropertyValue("CharFontNameComplex") >>= sString
;
2458 CPPUNIT_ASSERT_EQUAL(OUString("Courier"), sString
);
2459 xCell1Style
->getPropertyValue("CharFontStyleNameComplex") >>= sString
;
2460 CPPUNIT_ASSERT_EQUAL(OUString("Regularna"), sString
);
2461 xCell1Style
->getPropertyValue("CharFontFamilyComplex") >>= nInt16
;
2462 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16
);
2463 xCell1Style
->getPropertyValue("CharFontPitchComplex") >>= nInt16
;
2464 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nInt16
);
2467 xTableStyle
->getByName("first-row") >>= xCell1Style
;
2468 xCell1Style
->getPropertyValue("ParaAdjust") >>= nInt32
;
2469 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nInt32
);
2470 CPPUNIT_ASSERT_EQUAL(Color(0x9900FF), getProperty
<Color
>(xCell1Style
, "CharColor"));
2471 xCell1Style
->getPropertyValue("CharContoured") >>= bBool
;
2472 CPPUNIT_ASSERT_EQUAL(true, bBool
);
2473 xCell1Style
->getPropertyValue("CharShadowed") >>= bBool
;
2474 CPPUNIT_ASSERT_EQUAL(false, bBool
);
2475 xCell1Style
->getPropertyValue("CharStrikeout") >>= nInt32
;
2476 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nInt32
);
2477 xCell1Style
->getPropertyValue("CharUnderline") >>= nInt32
;
2478 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), nInt32
);
2479 // underline color test place
2481 xCell1Style
->getPropertyValue("CharHeight") >>= fFloat
;
2482 CPPUNIT_ASSERT_EQUAL(float(12.), fFloat
);
2483 xCell1Style
->getPropertyValue("CharWeight") >>= fFloat
;
2484 CPPUNIT_ASSERT_EQUAL(float(150.), fFloat
);
2485 xCell1Style
->getPropertyValue("CharPosture") >>= eCharPosture
;
2486 CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE
, eCharPosture
);
2487 xCell1Style
->getPropertyValue("CharFontName") >>= sString
;
2488 CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), sString
);
2489 xCell1Style
->getPropertyValue("CharFontStyleName") >>= sString
;
2490 CPPUNIT_ASSERT_EQUAL(OUString(), sString
);
2491 xCell1Style
->getPropertyValue("CharFontFamily") >>= nInt16
;
2492 CPPUNIT_ASSERT_EQUAL(sal_Int16(3), nInt16
);
2493 xCell1Style
->getPropertyValue("CharFontPitch") >>= nInt16
;
2494 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16
);
2496 xCell1Style
->getPropertyValue("CharHeightAsian") >>= fFloat
;
2497 CPPUNIT_ASSERT_EQUAL(float(12.), fFloat
);
2498 xCell1Style
->getPropertyValue("CharWeightAsian") >>= fFloat
;
2499 CPPUNIT_ASSERT_EQUAL(float(150.), fFloat
);
2500 xCell1Style
->getPropertyValue("CharPostureAsian") >>= eCharPosture
;
2501 CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE
, eCharPosture
);
2502 xCell1Style
->getPropertyValue("CharFontNameAsian") >>= sString
;
2503 CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), sString
);
2504 xCell1Style
->getPropertyValue("CharFontStyleNameAsian") >>= sString
;
2505 CPPUNIT_ASSERT_EQUAL(OUString("Pogrubiona"), sString
);
2506 xCell1Style
->getPropertyValue("CharFontFamilyAsian") >>= nInt16
;
2507 CPPUNIT_ASSERT_EQUAL(sal_Int16(3), nInt16
);
2508 xCell1Style
->getPropertyValue("CharFontPitchAsian") >>= nInt16
;
2509 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16
);
2511 xCell1Style
->getPropertyValue("CharHeightComplex") >>= fFloat
;
2512 CPPUNIT_ASSERT_EQUAL(float(12.), fFloat
);
2513 xCell1Style
->getPropertyValue("CharWeightComplex") >>= fFloat
;
2514 CPPUNIT_ASSERT_EQUAL(float(150.), fFloat
);
2515 xCell1Style
->getPropertyValue("CharPostureComplex") >>= eCharPosture
;
2516 CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE
, eCharPosture
);
2517 xCell1Style
->getPropertyValue("CharFontNameComplex") >>= sString
;
2518 CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), sString
);
2519 xCell1Style
->getPropertyValue("CharFontStyleNameComplex") >>= sString
;
2520 CPPUNIT_ASSERT_EQUAL(OUString("Pogrubiona"), sString
);
2521 xCell1Style
->getPropertyValue("CharFontFamilyComplex") >>= nInt16
;
2522 CPPUNIT_ASSERT_EQUAL(sal_Int16(3), nInt16
);
2523 xCell1Style
->getPropertyValue("CharFontPitchComplex") >>= nInt16
;
2524 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16
);
2527 xTableStyle
->getByName("first-row-even-column") >>= xCell1Style
;
2528 xCell1Style
->getPropertyValue("ParaAdjust") >>= nInt32
;
2529 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nInt32
);
2530 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, getProperty
<Color
>(xCell1Style
, "CharColor"));
2531 xCell1Style
->getPropertyValue("CharContoured") >>= bBool
;
2532 CPPUNIT_ASSERT_EQUAL(true, bBool
);
2533 xCell1Style
->getPropertyValue("CharShadowed") >>= bBool
;
2534 CPPUNIT_ASSERT_EQUAL(true, bBool
);
2535 xCell1Style
->getPropertyValue("CharStrikeout") >>= nInt32
;
2536 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nInt32
);
2537 xCell1Style
->getPropertyValue("CharUnderline") >>= nInt32
;
2538 CPPUNIT_ASSERT_EQUAL(sal_Int32(6), nInt32
);
2539 // underline color test place
2541 xCell1Style
->getPropertyValue("CharHeight") >>= fFloat
;
2542 CPPUNIT_ASSERT_EQUAL(float(12.), fFloat
);
2543 xCell1Style
->getPropertyValue("CharWeight") >>= fFloat
;
2544 CPPUNIT_ASSERT_EQUAL(float(100.), fFloat
);
2545 xCell1Style
->getPropertyValue("CharPosture") >>= eCharPosture
;
2546 CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC
, eCharPosture
);
2547 xCell1Style
->getPropertyValue("CharFontName") >>= sString
;
2548 CPPUNIT_ASSERT_EQUAL(OUString("Open Sans"), sString
);
2549 xCell1Style
->getPropertyValue("CharFontStyleName") >>= sString
;
2550 CPPUNIT_ASSERT_EQUAL(OUString(), sString
);
2551 xCell1Style
->getPropertyValue("CharFontFamily") >>= nInt16
;
2552 CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nInt16
);
2553 xCell1Style
->getPropertyValue("CharFontPitch") >>= nInt16
;
2554 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16
);
2556 xCell1Style
->getPropertyValue("CharHeightAsian") >>= fFloat
;
2557 CPPUNIT_ASSERT_EQUAL(float(12.), fFloat
);
2558 xCell1Style
->getPropertyValue("CharWeightAsian") >>= fFloat
;
2559 CPPUNIT_ASSERT_EQUAL(float(100.), fFloat
);
2560 xCell1Style
->getPropertyValue("CharPostureAsian") >>= eCharPosture
;
2561 CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC
, eCharPosture
);
2562 xCell1Style
->getPropertyValue("CharFontNameAsian") >>= sString
;
2563 CPPUNIT_ASSERT_EQUAL(OUString("Open Sans"), sString
);
2564 xCell1Style
->getPropertyValue("CharFontStyleNameAsian") >>= sString
;
2565 CPPUNIT_ASSERT_EQUAL(OUString("Kursywa"), sString
);
2566 xCell1Style
->getPropertyValue("CharFontFamilyAsian") >>= nInt16
;
2567 CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nInt16
);
2568 xCell1Style
->getPropertyValue("CharFontPitchAsian") >>= nInt16
;
2569 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16
);
2571 xCell1Style
->getPropertyValue("CharHeightComplex") >>= fFloat
;
2572 CPPUNIT_ASSERT_EQUAL(float(12.), fFloat
);
2573 xCell1Style
->getPropertyValue("CharWeightComplex") >>= fFloat
;
2574 CPPUNIT_ASSERT_EQUAL(float(100.), fFloat
);
2575 xCell1Style
->getPropertyValue("CharPostureComplex") >>= eCharPosture
;
2576 CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC
, eCharPosture
);
2577 xCell1Style
->getPropertyValue("CharFontNameComplex") >>= sString
;
2578 CPPUNIT_ASSERT_EQUAL(OUString("Open Sans"), sString
);
2579 xCell1Style
->getPropertyValue("CharFontStyleNameComplex") >>= sString
;
2580 CPPUNIT_ASSERT_EQUAL(OUString("Kursywa"), sString
);
2581 xCell1Style
->getPropertyValue("CharFontFamilyComplex") >>= nInt16
;
2582 CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nInt16
);
2583 xCell1Style
->getPropertyValue("CharFontPitchComplex") >>= nInt16
;
2584 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16
);
2587 CPPUNIT_TEST_FIXTURE(Test
, testTableStyles3
)
2589 loadAndReload("table_styles_3.odt");
2590 CPPUNIT_ASSERT_EQUAL(1, getPages());
2591 // This test checks if default valued attributes aren't exported.
2592 xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml");
2594 // <style:paragraph-properties>
2595 // For this element the only exported attributes are: "border-left", "border-bottom"
2596 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "background-color");
2597 // border-left place
2598 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "border-right");
2599 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "border-top");
2600 // border-bottom place
2601 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding");
2602 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-left");
2603 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-right");
2604 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-top");
2605 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "padding-bottom");
2606 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:table-cell-properties", "writing-mode");
2608 // <style:paragraph-properties> should be absent, because it has only "text-align" attribute, which shouldn't be exported.
2609 // Assume that style:paragraph-properties and style:text-properties exists.
2610 assertXPathChildren(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']", 2);
2612 // <style:text-properties>
2613 // For this element the only exported attributes are: "use-window-font-color place", "font-size-asian", "font-name-asian", "font-family-asian", "font-name-complex", "font-family-complex"
2614 // use-window-font-color place
2615 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-shadow");
2616 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-outline");
2617 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-line-through-style");
2618 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-line-through-type");
2619 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-underline-style");
2620 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "text-underline-color");
2621 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-size");
2622 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-weight");
2623 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style");
2624 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-name");
2625 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family");
2626 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-name");
2627 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family-generic");
2628 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-pitch");
2629 // font-size-asian place
2630 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-weight-asian");
2631 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-asian");
2632 // font-name-asian place
2633 // font-family-asian place
2634 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-name-asian");
2635 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family-generic-asian");
2636 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-pitch-asian");
2637 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-size-complex");
2638 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-weight-complex");
2639 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-complex");
2640 // font-name-complex place
2641 // font-family-complex place
2642 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-style-name-complex");
2643 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-family-generic-complex");
2644 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style3.2']/style:text-properties", "font-pitch-complex");
2648 CPPUNIT_TEST_FIXTURE(Test
, testTableStyles4
)
2650 load(mpTestDocumentPath
, "table_styles_4.odt");
2651 // Test if loaded styles overwrite existing styles
2652 uno::Reference
<style::XStyleFamiliesSupplier
> XFamiliesSupplier(mxComponent
, uno::UNO_QUERY
);
2653 uno::Reference
<container::XNameAccess
> xFamilies(XFamiliesSupplier
->getStyleFamilies());
2654 uno::Reference
<container::XNameAccess
> xTableFamily(xFamilies
->getByName("TableStyles"), uno::UNO_QUERY
);
2655 uno::Reference
<container::XNameAccess
> xTableStyle(xTableFamily
->getByName("Green"), uno::UNO_QUERY
);
2656 uno::Reference
<beans::XPropertySet
> xCell1Style
;
2658 xTableStyle
->getByName("first-row-start-column") >>= xCell1Style
;
2659 CPPUNIT_ASSERT_EQUAL(Color(0x00ff00), getProperty
<Color
>(xCell1Style
, "BackColor"));
2662 CPPUNIT_TEST_FIXTURE(Test
, testTableStyles5
)
2664 loadAndReload("table_styles_5.odt");
2665 CPPUNIT_ASSERT_EQUAL(1, getPages());
2666 // Test if cell styles doesn't have a style:parent-style-name attribute.
2667 xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml");
2669 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.1']", "parent-style-name");
2670 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.2']", "parent-style-name");
2671 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.3']", "parent-style-name");
2672 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.4']", "parent-style-name");
2673 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.5']", "parent-style-name");
2674 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.6']", "parent-style-name");
2675 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.7']", "parent-style-name");
2676 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.8']", "parent-style-name");
2677 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.9']", "parent-style-name");
2678 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.10']", "parent-style-name");
2679 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.11']", "parent-style-name");
2680 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.12']", "parent-style-name");
2681 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.13']", "parent-style-name");
2682 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.14']", "parent-style-name");
2683 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.15']", "parent-style-name");
2684 assertXPathNoAttribute(pXmlDoc
, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.16']", "parent-style-name");
2688 CPPUNIT_TEST_FIXTURE(Test
, testTdf145226
)
2690 loadAndReload("tdf145226.fodt");
2691 CPPUNIT_ASSERT_EQUAL(1, getPages());
2692 xmlDocUniquePtr pXmlDoc
= parseExport("content.xml");
2694 assertXPathNoAttribute(pXmlDoc
, "/office:document-content/office:body/office:text/table:table/table:table-row[1]", "style-name");
2695 assertXPathNoAttribute(pXmlDoc
, "/office:document-content/office:body/office:text/table:table/table:table-row[2]", "style-name");
2696 assertXPathNoAttribute(pXmlDoc
, "/office:document-content/office:body/office:text/table:table/table:table-row[3]", "style-name");
2697 assertXPathNoAttribute(pXmlDoc
, "/office:document-content/office:body/office:text/table:table/table:table-row[4]", "style-name");
2700 DECLARE_ODFEXPORT_TEST(testTdf101710
, "tdf101710.odt")
2702 CPPUNIT_ASSERT_EQUAL(1, getPages());
2703 // Test that number format of cell styles can be imported and exported.
2704 uno::Reference
<beans::XPropertySet
> xStyle(getStyles("CellStyles")->getByName("Test Style.11"), uno::UNO_QUERY
);
2705 CPPUNIT_ASSERT_EQUAL(sal_uInt32(10104), getProperty
<sal_uInt32
>(xStyle
, "NumberFormat"));
2708 CPPUNIT_TEST_FIXTURE(Test
, testTdf129568
)
2710 loadAndReload("tdf129568.fodt");
2711 // Test that export doesn't fail, and that style is imported and in use.
2712 uno::Reference
<style::XStyle
> xStyle(getStyles("CellStyles")->getByName("Default Style.1"), uno::UNO_QUERY
);
2713 CPPUNIT_ASSERT(xStyle
->isInUse());
2714 CPPUNIT_ASSERT_EQUAL(Color(0xffff00), getProperty
<Color
>(xStyle
, "BackColor"));
2717 CPPUNIT_TEST_FIXTURE(Test
, testTdf129568ui
)
2719 loadAndReload("tdf129568-ui.fodt");
2720 // Same as above, but styles referenced by UI name.
2721 uno::Reference
<style::XStyle
> xStyle(getStyles("CellStyles")->getByName("Default Style.1"), uno::UNO_QUERY
);
2722 CPPUNIT_ASSERT(xStyle
->isInUse());
2723 CPPUNIT_ASSERT_EQUAL(Color(0xffff00), getProperty
<Color
>(xStyle
, "BackColor"));
2726 DECLARE_ODFEXPORT_TEST(testTdf132642_keepWithNextTable
, "tdf132642_keepWithNextTable.odt")
2728 // Since the row is very big, it should split over two pages.
2729 // Since up to this point we haven't tried to make it match MS formats, it should start on page 1.
2730 CPPUNIT_ASSERT_EQUAL_MESSAGE("Row splits over 2 pages", 2, getPages());
2733 CPPUNIT_TEST_FIXTURE(Test
, testImageMimetype
)
2735 loadAndReload("image-mimetype.odt");
2736 CPPUNIT_ASSERT_EQUAL(1, getShapes());
2737 CPPUNIT_ASSERT_EQUAL(1, getPages());
2738 // Test that the loext:mimetype attribute is written for exported images, tdf#109202
2739 xmlDocUniquePtr pXmlDoc
= parseExport("content.xml");
2740 // Original image (svg)
2741 assertXPath(pXmlDoc
, "/office:document-content/office:body/office:text/text:p/draw:frame/draw:image[@draw:mime-type='image/svg+xml']");
2744 CPPUNIT_TEST_FIXTURE(Test
, testEmbeddedFontProps
)
2746 loadAndReload("embedded-font-props.odt");
2747 CPPUNIT_ASSERT_EQUAL(1, getPages());
2748 #if !defined(MACOSX)
2749 // Test that font style/weight of embedded fonts is exposed.
2750 // Test file is a normal ODT, except EmbedFonts is set to true in settings.xml.
2751 xmlDocUniquePtr pXmlDoc
= parseExport("content.xml");
2752 // These failed, the attributes were missing.
2753 assertXPath(pXmlDoc
, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[1]", "font-style", "normal");
2754 assertXPath(pXmlDoc
, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[1]", "font-weight", "normal");
2755 assertXPath(pXmlDoc
, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[2]", "font-style", "normal");
2756 assertXPath(pXmlDoc
, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[2]", "font-weight", "bold");
2757 assertXPath(pXmlDoc
, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[3]", "font-style", "italic");
2758 assertXPath(pXmlDoc
, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[3]", "font-weight", "normal");
2759 assertXPath(pXmlDoc
, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[4]", "font-style", "italic");
2760 assertXPath(pXmlDoc
, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[4]", "font-weight", "bold");
2764 DECLARE_ODFEXPORT_TEST(testTdf100492
, "tdf100492.odt")
2766 CPPUNIT_ASSERT_EQUAL(2, getShapes());
2767 CPPUNIT_ASSERT_EQUAL(1, getPages());
2768 uno::Reference
<drawing::XShape
> xShape
= getShape(1);
2769 CPPUNIT_ASSERT(xShape
.is());
2771 // Save the first shape to a SVG
2772 uno::Reference
<drawing::XGraphicExportFilter
> xGraphicExporter
= drawing::GraphicExportFilter::create(comphelper::getProcessComponentContext());
2773 uno::Reference
<lang::XComponent
> xSourceDoc(xShape
, uno::UNO_QUERY
);
2774 xGraphicExporter
->setSourceDocument(xSourceDoc
);
2776 SvMemoryStream aStream
;
2777 uno::Reference
<io::XOutputStream
> xOutputStream(new utl::OStreamWrapper(aStream
));
2778 uno::Sequence
<beans::PropertyValue
> aDescriptor( comphelper::InitPropertySequence({
2779 { "OutputStream", uno::Any(xOutputStream
) },
2780 { "FilterName", uno::Any(OUString("SVG")) }
2782 xGraphicExporter
->filter(aDescriptor
);
2783 aStream
.Seek(STREAM_SEEK_TO_BEGIN
);
2785 // TODO: Disabled. Parsing of SVG gives just root node without any children.
2786 // Reason of such behavior unclear. So XPATH assert fails.
2788 // Parse resulting SVG as XML file.
2789 // xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
2791 // Check amount of paths required to draw an arrow.
2792 // Since there are still some empty paths in output test can fail later. There are just two
2793 // really used and visible paths.
2794 //assertXPath(pXmlDoc, "/svg/path", 4);
2797 DECLARE_ODFEXPORT_TEST(testTdf77961
, "tdf77961.odt")
2799 CPPUNIT_ASSERT_EQUAL(1, getPages());
2800 uno::Reference
<container::XNameAccess
> xStyles(getStyles("PageStyles"));
2801 uno::Reference
<beans::XPropertySet
> xStyle(xStyles
->getByName("Standard"), uno::UNO_QUERY
);
2802 CPPUNIT_ASSERT_EQUAL( false , getProperty
<bool>(xStyle
, "GridDisplay"));
2803 CPPUNIT_ASSERT_EQUAL( false , getProperty
<bool>(xStyle
, "GridPrint"));
2806 DECLARE_ODFEXPORT_TEST(testReferenceLanguage
, "referencelanguage.odt")
2808 CPPUNIT_ASSERT_EQUAL(2, getPages());
2809 // Test loext:reference-language attribute of reference fields
2810 // (used from LibreOffice 6.1, and proposed for next ODF)
2811 OUString
const aFieldTexts
[] = { "A 2", "Az Isten", "Az 50-esek",
2812 "A 2018-asok", "Az egyebek", "A fejezetek",
2813 u
"Az „Őseinket...”", "a 2",
2814 "Az v", "az 1", "Az e)", "az 1",
2815 "Az (5)", "az 1", "A 2", "az 1" };
2816 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(mxComponent
, uno::UNO_QUERY
);
2817 // update "A (4)" to "Az (5)"
2818 uno::Reference
<util::XRefreshable
>(xTextFieldsSupplier
->getTextFields(), uno::UNO_QUERY_THROW
)->refresh();
2820 uno::Reference
<container::XEnumerationAccess
> xFieldsAccess(xTextFieldsSupplier
->getTextFields());
2821 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
2823 uno::Any
aHu(OUString("Hu"));
2824 uno::Any
ahu(OUString("hu"));
2825 for (size_t i
= 0; i
< SAL_N_ELEMENTS(aFieldTexts
); i
++)
2827 uno::Any aField
= xFields
->nextElement();
2828 uno::Reference
<lang::XServiceInfo
> xServiceInfo(aField
, uno::UNO_QUERY
);
2829 if (xServiceInfo
->supportsService("com.sun.star.text.textfield.GetReference"))
2831 uno::Reference
<beans::XPropertySet
> xPropertySet(aField
, uno::UNO_QUERY
);
2832 uno::Any aLang
= xPropertySet
->getPropertyValue("ReferenceFieldLanguage");
2833 CPPUNIT_ASSERT_EQUAL(true, aLang
== aHu
|| aLang
== ahu
);
2834 uno::Reference
<text::XTextContent
> xField(aField
, uno::UNO_QUERY
);
2835 CPPUNIT_ASSERT_EQUAL(aFieldTexts
[i
], xField
->getAnchor()->getString());
2840 CPPUNIT_TEST_FIXTURE(Test
, testRubyPosition
)
2842 loadAndReload("ruby-position.odt");
2843 CPPUNIT_ASSERT_EQUAL(1, getPages());
2844 xmlDocUniquePtr pXmlDoc
= parseExport("content.xml");
2846 assertXPath(pXmlDoc
, "//style:style[@style:family='ruby']/style:ruby-properties[@loext:ruby-position='inter-character']", 1);
2847 assertXPath(pXmlDoc
, "//style:style[@style:family='ruby']/style:ruby-properties[@style:ruby-position='below']", 1);
2850 DECLARE_ODFEXPORT_TEST(testAllowOverlap
, "allow-overlap.odt")
2852 CPPUNIT_ASSERT_EQUAL(2, getShapes());
2853 CPPUNIT_ASSERT_EQUAL(1, getPages());
2854 uno::Reference
<drawing::XShape
> xShape
= getShape(1);
2855 // Without the accompanying fix in place, this test would have failed with:
2856 // - Expression: !getProperty<bool>(xShape, "AllowOverlap")
2857 // i.e. the custom AllowOverlap=false shape property was lost on import/export.
2858 CPPUNIT_ASSERT(!getProperty
<bool>(xShape
, "AllowOverlap"));
2859 xShape
= getShape(2);
2860 CPPUNIT_ASSERT(!getProperty
<bool>(xShape
, "AllowOverlap"));
2863 CPPUNIT_TEST_FIXTURE(Test
, testSignatureLineProperties
)
2865 loadAndReload("signatureline-properties.fodt");
2866 uno::Reference
<drawing::XShape
> xShape
= getShape(1);
2867 CPPUNIT_ASSERT(xShape
.is());
2869 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xShape
, "IsSignatureLine"));
2870 CPPUNIT_ASSERT_EQUAL(OUString("{3C24159B-3B98-4F60-AB52-00E7721758E9}"),
2871 getProperty
<OUString
>(xShape
, "SignatureLineId"));
2872 CPPUNIT_ASSERT_EQUAL(OUString("John Doe"),
2873 getProperty
<OUString
>(xShape
, "SignatureLineSuggestedSignerName"));
2874 CPPUNIT_ASSERT_EQUAL(OUString("Farmer"),
2875 getProperty
<OUString
>(xShape
, "SignatureLineSuggestedSignerTitle"));
2876 CPPUNIT_ASSERT_EQUAL(OUString("john@farmers.org"),
2877 getProperty
<OUString
>(xShape
, "SignatureLineSuggestedSignerEmail"));
2878 CPPUNIT_ASSERT_EQUAL(OUString("Please farm here."),
2879 getProperty
<OUString
>(xShape
, "SignatureLineSigningInstructions"));
2880 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xShape
, "SignatureLineCanAddComment"));
2881 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xShape
, "SignatureLineShowSignDate"));
2883 // tdf#130917 This needs to be always set when importing a doc, ooxml export expects it.
2884 uno::Reference
<graphic::XGraphic
> xUnsignedGraphic
;
2885 uno::Reference
<beans::XPropertySet
> xProps(xShape
, uno::UNO_QUERY
);
2886 xProps
->getPropertyValue("SignatureLineUnsignedImage") >>= xUnsignedGraphic
;
2887 CPPUNIT_ASSERT_EQUAL(true, xUnsignedGraphic
.is());
2890 DECLARE_ODFEXPORT_TEST(testQrCodeGenProperties
, "qrcode-properties.odt")
2892 CPPUNIT_ASSERT_EQUAL(1, getShapes());
2893 CPPUNIT_ASSERT_EQUAL(1, getPages());
2894 uno::Reference
<drawing::XShape
> xShape
= getShape(1);
2895 CPPUNIT_ASSERT(xShape
.is());
2897 css::drawing::BarCode aBarCode
= getProperty
<css::drawing::BarCode
>(xShape
, "BarCodeProperties");
2899 CPPUNIT_ASSERT_EQUAL(OUString("www.libreoffice.org"),
2901 CPPUNIT_ASSERT_EQUAL(css::drawing::BarCodeErrorCorrection::LOW
,
2902 aBarCode
.ErrorCorrection
);
2903 CPPUNIT_ASSERT_EQUAL(sal_Int32(5),
2907 DECLARE_ODFEXPORT_TEST(testChapterNumberingNewLine
, "chapter-number-new-line.odt")
2909 CPPUNIT_ASSERT_EQUAL(1, getPages());
2910 uno::Reference
<text::XChapterNumberingSupplier
> xNumberingSupplier(mxComponent
, uno::UNO_QUERY
);
2911 uno::Reference
<container::XIndexAccess
> xNumberingRules
= xNumberingSupplier
->getChapterNumberingRules();
2912 comphelper::SequenceAsHashMap
hashMap(xNumberingRules
->getByIndex(0));
2914 //This failed Actual Value was LISTTAB instead of NEWLINE
2915 CPPUNIT_ASSERT_EQUAL(
2916 sal_Int16(SvxNumberFormat::NEWLINE
), hashMap
["LabelFollowedBy"].get
<sal_Int16
>());
2919 DECLARE_ODFEXPORT_TEST(testSpellOutNumberingTypes
, "spellout-numberingtypes.odt")
2921 CPPUNIT_ASSERT_EQUAL(1, getPages());
2922 // ordinal indicator, ordinal and cardinal number numbering styles (from LibreOffice 6.1)
2923 OUString
const aFieldTexts
[] = { "1st", "Erste", "Eins", "1.", "Premier", "Un", u
"1ᵉʳ", "First", "One" };
2924 // fallback for old platforms without std::codecvt and std::regex supports
2925 OUString
const aFieldTextFallbacks
[] = { "Ordinal-number 1", "Ordinal 1", "1" };
2926 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(mxComponent
, uno::UNO_QUERY
);
2927 // update text field content
2928 uno::Reference
<util::XRefreshable
>(xTextFieldsSupplier
->getTextFields(), uno::UNO_QUERY_THROW
)->refresh();
2930 uno::Reference
<container::XEnumerationAccess
> xFieldsAccess(xTextFieldsSupplier
->getTextFields());
2931 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
2933 for (size_t i
= 0; i
< SAL_N_ELEMENTS(aFieldTexts
); i
++)
2935 uno::Any aField
= xFields
->nextElement();
2936 uno::Reference
<lang::XServiceInfo
> xServiceInfo(aField
, uno::UNO_QUERY
);
2937 if (xServiceInfo
->supportsService("com.sun.star.text.textfield.PageNumber"))
2939 uno::Reference
<text::XTextContent
> xField(aField
, uno::UNO_QUERY
);
2940 CPPUNIT_ASSERT_EQUAL(true, aFieldTexts
[i
].equals(xField
->getAnchor()->getString()) ||
2941 aFieldTextFallbacks
[i
%3].equals(xField
->getAnchor()->getString()));
2946 // MAILMERGE Add conditional to expand / collapse bookmarks
2947 DECLARE_ODFEXPORT_TEST(tdf101856_overlapped
, "tdf101856_overlapped.odt")
2949 CPPUNIT_ASSERT_EQUAL(1, getPages());
2950 // get bookmark interface
2951 uno::Reference
<text::XBookmarksSupplier
> xBookmarksSupplier(mxComponent
, uno::UNO_QUERY
);
2952 uno::Reference
<container::XIndexAccess
> xBookmarksByIdx(xBookmarksSupplier
->getBookmarks(), uno::UNO_QUERY
);
2953 uno::Reference
<container::XNameAccess
> xBookmarksByName
= xBookmarksSupplier
->getBookmarks();
2955 // check: we have 2 bookmarks
2956 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(2), xBookmarksByIdx
->getCount());
2957 CPPUNIT_ASSERT(xBookmarksByName
->hasByName("BookmarkNonHidden"));
2958 CPPUNIT_ASSERT(xBookmarksByName
->hasByName("BookmarkHidden"));
2960 // <text:bookmark-start text:name="BookmarkNonHidden"/>
2961 uno::Reference
<beans::XPropertySet
> xBookmark1(xBookmarksByName
->getByName("BookmarkNonHidden"), uno::UNO_QUERY
);
2962 CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty
<OUString
>(xBookmark1
, UNO_NAME_BOOKMARK_CONDITION
));
2963 CPPUNIT_ASSERT_EQUAL(false, getProperty
<bool>(xBookmark1
, UNO_NAME_BOOKMARK_HIDDEN
));
2965 // <text:bookmark-start text:name="BookmarkHidden"/>
2966 uno::Reference
<beans::XPropertySet
> xBookmark2(xBookmarksByName
->getByName("BookmarkHidden"), uno::UNO_QUERY
);
2967 CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty
<OUString
>(xBookmark2
, UNO_NAME_BOOKMARK_CONDITION
));
2968 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xBookmark2
, UNO_NAME_BOOKMARK_HIDDEN
));
2971 // MAILMERGE Add conditional to expand / collapse bookmarks
2972 DECLARE_ODFEXPORT_TEST(tdf101856
, "tdf101856.odt")
2974 CPPUNIT_ASSERT_EQUAL(1, getPages());
2975 // get bookmark interface
2976 uno::Reference
<text::XBookmarksSupplier
> xBookmarksSupplier(mxComponent
, uno::UNO_QUERY
);
2977 uno::Reference
<container::XIndexAccess
> xBookmarksByIdx(xBookmarksSupplier
->getBookmarks(), uno::UNO_QUERY
);
2978 uno::Reference
<container::XNameAccess
> xBookmarksByName
= xBookmarksSupplier
->getBookmarks();
2980 // check: we have 2 bookmarks
2981 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(5), xBookmarksByIdx
->getCount());
2982 CPPUNIT_ASSERT(xBookmarksByName
->hasByName("BookmarkVisible"));
2983 CPPUNIT_ASSERT(xBookmarksByName
->hasByName("BookmarkHidden"));
2984 CPPUNIT_ASSERT(xBookmarksByName
->hasByName("BookmarkVisibleWithCondition"));
2985 CPPUNIT_ASSERT(xBookmarksByName
->hasByName("BookmarkNotHiddenWithCondition"));
2986 CPPUNIT_ASSERT(xBookmarksByName
->hasByName("BookmarkHiddenWithCondition"));
2988 // <text:bookmark-start text:name="BookmarkVisible"/>
2989 uno::Reference
<beans::XPropertySet
> xBookmark1(xBookmarksByName
->getByName("BookmarkVisible"), uno::UNO_QUERY
);
2990 CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty
<OUString
>(xBookmark1
, UNO_NAME_BOOKMARK_CONDITION
));
2991 CPPUNIT_ASSERT_EQUAL(false, getProperty
<bool>(xBookmark1
, UNO_NAME_BOOKMARK_HIDDEN
));
2993 // <text:bookmark-start text:name="BookmarkHidden" loext:condition="" loext:hidden="true"/>
2994 uno::Reference
<beans::XPropertySet
> xBookmark2(xBookmarksByName
->getByName("BookmarkHidden"), uno::UNO_QUERY
);
2995 CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty
<OUString
>(xBookmark2
, UNO_NAME_BOOKMARK_CONDITION
));
2996 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xBookmark2
, UNO_NAME_BOOKMARK_HIDDEN
));
2998 // <text:bookmark-start text:name="BookmarkVisibleWithCondition" loext:condition="0==1" loext:hidden="true"/>
2999 uno::Reference
<beans::XPropertySet
> xBookmark3(xBookmarksByName
->getByName("BookmarkVisibleWithCondition"), uno::UNO_QUERY
);
3000 CPPUNIT_ASSERT_EQUAL(OUString("0==1"), getProperty
<OUString
>(xBookmark3
, UNO_NAME_BOOKMARK_CONDITION
));
3001 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xBookmark3
, UNO_NAME_BOOKMARK_HIDDEN
));
3003 // <text:bookmark-start text:name="BookmarkNotHiddenWithCondition" loext:condition="1==1" loext:hidden="false"/>
3005 // The following test doesn't work, while during output in the case of loext:hidden="false".
3006 // no additional parameters are written. Implementation should be reviewed.
3008 // uno::Reference<beans::XPropertySet> xBookmark4(xBookmarksByName->getByName("BookmarkNotHiddenWithCondition"), uno::UNO_QUERY);
3009 // CPPUNIT_ASSERT_EQUAL(OUString("1==1"), getProperty<OUString>(xBookmark4, UNO_NAME_BOOKMARK_CONDITION));
3010 // CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xBookmark4, UNO_NAME_BOOKMARK_HIDDEN));
3012 // <text:bookmark-start text:name="BookmarkHiddenWithCondition" loext:condition="1==1" loext:hidden="true"/>
3013 uno::Reference
<beans::XPropertySet
> xBookmark5(xBookmarksByName
->getByName("BookmarkHiddenWithCondition"), uno::UNO_QUERY
);
3014 CPPUNIT_ASSERT_EQUAL(OUString("1==1"), getProperty
<OUString
>(xBookmark5
, UNO_NAME_BOOKMARK_CONDITION
));
3015 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xBookmark5
, UNO_NAME_BOOKMARK_HIDDEN
));
3018 DECLARE_ODFEXPORT_TEST(tdf118502
, "tdf118502.odt")
3020 CPPUNIT_ASSERT_EQUAL(1, getShapes());
3021 CPPUNIT_ASSERT_EQUAL(1, getPages());
3022 uno::Reference
<drawing::XShape
> xShape
= getShape(1);
3023 // Make sure the replacement graphic is still there
3024 // (was gone because the original graphic was not recognized during load)
3025 auto xReplacementGraphic
3026 = getProperty
<uno::Reference
<graphic::XGraphic
>>(xShape
, "ReplacementGraphic");
3027 CPPUNIT_ASSERT(xReplacementGraphic
.is());
3030 CPPUNIT_TEST_FIXTURE(Test
, tdf99631
)
3032 loadAndReload("tdf99631.docx");
3033 // check import of VisualArea settings of the embedded XLSX OLE objects
3034 xmlDocUniquePtr pXmlDoc
= parseExport("Object 1/settings.xml");
3035 assertXPathContent(pXmlDoc
, "//config:config-item[@config:name='VisibleAreaWidth']", "4516");
3036 assertXPathContent(pXmlDoc
, "//config:config-item[@config:name='VisibleAreaHeight']", "903");
3038 xmlDocUniquePtr pXmlDoc2
= parseExport("Object 2/settings.xml");
3039 assertXPathContent(pXmlDoc2
, "//config:config-item[@config:name='VisibleAreaWidth']", "4516");
3040 assertXPathContent(pXmlDoc2
, "//config:config-item[@config:name='VisibleAreaHeight']", "1355");
3043 CPPUNIT_TEST_FIXTURE(Test
, tdf128504
)
3045 loadAndReload("tdf128504.docx");
3046 uno::Reference
<text::XTextRange
> xPara
= getParagraph(6);
3047 uno::Reference
<beans::XPropertySet
> xRun(getRun(xPara
,1), uno::UNO_QUERY
);
3048 OUString unVisitedStyleName
= getProperty
<OUString
>(xRun
, "UnvisitedCharStyleName");
3049 CPPUNIT_ASSERT(!unVisitedStyleName
.equalsIgnoreAsciiCase("Internet Link"));
3050 OUString visitedStyleName
= getProperty
<OUString
>(xRun
, "VisitedCharStyleName");
3051 CPPUNIT_ASSERT(!visitedStyleName
.equalsIgnoreAsciiCase("Visited Internet Link"));
3054 DECLARE_ODFEXPORT_TEST(tdf121658
, "tdf121658.odt")
3056 CPPUNIT_ASSERT_EQUAL(1, getPages());
3057 uno::Reference
<container::XNameAccess
> xParaStyles(getStyles("ParagraphStyles"));
3058 uno::Reference
<beans::XPropertySet
> xStyle1(xParaStyles
->getByName(
3059 "Standard"), uno::UNO_QUERY
);
3060 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(xStyle1
, "ParaHyphenationNoCaps"));
3063 DECLARE_ODFEXPORT_TEST(tdf149248
, "tdf149248.odt")
3065 CPPUNIT_ASSERT_EQUAL(1, getPages());
3066 CPPUNIT_ASSERT_EQUAL(false, getProperty
<bool>(getParagraph(2), "ParaHyphenationNoLastWord"));
3067 CPPUNIT_ASSERT_EQUAL(true, getProperty
<bool>(getParagraph(4), "ParaHyphenationNoLastWord"));
3070 DECLARE_ODFEXPORT_TEST(testTdf150394
, "tdf150394.odt")
3072 // crashes at import time
3073 CPPUNIT_ASSERT_EQUAL(1, getPages());
3076 DECLARE_ODFEXPORT_TEST(tdf149324
, "tdf149324.odt")
3078 CPPUNIT_ASSERT_EQUAL(1, getPages());
3079 CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), getProperty
<sal_uInt16
>(getParagraph(2), "ParaHyphenationMinWordLength"));
3080 CPPUNIT_ASSERT_EQUAL(sal_uInt16(7), getProperty
<sal_uInt16
>(getParagraph(4), "ParaHyphenationMinWordLength"));
3083 DECLARE_ODFEXPORT_TEST(tdf149420
, "tdf149420.odt")
3085 CPPUNIT_ASSERT_EQUAL(1, getPages());
3086 CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), getProperty
<sal_uInt16
>(getParagraph(2), "ParaHyphenationZone"));
3087 CPPUNIT_ASSERT_EQUAL(sal_uInt16(567), getProperty
<sal_uInt16
>(getParagraph(4), "ParaHyphenationZone"));
3090 DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering
, "arabic-zero-numbering.odt")
3092 CPPUNIT_ASSERT_EQUAL(1, getPages());
3093 auto xNumberingRules
3094 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(1), "NumberingRules");
3095 comphelper::SequenceAsHashMap
aMap(xNumberingRules
->getByIndex(0));
3096 // Without the accompanying fix in place, this test would have failed with:
3099 // i.e. numbering type was ARABIC, not ARABIC_ZERO.
3100 CPPUNIT_ASSERT_EQUAL(o3tl::narrowing
<sal_uInt16
>(style::NumberingType::ARABIC_ZERO
),
3101 aMap
["NumberingType"].get
<sal_uInt16
>());
3104 DECLARE_ODFEXPORT_TEST(testArabicZero3Numbering
, "arabic-zero3-numbering.odt")
3106 CPPUNIT_ASSERT_EQUAL(1, getPages());
3107 auto xNumberingRules
3108 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(1), "NumberingRules");
3109 comphelper::SequenceAsHashMap
aMap(xNumberingRules
->getByIndex(0));
3110 // Without the accompanying fix in place, this test would have failed with:
3113 // i.e. numbering type was ARABIC, not ARABIC_ZERO3.
3114 CPPUNIT_ASSERT_EQUAL(o3tl::narrowing
<sal_uInt16
>(style::NumberingType::ARABIC_ZERO3
),
3115 aMap
["NumberingType"].get
<sal_uInt16
>());
3118 DECLARE_ODFEXPORT_TEST(testArabicZero4Numbering
, "arabic-zero4-numbering.odt")
3120 CPPUNIT_ASSERT_EQUAL(1, getPages());
3121 auto xNumberingRules
3122 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(1), "NumberingRules");
3123 comphelper::SequenceAsHashMap
aMap(xNumberingRules
->getByIndex(0));
3124 // Without the accompanying fix in place, this test would have failed with:
3127 // i.e. numbering type was ARABIC, not ARABIC_ZERO4.
3128 CPPUNIT_ASSERT_EQUAL(o3tl::narrowing
<sal_uInt16
>(style::NumberingType::ARABIC_ZERO4
),
3129 aMap
["NumberingType"].get
<sal_uInt16
>());
3132 DECLARE_ODFEXPORT_TEST(testArabicZero5Numbering
, "arabic-zero5-numbering.odt")
3134 CPPUNIT_ASSERT_EQUAL(1, getPages());
3135 auto xNumberingRules
3136 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(1), "NumberingRules");
3137 comphelper::SequenceAsHashMap
aMap(xNumberingRules
->getByIndex(0));
3138 // Without the accompanying fix in place, this test would have failed with:
3141 // i.e. numbering type was ARABIC, not ARABIC_ZERO5.
3142 CPPUNIT_ASSERT_EQUAL(o3tl::narrowing
<sal_uInt16
>(style::NumberingType::ARABIC_ZERO5
),
3143 aMap
["NumberingType"].get
<sal_uInt16
>());
3146 DECLARE_ODFEXPORT_TEST(testRovasNumbering
, "rovas-numbering.odt")
3148 CPPUNIT_ASSERT_EQUAL(1, getPages());
3149 auto xNumberingRules
3150 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(1), "NumberingRules");
3151 comphelper::SequenceAsHashMap
aMap(xNumberingRules
->getByIndex(0));
3152 // Without the accompanying fix in place, this test would have failed with:
3155 // i.e. numbering type was ARABIC, not SZEKELY_ROVAS.
3156 CPPUNIT_ASSERT_EQUAL(o3tl::narrowing
<sal_uInt16
>(style::NumberingType::SZEKELY_ROVAS
),
3157 aMap
["NumberingType"].get
<sal_uInt16
>());
3160 DECLARE_ODFEXPORT_TEST(testPageContentTop
, "page-content-top.odt")
3162 CPPUNIT_ASSERT_EQUAL(1, getShapes());
3163 CPPUNIT_ASSERT_EQUAL(1, getPages());
3164 uno::Reference
<beans::XPropertySet
> xShape(getShape(1), uno::UNO_QUERY
);
3165 sal_Int16 nExpected
= text::RelOrientation::PAGE_PRINT_AREA_TOP
;
3166 CPPUNIT_ASSERT_EQUAL(nExpected
, getProperty
<sal_Int16
>(xShape
, "VertOrientRelation"));
3169 DECLARE_ODFEXPORT_TEST(testPageContentBottom
, "page-content-bottom.odt")
3171 CPPUNIT_ASSERT_EQUAL(1, getShapes());
3172 CPPUNIT_ASSERT_EQUAL(1, getPages());
3173 uno::Reference
<beans::XPropertySet
> xShape(getShape(1), uno::UNO_QUERY
);
3174 sal_Int16 nExpected
= text::RelOrientation::PAGE_PRINT_AREA_BOTTOM
;
3175 CPPUNIT_ASSERT_EQUAL(nExpected
, getProperty
<sal_Int16
>(xShape
, "VertOrientRelation"));
3178 CPPUNIT_TEST_FIXTURE(Test
, tdf124470
)
3180 loadAndReload("tdf124470TableAndEmbeddedUsedFonts.odt");
3181 // Table styles were exported out of place, inside font-face-decls.
3182 // Without the fix in place, this will fail already in ODF validation:
3183 // "content.xml[2,2150]: Error: tag name "style:style" is not allowed. Possible tag names are: <font-face>"
3185 CPPUNIT_ASSERT_EQUAL(1, getPages());
3187 xmlDocUniquePtr pXmlDoc
= parseExport("content.xml");
3189 assertXPath(pXmlDoc
, "/office:document-content/office:font-face-decls/style:style", 0);
3190 assertXPath(pXmlDoc
, "/office:document-content/office:automatic-styles/style:style[@style:family='table']", 1);
3191 assertXPath(pXmlDoc
, "/office:document-content/office:automatic-styles/style:style[@style:family='table-column']", 2);
3192 assertXPath(pXmlDoc
, "/office:document-content/office:automatic-styles/style:style[@style:family='paragraph']", 1);
3195 CPPUNIT_TEST_FIXTURE(Test
, tdf135942
)
3197 loadAndReload("nestedTableInFooter.odt");
3198 // All table autostyles should be collected, including nested, and must not crash.
3200 CPPUNIT_ASSERT_EQUAL(1, getPages());
3202 xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml");
3204 assertXPath(pXmlDoc
, "/office:document-styles/office:automatic-styles/style:style[@style:family='table']", 2);
3207 CPPUNIT_TEST_FIXTURE(Test
, tdf150927
)
3209 // Similar to tdf135942
3211 loadAndReload("table-in-frame-in-table-in-header-base.odt");
3212 // All table autostyles should be collected, including nested, and must not crash.
3214 CPPUNIT_ASSERT_EQUAL(1, getPages());
3216 xmlDocUniquePtr pXmlDoc
= parseExport("styles.xml");
3218 assertXPath(pXmlDoc
, "/office:document-styles/office:automatic-styles/style:style[@style:family='table']", 2);
3221 DECLARE_ODFEXPORT_TEST(testGutterLeft
, "gutter-left.odt")
3223 CPPUNIT_ASSERT_EQUAL(1, getPages());
3224 uno::Reference
<beans::XPropertySet
> xPageStyle
;
3225 getStyles("PageStyles")->getByName("Standard") >>= xPageStyle
;
3226 sal_Int32 nGutterMargin
{};
3227 xPageStyle
->getPropertyValue("GutterMargin") >>= nGutterMargin
;
3228 // Without the accompanying fix in place, this test would have failed with:
3231 // i.e. gutter margin was lost.
3232 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(1270), nGutterMargin
);
3235 CPPUNIT_PLUGIN_IMPLEMENT();
3236 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */