2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 #include <com/sun/star/awt/XBitmap.hpp>
10 #include <com/sun/star/beans/XPropertySet.hpp>
11 #include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp>
12 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
13 #include <com/sun/star/drawing/XControlShape.hpp>
14 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
15 #include <com/sun/star/lang/XServiceInfo.hpp>
16 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
17 #include <com/sun/star/text/HoriOrientation.hpp>
18 #include <com/sun/star/text/RelOrientation.hpp>
19 #include <com/sun/star/text/SetVariableType.hpp>
20 #include <com/sun/star/text/TableColumnSeparator.hpp>
21 #include <com/sun/star/text/TextContentAnchorType.hpp>
22 #include <com/sun/star/text/VertOrientation.hpp>
23 #include <com/sun/star/text/WrapTextMode.hpp>
24 #include <com/sun/star/text/WritingMode2.hpp>
25 #include <com/sun/star/text/XDependentTextField.hpp>
26 #include <com/sun/star/text/XFormField.hpp>
27 #include <com/sun/star/text/XPageCursor.hpp>
28 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
29 #include <com/sun/star/text/XTextFrame.hpp>
30 #include <com/sun/star/text/XTextFramesSupplier.hpp>
31 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
32 #include <com/sun/star/style/BreakType.hpp>
33 #include <com/sun/star/style/ParagraphAdjust.hpp>
34 #include <com/sun/star/table/ShadowFormat.hpp>
35 #include <com/sun/star/view/XSelectionSupplier.hpp>
36 #include <com/sun/star/view/XFormLayerAccess.hpp>
37 #include <com/sun/star/table/BorderLine2.hpp>
38 #include <com/sun/star/table/TableBorder2.hpp>
39 #include <com/sun/star/text/SizeType.hpp>
41 #include <vcl/svapp.hxx>
43 #include <swmodeltestbase.hxx>
44 #include <bordertest.hxx>
46 #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
47 #define EMU_TO_MM100(EMU) (EMU / 360)
49 class Test
: public SwModelTestBase
73 void testNumbering1();
75 void testAllGapsWord();
100 void testFineTableDash();
104 void testGroupshapeLine();
106 void testTbLrHeight();
110 void testToolsLineNumbering();
113 void testTableWidth();
114 void testConditionalstylesTbllook();
116 void testN592908_Frame();
117 void testN592908_Picture();
119 void testIndentation();
120 void testPageBackground();
121 void testWatermark();
122 void testPageBorderShadow();
130 void testTableAutoColumnFixedSize();
131 void testTableFloating();
132 void testTableAutoNested();
133 void testTableStyleParprop();
134 void testTablePagebreak();
136 void testVmlTextVerticalAdjust();
137 void testGroupshapeSdt();
138 void testBnc779620();
139 void testRPrChangeClosed();
142 void testRhbz988516();
144 CPPUNIT_TEST_SUITE(Test
);
145 #if !defined(MACOSX) && !defined(WNT)
148 CPPUNIT_TEST_SUITE_END();
156 MethodEntry
<Test
> aMethods
[] = {
157 {"n751054.docx", &Test::testN751054
},
158 {"n751117.docx", &Test::testN751117
},
159 {"n751017.docx", &Test::testN751017
},
160 {"n750935.docx", &Test::testN750935
},
161 {"n757890.docx", &Test::testN757890
},
162 {"fdo49940.docx", &Test::testFdo49940
},
163 {"n751077.docx", &Test::testN751077
},
164 {"n705956-1.docx", &Test::testN705956_1
},
165 {"n705956-2.docx", &Test::testN705956_2
},
166 {"n747461.docx", &Test::testN747461
},
167 {"n750255.docx", &Test::testN750255
},
168 {"n652364.docx", &Test::testN652364
},
169 {"n760764.docx", &Test::testN760764
},
170 {"n764005.docx", &Test::testN764005
},
171 {"smartart.docx", &Test::testSmartart
},
172 {"n764745-alignment.docx", &Test::testN764745
},
173 {"n766477.docx", &Test::testN766477
},
174 {"n758883.docx", &Test::testN758883
},
175 {"n766481.docx", &Test::testN766481
},
176 {"n766487.docx", &Test::testN766487
},
177 {"n693238.docx", &Test::testN693238
},
178 {"numbering1.docx", &Test::testNumbering1
},
179 {"bnc773061.docx", &Test::testBnc773061
},
180 {"all_gaps_word.docx", &Test::testAllGapsWord
},
181 {"n775906.docx", &Test::testN775906
},
182 {"n775899.docx", &Test::testN775899
},
183 {"n777345.docx", &Test::testN777345
},
184 {"n777337.docx", &Test::testN777337
},
185 {"n778836.docx", &Test::testN778836
},
186 {"n778140.docx", &Test::testN778140
},
187 {"n778828.docx", &Test::testN778828
},
188 {"ink.docx", &Test::testInk
},
189 {"n779834.docx", &Test::testN779834
},
190 {"n779627.docx", &Test::testN779627
},
191 {"n779941.docx", &Test::testN779941
},
192 {"fdo55187.docx", &Test::testFdo55187
},
193 {"fdo74357.docx", &Test::testFdo74357
},
194 {"n780563.docx", &Test::testN780563
},
195 {"n780853.docx", &Test::testN780853
},
196 {"n780843.docx", &Test::testN780843
},
197 {"imgshadow.docx", &Test::testShadow
},
198 {"n782061.docx", &Test::testN782061
},
199 {"n782345.docx", &Test::testN782345
},
200 {"n783638.docx", &Test::testN783638
},
201 {"fdo52208.docx", &Test::testFdo52208
},
202 {"n785767.docx", &Test::testN785767
},
203 {"n773061.docx", &Test::testN773061
},
204 {"n780645.docx", &Test::testN780645
},
205 {"tableborder-finedash.docx", &Test::testFineTableDash
},
206 {"n792778.docx", &Test::testN792778
},
207 {"n793262.docx", &Test::testN793262
},
208 {"n793998.docx", &Test::testN793998
},
209 {"groupshape-line.docx", &Test::testGroupshapeLine
},
210 {"n779642.docx", &Test::testN779642
},
211 {"tblr-height.docx", &Test::testTbLrHeight
},
212 {"fdo53985.docx", &Test::testFdo53985
},
213 {"fdo59638.docx", &Test::testFdo59638
},
214 {"fdo61343.docx", &Test::testFdo61343
},
215 {"tools-line-numbering.docx", &Test::testToolsLineNumbering
},
216 {"fdo60922.docx", &Test::testFdo60922
},
217 {"fdo59273.docx", &Test::testFdo59273
},
218 {"table_width.docx", &Test::testTableWidth
},
219 {"conditionalstyles-tbllook.docx", &Test::testConditionalstylesTbllook
},
220 {"fdo63685.docx", &Test::testFdo63685
},
221 {"n592908-frame.docx", &Test::testN592908_Frame
},
222 {"n592908-picture.docx", &Test::testN592908_Picture
},
223 {"n779630.docx", &Test::testN779630
},
224 {"indentation.docx", &Test::testIndentation
},
225 {"page-background.docx", &Test::testPageBackground
},
226 {"watermark.docx", &Test::testWatermark
},
227 {"page-border-shadow.docx", &Test::testPageBorderShadow
},
228 {"n820509.docx", &Test::testN820509
},
229 {"n820788.docx", &Test::testN820788
},
230 {"n820504.docx", &Test::testN820504
},
231 {"fdo43641.docx", &Test::testFdo43641
},
232 {"fdo46361.docx", &Test::testFdo46361
},
233 {"fdo65632.docx", &Test::testFdo65632
},
234 {"n816593.docx", &Test::testN816593
},
235 {"table-auto-column-fixed-size.docx", &Test::testTableAutoColumnFixedSize
},
236 {"table-floating.docx", &Test::testTableFloating
},
237 {"table-auto-nested.docx", &Test::testTableAutoNested
},
238 {"table-style-parprop.docx", &Test::testTableStyleParprop
},
239 {"table-pagebreak.docx", &Test::testTablePagebreak
},
240 {"fdo68607.docx", &Test::testFdo68607
},
241 {"vml-text-vertical-adjust.docx", &Test::testVmlTextVerticalAdjust
},
242 {"groupshape-sdt.docx", &Test::testGroupshapeSdt
},
243 {"bnc779620.docx", &Test::testBnc779620
},
244 {"rprchange_closed.docx", &Test::testRPrChangeClosed
},
245 {"fdo65090.docx", &Test::testFdo65090
},
246 {"fdo73389.docx", &Test::testFdo73389
},
247 {"rhbz988516.docx", &Test::testRhbz988516
},
250 for (unsigned int i
= 0; i
< SAL_N_ELEMENTS(aMethods
); ++i
)
252 MethodEntry
<Test
>& rEntry
= aMethods
[i
];
253 load("/sw/qa/extras/ooxmlimport/data/", rEntry
.pName
);
254 (this->*rEntry
.pMethod
)();
259 void Test::testN751054()
261 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
262 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
263 uno::Reference
<beans::XPropertySet
> xPropertySet(xDraws
->getByIndex(0), uno::UNO_QUERY
);
264 text::TextContentAnchorType eValue
;
265 xPropertySet
->getPropertyValue("AnchorType") >>= eValue
;
266 CPPUNIT_ASSERT(eValue
!= text::TextContentAnchorType_AS_CHARACTER
);
269 void Test::testN751117()
271 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
272 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
274 // First shape: the end should be an arrow, should be rotated and should be flipped.
275 uno::Reference
<beans::XPropertySet
> xPropertySet(xDraws
->getByIndex(0), uno::UNO_QUERY
);
277 xPropertySet
->getPropertyValue("LineEndName") >>= aValue
;
278 CPPUNIT_ASSERT(aValue
.indexOf("Arrow") != -1);
280 sal_Int32 nValue
= 0;
281 xPropertySet
->getPropertyValue("RotateAngle") >>= nValue
;
282 CPPUNIT_ASSERT_EQUAL(sal_Int32(90 * 100), nValue
);
284 uno::Reference
<drawing::XShape
> xShape(xPropertySet
, uno::UNO_QUERY
);
285 awt::Size
aActualSize(xShape
->getSize());
286 CPPUNIT_ASSERT(aActualSize
.Width
< 0);
288 // The second shape should be a line
289 uno::Reference
<lang::XServiceInfo
> xServiceInfo(xDraws
->getByIndex(1), uno::UNO_QUERY
);
290 CPPUNIT_ASSERT(xServiceInfo
->supportsService("com.sun.star.drawing.LineShape"));
293 void Test::testN751017()
295 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(mxComponent
, uno::UNO_QUERY
);
296 uno::Reference
<container::XNameAccess
> xMasters(xTextFieldsSupplier
->getTextFieldMasters());
297 // Make sure we have a variable named foo.
298 CPPUNIT_ASSERT(xMasters
->hasByName("com.sun.star.text.FieldMaster.SetExpression.foo"));
300 uno::Reference
<container::XEnumerationAccess
> xFieldsAccess(xTextFieldsSupplier
->getTextFields());
301 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
302 bool bFoundSet(false), bFoundGet(false);
303 while (xFields
->hasMoreElements())
305 uno::Reference
<lang::XServiceInfo
> xServiceInfo(xFields
->nextElement(), uno::UNO_QUERY
);
306 uno::Reference
<beans::XPropertySet
> xPropertySet(xServiceInfo
, uno::UNO_QUERY
);
307 sal_Int16 nValue
= 0;
309 if (xServiceInfo
->supportsService("com.sun.star.text.TextField.SetExpression"))
312 uno::Reference
<text::XDependentTextField
> xDependentTextField(xServiceInfo
, uno::UNO_QUERY
);
313 uno::Reference
<beans::XPropertySet
> xMasterProps(xDependentTextField
->getTextFieldMaster());
315 // First step: did we set foo to "bar"?
316 xMasterProps
->getPropertyValue("Name") >>= aValue
;
317 CPPUNIT_ASSERT_EQUAL(OUString("foo"), aValue
);
318 xPropertySet
->getPropertyValue("SubType") >>= nValue
;
319 CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING
, nValue
);
320 xPropertySet
->getPropertyValue("Content") >>= aValue
;
321 CPPUNIT_ASSERT_EQUAL(OUString("bar"), aValue
);
323 else if (xServiceInfo
->supportsService("com.sun.star.text.TextField.GetExpression"))
325 // Second step: check the value of foo.
327 xPropertySet
->getPropertyValue("Content") >>= aValue
;
328 CPPUNIT_ASSERT_EQUAL(OUString("foo"), aValue
);
329 xPropertySet
->getPropertyValue("SubType") >>= nValue
;
330 CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING
, nValue
);
331 xPropertySet
->getPropertyValue("CurrentPresentation") >>= aValue
;
332 CPPUNIT_ASSERT_EQUAL(OUString("bar"), aValue
);
335 CPPUNIT_ASSERT(bFoundSet
);
336 CPPUNIT_ASSERT(bFoundGet
);
339 void Test::testN750935()
341 uno::Reference
<frame::XModel
> xModel(mxComponent
, uno::UNO_QUERY
);
342 uno::Reference
<text::XTextViewCursorSupplier
> xTextViewCursorSupplier(xModel
->getCurrentController(), uno::UNO_QUERY
);
343 uno::Reference
<text::XPageCursor
> xCursor(xTextViewCursorSupplier
->getViewCursor(), uno::UNO_QUERY
);
344 xCursor
->jumpToLastPage();
345 // Some page break types were ignores, resulting in less pages.
346 CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor
->getPage());
349 * The problem was that the header and footer was not shared.
351 * xray ThisComponent.StyleFamilies.PageStyles.Default.FooterIsShared
353 uno::Reference
<beans::XPropertySet
> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE
), uno::UNO_QUERY
);
354 sal_Bool bValue
= false;
355 xPropertySet
->getPropertyValue("HeaderIsShared") >>= bValue
;
356 CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue
);
357 xPropertySet
->getPropertyValue("FooterIsShared") >>= bValue
;
358 CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue
);
361 void Test::testN757890()
363 // The w:pStyle token affected the text outside the textbox.
364 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
365 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextDocument
->getText(), uno::UNO_QUERY
);
366 uno::Reference
<container::XEnumeration
> xParaEnum
= xParaEnumAccess
->createEnumeration();
367 uno::Reference
<beans::XPropertySet
> xPara(xParaEnum
->nextElement(), uno::UNO_QUERY
);
369 xPara
->getPropertyValue("ParaStyleName") >>= aValue
;
370 CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), aValue
);
372 // This wan't centered
373 uno::Reference
<text::XTextFramesSupplier
> xTextFramesSupplier(mxComponent
, uno::UNO_QUERY
);
374 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
375 uno::Reference
<beans::XPropertySet
> xFrame(xIndexAccess
->getByIndex(0), uno::UNO_QUERY
);
377 xFrame
->getPropertyValue("HoriOrient") >>= nValue
;
378 CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER
, nValue
);
381 void Test::testRhbz988516()
383 // The problem was that the list properties of the footer leaked into body
384 CPPUNIT_ASSERT_EQUAL(OUString(),
385 getProperty
<OUString
>(getParagraph(1), "NumberingStyleName"));
386 CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), getParagraph(2)->getString());
387 CPPUNIT_ASSERT_EQUAL(OUString(),
388 getProperty
<OUString
>(getParagraph(2), "NumberingStyleName"));
389 CPPUNIT_ASSERT_EQUAL(OUString(),
390 getProperty
<OUString
>(getParagraph(3), "NumberingStyleName"));
393 void Test::testFdo49940()
395 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
396 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextDocument
->getText(), uno::UNO_QUERY
);
397 uno::Reference
<container::XEnumeration
> xParaEnum
= xParaEnumAccess
->createEnumeration();
398 uno::Reference
<beans::XPropertySet
> xPara(xParaEnum
->nextElement(), uno::UNO_QUERY
);
400 xPara
->getPropertyValue("PageStyleName") >>= aValue
;
401 CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue
);
404 void Test::testN751077()
407 xray ThisComponent.DrawPage(1).getByIndex(0).String
408 xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName
410 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
411 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(xTextDocument
, uno::UNO_QUERY
);
412 uno::Reference
<drawing::XDrawPage
> xDrawPage
= xDrawPageSupplier
->getDrawPage();
413 uno::Reference
<drawing::XShapes
> xShapes(xDrawPage
->getByIndex(1), uno::UNO_QUERY
);
414 uno::Reference
<text::XTextRange
> xShape(xShapes
->getByIndex(0), uno::UNO_QUERY
);
415 CPPUNIT_ASSERT_EQUAL(OUString("TEXT1\n"), xShape
->getString());
416 // we want to test the textbox is on the first page (it was put onto another page without the fix),
417 // use a small trick and instead of checking the page layout, check the page style
418 uno::Reference
<text::XTextContent
> xTextContent(xShape
, uno::UNO_QUERY
);
419 CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty
<OUString
>(xTextContent
->getAnchor(), "PageStyleName"));
422 void Test::testN705956_1()
425 Get the first image in the document and check it's the one image in the document.
426 It should be also anchored inline (as character) and be inside a groupshape.
427 image = ThisComponent.DrawPage.getByIndex(0)
428 graphic = image(0).Graphic
430 xray image.AnchorType
432 uno::Reference
<text::XTextDocument
> textDocument(mxComponent
, uno::UNO_QUERY
);
433 uno::Reference
<drawing::XDrawPageSupplier
> drawPageSupplier(textDocument
, uno::UNO_QUERY
);
434 uno::Reference
<drawing::XDrawPage
> drawPage
= drawPageSupplier
->getDrawPage();
435 CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), drawPage
->getCount());
436 uno::Reference
<drawing::XShapes
> shapes(drawPage
->getByIndex(0), uno::UNO_QUERY
);
437 uno::Reference
<drawing::XShape
> image
;
438 shapes
->getByIndex(0) >>= image
;
439 uno::Reference
<beans::XPropertySet
> imageProperties(image
, uno::UNO_QUERY
);
440 uno::Reference
<graphic::XGraphic
> graphic
;
441 imageProperties
->getPropertyValue( "Graphic" ) >>= graphic
;
442 uno::Reference
<awt::XBitmap
> bitmap(graphic
, uno::UNO_QUERY
);
443 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32
>(120), bitmap
->getSize().Width
);
444 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32
>(106), bitmap
->getSize().Height
);
445 text::TextContentAnchorType anchorType
;
446 imageProperties
->getPropertyValue( "AnchorType" ) >>= anchorType
;
447 CPPUNIT_ASSERT_EQUAL( text::TextContentAnchorType_AS_CHARACTER
, anchorType
);
450 void Test::testN705956_2()
453 <v:shapetype> must be global, reachable even from <v:shape> inside another <w:pict>
454 image = ThisComponent.DrawPage.getByIndex(0)
457 uno::Reference
<text::XTextDocument
> textDocument(mxComponent
, uno::UNO_QUERY
);
458 uno::Reference
<drawing::XDrawPageSupplier
> drawPageSupplier(textDocument
, uno::UNO_QUERY
);
459 uno::Reference
<drawing::XDrawPage
> drawPage
= drawPageSupplier
->getDrawPage();
460 uno::Reference
<drawing::XShape
> image
;
461 drawPage
->getByIndex(0) >>= image
;
462 uno::Reference
<beans::XPropertySet
> imageProperties(image
, uno::UNO_QUERY
);
464 imageProperties
->getPropertyValue( "FillColor" ) >>= fillColor
;
465 CPPUNIT_ASSERT_EQUAL( sal_Int32( 0xc0504d ), fillColor
);
468 void Test::testN747461()
471 The document contains 3 images (Red, Black, Green, in this order), with explicit
472 w:relativeHeight (300, 0, 225763766). Check that they are in the right ZOrder
473 after they are loaded.
475 uno::Reference
<text::XTextDocument
> textDocument(mxComponent
, uno::UNO_QUERY
);
476 uno::Reference
<drawing::XDrawPageSupplier
> drawPageSupplier(textDocument
, uno::UNO_QUERY
);
477 uno::Reference
<drawing::XDrawPage
> drawPage
= drawPageSupplier
->getDrawPage();
478 uno::Reference
<drawing::XShape
> image1
, image2
, image3
;
479 drawPage
->getByIndex( 0 ) >>= image1
;
480 drawPage
->getByIndex( 1 ) >>= image2
;
481 drawPage
->getByIndex( 2 ) >>= image3
;
482 sal_Int32 zOrder1
, zOrder2
, zOrder3
;
483 OUString descr1
, descr2
, descr3
;
484 uno::Reference
<beans::XPropertySet
> imageProperties1(image1
, uno::UNO_QUERY
);
485 imageProperties1
->getPropertyValue( "ZOrder" ) >>= zOrder1
;
486 imageProperties1
->getPropertyValue( "Description" ) >>= descr1
;
487 uno::Reference
<beans::XPropertySet
> imageProperties2(image2
, uno::UNO_QUERY
);
488 imageProperties2
->getPropertyValue( "ZOrder" ) >>= zOrder2
;
489 imageProperties2
->getPropertyValue( "Description" ) >>= descr2
;
490 uno::Reference
<beans::XPropertySet
> imageProperties3(image3
, uno::UNO_QUERY
);
491 imageProperties3
->getPropertyValue( "ZOrder" ) >>= zOrder3
;
492 imageProperties3
->getPropertyValue( "Description" ) >>= descr3
;
493 CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), zOrder1
);
494 CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), zOrder2
);
495 CPPUNIT_ASSERT_EQUAL( sal_Int32( 2 ), zOrder3
);
496 CPPUNIT_ASSERT_EQUAL( OUString( "Black" ), descr1
);
497 CPPUNIT_ASSERT_EQUAL( OUString( "Red" ), descr2
);
498 CPPUNIT_ASSERT_EQUAL( OUString( "Green" ), descr3
);
501 void Test::testN750255()
505 Column break without columns on the page is a page break, so check those paragraphs
506 are on page 2 (page style 'Converted1') and page 3 (page style 'Converted2')
507 enum = ThisComponent.Text.createEnumeration
509 para1 = enum.nextElement
511 xray para1.PageStyleName
512 para2 = enum.nextElement
514 xray para2.PageStyleName
516 // get the 2nd and 3rd paragraph
517 uno::Reference
<uno::XInterface
> paragraph1(getParagraph( 2, "one" ));
518 uno::Reference
<uno::XInterface
> paragraph2(getParagraph( 3, "two" ));
519 OUString pageStyle1
= getProperty
< OUString
>( paragraph1
, "PageStyleName" );
520 OUString pageStyle2
= getProperty
< OUString
>( paragraph2
, "PageStyleName" );
521 CPPUNIT_ASSERT_EQUAL( OUString( "Converted1" ), pageStyle1
);
522 CPPUNIT_ASSERT_EQUAL( OUString( "Converted2" ), pageStyle2
);
526 void Test::testN652364()
529 Related to 750255 above, column break with columns on the page however should be a column break.
530 enum = ThisComponent.Text.createEnumeration
532 para1 = enum.nextElement
534 xray para1.PageStyleName
536 para2 = enum.nextElement
538 xray para2.PageStyleName
540 // get the 2nd and 4th paragraph
541 uno::Reference
<uno::XInterface
> paragraph1(getParagraph( 2, "text1" ));
542 uno::Reference
<uno::XInterface
> paragraph2(getParagraph( 4, "text2" ));
543 OUString pageStyle1
= getProperty
< OUString
>( paragraph1
, "PageStyleName" );
544 OUString pageStyle2
= getProperty
< OUString
>( paragraph2
, "PageStyleName" );
545 // "Standard" is the style for the first page (2nd is "Converted1").
546 CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle1
);
547 CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle2
);
550 void Test::testN760764()
552 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
553 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextDocument
->getText(), uno::UNO_QUERY
);
554 uno::Reference
<container::XEnumeration
> xParaEnum(xParaEnumAccess
->createEnumeration());
555 uno::Reference
<container::XEnumerationAccess
> xRunEnumAccess(xParaEnum
->nextElement(), uno::UNO_QUERY
);
556 uno::Reference
<container::XEnumeration
> xRunEnum(xRunEnumAccess
->createEnumeration());
558 // Access the second run, which is a textfield
559 xRunEnum
->nextElement();
560 uno::Reference
<beans::XPropertySet
> xRun(xRunEnum
->nextElement(), uno::UNO_QUERY
);
562 xRun
->getPropertyValue("CharHeight") >>= fValue
;
563 // This used to be 11, as character properties were ignored.
564 CPPUNIT_ASSERT_EQUAL(8.f
, fValue
);
567 void Test::testN764005()
569 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
570 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
571 uno::Reference
<beans::XPropertySet
> xPropertySet(xDraws
->getByIndex(0), uno::UNO_QUERY
);
573 // The picture in the header wasn't absolutely positioned and wasn't in the background.
574 text::TextContentAnchorType eValue
;
575 xPropertySet
->getPropertyValue("AnchorType") >>= eValue
;
576 CPPUNIT_ASSERT(eValue
!= text::TextContentAnchorType_AS_CHARACTER
);
577 sal_Bool bValue
= sal_True
;
578 xPropertySet
->getPropertyValue("Opaque") >>= bValue
;
579 CPPUNIT_ASSERT_EQUAL(false, bool(bValue
));
582 void Test::testSmartart()
584 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
585 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
586 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws
->getCount()); // One groupshape in the doc
588 uno::Reference
<container::XIndexAccess
> xGroup(xDraws
->getByIndex(0), uno::UNO_QUERY
);
589 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xGroup
->getCount()); // 3 rectangles and an arrow in the group
591 uno::Reference
<beans::XPropertySet
> xPropertySet(xGroup
->getByIndex(1), uno::UNO_QUERY
);
593 xPropertySet
->getPropertyValue("FillColor") >>= nValue
;
594 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), nValue
); // If fill color is right, theme import is OK
596 uno::Reference
<text::XTextRange
> xTextRange(xGroup
->getByIndex(1), uno::UNO_QUERY
);
597 CPPUNIT_ASSERT_EQUAL(OUString("Sample"), xTextRange
->getString()); // Shape has text
599 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextRange
->getText(), uno::UNO_QUERY
);
600 uno::Reference
<container::XEnumeration
> xParaEnum
= xParaEnumAccess
->createEnumeration();
601 xPropertySet
.set(xParaEnum
->nextElement(), uno::UNO_QUERY
);
602 xPropertySet
->getPropertyValue("ParaAdjust") >>= nValue
;
603 CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_CENTER
), nValue
); // Paragraph properties are imported
606 void Test::testN764745()
609 shape = ThisComponent.DrawPage.getByIndex(0)
610 xray shape.AnchorType
611 xray shape.AnchorPosition.X
612 xray ThisComponent.StyleFamilies.PageStyles.Default.Width
614 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
615 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
616 uno::Reference
<beans::XPropertySet
> xPropertySet(xDraws
->getByIndex(0), uno::UNO_QUERY
);
617 // The paragraph is right-aligned and the picture does not explicitly specify position,
618 // so check it's anchored as character and in the right side of the document.
619 text::TextContentAnchorType anchorType
;
620 xPropertySet
->getPropertyValue("AnchorType") >>= anchorType
;
621 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER
, anchorType
);
623 xPropertySet
->getPropertyValue("AnchorPosition") >>= pos
;
624 uno::Reference
<style::XStyleFamiliesSupplier
> styleFamiliesSupplier(mxComponent
, uno::UNO_QUERY
);
625 uno::Reference
<container::XNameAccess
> styleFamilies
= styleFamiliesSupplier
->getStyleFamilies();
626 uno::Reference
<container::XNameAccess
> pageStyles
;
627 styleFamilies
->getByName("PageStyles") >>= pageStyles
;
628 uno::Reference
<uno::XInterface
> defaultStyle
;
629 pageStyles
->getByName(DEFAULT_STYLE
) >>= defaultStyle
;
630 uno::Reference
<beans::XPropertySet
> styleProperties( defaultStyle
, uno::UNO_QUERY
);
632 styleProperties
->getPropertyValue( "Width" ) >>= width
;
633 CPPUNIT_ASSERT( pos
.X
> width
/ 2 );
636 void Test::testN766477()
639 * The problem was that the checkbox was not checked.
641 * oParas = ThisComponent.Text.createEnumeration
642 * oPara = oParas.nextElement
643 * oRuns = oPara.createEnumeration
644 * oRun = oRuns.nextElement
645 * xray oRun.Bookmark.Parameters.ElementNames(0) 'Checkbox_Checked
647 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
648 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextDocument
->getText(), uno::UNO_QUERY
);
649 uno::Reference
<container::XEnumeration
> xParaEnum(xParaEnumAccess
->createEnumeration());
650 uno::Reference
<container::XEnumerationAccess
> xRunEnumAccess(xParaEnum
->nextElement(), uno::UNO_QUERY
);
651 uno::Reference
<container::XEnumeration
> xRunEnum(xRunEnumAccess
->createEnumeration());
652 uno::Reference
<beans::XPropertySet
> xRun(xRunEnum
->nextElement(), uno::UNO_QUERY
);
653 uno::Reference
<text::XFormField
> xFormField(xRun
->getPropertyValue("Bookmark"), uno::UNO_QUERY
);
654 uno::Reference
<container::XNameContainer
> xParameters(xFormField
->getParameters());
655 uno::Sequence
<OUString
> aElementNames(xParameters
->getElementNames());
656 CPPUNIT_ASSERT_EQUAL(OUString("Checkbox_Checked"), aElementNames
[0]);
659 void Test::testN758883()
662 * The problem was that direct formatting of the paragraph was not applied
663 * to the numbering. This is easier to test using a layout dump.
665 OUString aHeight
= parseDump("/root/page/body/txt/Special", "nHeight");
666 CPPUNIT_ASSERT_EQUAL(sal_Int32(220), aHeight
.toInt32()); // It was 280
669 * Next problem was that the page margin contained the width of the page border as well.
671 * xray ThisComponent.StyleFamilies.PageStyles.Default.LeftMargin
673 uno::Reference
<beans::XPropertySet
> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE
), uno::UNO_QUERY
);
674 sal_Int32 nValue
= 0;
675 xPropertySet
->getPropertyValue("LeftMargin") >>= nValue
;
676 CPPUNIT_ASSERT_EQUAL(sal_Int32(794), nValue
);
678 // No assert for the 3rd problem: see the comment in the test doc.
681 * 4th problem: Wrap type of the textwrape was not 'through'.
683 * xray ThisComponent.DrawPage(0).Surround ' was 2, should be 1
685 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
686 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
687 xPropertySet
.set(xDraws
->getByIndex(0), uno::UNO_QUERY
);
688 text::WrapTextMode eValue
;
689 xPropertySet
->getPropertyValue("Surround") >>= eValue
;
690 CPPUNIT_ASSERT_EQUAL(eValue
, text::WrapTextMode_THROUGHT
);
693 * 5th problem: anchor type of the second textbox was wrong.
695 * xray ThisComponent.DrawPage(1).AnchorType ' was 1, should be 4
697 xPropertySet
.set(xDraws
->getByIndex(1), uno::UNO_QUERY
);
698 text::TextContentAnchorType eAnchorType
;
699 xPropertySet
->getPropertyValue("AnchorType") >>= eAnchorType
;
700 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER
, eAnchorType
);
702 // 6th problem: xray ThisComponent.DrawPage(2).AnchorType ' was 2, should be 4
703 xPropertySet
.set(xDraws
->getByIndex(2), uno::UNO_QUERY
);
704 xPropertySet
->getPropertyValue("AnchorType") >>= eAnchorType
;
705 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER
, eAnchorType
);
708 void Test::testN766481()
711 * The problem was that we had an additional paragraph before the pagebreak.
713 * oParas = ThisComponent.Text.createEnumeration
714 * oPara = oParas.nextElement
715 * oPara = oParas.nextElement
716 * xray oParas.hasMoreElements ' should be false
718 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
719 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextDocument
->getText(), uno::UNO_QUERY
);
720 uno::Reference
<container::XEnumeration
> xParaEnum(xParaEnumAccess
->createEnumeration());
721 for (int i
= 0; i
< 2; ++i
)
722 xParaEnum
->nextElement();
723 CPPUNIT_ASSERT_EQUAL(sal_False
, xParaEnum
->hasMoreElements());
726 void Test::testN766487()
729 * The problem was that 1) the font size of the first para was too large 2) numbering had no first-line-indent.
731 * oParas = ThisComponent.Text.createEnumeration
732 * oPara = oParas.nextElement
733 * oRuns = oPara.createEnumeration
734 * oRun = oRuns.nextElement
735 * xray oRun.CharHeight ' 12, was larger
736 * oPara = oParas.nextElement
737 * xray oPara.ParaFirstLineIndent ' -635, was 0
739 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
740 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xTextDocument
->getText(), uno::UNO_QUERY
);
741 uno::Reference
<container::XEnumeration
> xParaEnum(xParaEnumAccess
->createEnumeration());
743 uno::Reference
<container::XEnumerationAccess
> xRunEnumAccess(xParaEnum
->nextElement(), uno::UNO_QUERY
);
744 uno::Reference
<container::XEnumeration
> xRunEnum(xRunEnumAccess
->createEnumeration());
745 uno::Reference
<beans::XPropertySet
> xPropertySet(xRunEnum
->nextElement(), uno::UNO_QUERY
);
747 xPropertySet
->getPropertyValue("CharHeight") >>= fValue
;
748 CPPUNIT_ASSERT_EQUAL(12.f
, fValue
);
750 xPropertySet
.set(xParaEnum
->nextElement(), uno::UNO_QUERY
);
751 sal_Int32 nValue
= 0;
752 xPropertySet
->getPropertyValue("ParaFirstLineIndent") >>= nValue
;
753 CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-360)), nValue
);
756 void Test::testN693238()
759 * The problem was that a continous section break at the end of the doc caused the margins to be ignored.
761 * xray ThisComponent.StyleFamilies.PageStyles.Default.LeftMargin ' was 2000, should be 635
763 uno::Reference
<beans::XPropertySet
> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE
), uno::UNO_QUERY
);
764 sal_Int32 nValue
= 0;
765 xPropertySet
->getPropertyValue("LeftMargin") >>= nValue
;
766 CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nValue
);
769 void Test::testNumbering1()
771 /* <w:numPr> in the paragraph itself was overriden by <w:numpr> introduced by the paragraph's <w:pStyle>
772 enum = ThisComponent.Text.createEnumeration
773 para = enum.NextElement
774 xray para.NumberingStyleName
775 numberingstyle = ThisComponent.NumberingRules.getByIndex(6)
776 xray numberingstyle.name - should match name above
777 numbering = numberingstyle.getByIndex(0)
778 xray numbering(11) - should be 4, arabic
779 note that the indexes may get off as the implementation evolves, C++ code seaches in loops
781 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
782 uno::Reference
< text::XTextRange
> paragraph(getParagraph( 1, "Text1." ));
783 OUString numberingStyleName
= getProperty
< OUString
>( paragraph
, "NumberingStyleName" );
784 uno::Reference
<text::XNumberingRulesSupplier
> xNumberingRulesSupplier(mxComponent
, uno::UNO_QUERY
);
785 uno::Reference
<container::XIndexAccess
> numberingRules(xNumberingRulesSupplier
->getNumberingRules(), uno::UNO_QUERY
);
786 uno::Reference
<container::XIndexAccess
> numberingRule
;
788 i
< numberingRules
->getCount();
791 OUString name
= getProperty
< OUString
>( numberingRules
->getByIndex( i
), "Name" );
792 if( name
== numberingStyleName
)
794 numberingRule
.set( numberingRules
->getByIndex( i
), uno::UNO_QUERY
);
798 CPPUNIT_ASSERT( numberingRule
.is());
799 uno::Sequence
< beans::PropertyValue
> numbering
;
800 numberingRule
->getByIndex( 0 ) >>= numbering
;
801 sal_Int16 numberingType
= style::NumberingType::NUMBER_NONE
;
803 i
< numbering
.getLength();
806 if( numbering
[ i
].Name
== "NumberingType" )
808 numbering
[ i
].Value
>>= numberingType
;
812 CPPUNIT_ASSERT_EQUAL( style::NumberingType::ARABIC
, numberingType
);
815 void Test::testBnc773061()
817 uno::Reference
< text::XTextRange
> paragraph
= getParagraph( 1 );
818 uno::Reference
< text::XTextRange
> normal
= getRun( paragraph
, 1, "Normal " );
819 uno::Reference
< text::XTextRange
> raised
= getRun( paragraph
, 2, "Raised" );
820 uno::Reference
< text::XTextRange
> lowered
= getRun( paragraph
, 4, "Lowered" );
821 CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), getProperty
< sal_Int32
>( normal
, "CharEscapement" ));
822 CPPUNIT_ASSERT_EQUAL( sal_Int32( 50 ), getProperty
< sal_Int32
>( raised
, "CharEscapement" ));
823 CPPUNIT_ASSERT_EQUAL( sal_Int32( -25 ), getProperty
< sal_Int32
>( lowered
, "CharEscapement" ));
824 CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty
< sal_Int32
>( normal
, "CharEscapementHeight" ));
825 CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty
< sal_Int32
>( raised
, "CharEscapementHeight" ));
826 CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty
< sal_Int32
>( lowered
, "CharEscapementHeight" ));
829 void Test::testAllGapsWord()
831 BorderTest borderTest
;
832 borderTest
.testTheBorders(mxComponent
);
835 void Test::testN775906()
838 * The problem was that right margin (via direct formatting) erased the left/first margin (inherited from numbering style).
840 * oParas = ThisComponent.Text.createEnumeration
841 * oPara = oParas.nextElement
842 * xray oPara.ParaFirstLineIndent ' was 0
843 * xray oPara.ParaLeftMargin ' was 0
845 CPPUNIT_ASSERT_EQUAL(sal_Int32(-635), getProperty
<sal_Int32
>(getParagraph(1), "ParaFirstLineIndent"));
846 CPPUNIT_ASSERT_EQUAL(sal_Int32(1905), getProperty
<sal_Int32
>(getParagraph(1), "ParaLeftMargin"));
849 void Test::testN775899()
852 * The problem was that a floating table wasn't imported as a frame, then it contained fake paragraphs.
854 * ThisComponent.TextFrames.Count ' was 0
855 * oParas = ThisComponent.TextFrames(0).Text.createEnumeration
856 * oPara = oParas.nextElement
857 * oPara.supportsService("com.sun.star.text.TextTable") 'was a fake paragraph
858 * oParas.hasMoreElements 'was true
860 uno::Reference
<text::XTextFramesSupplier
> xTextFramesSupplier(mxComponent
, uno::UNO_QUERY
);
861 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
862 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess
->getCount());
864 uno::Reference
<text::XTextFrame
> xFrame(xIndexAccess
->getByIndex(0), uno::UNO_QUERY
);
865 uno::Reference
<container::XEnumerationAccess
> xParaEnumAccess(xFrame
->getText(), uno::UNO_QUERY
);
866 uno::Reference
<container::XEnumeration
> xParaEnum
= xParaEnumAccess
->createEnumeration();
867 uno::Reference
<lang::XServiceInfo
> xServiceInfo(xParaEnum
->nextElement(), uno::UNO_QUERY
);
868 CPPUNIT_ASSERT_EQUAL(sal_True
, xServiceInfo
->supportsService("com.sun.star.text.TextTable"));
870 CPPUNIT_ASSERT_EQUAL(sal_False
, xParaEnum
->hasMoreElements());
873 void Test::testN777345()
875 // The problem was that v:imagedata inside v:rect was ignored.
876 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
877 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
878 uno::Reference
<document::XEmbeddedObjectSupplier2
> xSupplier(xDraws
->getByIndex(0), uno::UNO_QUERY
);
879 uno::Reference
<graphic::XGraphic
> xGraphic
= xSupplier
->getReplacementGraphic();
880 Graphic
aGraphic(xGraphic
);
881 // If this changes later, feel free to update it, but make sure it's not
882 // the checksum of a white/transparent placeholder rectangle.
883 CPPUNIT_ASSERT_EQUAL(sal_uLong(2529763117U), aGraphic
.GetChecksum());
886 void Test::testN777337()
889 * The problem was that the top and bottom margin on the first page was only 0.1cm instead of 1.7cm.
891 * oFirst = ThisComponent.StyleFamilies.PageStyles.getByName("First Page")
892 * xray oFirst.TopMargin
893 * xray oFirst.BottomMargin
895 uno::Reference
<beans::XPropertySet
> xPropertySet(getStyles("PageStyles")->getByName("First Page"), uno::UNO_QUERY
);
896 CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty
<sal_Int32
>(xPropertySet
, "TopMargin"));
897 CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty
<sal_Int32
>(xPropertySet
, "BottomMargin"));
900 void Test::testN778836()
903 * The problem was that the paragraph inherited margins from the numbering
904 * and parent paragraph styles and the result was incorrect.
906 CPPUNIT_ASSERT_EQUAL(sal_Int32(1270), getProperty
<sal_Int32
>(getParagraph(0), "ParaRightMargin"));
907 CPPUNIT_ASSERT_EQUAL(sal_Int32(3810), getProperty
<sal_Int32
>(getParagraph(0), "ParaLeftMargin"));
908 CPPUNIT_ASSERT_EQUAL(sal_Int32(-635), getProperty
<sal_Int32
>(getParagraph(0), "ParaFirstLineIndent"));
911 void Test::testN778140()
914 * The problem was that the paragraph top/bottom margins were incorrect due
915 * to unhandled w:doNotUseHTMLParagraphAutoSpacing.
917 CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty
<sal_Int32
>(getParagraph(0), "ParaTopMargin"));
918 CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty
<sal_Int32
>(getParagraph(0), "ParaBottomMargin"));
921 void Test::testN778828()
924 * The problem was that a page break after a continous section break caused
925 * double page break on title page.
927 uno::Reference
<frame::XModel
> xModel(mxComponent
, uno::UNO_QUERY
);
928 uno::Reference
<text::XTextViewCursorSupplier
> xTextViewCursorSupplier(xModel
->getCurrentController(), uno::UNO_QUERY
);
929 uno::Reference
<text::XPageCursor
> xCursor(xTextViewCursorSupplier
->getViewCursor(), uno::UNO_QUERY
);
930 xCursor
->jumpToLastPage();
931 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor
->getPage());
937 * The problem was that ~nothing was imported, except an empty CustomShape.
939 * xray ThisComponent.DrawPage(0).supportsService("com.sun.star.drawing.OpenBezierShape")
941 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
942 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
943 uno::Reference
<lang::XServiceInfo
> xServiceInfo(xDraws
->getByIndex(0), uno::UNO_QUERY
);
944 CPPUNIT_ASSERT(xServiceInfo
->supportsService("com.sun.star.drawing.OpenBezierShape"));
947 void Test::testN779834()
949 // This document simply crashed the importer.
952 void Test::testN779627()
955 * The problem was that the table left position was based on the tableCellMar left value
956 * even for nested tables, while it shouldn't.
958 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
959 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
960 uno::Reference
<beans::XPropertySet
> xTableProperties(xTables
->getByIndex(0), uno::UNO_QUERY
);
961 uno::Any aValue
= xTableProperties
->getPropertyValue("LeftMargin");
962 sal_Int32 nLeftMargin
;
963 aValue
>>= nLeftMargin
;
964 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Left margin shouldn't take tableCellMar into account in nested tables",
965 sal_Int32(0), nLeftMargin
);
968 * Another problem tested with this document is that the roundrect is
969 * centered vertically and horizontally.
971 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
972 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
973 uno::Reference
<beans::XPropertySet
> xShapeProperties( xDraws
->getByIndex(3), uno::UNO_QUERY
);
974 uno::Reference
<drawing::XShapeDescriptor
> xShapeDescriptor(xShapeProperties
, uno::UNO_QUERY
);
975 // If this goes wrong, probably the index of the shape is changed and the test should be adjusted.
976 CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.RectangleShape"), xShapeDescriptor
->getShapeType());
978 xShapeProperties
->getPropertyValue("HoriOrient") >>= nValue
;
979 CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally", text::HoriOrientation::CENTER
, nValue
);
980 xShapeProperties
->getPropertyValue("HoriOrientRelation") >>= nValue
;
981 CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally relatively to page", text::RelOrientation::PAGE_FRAME
, nValue
);
982 xShapeProperties
->getPropertyValue("VertOrient") >>= nValue
;
983 CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically", text::VertOrientation::CENTER
, nValue
);
984 xShapeProperties
->getPropertyValue("VertOrientRelation") >>= nValue
;
985 CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically relatively to page", text::RelOrientation::PAGE_FRAME
, nValue
);
988 void Test::testFdo74357()
990 // Floating table wasn't converted to a textframe.
991 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
992 uno::Reference
<container::XIndexAccess
> xDrawPage(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
994 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage
->getCount());
997 void Test::testFdo55187()
999 // 0x010d was imported as a newline.
1000 getParagraph(1, OUString("lupčka", 7, RTL_TEXTENCODING_UTF8
));
1003 void Test::testN780563()
1006 * Make sure we have the table in the fly frame created
1008 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1009 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
1010 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables
->getCount( ));
1013 void Test::testN780853()
1016 * The problem was that the table was not imported.
1018 * xray ThisComponent.TextTables.Count 'was 0
1020 uno::Reference
<text::XTextTablesSupplier
> xTextTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1021 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1022 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess
->getCount());
1025 void Test::testN780843()
1028 * The problem was that wrong footer was picked.
1030 * oParas = ThisComponent.Text.createEnumeration
1031 * oPara = oParas.nextElement
1032 * oPara = oParas.nextElement
1033 * oPara = oParas.nextElement
1034 * sStyle = oPara.PageStyleName
1035 * oStyle = ThisComponent.StyleFamilies.PageStyles.getByName(sStyle)
1036 * xray oStyle.FooterText.String ' was "hidden footer"
1038 uno::Reference
< text::XTextRange
> xPara
= getParagraph(3);
1039 OUString aStyleName
= getProperty
<OUString
>(xPara
, "PageStyleName");
1040 uno::Reference
<beans::XPropertySet
> xPageStyle(getStyles("PageStyles")->getByName(aStyleName
), uno::UNO_QUERY
);
1041 uno::Reference
<text::XTextRange
> xFooter
= getProperty
< uno::Reference
<text::XTextRange
> >(xPageStyle
, "FooterText");
1042 CPPUNIT_ASSERT_EQUAL(OUString("shown footer"), xFooter
->getString());
1045 void Test::testShadow()
1048 * The problem was that drop shadows on inline images were not being
1049 * imported and applied.
1051 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1052 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1053 uno::Reference
<beans::XPropertySet
> xPropertySet(xDraws
->getByIndex(1), uno::UNO_QUERY
);
1055 table::ShadowFormat aShadow
;
1056 xPropertySet
->getPropertyValue("ShadowFormat") >>= aShadow
;
1057 CPPUNIT_ASSERT(sal_Int32(aShadow
.ShadowWidth
) > 0);
1060 void Test::testN782061()
1063 * The problem was that the character escapement in the second run was -58.
1065 CPPUNIT_ASSERT_EQUAL(sal_Int32(-9), getProperty
<sal_Int32
>(getRun(getParagraph(1), 2), "CharEscapement"));
1068 void Test::testN782345()
1071 * The problem was that the page break was inserted before the 3rd para, instead of before the 2nd para.
1073 CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE
, getProperty
<style::BreakType
>(getParagraph(2), "BreakType"));
1076 void Test::testN779941()
1079 * Make sure top/bottom margins of tables are set to 0 (problem was: bottom margin set to 0.35cm)
1081 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1082 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
1083 uno::Reference
<beans::XPropertySet
> xTableProperties(xTables
->getByIndex(0), uno::UNO_QUERY
);
1085 uno::Any aValue
= xTableProperties
->getPropertyValue("TopMargin");
1086 sal_Int32 nTopMargin
;
1087 aValue
>>= nTopMargin
;
1088 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nTopMargin
);
1091 uno::Any aValue
= xTableProperties
->getPropertyValue("BottomMargin");
1092 sal_Int32 nBottomMargin
;
1093 aValue
>>= nBottomMargin
;
1094 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nBottomMargin
);
1098 void Test::testN783638()
1100 // The problem was that the margins of inline images were not zero.
1101 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1102 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1103 uno::Reference
<beans::XPropertySet
> xPropertySet(xDraws
->getByIndex(0), uno::UNO_QUERY
);
1104 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(xPropertySet
, "LeftMargin"));
1107 void Test::testFdo52208()
1109 // The problem was that the document had 2 pages instead of 1.
1110 uno::Reference
<frame::XModel
> xModel(mxComponent
, uno::UNO_QUERY
);
1111 uno::Reference
<text::XTextViewCursorSupplier
> xTextViewCursorSupplier(xModel
->getCurrentController(), uno::UNO_QUERY
);
1112 uno::Reference
<text::XPageCursor
> xCursor(xTextViewCursorSupplier
->getViewCursor(), uno::UNO_QUERY
);
1113 xCursor
->jumpToLastPage();
1114 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor
->getPage());
1118 void Test::testN785767()
1120 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1121 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
1122 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1123 uno::Reference
<table::XTableRows
> xTableRows(xTextTable
->getRows(), uno::UNO_QUERY
);
1124 // Check the A1 and B1 cells, the width of both of them was the default value (10000 / 9, as there were 9 cells in the row).
1125 CPPUNIT_ASSERT_MESSAGE("A1 must not have default width", sal_Int16(10000 / 9) != getProperty
< uno::Sequence
<text::TableColumnSeparator
> >(xTableRows
->getByIndex(0), "TableColumnSeparators")[0].Position
);
1126 CPPUNIT_ASSERT_MESSAGE("B1 must not have default width", sal_Int16(10000 / 9) != getProperty
< uno::Sequence
<text::TableColumnSeparator
> >(xTableRows
->getByIndex(1), "TableColumnSeparators")[0].Position
);
1129 void Test::testN773061()
1131 // xray ThisComponent.TextFrames(0).LeftBorderDistance
1132 uno::Reference
<text::XTextFramesSupplier
> xTextFramesSupplier(mxComponent
, uno::UNO_QUERY
);
1133 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
1134 uno::Reference
<beans::XPropertySet
> xFrame(xIndexAccess
->getByIndex(0), uno::UNO_QUERY
);
1135 CPPUNIT_ASSERT_EQUAL( getProperty
< sal_Int32
>( xFrame
, "LeftBorderDistance" ), sal_Int32( 0 ));
1136 CPPUNIT_ASSERT_EQUAL( getProperty
< sal_Int32
>( xFrame
, "TopBorderDistance" ), sal_Int32( 0 ));
1137 CPPUNIT_ASSERT_EQUAL( getProperty
< sal_Int32
>( xFrame
, "RightBorderDistance" ), sal_Int32( 0 ));
1138 CPPUNIT_ASSERT_EQUAL( getProperty
< sal_Int32
>( xFrame
, "BottomBorderDistance" ), sal_Int32( 0 ));
1141 void Test::testN780645()
1143 // The problem was that when the number of cells didn't match the grid, we
1144 // didn't take care of direct cell widths.
1145 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1146 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
1147 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1148 uno::Reference
<table::XTableRows
> xTableRows(xTextTable
->getRows(), uno::UNO_QUERY
);
1149 CPPUNIT_ASSERT_EQUAL(sal_Int16(2135), getProperty
< uno::Sequence
<text::TableColumnSeparator
> >(xTableRows
->getByIndex(1), "TableColumnSeparators")[0].Position
); // was 1999
1152 void Test::testFineTableDash()
1154 // The problem was that finely dashed borders on tables were unsupported
1155 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1156 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
1157 uno::Reference
<beans::XPropertySet
> xTableProperties(xTables
->getByIndex(0), uno::UNO_QUERY
);
1158 table::TableBorder2 aBorder
;
1159 xTableProperties
->getPropertyValue("TableBorder2") >>= aBorder
;
1160 CPPUNIT_ASSERT_EQUAL(aBorder
.RightLine
.LineStyle
, table::BorderLineStyle::FINE_DASHED
);
1163 void Test::testN792778()
1166 * The problem was that the importer didn't handle complex groupshapes with groupshapes, textboxes and graphics inside.
1168 * xray ThisComponent.DrawPage.Count ' 1 groupshape
1169 * xray ThisComponent.DrawPage(0).Count ' 2 sub-groupshapes
1170 * xray ThisComponent.DrawPage(0).getByIndex(0).Count ' first sub-groupshape: 1 pic
1171 * xray ThisComponent.DrawPage(0).getByIndex(1).Count ' second sub-groupshape: 1 pic
1172 * xray ThisComponent.DrawPage(0).getByIndex(0).getByIndex(0).Position.Y ' 11684, the vertical position of the shapes were also wrong
1173 * xray ThisComponent.DrawPage(0).getByIndex(1).getByIndex(0).Position.Y ' 11684
1175 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1176 uno::Reference
<container::XIndexAccess
> xDrawPage(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1177 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage
->getCount());
1179 uno::Reference
<drawing::XShapes
> xGroupShape(xDrawPage
->getByIndex(0), uno::UNO_QUERY
);
1180 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupShape
->getCount());
1182 uno::Reference
<drawing::XShapes
> xInnerGroupShape(xGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1183 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xInnerGroupShape
->getCount());
1185 uno::Reference
<drawing::XShape
> xInnerShape(xInnerGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1186 CPPUNIT_ASSERT_EQUAL(sal_Int32(11684), xInnerShape
->getPosition().Y
);
1188 xInnerGroupShape
.set(xGroupShape
->getByIndex(1), uno::UNO_QUERY
);
1189 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xInnerGroupShape
->getCount());
1191 xInnerShape
.set(xInnerGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1192 CPPUNIT_ASSERT_EQUAL(sal_Int32(11684), xInnerShape
->getPosition().Y
);
1195 void Test::testGroupshapeLine()
1198 * Another fallout from n#792778, this time first the lines inside a
1199 * groupshape wasn't imported, then the fix broke the size/position of
1200 * non-groupshape lines. Test both here.
1202 * xray ThisComponent.DrawPage.Count ' 2 shapes
1203 * xray ThisComponent.DrawPage(0).Position 'x: 2656, y: 339
1204 * xray ThisComponent.DrawPage(0).Size ' width: 3270, height: 1392
1205 * xray ThisComponent.DrawPage(1).getByIndex(0).Position 'x: 1272, y: 2286
1206 * xray ThisComponent.DrawPage(1).getByIndex(0).Size 'width: 10160, height: 0
1208 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1209 uno::Reference
<container::XIndexAccess
> xDrawPage(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1210 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDrawPage
->getCount());
1212 uno::Reference
<drawing::XShape
> xShape(xDrawPage
->getByIndex(0), uno::UNO_QUERY
);
1213 CPPUNIT_ASSERT_EQUAL(sal_Int32(2656), xShape
->getPosition().X
);
1214 CPPUNIT_ASSERT_EQUAL(sal_Int32(339), xShape
->getPosition().Y
);
1215 CPPUNIT_ASSERT_EQUAL(sal_Int32(3270), xShape
->getSize().Width
);
1216 CPPUNIT_ASSERT_EQUAL(sal_Int32(1392), xShape
->getSize().Height
);
1218 uno::Reference
<drawing::XShapes
> xGroupShape(xDrawPage
->getByIndex(1), uno::UNO_QUERY
);
1219 xShape
.set(xGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1220 CPPUNIT_ASSERT_EQUAL(sal_Int32(1272), xShape
->getPosition().X
);
1221 CPPUNIT_ASSERT_EQUAL(sal_Int32(2286), xShape
->getPosition().Y
);
1222 CPPUNIT_ASSERT_EQUAL(sal_Int32(10160), xShape
->getSize().Width
);
1223 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape
->getSize().Height
);
1226 void Test::testN793262()
1228 uno::Reference
<container::XEnumerationAccess
> xHeaderText
= getProperty
< uno::Reference
<container::XEnumerationAccess
> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE
), "HeaderText");
1229 uno::Reference
<container::XEnumeration
> xHeaderParagraphs(xHeaderText
->createEnumeration());
1230 xHeaderParagraphs
->nextElement();
1231 // Font size of the last empty paragraph in the header was ignored, this was 11.
1232 CPPUNIT_ASSERT_EQUAL(16.f
, getProperty
<float>(xHeaderParagraphs
->nextElement(), "CharHeight"));
1234 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1235 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1236 uno::Reference
<text::XTextTable
> xTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1237 // Cell margins as direct formatting were ignored, this was 0.
1238 CPPUNIT_ASSERT_EQUAL(sal_Int32(76), getProperty
<sal_Int32
>(xTable
->getCellByName("A1"), "TopBorderDistance"));
1241 void Test::testN793998()
1243 sal_Int32 nTextPortion
= parseDump("/root/page/body/txt/Text[1]", "nWidth").toInt32(); // Width of the first (text) portion
1244 sal_Int32 nTabPortion
= parseDump("/root/page/body/txt/Text[2]", "nWidth").toInt32(); // Width of the second (tab) portion
1245 sal_Int32 nParagraph
= parseDump("/root/page/body/txt/infos/bounds", "width").toInt32(); // Width of the paragraph
1246 sal_Int32 nRightMargin
= 3000;
1247 // The problem was that the tab portion didn't ignore the right margin, so text + tab width wasn't larger than body (paragraph - right margin) width.
1248 CPPUNIT_ASSERT(nTextPortion
+ nTabPortion
> nParagraph
- nRightMargin
);
1251 void Test::testN779642()
1253 uno::Reference
<text::XTextTablesSupplier
> xTextTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1255 // First problem: check that we have 2 tables, nesting caused the
1256 // creation of outer one to fail
1257 uno::Reference
<container::XIndexAccess
> xTables(xTextTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1258 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong number of imported tables", sal_Int32(2), xTables
->getCount());
1260 // Second problem: check that the outer table is in a frame, at the bottom of the page
1261 uno::Reference
<text::XTextTable
> xTextTable(xTextTablesSupplier
->getTextTables()->getByName("Table2"), uno::UNO_QUERY
);
1262 uno::Reference
<beans::XPropertySet
> xAnchor(xTextTable
->getAnchor(), uno::UNO_QUERY
);
1263 uno::Any aFrame
= xAnchor
->getPropertyValue("TextFrame");
1264 uno::Reference
<beans::XPropertySet
> xFrame
;
1267 xFrame
->getPropertyValue("VertOrient") >>= nValue
;
1268 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation", nValue
, text::VertOrientation::BOTTOM
);
1269 xFrame
->getPropertyValue("VertOrientRelation") >>= nValue
;
1270 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation relation", nValue
, text::RelOrientation::PAGE_PRINT_AREA
);
1273 void Test::testTbLrHeight()
1275 uno::Reference
<text::XTextTablesSupplier
> xTextTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1276 uno::Reference
<container::XIndexAccess
> xTables(xTextTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1277 uno::Reference
<text::XTextTable
> xTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1278 uno::Reference
<table::XTableRows
> xTableRows(xTable
->getRows(), uno::UNO_QUERY
);
1279 // btLr text direction was imported as MIN, it should be FIX to avoid incorrectly large height in case of too much content.
1280 CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX
, getProperty
<sal_Int16
>(xTableRows
->getByIndex(0), "SizeType"));
1283 void Test::testFdo53985()
1285 // Unhandled excetion prevented import of the rest of the document.
1287 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1288 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
1289 CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTables
->getCount()); // Only 4 tables were imported.
1292 void Test::testFdo59638()
1294 // The problem was that w:lvlOverride inside w:num was ignores by dmapper.
1296 uno::Reference
<beans::XPropertySet
> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY
);
1297 uno::Reference
<container::XIndexAccess
> xLevels(xPropertySet
->getPropertyValue("NumberingRules"), uno::UNO_QUERY
);
1298 uno::Sequence
<beans::PropertyValue
> aProps
;
1299 xLevels
->getByIndex(0) >>= aProps
; // 1st level
1301 for (int i
= 0; i
< aProps
.getLength(); ++i
)
1303 const beans::PropertyValue
& rProp
= aProps
[i
];
1305 if (rProp
.Name
== "BulletChar")
1307 // Was '*', should be 'o'.
1308 CPPUNIT_ASSERT_EQUAL(OUString("\xEF\x82\xB7", 3, RTL_TEXTENCODING_UTF8
), rProp
.Value
.get
<OUString
>());
1312 CPPUNIT_FAIL("no BulletChar property");
1315 void Test::testFdo61343()
1317 // The problem was that there were a groupshape in the doc, followed by an
1318 // OLE object, and this lead to a crash.
1319 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1320 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1321 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws
->getCount());
1324 void Test::testToolsLineNumbering()
1327 * Test the line numbering feature import (Tools->Line Numbering ...)
1329 * xray ThisComponent.getLineNumberingProperties().IsOn == True
1330 * xray ThisComponent.getLineNumberingProperties().CountEmptyLines == True
1331 * xray ThisComponent.getLineNumberingProperties().NumberPosition == 0
1332 * xray ThisComponent.getLineNumberingProperties().NumberingType == 4
1333 * xray ThisComponent.getLineNumberingProperties().SeparatorInterval == 3
1336 sal_Bool bValue
= sal_False
;
1337 sal_Int32 nValue
= -1;
1339 uno::Reference
< text::XTextDocument
> xtextDocument(mxComponent
, uno::UNO_QUERY
);
1340 uno::Reference
< text::XLineNumberingProperties
> xLineProperties( xtextDocument
, uno::UNO_QUERY_THROW
);
1341 uno::Reference
< beans::XPropertySet
> xPropertySet
= xLineProperties
->getLineNumberingProperties();
1343 xPropertySet
->getPropertyValue("IsOn") >>= bValue
;
1344 CPPUNIT_ASSERT_EQUAL(sal_True
, bValue
);
1346 xPropertySet
->getPropertyValue("CountEmptyLines") >>= bValue
;
1347 CPPUNIT_ASSERT_EQUAL(sal_True
, bValue
);
1349 xPropertySet
->getPropertyValue("NumberPosition") >>= nValue
;
1350 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nValue
);
1352 xPropertySet
->getPropertyValue("NumberingType") >>= nValue
;
1353 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), nValue
);
1355 xPropertySet
->getPropertyValue("SeparatorInterval") >>= nValue
;
1356 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nValue
);
1359 void Test::testFdo60922()
1361 // This was 0, not 100, due to wrong import of w:position w:val="0"
1362 CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty
<sal_Int32
>(getRun(getParagraph(1), 1), "CharEscapementHeight"));
1365 void Test::testFdo59273()
1367 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1368 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
1369 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1370 // Was 115596 (i.e. 10 times wider than necessary), as w:tblW was missing and the importer didn't set it.
1371 CPPUNIT_ASSERT_EQUAL(sal_Int32(12961), getProperty
<sal_Int32
>(xTextTable
, "Width"));
1373 uno::Reference
<table::XTableRows
> xTableRows(xTextTable
->getRows(), uno::UNO_QUERY
);
1374 // Was 9997, so the 4th column had ~zero width
1375 CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty
< uno::Sequence
<text::TableColumnSeparator
> >(xTableRows
->getByIndex(0), "TableColumnSeparators")[2].Position
);
1378 void Test::testTableWidth()
1380 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1381 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1382 // Relative width wasn't recognized during import.
1383 CPPUNIT_ASSERT_EQUAL(true, bool(getProperty
<sal_Bool
>(xTables
->getByIndex(0), "IsWidthRelative")));
1385 uno::Reference
<text::XTextFramesSupplier
> xFramesSupplier(mxComponent
, uno::UNO_QUERY
);
1386 uno::Reference
<container::XIndexAccess
> xFrames(xFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
1387 CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty
<sal_Int32
>(xFrames
->getByIndex(0), "FrameWidthPercent"));
1390 void Test::testConditionalstylesTbllook()
1392 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1393 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1394 uno::Reference
<text::XTextTable
> xTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1395 // Background was -1.
1396 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x7F7F7F), getProperty
<sal_Int32
>(xTable
->getCellByName("A1"), "BackColor"));
1399 void Test::testFdo63685()
1401 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1402 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1403 // Was 85697, i.e. original 114120 was converted to mm100 from twips, not from EMUs.
1404 CPPUNIT_ASSERT_EQUAL(sal_Int32(318), getProperty
<sal_Int32
>(xDraws
->getByIndex(0), "TopMargin"));
1407 void Test::testN592908_Frame()
1409 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1410 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1411 uno::Reference
<beans::XPropertySet
> xPropertySet(xDraws
->getByIndex(0), uno::UNO_QUERY
);
1412 text::WrapTextMode eValue
;
1413 xPropertySet
->getPropertyValue("Surround") >>= eValue
;
1414 CPPUNIT_ASSERT_EQUAL(eValue
, text::WrapTextMode_PARALLEL
);
1417 void Test::testN592908_Picture()
1419 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1420 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1421 uno::Reference
<beans::XPropertySet
> xPropertySet(xDraws
->getByIndex(0), uno::UNO_QUERY
);
1422 text::WrapTextMode eValue
;
1423 xPropertySet
->getPropertyValue("Surround") >>= eValue
;
1424 CPPUNIT_ASSERT_EQUAL(eValue
, text::WrapTextMode_PARALLEL
);
1427 void Test::testN779630()
1429 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1430 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1432 // First shape: date picker
1433 uno::Reference
<drawing::XControlShape
> xControlShape(xDraws
->getByIndex(0), uno::UNO_QUERY
);
1434 uno::Reference
<beans::XPropertySet
> xPropertySet(xControlShape
->getControl(), uno::UNO_QUERY
);
1435 uno::Reference
<lang::XServiceInfo
> xServiceInfo(xPropertySet
, uno::UNO_QUERY
);
1436 CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo
->supportsService("com.sun.star.form.component.DateField")));
1437 CPPUNIT_ASSERT_EQUAL(OUString("date default text"), getProperty
<OUString
>(xPropertySet
, "HelpText"));
1438 CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty
<sal_Int16
>(xPropertySet
, "DateFormat"));
1439 CPPUNIT_ASSERT_EQUAL(true, bool(getProperty
<sal_Bool
>(xPropertySet
, "Dropdown")));
1441 // Second shape: combo box
1442 xControlShape
.set(xDraws
->getByIndex(1), uno::UNO_QUERY
);
1443 xPropertySet
.set(xControlShape
->getControl(), uno::UNO_QUERY
);
1444 xServiceInfo
.set(xPropertySet
, uno::UNO_QUERY
);
1445 CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo
->supportsService("com.sun.star.form.component.ComboBox")));
1446 CPPUNIT_ASSERT_EQUAL(OUString("dropdown default text"), getProperty
<OUString
>(xPropertySet
, "DefaultText"));
1447 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty
< uno::Sequence
<OUString
> >(xPropertySet
, "StringItemList").getLength());
1448 CPPUNIT_ASSERT_EQUAL(true, bool(getProperty
<sal_Bool
>(xPropertySet
, "Dropdown")));
1451 void Test::testIndentation()
1453 uno::Reference
<beans::XPropertySet
> xPropertySet(getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY
);
1454 // This was RL_TB (e.g. right-to-left).
1455 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB
, getProperty
<sal_Int16
>(xPropertySet
, "WritingMode"));
1458 void Test::testPageBackground()
1460 // The problem was that <w:background w:color="92D050"/> was ignored.
1461 uno::Reference
<beans::XPropertySet
> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE
), uno::UNO_QUERY
);
1462 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty
<sal_Int32
>(xPageStyle
, "BackColor"));
1465 void Test::testWatermark()
1467 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1468 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1469 uno::Reference
<text::XTextRange
> xShape(xDraws
->getByIndex(0), uno::UNO_QUERY
);
1470 // 1st problem: last character was missing
1471 CPPUNIT_ASSERT_EQUAL(OUString("SAMPLE"), xShape
->getString());
1473 uno::Reference
<beans::XPropertySet
> xPropertySet(xShape
, uno::UNO_QUERY
);
1474 uno::Sequence
<beans::PropertyValue
> aProps
= getProperty
< uno::Sequence
<beans::PropertyValue
> >(xShape
, "CustomShapeGeometry");
1475 bool bFound
= false;
1476 for (int i
= 0; i
< aProps
.getLength(); ++i
)
1477 if (aProps
[i
].Name
== "TextPath")
1479 // 2nd problem: v:textpath wasn't imported
1480 CPPUNIT_ASSERT_EQUAL(true, bFound
);
1482 // 3rd problem: rotation angle was 315, not 45.
1483 CPPUNIT_ASSERT_EQUAL(sal_Int32(45 * 100), getProperty
<sal_Int32
>(xShape
, "RotateAngle"));
1485 // 4th problem: mso-position-vertical-relative:margin was ignored, VertOrientRelation was text::RelOrientation::FRAME.
1486 CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA
, getProperty
<sal_Int16
>(xShape
, "VertOrientRelation"));
1489 void Test::testPageBorderShadow()
1491 // The problem was that in w:pgBorders, child elements had a w:shadow attribute, but that was ignored.
1492 table::ShadowFormat aShadow
= getProperty
<table::ShadowFormat
>(getStyles("PageStyles")->getByName(DEFAULT_STYLE
), "ShadowFormat");
1493 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, sal_uInt32(aShadow
.Color
));
1494 CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT
, aShadow
.Location
);
1495 // w:sz="48" is in eights of a point, 1 pt is 20 twips.
1496 CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(48/8*20)), aShadow
.ShadowWidth
);
1499 void Test::testN820509()
1501 // Design mode was enabled.
1502 uno::Reference
<frame::XModel
> xModel(mxComponent
, uno::UNO_QUERY
);
1503 uno::Reference
<view::XFormLayerAccess
> xFormLayerAccess(xModel
->getCurrentController(), uno::UNO_QUERY
);
1504 CPPUNIT_ASSERT_EQUAL(false, bool(xFormLayerAccess
->isFormDesignMode()));
1506 // M.d.yyyy date format was unhandled.
1507 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1508 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1509 uno::Reference
<drawing::XControlShape
> xControlShape(xDraws
->getByIndex(0), uno::UNO_QUERY
);
1510 uno::Reference
<beans::XPropertySet
> xPropertySet(xControlShape
->getControl(), uno::UNO_QUERY
);
1511 uno::Reference
<lang::XServiceInfo
> xServiceInfo(xPropertySet
, uno::UNO_QUERY
);
1512 CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty
<sal_Int16
>(xPropertySet
, "DateFormat"));
1515 void Test::testN820788()
1517 // The problem was that AutoSize was not enabled for the text frame.
1518 uno::Reference
<text::XTextFramesSupplier
> xTextFramesSupplier(mxComponent
, uno::UNO_QUERY
);
1519 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
1520 uno::Reference
<beans::XPropertySet
> xFrame(xIndexAccess
->getByIndex(0), uno::UNO_QUERY
);
1521 // This was text::SizeType::FIX.
1522 CPPUNIT_ASSERT_EQUAL(text::SizeType::MIN
, getProperty
<sal_Int16
>(xFrame
, "SizeType"));
1525 void Test::testN820504()
1527 uno::Reference
<style::XStyleFamiliesSupplier
> xFamiliesSupplier(mxComponent
, uno::UNO_QUERY
);
1528 uno::Reference
<container::XNameAccess
> xFamiliesAccess(xFamiliesSupplier
->getStyleFamilies(), uno::UNO_QUERY
);
1529 uno::Reference
<container::XNameAccess
> xStylesAccess(xFamiliesAccess
->getByName("ParagraphStyles"), uno::UNO_QUERY
);
1530 uno::Reference
<beans::XPropertySet
> xStyle(xStylesAccess
->getByName("Default Style"), uno::UNO_QUERY
);
1531 // The problem was that the CharColor was set to AUTO (-1) even if we have some default char color set
1532 CPPUNIT_ASSERT_EQUAL(sal_Int32(4040635), getProperty
<sal_Int32
>(xStyle
, "CharColor"));
1534 // Also, the groupshape was anchored at-page instead of at-character
1535 // (that's incorrect as Word only supports at-character and as-character).
1536 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1537 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1538 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER
, getProperty
<text::TextContentAnchorType
>(xDraws
->getByIndex(0), "AnchorType"));
1541 void Test::testFdo43641()
1543 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1544 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1545 uno::Reference
<container::XIndexAccess
> xGroupShape(xDraws
->getByIndex(0), uno::UNO_QUERY
);
1546 uno::Reference
<drawing::XShape
> xLine(xGroupShape
->getByIndex(1), uno::UNO_QUERY
);
1547 // This was 2200, not 2579 in mm100, i.e. the size of the line shape was incorrect.
1548 CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(928694)), xLine
->getSize().Width
);
1551 void Test::testFdo46361()
1553 uno::Reference
<drawing::XDrawPageSupplier
> xDrawPageSupplier(mxComponent
, uno::UNO_QUERY
);
1554 uno::Reference
<container::XIndexAccess
> xDraws(xDrawPageSupplier
->getDrawPage(), uno::UNO_QUERY
);
1555 uno::Reference
<container::XIndexAccess
> xGroupShape(xDraws
->getByIndex(0), uno::UNO_QUERY
);
1556 uno::Reference
<drawing::XShape
> xShape(xGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1558 CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP
, getProperty
<drawing::TextVerticalAdjust
>(xShape
, "TextVerticalAdjust"));
1559 uno::Reference
<text::XText
> xText
= uno::Reference
<text::XTextRange
>(xShape
, uno::UNO_QUERY
)->getText();
1560 uno::Reference
<text::XTextRange
> xParagraph
= getParagraphOfText(1, xText
);
1562 CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER
, static_cast<style::ParagraphAdjust
>(getProperty
<sal_Int16
>(xParagraph
, "ParaAdjust")));
1563 // This was black, not green.
1564 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x008000), getProperty
<sal_Int32
>(getRun(xParagraph
, 1), "CharColor"));
1565 // \n char was missing due to unhandled w:br.
1566 CPPUNIT_ASSERT_EQUAL(OUString("text\ntext"), uno::Reference
<text::XTextRange
>(xGroupShape
->getByIndex(1), uno::UNO_QUERY
)->getString());
1567 // \n chars were missing, due to unhandled multiple w:p tags.
1568 CPPUNIT_ASSERT_EQUAL(OUString("text\ntext\n"), uno::Reference
<text::XTextRange
>(xGroupShape
->getByIndex(2), uno::UNO_QUERY
)->getString());
1571 void Test::testFdo65632()
1573 // The problem was that the footnote text had fake redline: only the body
1574 // text has redline in fact.
1575 uno::Reference
<text::XFootnotesSupplier
> xFootnotesSupplier(mxComponent
, uno::UNO_QUERY
);
1576 uno::Reference
<container::XIndexAccess
> xFootnotes(xFootnotesSupplier
->getFootnotes(), uno::UNO_QUERY
);
1577 uno::Reference
<text::XText
> xText(xFootnotes
->getByIndex(0), uno::UNO_QUERY
);
1578 //uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText);
1579 CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty
<OUString
>(getRun(getParagraphOfText(1, xText
), 1), "TextPortionType"));
1582 void Test::testN816593()
1584 // Two consecutive <w:tbl> without any paragraph in between, but with different tblpPr. In this
1585 // case we need to have 2 different tables instead of 1
1586 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1587 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
1588 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables
->getCount());
1591 void Test::testTableAutoColumnFixedSize()
1593 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1594 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1595 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1597 // Width was not recognized during import when table size was 'auto'
1598 CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(3996)), getProperty
<sal_Int32
>(xTextTable
, "Width"));
1601 void Test::testTableFloating()
1603 // Both the size and the position of the table was incorrect.
1604 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1605 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1606 // Second table was too wide: 16249, i.e. as wide as the first table.
1607 CPPUNIT_ASSERT_EQUAL(sal_Int32(11248), getProperty
<sal_Int32
>(xTables
->getByIndex(1), "Width"));
1609 uno::Reference
<text::XTextFramesSupplier
> xTextFramesSupplier(mxComponent
, uno::UNO_QUERY
);
1610 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
1611 uno::Reference
<beans::XPropertySet
> xFrame(xIndexAccess
->getByIndex(0), uno::UNO_QUERY
);
1612 // This was 0, should be the the opposite of (left margin + half of the border width).
1613 CPPUNIT_ASSERT_EQUAL(sal_Int32(-199), getProperty
<sal_Int32
>(xFrame
, "HoriOrientPosition"));
1614 // Was 0 as well, should be the right margin.
1615 CPPUNIT_ASSERT_EQUAL(sal_Int32(191), getProperty
<sal_Int32
>(xFrame
, "RightMargin"));
1618 void Test::testTableAutoNested()
1620 // This was 176, when compat option is not enabled, the auto paragraph bottom margin value was incorrect.
1621 CPPUNIT_ASSERT_EQUAL(sal_Int32(494), getProperty
<sal_Int32
>(getParagraph(1), "ParaBottomMargin"));
1623 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1624 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1625 // This was 115596, i.e. the width of the outer table was too large.
1626 CPPUNIT_ASSERT_EQUAL(sal_Int32(23051), getProperty
<sal_Int32
>(xTables
->getByIndex(1), "Width"));
1629 void Test::testTableStyleParprop()
1631 // The problem was that w:spacing's w:after=0 (a paragraph property) wasn't imported from table style.
1632 uno::Reference
<text::XTextTable
> xTable(getParagraphOrTable(1), uno::UNO_QUERY
);
1633 uno::Reference
<text::XTextRange
> xCell(xTable
->getCellByName("A1"), uno::UNO_QUERY
);
1634 // This was 353, the document default, i.e. paragraph property from table style had no effect.
1635 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
<sal_Int32
>(getParagraphOfText(1, xCell
->getText()), "ParaBottomMargin"));
1638 void Test::testTablePagebreak()
1640 // Page break inside table: should be ignored (was style::BreakType_PAGE_BEFORE before).
1641 CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE
, getProperty
<style::BreakType
>(getParagraphOrTable(2), "BreakType"));
1643 // This one is outside the table: should not be ignored.
1644 CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE
, getProperty
<style::BreakType
>(getParagraph(3), "BreakType"));
1647 void Test::testFdo68607()
1649 // Bugdoc was 8 pages in Word, 1 in Writer due to pointlessly wrapping the
1650 // table in a frame. Exact layout may depend on fonts available, etc. --
1651 // but at least make sure that our table spans over multiple pages now.
1652 CPPUNIT_ASSERT(getPages() > 1);
1655 void Test::testVmlTextVerticalAdjust()
1657 uno::Reference
<drawing::XShapes
> xOuterGroupShape(getShape(1), uno::UNO_QUERY
);
1658 uno::Reference
<drawing::XShapes
> xInnerGroupShape(xOuterGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1659 uno::Reference
<drawing::XShape
> xShape(xInnerGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1661 CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP
, getProperty
<drawing::TextVerticalAdjust
>(xShape
, "TextVerticalAdjust"));
1664 void Test::testGroupshapeSdt()
1666 // All problems here are due to the groupshape: we have a drawinglayer rectangle, not a writer textframe.
1667 uno::Reference
<drawing::XShapes
> xOuterGroupShape(getShape(1), uno::UNO_QUERY
);
1668 uno::Reference
<drawing::XShapes
> xInnerGroupShape(xOuterGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1669 uno::Reference
<text::XTextRange
> xShape(xInnerGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1670 // Border distances were not implemented, this was 0.
1671 CPPUNIT_ASSERT_EQUAL(sal_Int32(1905), getProperty
<sal_Int32
>(xShape
, "TextUpperDistance"));
1672 // Sdt field result wasn't imported, this was "".
1673 CPPUNIT_ASSERT_EQUAL(OUString("placeholder text"), xShape
->getString());
1674 // w:spacing was ignored in oox, this was 0.
1675 CPPUNIT_ASSERT_EQUAL(sal_Int32(20), getProperty
<sal_Int32
>(getRun(getParagraphOfText(1, xShape
->getText()), 1), "CharKerning"));
1678 void Test::testBnc779620()
1680 // The problem was that the floating table was imported as a non-floating one.
1681 uno::Reference
<text::XTextFramesSupplier
> xTextFramesSupplier(mxComponent
, uno::UNO_QUERY
);
1682 uno::Reference
<container::XIndexAccess
> xIndexAccess(xTextFramesSupplier
->getTextFrames(), uno::UNO_QUERY
);
1683 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess
->getCount());
1686 void Test::testRPrChangeClosed()
1688 // Redline defined by rPrChanged wasn't removed.
1689 // First paragraph has an rPrChange element, make sure it doesn't appear in the second paragraph.
1690 CPPUNIT_ASSERT_EQUAL(false, hasProperty(getRun(getParagraph(2), 1), "RedlineType"));
1693 void Test::testFdo65090()
1695 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1696 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables( ), uno::UNO_QUERY
);
1697 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1698 uno::Reference
<table::XTableRows
> xTableRows(xTextTable
->getRows(), uno::UNO_QUERY
);
1699 // The first row had two cells, instead of a single horizontally merged one.
1700 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty
< uno::Sequence
<text::TableColumnSeparator
> >(xTableRows
->getByIndex(0), "TableColumnSeparators").getLength());
1703 void Test::testFdo73389()
1705 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1706 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(), uno::UNO_QUERY
);
1707 // This was 9340, i.e. the width of the inner table was too large.
1708 CPPUNIT_ASSERT_EQUAL(sal_Int32(2842), getProperty
<sal_Int32
>(xTables
->getByIndex(0), "Width"));
1711 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
1713 CPPUNIT_PLUGIN_IMPLEMENT();
1715 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */