LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/qa/extras/ooxmlimport - ooxmlimport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 746 747 99.9 %
Date: 2013-07-09 Functions: 85 86 98.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * This file is part of the LibreOffice project.
       3             :  *
       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/.
       7             :  */
       8             : 
       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>
      40             : 
      41             : #include <vcl/svapp.hxx>
      42             : 
      43             : #include <swmodeltestbase.hxx>
      44             : #include <bordertest.hxx>
      45             : 
      46             : #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
      47             : #define EMU_TO_MM100(EMU) (EMU / 360)
      48             : 
      49           3 : class Test : public SwModelTestBase
      50             : {
      51             : public:
      52             :     void testN751054();
      53             :     void testN751117();
      54             :     void testN751017();
      55             :     void testN750935();
      56             :     void testN757890();
      57             :     void testFdo49940();
      58             :     void testN751077();
      59             :     void testN705956_1();
      60             :     void testN705956_2();
      61             :     void testN747461();
      62             :     void testN750255();
      63             :     void testN652364();
      64             :     void testN760764();
      65             :     void testN764005();
      66             :     void testSmartart();
      67             :     void testN764745();
      68             :     void testN766477();
      69             :     void testN758883();
      70             :     void testN766481();
      71             :     void testN766487();
      72             :     void testN693238();
      73             :     void testNumbering1();
      74             :     void testBnc773061();
      75             :     void testAllGapsWord();
      76             :     void testN775906();
      77             :     void testN775899();
      78             :     void testN777345();
      79             :     void testN777337();
      80             :     void testN778836();
      81             :     void testN778140();
      82             :     void testN778828();
      83             :     void testInk();
      84             :     void testN779834();
      85             :     void testN779627();
      86             :     void testN779941();
      87             :     void testFdo55187();
      88             :     void testN780563();
      89             :     void testN780853();
      90             :     void testN780843();
      91             :     void testShadow();
      92             :     void testN782061();
      93             :     void testN782345();
      94             :     void testN783638();
      95             :     void testFdo52208();
      96             :     void testN785767();
      97             :     void testN773061();
      98             :     void testN780645();
      99             :     void testFineTableDash();
     100             :     void testN792778();
     101             :     void testN793262();
     102             :     void testN793998();
     103             :     void testGroupshapeLine();
     104             :     void testN779642();
     105             :     void testTbLrHeight();
     106             :     void testFdo53985();
     107             :     void testFdo59638();
     108             :     void testFdo61343();
     109             :     void testToolsLineNumbering();
     110             :     void testFdo60922();
     111             :     void testFdo59273();
     112             :     void testTableWidth();
     113             :     void testConditionalstylesTbllook();
     114             :     void testFdo63685();
     115             :     void testN592908_Frame();
     116             :     void testN592908_Picture();
     117             :     void testN779630();
     118             :     void testIndentation();
     119             :     void testPageBorderShadow();
     120             :     void testN816593();
     121             :     void testN820509();
     122             :     void testN820788();
     123             :     void testN820504();
     124             :     void testFdo43641();
     125             :     void testTableAutoColumnFixedSize();
     126             :     void testFdo46361();
     127             : 
     128           2 :     CPPUNIT_TEST_SUITE(Test);
     129             : #if !defined(MACOSX) && !defined(WNT)
     130           1 :     CPPUNIT_TEST(run);
     131             : #endif
     132           2 :     CPPUNIT_TEST_SUITE_END();
     133             : 
     134             : private:
     135             :     void run();
     136             : };
     137             : 
     138           1 : void Test::run()
     139             : {
     140             :     MethodEntry<Test> aMethods[] = {
     141             :         {"n751054.docx", &Test::testN751054},
     142             :         {"n751117.docx", &Test::testN751117},
     143             :         {"n751017.docx", &Test::testN751017},
     144             :         {"n750935.docx", &Test::testN750935},
     145             :         {"n757890.docx", &Test::testN757890},
     146             :         {"fdo49940.docx", &Test::testFdo49940},
     147             :         {"n751077.docx", &Test::testN751077},
     148             :         {"n705956-1.docx", &Test::testN705956_1},
     149             :         {"n705956-2.docx", &Test::testN705956_2},
     150             :         {"n747461.docx", &Test::testN747461},
     151             :         {"n750255.docx", &Test::testN750255},
     152             :         {"n652364.docx", &Test::testN652364},
     153             :         {"n760764.docx", &Test::testN760764},
     154             :         {"n764005.docx", &Test::testN764005},
     155             :         {"smartart.docx", &Test::testSmartart},
     156             :         {"n764745-alignment.docx", &Test::testN764745},
     157             :         {"n766477.docx", &Test::testN766477},
     158             :         {"n758883.docx", &Test::testN758883},
     159             :         {"n766481.docx", &Test::testN766481},
     160             :         {"n766487.docx", &Test::testN766487},
     161             :         {"n693238.docx", &Test::testN693238},
     162             :         {"numbering1.docx", &Test::testNumbering1},
     163             :         {"bnc773061.docx", &Test::testBnc773061},
     164             :         {"all_gaps_word.docx", &Test::testAllGapsWord},
     165             :         {"n775906.docx", &Test::testN775906},
     166             :         {"n775899.docx", &Test::testN775899},
     167             :         {"n777345.docx", &Test::testN777345},
     168             :         {"n777337.docx", &Test::testN777337},
     169             :         {"n778836.docx", &Test::testN778836},
     170             :         {"n778140.docx", &Test::testN778140},
     171             :         {"n778828.docx", &Test::testN778828},
     172             :         {"ink.docx", &Test::testInk},
     173             :         {"n779834.docx", &Test::testN779834},
     174             :         {"n779627.docx", &Test::testN779627},
     175             :         {"n779941.docx", &Test::testN779941},
     176             :         {"fdo55187.docx", &Test::testFdo55187},
     177             :         {"n780563.docx", &Test::testN780563},
     178             :         {"n780853.docx", &Test::testN780853},
     179             :         {"n780843.docx", &Test::testN780843},
     180             :         {"imgshadow.docx", &Test::testShadow},
     181             :         {"n782061.docx", &Test::testN782061},
     182             :         {"n782345.docx", &Test::testN782345},
     183             :         {"n783638.docx", &Test::testN783638},
     184             :         {"fdo52208.docx", &Test::testFdo52208},
     185             :         {"n785767.docx", &Test::testN785767},
     186             :         {"n773061.docx", &Test::testN773061},
     187             :         {"n780645.docx", &Test::testN780645},
     188             :         {"tableborder-finedash.docx", &Test::testFineTableDash},
     189             :         {"n792778.docx", &Test::testN792778},
     190             :         {"n793262.docx", &Test::testN793262},
     191             :         {"n793998.docx", &Test::testN793998},
     192             :         {"groupshape-line.docx", &Test::testGroupshapeLine},
     193             :         {"n779642.docx", &Test::testN779642},
     194             :         {"tblr-height.docx", &Test::testTbLrHeight},
     195             :         {"fdo53985.docx", &Test::testFdo53985},
     196             :         {"fdo59638.docx", &Test::testFdo59638},
     197             :         {"fdo61343.docx", &Test::testFdo61343},
     198             :         {"tools-line-numbering.docx", &Test::testToolsLineNumbering},
     199             :         {"fdo60922.docx", &Test::testFdo60922},
     200             :         {"fdo59273.docx", &Test::testFdo59273},
     201             :         {"table_width.docx", &Test::testTableWidth},
     202             :         {"conditionalstyles-tbllook.docx", &Test::testConditionalstylesTbllook},
     203             :         {"fdo63685.docx", &Test::testFdo63685},
     204             :         {"n592908-frame.docx", &Test::testN592908_Frame},
     205             :         {"n592908-picture.docx", &Test::testN592908_Picture},
     206             :         {"n779630.docx", &Test::testN779630},
     207             :         {"indentation.docx", &Test::testIndentation},
     208             :         {"page-border-shadow.docx", &Test::testPageBorderShadow},
     209             :         {"n816593.docx", &Test::testN816593},
     210             :         {"n820509.docx", &Test::testN820509},
     211             :         {"n820788.docx", &Test::testN820788},
     212             :         {"n820504.docx", &Test::testN820504},
     213             :         {"fdo43641.docx", &Test::testFdo43641},
     214             :         {"table-auto-column-fixed-size.docx", &Test::testTableAutoColumnFixedSize},
     215             :         {"fdo46361.docx", &Test::testFdo46361},
     216           1 :     };
     217           1 :     header();
     218          76 :     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     219             :     {
     220          75 :         MethodEntry<Test>& rEntry = aMethods[i];
     221          75 :         load("/sw/qa/extras/ooxmlimport/data/",  rEntry.pName);
     222          75 :         (this->*rEntry.pMethod)();
     223          75 :         finish();
     224             :     }
     225           1 : }
     226             : 
     227           1 : void Test::testN751054()
     228             : {
     229           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     230           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     231           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
     232             :     text::TextContentAnchorType eValue;
     233           1 :     xPropertySet->getPropertyValue("AnchorType") >>= eValue;
     234           2 :     CPPUNIT_ASSERT(eValue != text::TextContentAnchorType_AS_CHARACTER);
     235           1 : }
     236             : 
     237           1 : void Test::testN751117()
     238             : {
     239           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     240           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     241             : 
     242             :     // First shape: the end should be an arrow, should be rotated and should be flipped.
     243           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
     244           2 :     OUString aValue;
     245           1 :     xPropertySet->getPropertyValue("LineEndName") >>= aValue;
     246           1 :     CPPUNIT_ASSERT(aValue.indexOf("Arrow") != -1);
     247             : 
     248           1 :     sal_Int32 nValue = 0;
     249           1 :     xPropertySet->getPropertyValue("RotateAngle") >>= nValue;
     250           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(90 * 100), nValue);
     251             : 
     252           2 :     uno::Reference<drawing::XShape> xShape(xPropertySet, uno::UNO_QUERY);
     253           1 :     awt::Size aActualSize(xShape->getSize());
     254           1 :     CPPUNIT_ASSERT(aActualSize.Width < 0);
     255             : 
     256             :     // The second shape should be a line
     257           2 :     uno::Reference<lang::XServiceInfo> xServiceInfo(xDraws->getByIndex(1), uno::UNO_QUERY);
     258           2 :     CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.drawing.LineShape"));
     259           1 : }
     260             : 
     261           1 : void Test::testN751017()
     262             : {
     263           1 :     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     264           2 :     uno::Reference<container::XNameAccess> xMasters(xTextFieldsSupplier->getTextFieldMasters());
     265             :     // Make sure we have a variable named foo.
     266           1 :     CPPUNIT_ASSERT(xMasters->hasByName("com.sun.star.text.FieldMaster.SetExpression.foo"));
     267             : 
     268           2 :     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     269           2 :     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
     270           1 :     bool bFoundSet(false), bFoundGet(false);
     271           4 :     while (xFields->hasMoreElements())
     272             :     {
     273           2 :         uno::Reference<lang::XServiceInfo> xServiceInfo(xFields->nextElement(), uno::UNO_QUERY);
     274           4 :         uno::Reference<beans::XPropertySet> xPropertySet(xServiceInfo, uno::UNO_QUERY);
     275           2 :         sal_Int16 nValue = 0;
     276           4 :         OUString aValue;
     277           2 :         if (xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression"))
     278             :         {
     279           1 :             bFoundSet = true;
     280           1 :             uno::Reference<text::XDependentTextField> xDependentTextField(xServiceInfo, uno::UNO_QUERY);
     281           2 :             uno::Reference<beans::XPropertySet> xMasterProps(xDependentTextField->getTextFieldMaster());
     282             : 
     283             :             // First step: did we set foo to "bar"?
     284           1 :             xMasterProps->getPropertyValue("Name") >>= aValue;
     285           1 :             CPPUNIT_ASSERT_EQUAL(OUString("foo"), aValue);
     286           1 :             xPropertySet->getPropertyValue("SubType") >>= nValue;
     287           1 :             CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING, nValue);
     288           1 :             xPropertySet->getPropertyValue("Content") >>= aValue;
     289           2 :             CPPUNIT_ASSERT_EQUAL(OUString("bar"), aValue);
     290             :         }
     291           1 :         else if (xServiceInfo->supportsService("com.sun.star.text.TextField.GetExpression"))
     292             :         {
     293             :             // Second step: check the value of foo.
     294           1 :             bFoundGet = true;
     295           1 :             xPropertySet->getPropertyValue("Content") >>= aValue;
     296           1 :             CPPUNIT_ASSERT_EQUAL(OUString("foo"), aValue);
     297           1 :             xPropertySet->getPropertyValue("SubType") >>= nValue;
     298           1 :             CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING, nValue);
     299           1 :             xPropertySet->getPropertyValue("CurrentPresentation") >>= aValue;
     300           1 :             CPPUNIT_ASSERT_EQUAL(OUString("bar"), aValue);
     301             :         }
     302           2 :     }
     303           1 :     CPPUNIT_ASSERT(bFoundSet);
     304           2 :     CPPUNIT_ASSERT(bFoundGet);
     305           1 : }
     306             : 
     307           1 : void Test::testN750935()
     308             : {
     309           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     310           2 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
     311           2 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
     312           1 :     xCursor->jumpToLastPage();
     313             :     // Some page break types were ignores, resulting in less pages.
     314           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor->getPage());
     315             : 
     316             :     /*
     317             :      * The problem was that the header and footer was not shared.
     318             :      *
     319             :      * xray ThisComponent.StyleFamilies.PageStyles.Default.FooterIsShared
     320             :      */
     321           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     322           1 :     sal_Bool bValue = false;
     323           1 :     xPropertySet->getPropertyValue("HeaderIsShared") >>= bValue;
     324           1 :     CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
     325           1 :     xPropertySet->getPropertyValue("FooterIsShared") >>= bValue;
     326           2 :     CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
     327           1 : }
     328             : 
     329           1 : void Test::testN757890()
     330             : {
     331             :     // The w:pStyle token affected the text outside the textbox.
     332           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     333           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     334           2 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     335           2 :     uno::Reference<beans::XPropertySet> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
     336           2 :     OUString aValue;
     337           1 :     xPara->getPropertyValue("ParaStyleName") >>= aValue;
     338           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), aValue);
     339             : 
     340             :     // This wan't centered
     341           2 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     342           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     343           2 :     uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     344             :     sal_Int16 nValue;
     345           1 :     xFrame->getPropertyValue("HoriOrient") >>= nValue;
     346           2 :     CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue);
     347           1 : }
     348             : 
     349           1 : void Test::testFdo49940()
     350             : {
     351           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     352           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     353           2 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     354           2 :     uno::Reference<beans::XPropertySet> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
     355           2 :     OUString aValue;
     356           1 :     xPara->getPropertyValue("PageStyleName") >>= aValue;
     357           2 :     CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue);
     358           1 : }
     359             : 
     360           1 : void Test::testN751077()
     361             : {
     362             : /*
     363             : xray ThisComponent.DrawPage(1).getByIndex(0).String
     364             : xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName
     365             : */
     366           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     367           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xTextDocument, uno::UNO_QUERY);
     368           2 :     uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
     369           2 :     uno::Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(1), uno::UNO_QUERY);
     370           2 :     uno::Reference<text::XTextRange> xShape(xShapes->getByIndex(0), uno::UNO_QUERY);
     371           1 :     CPPUNIT_ASSERT_EQUAL(OUString("TEXT1\n"), xShape->getString());
     372             :     // we want to test the textbox is on the first page (it was put onto another page without the fix),
     373             :     // use a small trick and instead of checking the page layout, check the page style
     374           2 :     uno::Reference<text::XTextContent> xTextContent(xShape, uno::UNO_QUERY);
     375           2 :     CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty<OUString>(xTextContent->getAnchor(), "PageStyleName"));
     376           1 : }
     377             : 
     378           1 : void Test::testN705956_1()
     379             : {
     380             : /*
     381             : Get the first image in the document and check it's the one image in the document.
     382             : It should be also anchored inline (as character) and be inside a groupshape.
     383             : image = ThisComponent.DrawPage.getByIndex(0)
     384             : graphic = image(0).Graphic
     385             : xray graphic.Size
     386             : xray image.AnchorType
     387             : */
     388           1 :     uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
     389           2 :     uno::Reference<drawing::XDrawPageSupplier> drawPageSupplier(textDocument, uno::UNO_QUERY);
     390           2 :     uno::Reference<drawing::XDrawPage> drawPage = drawPageSupplier->getDrawPage();
     391           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), drawPage->getCount());
     392           2 :     uno::Reference<drawing::XShapes> shapes(drawPage->getByIndex(0), uno::UNO_QUERY);
     393           2 :     uno::Reference<drawing::XShape> image;
     394           1 :     shapes->getByIndex(0) >>= image;
     395           2 :     uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
     396           2 :     uno::Reference<graphic::XGraphic> graphic;
     397           1 :     imageProperties->getPropertyValue( "Graphic" ) >>= graphic;
     398           2 :     uno::Reference<awt::XBitmap> bitmap(graphic, uno::UNO_QUERY);
     399           1 :     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(120), bitmap->getSize().Width );
     400           1 :     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(106), bitmap->getSize().Height );
     401             :     text::TextContentAnchorType anchorType;
     402           1 :     imageProperties->getPropertyValue( "AnchorType" ) >>= anchorType;
     403           2 :     CPPUNIT_ASSERT_EQUAL( text::TextContentAnchorType_AS_CHARACTER, anchorType );
     404           1 : }
     405             : 
     406           1 : void Test::testN705956_2()
     407             : {
     408             : /*
     409             : <v:shapetype> must be global, reachable even from <v:shape> inside another <w:pict>
     410             : image = ThisComponent.DrawPage.getByIndex(0)
     411             : xray image.FillColor
     412             : */
     413           1 :     uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
     414           2 :     uno::Reference<drawing::XDrawPageSupplier> drawPageSupplier(textDocument, uno::UNO_QUERY);
     415           2 :     uno::Reference<drawing::XDrawPage> drawPage = drawPageSupplier->getDrawPage();
     416           2 :     uno::Reference<drawing::XShape> image;
     417           1 :     drawPage->getByIndex(0) >>= image;
     418           2 :     uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
     419             :     sal_Int32 fillColor;
     420           1 :     imageProperties->getPropertyValue( "FillColor" ) >>= fillColor;
     421           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0xc0504d ), fillColor );
     422           1 : }
     423             : 
     424           1 : void Test::testN747461()
     425             : {
     426             : /*
     427             : The document contains 3 images (Red, Black, Green, in this order), with explicit
     428             : w:relativeHeight (300, 0, 225763766). Check that they are in the right ZOrder
     429             : after they are loaded.
     430             : */
     431           1 :     uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
     432           2 :     uno::Reference<drawing::XDrawPageSupplier> drawPageSupplier(textDocument, uno::UNO_QUERY);
     433           2 :     uno::Reference<drawing::XDrawPage> drawPage = drawPageSupplier->getDrawPage();
     434           2 :     uno::Reference<drawing::XShape> image1, image2, image3;
     435           1 :     drawPage->getByIndex( 0 ) >>= image1;
     436           1 :     drawPage->getByIndex( 1 ) >>= image2;
     437           1 :     drawPage->getByIndex( 2 ) >>= image3;
     438             :     sal_Int32 zOrder1, zOrder2, zOrder3;
     439           2 :     OUString descr1, descr2, descr3;
     440           2 :     uno::Reference<beans::XPropertySet> imageProperties1(image1, uno::UNO_QUERY);
     441           1 :     imageProperties1->getPropertyValue( "ZOrder" ) >>= zOrder1;
     442           1 :     imageProperties1->getPropertyValue( "Description" ) >>= descr1;
     443           2 :     uno::Reference<beans::XPropertySet> imageProperties2(image2, uno::UNO_QUERY);
     444           1 :     imageProperties2->getPropertyValue( "ZOrder" ) >>= zOrder2;
     445           1 :     imageProperties2->getPropertyValue( "Description" ) >>= descr2;
     446           2 :     uno::Reference<beans::XPropertySet> imageProperties3(image3, uno::UNO_QUERY);
     447           1 :     imageProperties3->getPropertyValue( "ZOrder" ) >>= zOrder3;
     448           1 :     imageProperties3->getPropertyValue( "Description" ) >>= descr3;
     449           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), zOrder1 );
     450           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), zOrder2 );
     451           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 2 ), zOrder3 );
     452           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "Black" ), descr1 );
     453           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "Red" ), descr2 );
     454           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "Green" ), descr3 );
     455           1 : }
     456             : 
     457           1 : void Test::testN750255()
     458             : {
     459             : 
     460             : /*
     461             : Column break without columns on the page is a page break, so check those paragraphs
     462             : are on page 2 (page style 'Converted1') and page 3 (page style 'Converted2')
     463             : enum = ThisComponent.Text.createEnumeration
     464             : enum.nextElement
     465             : para1 = enum.nextElement
     466             : xray para1.String
     467             : xray para1.PageStyleName
     468             : para2 = enum.nextElement
     469             : xray para2.String
     470             : xray para2.PageStyleName
     471             : */
     472             :     // get the 2nd and 3rd paragraph
     473           1 :     uno::Reference<uno::XInterface> paragraph1(getParagraph( 2, "one" ));
     474           2 :     uno::Reference<uno::XInterface> paragraph2(getParagraph( 3, "two" ));
     475           2 :     OUString pageStyle1 = getProperty< OUString >( paragraph1, "PageStyleName" );
     476           2 :     OUString pageStyle2 = getProperty< OUString >( paragraph2, "PageStyleName" );
     477           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "Converted1" ), pageStyle1 );
     478           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "Converted2" ), pageStyle2 );
     479             : 
     480           1 : }
     481             : 
     482           1 : void Test::testN652364()
     483             : {
     484             : /*
     485             : Related to 750255 above, column break with columns on the page however should be a column break.
     486             : enum = ThisComponent.Text.createEnumeration
     487             : enum.nextElement
     488             : para1 = enum.nextElement
     489             : xray para1.String
     490             : xray para1.PageStyleName
     491             : enum.nextElement
     492             : para2 = enum.nextElement
     493             : xray para2.String
     494             : xray para2.PageStyleName
     495             : */
     496             :     // get the 2nd and 4th paragraph
     497           1 :     uno::Reference<uno::XInterface> paragraph1(getParagraph( 2, "text1" ));
     498           2 :     uno::Reference<uno::XInterface> paragraph2(getParagraph( 4, "text2" ));
     499           2 :     OUString pageStyle1 = getProperty< OUString >( paragraph1, "PageStyleName" );
     500           2 :     OUString pageStyle2 = getProperty< OUString >( paragraph2, "PageStyleName" );
     501             :     // "Standard" is the style for the first page (2nd is "Converted1").
     502           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle1 );
     503           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle2 );
     504           1 : }
     505             : 
     506           1 : void Test::testN760764()
     507             : {
     508           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     509           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     510           2 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     511           2 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     512           2 :     uno::Reference<container::XEnumeration> xRunEnum(xRunEnumAccess->createEnumeration());
     513             : 
     514             :     // Access the second run, which is a textfield
     515           1 :     xRunEnum->nextElement();
     516           2 :     uno::Reference<beans::XPropertySet> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
     517             :     float fValue;
     518           1 :     xRun->getPropertyValue("CharHeight") >>= fValue;
     519             :     // This used to be 11, as character properties were ignored.
     520           2 :     CPPUNIT_ASSERT_EQUAL(8.f, fValue);
     521           1 : }
     522             : 
     523           1 : void Test::testN764005()
     524             : {
     525           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     526           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     527           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
     528             : 
     529             :     // The picture in the header wasn't absolutely positioned and wasn't in the background.
     530             :     text::TextContentAnchorType eValue;
     531           1 :     xPropertySet->getPropertyValue("AnchorType") >>= eValue;
     532           1 :     CPPUNIT_ASSERT(eValue != text::TextContentAnchorType_AS_CHARACTER);
     533           1 :     sal_Bool bValue = sal_True;
     534           1 :     xPropertySet->getPropertyValue("Opaque") >>= bValue;
     535           2 :     CPPUNIT_ASSERT_EQUAL(false, bool(bValue));
     536           1 : }
     537             : 
     538           1 : void Test::testSmartart()
     539             : {
     540           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     541           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     542           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); // One groupshape in the doc
     543             : 
     544           2 :     uno::Reference<container::XIndexAccess> xGroup(xDraws->getByIndex(0), uno::UNO_QUERY);
     545           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xGroup->getCount()); // 3 rectangles and an arrow in the group
     546             : 
     547           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xGroup->getByIndex(1), uno::UNO_QUERY);
     548           1 :     sal_Int32 nValue(0);
     549           1 :     xPropertySet->getPropertyValue("FillColor") >>= nValue;
     550           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), nValue); // If fill color is right, theme import is OK
     551             : 
     552           2 :     uno::Reference<text::XTextRange> xTextRange(xGroup->getByIndex(1), uno::UNO_QUERY);
     553           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Sample"), xTextRange->getString()); // Shape has text
     554             : 
     555           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextRange->getText(), uno::UNO_QUERY);
     556           2 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     557           1 :     xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
     558           1 :     xPropertySet->getPropertyValue("ParaAdjust") >>= nValue;
     559           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_CENTER), nValue); // Paragraph properties are imported
     560           1 : }
     561             : 
     562           1 : void Test::testN764745()
     563             : {
     564             : /*
     565             : shape = ThisComponent.DrawPage.getByIndex(0)
     566             : xray shape.AnchorType
     567             : xray shape.AnchorPosition.X
     568             : xray ThisComponent.StyleFamilies.PageStyles.Default.Width
     569             : */
     570           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     571           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     572           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
     573             :     // The paragraph is right-aligned and the picture does not explicitly specify position,
     574             :     // so check it's anchored as character and in the right side of the document.
     575             :     text::TextContentAnchorType anchorType;
     576           1 :     xPropertySet->getPropertyValue("AnchorType") >>= anchorType;
     577           1 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, anchorType);
     578           1 :     awt::Point pos;
     579           1 :     xPropertySet->getPropertyValue("AnchorPosition") >>= pos;
     580           2 :     uno::Reference<style::XStyleFamiliesSupplier> styleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
     581           2 :     uno::Reference<container::XNameAccess> styleFamilies = styleFamiliesSupplier->getStyleFamilies();
     582           2 :     uno::Reference<container::XNameAccess> pageStyles;
     583           1 :     styleFamilies->getByName("PageStyles") >>= pageStyles;
     584           2 :     uno::Reference<uno::XInterface> defaultStyle;
     585           1 :     pageStyles->getByName(DEFAULT_STYLE) >>= defaultStyle;
     586           2 :     uno::Reference<beans::XPropertySet> styleProperties( defaultStyle, uno::UNO_QUERY );
     587           1 :     sal_Int32 width = 0;
     588           1 :     styleProperties->getPropertyValue( "Width" ) >>= width;
     589           2 :     CPPUNIT_ASSERT( pos.X > width / 2 );
     590           1 : }
     591             : 
     592           1 : void Test::testN766477()
     593             : {
     594             :     /*
     595             :      * The problem was that the checkbox was not checked.
     596             :      *
     597             :      * oParas = ThisComponent.Text.createEnumeration
     598             :      * oPara = oParas.nextElement
     599             :      * oRuns = oPara.createEnumeration
     600             :      * oRun = oRuns.nextElement
     601             :      * xray oRun.Bookmark.Parameters.ElementNames(0) 'Checkbox_Checked
     602             :      */
     603           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     604           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     605           2 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     606           2 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     607           2 :     uno::Reference<container::XEnumeration> xRunEnum(xRunEnumAccess->createEnumeration());
     608           2 :     uno::Reference<beans::XPropertySet> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
     609           2 :     uno::Reference<text::XFormField> xFormField(xRun->getPropertyValue("Bookmark"), uno::UNO_QUERY);
     610           2 :     uno::Reference<container::XNameContainer> xParameters(xFormField->getParameters());
     611           2 :     uno::Sequence<OUString> aElementNames(xParameters->getElementNames());
     612           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Checkbox_Checked"), aElementNames[0]);
     613           1 : }
     614             : 
     615           1 : void Test::testN758883()
     616             : {
     617             :     /*
     618             :      * The problem was that direct formatting of the paragraph was not applied
     619             :      * to the numbering. This is easier to test using a layout dump.
     620             :      */
     621           1 :     OUString aHeight = parseDump("/root/page/body/txt/Special", "nHeight");
     622           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(220), aHeight.toInt32()); // It was 280
     623             : 
     624             :     /*
     625             :      * Next problem was that the page margin contained the width of the page border as well.
     626             :      *
     627             :      * xray ThisComponent.StyleFamilies.PageStyles.Default.LeftMargin
     628             :      */
     629           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     630           1 :     sal_Int32 nValue = 0;
     631           1 :     xPropertySet->getPropertyValue("LeftMargin") >>= nValue;
     632           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(794), nValue);
     633             : 
     634             :     // No assert for the 3rd problem: see the comment in the test doc.
     635             : 
     636             :     /*
     637             :      * 4th problem: Wrap type of the textwrape was not 'through'.
     638             :      *
     639             :      * xray ThisComponent.DrawPage(0).Surround ' was 2, should be 1
     640             :      */
     641           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     642           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     643           1 :     xPropertySet.set(xDraws->getByIndex(0), uno::UNO_QUERY);
     644             :     text::WrapTextMode eValue;
     645           1 :     xPropertySet->getPropertyValue("Surround") >>= eValue;
     646           1 :     CPPUNIT_ASSERT_EQUAL(eValue, text::WrapTextMode_THROUGHT);
     647             : 
     648             :     /*
     649             :      * 5th problem: anchor type of the second textbox was wrong.
     650             :      *
     651             :      * xray ThisComponent.DrawPage(1).AnchorType ' was 1, should be 4
     652             :      */
     653           1 :     xPropertySet.set(xDraws->getByIndex(1), uno::UNO_QUERY);
     654             :     text::TextContentAnchorType eAnchorType;
     655           1 :     xPropertySet->getPropertyValue("AnchorType") >>= eAnchorType;
     656           1 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eAnchorType);
     657             : 
     658             :     // 6th problem: xray ThisComponent.DrawPage(2).AnchorType ' was 2, should be 4
     659           1 :     xPropertySet.set(xDraws->getByIndex(2), uno::UNO_QUERY);
     660           1 :     xPropertySet->getPropertyValue("AnchorType") >>= eAnchorType;
     661           2 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eAnchorType);
     662           1 : }
     663             : 
     664           1 : void Test::testN766481()
     665             : {
     666             :     /*
     667             :      * The problem was that we had an additional paragraph before the pagebreak.
     668             :      *
     669             :      * oParas = ThisComponent.Text.createEnumeration
     670             :      * oPara = oParas.nextElement
     671             :      * oPara = oParas.nextElement
     672             :      * xray oParas.hasMoreElements ' should be false
     673             :      */
     674           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     675           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     676           2 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     677           3 :     for (int i = 0; i < 2; ++i)
     678           2 :         xParaEnum->nextElement();
     679           2 :     CPPUNIT_ASSERT_EQUAL(sal_False, xParaEnum->hasMoreElements());
     680           1 : }
     681             : 
     682           1 : void Test::testN766487()
     683             : {
     684             :     /*
     685             :      * The problem was that 1) the font size of the first para was too large 2) numbering had no first-line-indent.
     686             :      *
     687             :      * oParas = ThisComponent.Text.createEnumeration
     688             :      * oPara = oParas.nextElement
     689             :      * oRuns = oPara.createEnumeration
     690             :      * oRun = oRuns.nextElement
     691             :      * xray oRun.CharHeight ' 12, was larger
     692             :      * oPara = oParas.nextElement
     693             :      * xray oPara.ParaFirstLineIndent ' -635, was 0
     694             :      */
     695           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     696           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     697           2 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     698             : 
     699           2 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     700           2 :     uno::Reference<container::XEnumeration> xRunEnum(xRunEnumAccess->createEnumeration());
     701           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
     702           1 :     float fValue = 0;
     703           1 :     xPropertySet->getPropertyValue("CharHeight") >>= fValue;
     704           1 :     CPPUNIT_ASSERT_EQUAL(12.f, fValue);
     705             : 
     706           1 :     xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
     707           1 :     sal_Int32 nValue = 0;
     708           1 :     xPropertySet->getPropertyValue("ParaFirstLineIndent") >>= nValue;
     709           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-360)), nValue);
     710           1 : }
     711             : 
     712           1 : void Test::testN693238()
     713             : {
     714             :     /*
     715             :      * The problem was that a continous section break at the end of the doc caused the margins to be ignored.
     716             :      *
     717             :      * xray ThisComponent.StyleFamilies.PageStyles.Default.LeftMargin ' was 2000, should be 635
     718             :      */
     719           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     720           1 :     sal_Int32 nValue = 0;
     721           1 :     xPropertySet->getPropertyValue("LeftMargin") >>= nValue;
     722           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nValue);
     723           1 : }
     724             : 
     725           1 : void Test::testNumbering1()
     726             : {
     727             : /* <w:numPr> in the paragraph itself was overriden by <w:numpr> introduced by the paragraph's <w:pStyle>
     728             : enum = ThisComponent.Text.createEnumeration
     729             : para = enum.NextElement
     730             : xray para.NumberingStyleName
     731             : numberingstyle = ThisComponent.NumberingRules.getByIndex(6)
     732             : xray numberingstyle.name   - should match name above
     733             : numbering = numberingstyle.getByIndex(0)
     734             : xray numbering(11)  - should be 4, arabic
     735             : note that the indexes may get off as the implementation evolves, C++ code seaches in loops
     736             : */
     737           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     738           2 :     uno::Reference< text::XTextRange > paragraph(getParagraph( 1, "Text1." ));
     739           2 :     OUString numberingStyleName = getProperty< OUString >( paragraph, "NumberingStyleName" );
     740           2 :     uno::Reference<text::XNumberingRulesSupplier> xNumberingRulesSupplier(mxComponent, uno::UNO_QUERY);
     741           2 :     uno::Reference<container::XIndexAccess> numberingRules(xNumberingRulesSupplier->getNumberingRules(), uno::UNO_QUERY);
     742           2 :     uno::Reference<container::XIndexAccess> numberingRule;
     743          14 :     for( int i = 0;
     744           7 :          i < numberingRules->getCount();
     745             :          ++i )
     746             :     {
     747           7 :         OUString name = getProperty< OUString >( numberingRules->getByIndex( i ), "Name" );
     748           7 :         if( name == numberingStyleName )
     749             :         {
     750           1 :             numberingRule.set( numberingRules->getByIndex( i ), uno::UNO_QUERY );
     751           1 :             break;
     752             :         }
     753           6 :     }
     754           1 :     CPPUNIT_ASSERT( numberingRule.is());
     755           2 :     uno::Sequence< beans::PropertyValue > numbering;
     756           1 :     numberingRule->getByIndex( 0 ) >>= numbering;
     757           1 :     sal_Int16 numberingType = style::NumberingType::NUMBER_NONE;
     758          24 :     for( int i = 0;
     759          12 :          i < numbering.getLength();
     760             :          ++i )
     761             :         {
     762          12 :         if( numbering[ i ].Name == "NumberingType" )
     763             :             {
     764           1 :             numbering[ i ].Value >>= numberingType;
     765           1 :             break;
     766             :             }
     767             :         }
     768           2 :     CPPUNIT_ASSERT_EQUAL( style::NumberingType::ARABIC, numberingType );
     769           1 : }
     770             : 
     771           1 : void Test::testBnc773061()
     772             : {
     773           1 :     uno::Reference< text::XTextRange > paragraph = getParagraph( 1 );
     774           2 :     uno::Reference< text::XTextRange > normal = getRun( paragraph, 1, "Normal " );
     775           2 :     uno::Reference< text::XTextRange > raised = getRun( paragraph, 2, "Raised" );
     776           2 :     uno::Reference< text::XTextRange > lowered = getRun( paragraph, 4, "Lowered" );
     777           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), getProperty< sal_Int32 >( normal, "CharEscapement" ));
     778           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 50 ), getProperty< sal_Int32 >( raised, "CharEscapement" ));
     779           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( -25 ), getProperty< sal_Int32 >( lowered, "CharEscapement" ));
     780           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( normal, "CharEscapementHeight" ));
     781           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( raised, "CharEscapementHeight" ));
     782           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( lowered, "CharEscapementHeight" ));
     783           1 : }
     784             : 
     785           1 : void Test::testAllGapsWord()
     786             : {
     787           1 :     BorderTest borderTest;
     788           1 :     borderTest.testTheBorders(mxComponent);
     789           1 : }
     790             : 
     791           1 : void Test::testN775906()
     792             : {
     793             :     /*
     794             :      * The problem was that right margin (via direct formatting) erased the left/first margin (inherited from numbering style).
     795             :      *
     796             :      * oParas = ThisComponent.Text.createEnumeration
     797             :      * oPara = oParas.nextElement
     798             :      * xray oPara.ParaFirstLineIndent ' was 0
     799             :      * xray oPara.ParaLeftMargin ' was 0
     800             :      */
     801           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-635), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent"));
     802           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1905), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
     803           1 : }
     804             : 
     805           1 : void Test::testN775899()
     806             : {
     807             :     /*
     808             :      * The problem was that a floating table wasn't imported as a frame, then it contained fake paragraphs.
     809             :      *
     810             :      * ThisComponent.TextFrames.Count ' was 0
     811             :      * oParas = ThisComponent.TextFrames(0).Text.createEnumeration
     812             :      * oPara = oParas.nextElement
     813             :      * oPara.supportsService("com.sun.star.text.TextTable") 'was a fake paragraph
     814             :      * oParas.hasMoreElements 'was true
     815             :      */
     816           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     817           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     818           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
     819             : 
     820           2 :     uno::Reference<text::XTextFrame> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     821           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xFrame->getText(), uno::UNO_QUERY);
     822           2 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     823           2 :     uno::Reference<lang::XServiceInfo> xServiceInfo(xParaEnum->nextElement(), uno::UNO_QUERY);
     824           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, xServiceInfo->supportsService("com.sun.star.text.TextTable"));
     825             : 
     826           2 :     CPPUNIT_ASSERT_EQUAL(sal_False, xParaEnum->hasMoreElements());
     827           1 : }
     828             : 
     829           1 : void Test::testN777345()
     830             : {
     831             :     // The problem was that v:imagedata inside v:rect was ignored.
     832           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     833           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     834           2 :     uno::Reference<document::XEmbeddedObjectSupplier2> xSupplier(xDraws->getByIndex(0), uno::UNO_QUERY);
     835           2 :     uno::Reference<graphic::XGraphic> xGraphic = xSupplier->getReplacementGraphic();
     836           2 :     Graphic aGraphic(xGraphic);
     837             :     // If this changes later, feel free to update it, but make sure it's not
     838             :     // the checksum of a white/transparent placeholder rectangle.
     839           2 :     CPPUNIT_ASSERT_EQUAL(sal_uLong(2529763117U), aGraphic.GetChecksum());
     840           1 : }
     841             : 
     842           1 : void Test::testN777337()
     843             : {
     844             :     /*
     845             :      * The problem was that the top and bottom margin on the first page was only 0.1cm instead of 1.7cm.
     846             :      *
     847             :      * oFirst = ThisComponent.StyleFamilies.PageStyles.getByName("First Page")
     848             :      * xray oFirst.TopMargin
     849             :      * xray oFirst.BottomMargin
     850             :      */
     851           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("First Page"), uno::UNO_QUERY);
     852           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty<sal_Int32>(xPropertySet, "TopMargin"));
     853           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty<sal_Int32>(xPropertySet, "BottomMargin"));
     854           1 : }
     855             : 
     856           1 : void Test::testN778836()
     857             : {
     858             :     /*
     859             :      * The problem was that the paragraph inherited margins from the numbering
     860             :      * and parent paragraph styles and the result was incorrect.
     861             :      */
     862           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1270), getProperty<sal_Int32>(getParagraph(0), "ParaRightMargin"));
     863           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3810), getProperty<sal_Int32>(getParagraph(0), "ParaLeftMargin"));
     864           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-635), getProperty<sal_Int32>(getParagraph(0), "ParaFirstLineIndent"));
     865           1 : }
     866             : 
     867           1 : void Test::testN778140()
     868             : {
     869             :     /*
     870             :      * The problem was that the paragraph top/bottom margins were incorrect due
     871             :      * to unhandled w:doNotUseHTMLParagraphAutoSpacing.
     872             :      */
     873           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty<sal_Int32>(getParagraph(0), "ParaTopMargin"));
     874           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty<sal_Int32>(getParagraph(0), "ParaBottomMargin"));
     875           1 : }
     876             : 
     877           1 : void Test::testN778828()
     878             : {
     879             :     /*
     880             :      * The problem was that a page break after a continous section break caused
     881             :      * double page break on title page.
     882             :      */
     883           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     884           2 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
     885           2 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
     886           1 :     xCursor->jumpToLastPage();
     887           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage());
     888           1 : }
     889             : 
     890           1 : void Test::testInk()
     891             : {
     892             :     /*
     893             :      * The problem was that ~nothing was imported, except an empty CustomShape.
     894             :      *
     895             :      * xray ThisComponent.DrawPage(0).supportsService("com.sun.star.drawing.OpenBezierShape")
     896             :      */
     897           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     898           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     899           2 :     uno::Reference<lang::XServiceInfo> xServiceInfo(xDraws->getByIndex(0), uno::UNO_QUERY);
     900           2 :     CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.drawing.OpenBezierShape"));
     901           1 : }
     902             : 
     903           1 : void Test::testN779834()
     904             : {
     905             :     // This document simply crashed the importer.
     906           1 : }
     907             : 
     908           1 : void Test::testN779627()
     909             : {
     910             :     /*
     911             :      * The problem was that the table left position was based on the tableCellMar left value
     912             :      * even for nested tables, while it shouldn't.
     913             :      */
     914           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     915           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
     916           2 :     uno::Reference<beans::XPropertySet> xTableProperties(xTables->getByIndex(0), uno::UNO_QUERY);
     917           2 :     uno::Any aValue = xTableProperties->getPropertyValue("LeftMargin");
     918             :     sal_Int32 nLeftMargin;
     919           1 :     aValue >>= nLeftMargin;
     920           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Left margin shouldn't take tableCellMar into account in nested tables",
     921           1 :             sal_Int32(0), nLeftMargin);
     922             : 
     923             :     /*
     924             :      * Another problem tested with this document is that the roundrect is
     925             :      * centered vertically and horizontally.
     926             :      */
     927           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     928           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     929           2 :     uno::Reference<beans::XPropertySet> xShapeProperties( xDraws->getByIndex(3), uno::UNO_QUERY );
     930           2 :     uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xShapeProperties, uno::UNO_QUERY);
     931             :     // If this goes wrong, probably the index of the shape is changed and the test should be adjusted.
     932           1 :     CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.RectangleShape"), xShapeDescriptor->getShapeType());
     933             :     sal_Int16 nValue;
     934           1 :     xShapeProperties->getPropertyValue("HoriOrient") >>= nValue;
     935           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally", text::HoriOrientation::CENTER, nValue);
     936           1 :     xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
     937           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally relatively to page", text::RelOrientation::PAGE_FRAME, nValue);
     938           1 :     xShapeProperties->getPropertyValue("VertOrient") >>= nValue;
     939           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically", text::VertOrientation::CENTER, nValue);
     940           1 :     xShapeProperties->getPropertyValue("VertOrientRelation") >>= nValue;
     941           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically relatively to page", text::RelOrientation::PAGE_FRAME, nValue);
     942           1 : }
     943             : 
     944           1 : void Test::testFdo55187()
     945             : {
     946             :     // 0x010d was imported as a newline.
     947           1 :     getParagraph(1, OUString("lupčka", 7, RTL_TEXTENCODING_UTF8));
     948           1 : }
     949             : 
     950           1 : void Test::testN780563()
     951             : {
     952             :     /*
     953             :      * Make sure we have the table in the fly frame created
     954             :      */
     955           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     956           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
     957           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount( ));
     958           1 : }
     959             : 
     960           1 : void Test::testN780853()
     961             : {
     962             :     /*
     963             :      * The problem was that the table was not imported.
     964             :      *
     965             :      * xray ThisComponent.TextTables.Count 'was 0
     966             :      */
     967           1 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     968           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     969           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
     970           1 : }
     971             : 
     972           1 : void Test::testN780843()
     973             : {
     974             :     /*
     975             :      * The problem was that wrong footer was picked.
     976             :      *
     977             :      * oParas = ThisComponent.Text.createEnumeration
     978             :      * oPara = oParas.nextElement
     979             :      * oPara = oParas.nextElement
     980             :      * oPara = oParas.nextElement
     981             :      * sStyle = oPara.PageStyleName
     982             :      * oStyle = ThisComponent.StyleFamilies.PageStyles.getByName(sStyle)
     983             :      * xray oStyle.FooterText.String ' was "hidden footer"
     984             :      */
     985           1 :     uno::Reference< text::XTextRange > xPara = getParagraph(3);
     986           2 :     OUString aStyleName = getProperty<OUString>(xPara, "PageStyleName");
     987           2 :     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(aStyleName), uno::UNO_QUERY);
     988           2 :     uno::Reference<text::XTextRange> xFooter = getProperty< uno::Reference<text::XTextRange> >(xPageStyle, "FooterText");
     989           2 :     CPPUNIT_ASSERT_EQUAL(OUString("shown footer"), xFooter->getString());
     990           1 : }
     991             : 
     992           1 : void Test::testShadow()
     993             : {
     994             :     /*
     995             :      * The problem was that drop shadows on inline images were not being
     996             :      * imported and applied.
     997             :      */
     998           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     999           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1000           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(1), uno::UNO_QUERY);
    1001             : 
    1002           1 :     table::ShadowFormat aShadow;
    1003           1 :     xPropertySet->getPropertyValue("ShadowFormat") >>= aShadow;
    1004           2 :     CPPUNIT_ASSERT(sal_Int32(aShadow.ShadowWidth) > 0);
    1005           1 : }
    1006             : 
    1007           1 : void Test::testN782061()
    1008             : {
    1009             :     /*
    1010             :      * The problem was that the character escapement in the second run was -58.
    1011             :      */
    1012           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-9), getProperty<sal_Int32>(getRun(getParagraph(1), 2), "CharEscapement"));
    1013           1 : }
    1014             : 
    1015           1 : void Test::testN782345()
    1016             : {
    1017             :     /*
    1018             :      * The problem was that the page break was inserted before the 3rd para, instead of before the 2nd para.
    1019             :      */
    1020           1 :     CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType"));
    1021           1 : }
    1022             : 
    1023           1 : void Test::testN779941()
    1024             : {
    1025             :     /*
    1026             :      * Make sure top/bottom margins of tables are set to 0 (problem was: bottom margin set to 0.35cm)
    1027             :      */
    1028           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1029           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1030           2 :     uno::Reference<beans::XPropertySet> xTableProperties(xTables->getByIndex(0), uno::UNO_QUERY);
    1031             :     {
    1032           1 :         uno::Any aValue = xTableProperties->getPropertyValue("TopMargin");
    1033             :         sal_Int32 nTopMargin;
    1034           1 :         aValue >>= nTopMargin;
    1035           1 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nTopMargin);
    1036             :     }
    1037             :     {
    1038           1 :         uno::Any aValue = xTableProperties->getPropertyValue("BottomMargin");
    1039             :         sal_Int32 nBottomMargin;
    1040           1 :         aValue >>= nBottomMargin;
    1041           1 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nBottomMargin);
    1042           1 :     }
    1043           1 : }
    1044             : 
    1045           1 : void Test::testN783638()
    1046             : {
    1047             :     // The problem was that the margins of inline images were not zero.
    1048           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1049           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1050           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
    1051           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPropertySet, "LeftMargin"));
    1052           1 : }
    1053             : 
    1054           1 : void Test::testFdo52208()
    1055             : {
    1056             :     // The problem was that the document had 2 pages instead of 1.
    1057           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
    1058           2 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
    1059           2 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
    1060           1 :     xCursor->jumpToLastPage();
    1061           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
    1062           1 : }
    1063             : 
    1064             : 
    1065           1 : void Test::testN785767()
    1066             : {
    1067           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1068           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1069           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1070           2 :     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
    1071             :     // 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).
    1072           1 :     CPPUNIT_ASSERT_MESSAGE("A1 must not have default width", sal_Int16(10000 / 9) != getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
    1073           2 :     CPPUNIT_ASSERT_MESSAGE("B1 must not have default width", sal_Int16(10000 / 9) != getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
    1074           1 : }
    1075             : 
    1076           1 : void Test::testN773061()
    1077             : {
    1078             : // xray ThisComponent.TextFrames(0).LeftBorderDistance
    1079           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
    1080           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
    1081           2 :     uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
    1082           1 :     CPPUNIT_ASSERT_EQUAL( getProperty< sal_Int32 >( xFrame, "LeftBorderDistance" ), sal_Int32( 0 ));
    1083           1 :     CPPUNIT_ASSERT_EQUAL( getProperty< sal_Int32 >( xFrame, "TopBorderDistance" ), sal_Int32( 0 ));
    1084           1 :     CPPUNIT_ASSERT_EQUAL( getProperty< sal_Int32 >( xFrame, "RightBorderDistance" ), sal_Int32( 0 ));
    1085           2 :     CPPUNIT_ASSERT_EQUAL( getProperty< sal_Int32 >( xFrame, "BottomBorderDistance" ), sal_Int32( 0 ));
    1086           1 : }
    1087             : 
    1088           1 : void Test::testN780645()
    1089             : {
    1090             :     // The problem was that when the number of cells didn't match the grid, we
    1091             :     // didn't take care of direct cell widths.
    1092           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1093           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1094           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1095           2 :     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
    1096           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(2135), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); // was 1999
    1097           1 : }
    1098             : 
    1099           1 : void Test::testFineTableDash()
    1100             : {
    1101             :     // The problem was that finely dashed borders on tables were unsupported
    1102           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1103           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1104           2 :     uno::Reference<beans::XPropertySet> xTableProperties(xTables->getByIndex(0), uno::UNO_QUERY);
    1105           1 :     table::TableBorder2 aBorder;
    1106           1 :     xTableProperties->getPropertyValue("TableBorder2") >>= aBorder;
    1107           2 :     CPPUNIT_ASSERT_EQUAL(aBorder.RightLine.LineStyle, table::BorderLineStyle::FINE_DASHED);
    1108           1 : }
    1109             : 
    1110           1 : void Test::testN792778()
    1111             : {
    1112             :     /*
    1113             :      * The problem was that the importer didn't handle complex groupshapes with groupshapes, textboxes and graphics inside.
    1114             :      *
    1115             :      * xray ThisComponent.DrawPage.Count ' 1 groupshape
    1116             :      * xray ThisComponent.DrawPage(0).Count ' 2 sub-groupshapes
    1117             :      * xray ThisComponent.DrawPage(0).getByIndex(0).Count ' first sub-groupshape: 1 pic
    1118             :      * xray ThisComponent.DrawPage(0).getByIndex(1).Count ' second sub-groupshape: 1 pic
    1119             :      * xray ThisComponent.DrawPage(0).getByIndex(0).getByIndex(0).Position.Y ' 11684, the vertical position of the shapes were also wrong
    1120             :      * xray ThisComponent.DrawPage(0).getByIndex(1).getByIndex(0).Position.Y ' 11684
    1121             :      */
    1122           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1123           2 :     uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1124           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
    1125             : 
    1126           2 :     uno::Reference<drawing::XShapes> xGroupShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
    1127           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupShape->getCount());
    1128             : 
    1129           2 :     uno::Reference<drawing::XShapes> xInnerGroupShape(xGroupShape->getByIndex(0), uno::UNO_QUERY);
    1130           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xInnerGroupShape->getCount());
    1131             : 
    1132           2 :     uno::Reference<drawing::XShape> xInnerShape(xInnerGroupShape->getByIndex(0), uno::UNO_QUERY);
    1133           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(11684), xInnerShape->getPosition().Y);
    1134             : 
    1135           1 :     xInnerGroupShape.set(xGroupShape->getByIndex(1), uno::UNO_QUERY);
    1136           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xInnerGroupShape->getCount());
    1137             : 
    1138           1 :     xInnerShape.set(xInnerGroupShape->getByIndex(0), uno::UNO_QUERY);
    1139           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(11684), xInnerShape->getPosition().Y);
    1140           1 : }
    1141             : 
    1142           1 : void Test::testGroupshapeLine()
    1143             : {
    1144             :     /*
    1145             :      * Another fallout from n#792778, this time first the lines inside a
    1146             :      * groupshape wasn't imported, then the fix broke the size/position of
    1147             :      * non-groupshape lines. Test both here.
    1148             :      *
    1149             :      * xray ThisComponent.DrawPage.Count ' 2 shapes
    1150             :      * xray ThisComponent.DrawPage(0).Position 'x: 2656, y: 339
    1151             :      * xray ThisComponent.DrawPage(0).Size ' width: 3270, height: 1392
    1152             :      * xray ThisComponent.DrawPage(1).getByIndex(0).Position 'x: 1272, y: 2286
    1153             :      * xray ThisComponent.DrawPage(1).getByIndex(0).Size 'width: 10160, height: 0
    1154             :      */
    1155           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1156           2 :     uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1157           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDrawPage->getCount());
    1158             : 
    1159           2 :     uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
    1160           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2656), xShape->getPosition().X);
    1161           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(339), xShape->getPosition().Y);
    1162           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3270), xShape->getSize().Width);
    1163           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1392), xShape->getSize().Height);
    1164             : 
    1165           2 :     uno::Reference<drawing::XShapes> xGroupShape(xDrawPage->getByIndex(1), uno::UNO_QUERY);
    1166           1 :     xShape.set(xGroupShape->getByIndex(0), uno::UNO_QUERY);
    1167           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1272), xShape->getPosition().X);
    1168           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2286), xShape->getPosition().Y);
    1169           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(10160), xShape->getSize().Width);
    1170           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getSize().Height);
    1171           1 : }
    1172             : 
    1173           1 : void Test::testN793262()
    1174             : {
    1175           1 :     uno::Reference<container::XEnumerationAccess> xHeaderText = getProperty< uno::Reference<container::XEnumerationAccess> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
    1176           2 :     uno::Reference<container::XEnumeration> xHeaderParagraphs(xHeaderText->createEnumeration());
    1177           1 :     xHeaderParagraphs->nextElement();
    1178             :     // Font size of the last empty paragraph in the header was ignored, this was 11.
    1179           1 :     CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xHeaderParagraphs->nextElement(), "CharHeight"));
    1180             : 
    1181           2 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1182           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1183           2 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1184             :     // Cell margins as direct formatting were ignored, this was 0.
    1185           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(76), getProperty<sal_Int32>(xTable->getCellByName("A1"), "TopBorderDistance"));
    1186           1 : }
    1187             : 
    1188           1 : void Test::testN793998()
    1189             : {
    1190           1 :     sal_Int32 nTextPortion = parseDump("/root/page/body/txt/Text[1]", "nWidth").toInt32(); // Width of the first (text) portion
    1191           1 :     sal_Int32 nTabPortion = parseDump("/root/page/body/txt/Text[2]", "nWidth").toInt32(); // Width of the second (tab) portion
    1192           1 :     sal_Int32 nParagraph = parseDump("/root/page/body/txt/infos/bounds", "width").toInt32(); // Width of the paragraph
    1193           1 :     sal_Int32 nRightMargin = 3000;
    1194             :     // 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.
    1195           1 :     CPPUNIT_ASSERT(nTextPortion + nTabPortion > nParagraph - nRightMargin);
    1196           1 : }
    1197             : 
    1198           1 : void Test::testN779642()
    1199             : {
    1200           1 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1201             : 
    1202             :     // First problem: check that we have 2 tables, nesting caused the
    1203             :     // creation of outer one to fail
    1204           2 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1205           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong number of imported tables", sal_Int32(2), xTables->getCount());
    1206             : 
    1207             :     // Second problem: check that the outer table is in a frame, at the bottom of the page
    1208           2 :     uno::Reference<text::XTextTable> xTextTable(xTextTablesSupplier->getTextTables()->getByName("Table2"), uno::UNO_QUERY);
    1209           2 :     uno::Reference<beans::XPropertySet> xAnchor(xTextTable->getAnchor(), uno::UNO_QUERY);
    1210           2 :     uno::Any aFrame = xAnchor->getPropertyValue("TextFrame");
    1211           2 :     uno::Reference<beans::XPropertySet> xFrame;
    1212           1 :     aFrame >>= xFrame;
    1213             :     sal_Int16 nValue;
    1214           1 :     xFrame->getPropertyValue("VertOrient") >>= nValue;
    1215           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation", nValue, text::VertOrientation::BOTTOM);
    1216           1 :     xFrame->getPropertyValue("VertOrientRelation") >>= nValue;
    1217           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation relation", nValue, text::RelOrientation::PAGE_PRINT_AREA);
    1218           1 : }
    1219             : 
    1220           1 : void Test::testTbLrHeight()
    1221             : {
    1222           1 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1223           2 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1224           2 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1225           2 :     uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
    1226             :     // btLr text direction was imported as MIN, it should be FIX to avoid incorrectly large height in case of too much content.
    1227           2 :     CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty<sal_Int16>(xTableRows->getByIndex(0), "SizeType"));
    1228           1 : }
    1229             : 
    1230           1 : void Test::testFdo53985()
    1231             : {
    1232             :     // Unhandled excetion prevented import of the rest of the document.
    1233             : 
    1234           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1235           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1236           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTables->getCount()); // Only 4 tables were imported.
    1237           1 : }
    1238             : 
    1239           1 : void Test::testFdo59638()
    1240             : {
    1241             :     // The problem was that w:lvlOverride inside w:num was ignores by dmapper.
    1242             : 
    1243           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
    1244           1 :     uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
    1245           1 :     uno::Sequence<beans::PropertyValue> aProps;
    1246           1 :     xLevels->getByIndex(0) >>= aProps; // 1st level
    1247             : 
    1248          14 :     for (int i = 0; i < aProps.getLength(); ++i)
    1249             :     {
    1250          14 :         const beans::PropertyValue& rProp = aProps[i];
    1251             : 
    1252          14 :         if (rProp.Name == "BulletChar")
    1253             :         {
    1254             :             // Was '*', should be 'o'.
    1255           1 :             CPPUNIT_ASSERT_EQUAL(OUString("\xEF\x82\xB7", 3, RTL_TEXTENCODING_UTF8), rProp.Value.get<OUString>());
    1256           2 :             return;
    1257             :         }
    1258             :     }
    1259           0 :     CPPUNIT_FAIL("no BulletChar property");
    1260             : }
    1261             : 
    1262           1 : void Test::testFdo61343()
    1263             : {
    1264             :     // The problem was that there were a groupshape in the doc, followed by an
    1265             :     // OLE object, and this lead to a crash.
    1266           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1267           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1268           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
    1269           1 : }
    1270             : 
    1271           1 : void Test::testToolsLineNumbering()
    1272             : {
    1273             :     /*
    1274             :      * Test the line numbering feature import (Tools->Line Numbering ...)
    1275             :      *
    1276             :      * xray ThisComponent.getLineNumberingProperties().IsOn == True
    1277             :      * xray ThisComponent.getLineNumberingProperties().CountEmptyLines == True
    1278             :      * xray ThisComponent.getLineNumberingProperties().NumberPosition == 0
    1279             :      * xray ThisComponent.getLineNumberingProperties().NumberingType == 4
    1280             :      * xray ThisComponent.getLineNumberingProperties().SeparatorInterval == 3
    1281             :      */
    1282             : 
    1283           1 :     sal_Bool bValue = sal_False;
    1284           1 :     sal_Int32 nValue = -1;
    1285             : 
    1286           1 :     uno::Reference< text::XTextDocument > xtextDocument(mxComponent, uno::UNO_QUERY);
    1287           2 :     uno::Reference< text::XLineNumberingProperties > xLineProperties( xtextDocument, uno::UNO_QUERY_THROW );
    1288           2 :     uno::Reference< beans::XPropertySet > xPropertySet = xLineProperties->getLineNumberingProperties();
    1289             : 
    1290           1 :     xPropertySet->getPropertyValue("IsOn") >>= bValue;
    1291           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, bValue);
    1292             : 
    1293           1 :     xPropertySet->getPropertyValue("CountEmptyLines") >>= bValue;
    1294           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, bValue);
    1295             : 
    1296           1 :     xPropertySet->getPropertyValue("NumberPosition") >>= nValue;
    1297           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nValue);
    1298             : 
    1299           1 :     xPropertySet->getPropertyValue("NumberingType") >>= nValue;
    1300           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4), nValue);
    1301             : 
    1302           1 :     xPropertySet->getPropertyValue("SeparatorInterval") >>= nValue;
    1303           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nValue);
    1304           1 : }
    1305             : 
    1306           1 : void Test::testFdo60922()
    1307             : {
    1308             :     // This was 0, not 100, due to wrong import of w:position w:val="0"
    1309           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharEscapementHeight"));
    1310           1 : }
    1311             : 
    1312           1 : void Test::testFdo59273()
    1313             : {
    1314           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1315           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1316           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1317             :     // Was 115596 (i.e. 10 times wider than necessary), as w:tblW was missing and the importer didn't set it.
    1318           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(12961), getProperty<sal_Int32>(xTextTable, "Width"));
    1319             : 
    1320           2 :     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
    1321             :     // Was 9997, so the 4th column had ~zero width
    1322           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[2].Position);
    1323           1 : }
    1324             : 
    1325           1 : void Test::testTableWidth()
    1326             : {
    1327           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1328           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1329             :     // Relative width wasn't recognized during import.
    1330           1 :     CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xTables->getByIndex(0), "IsWidthRelative")));
    1331             : 
    1332           2 :     uno::Reference<text::XTextFramesSupplier> xFramesSupplier(mxComponent, uno::UNO_QUERY);
    1333           2 :     uno::Reference<container::XIndexAccess> xFrames(xFramesSupplier->getTextFrames(), uno::UNO_QUERY);
    1334           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(xFrames->getByIndex(0), "FrameWidthPercent"));
    1335           1 : }
    1336             : 
    1337           1 : void Test::testConditionalstylesTbllook()
    1338             : {
    1339           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1340           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1341           2 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1342             :     // Background was -1.
    1343           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x7F7F7F), getProperty<sal_Int32>(xTable->getCellByName("A1"), "BackColor"));
    1344           1 : }
    1345             : 
    1346           1 : void Test::testFdo63685()
    1347             : {
    1348           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1349           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1350             :     // Was 85697, i.e. original 114120 was converted to mm100 from twips, not from EMUs.
    1351           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(318), getProperty<sal_Int32>(xDraws->getByIndex(0), "TopMargin"));
    1352           1 : }
    1353             : 
    1354           1 : void Test::testN592908_Frame()
    1355             : {
    1356           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1357           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1358           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
    1359             :     text::WrapTextMode eValue;
    1360           1 :     xPropertySet->getPropertyValue("Surround") >>= eValue;
    1361           2 :     CPPUNIT_ASSERT_EQUAL(eValue, text::WrapTextMode_PARALLEL);
    1362           1 : }
    1363             : 
    1364           1 : void Test::testN592908_Picture()
    1365             : {
    1366           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1367           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1368           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
    1369             :     text::WrapTextMode eValue;
    1370           1 :     xPropertySet->getPropertyValue("Surround") >>= eValue;
    1371           2 :     CPPUNIT_ASSERT_EQUAL(eValue, text::WrapTextMode_PARALLEL);
    1372           1 : }
    1373             : 
    1374           1 : void Test::testN779630()
    1375             : {
    1376           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1377           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1378             : 
    1379             :     // First shape: date picker
    1380           2 :     uno::Reference<drawing::XControlShape> xControlShape(xDraws->getByIndex(0), uno::UNO_QUERY);
    1381           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
    1382           2 :     uno::Reference<lang::XServiceInfo> xServiceInfo(xPropertySet, uno::UNO_QUERY);
    1383           1 :     CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo->supportsService("com.sun.star.form.component.DateField")));
    1384           1 :     CPPUNIT_ASSERT_EQUAL(OUString("date default text"), getProperty<OUString>(xPropertySet, "HelpText"));
    1385           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty<sal_Int16>(xPropertySet, "DateFormat"));
    1386           1 :     CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xPropertySet, "Dropdown")));
    1387             : 
    1388             :     // Second shape: combo box
    1389           1 :     xControlShape.set(xDraws->getByIndex(1), uno::UNO_QUERY);
    1390           1 :     xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY);
    1391           1 :     xServiceInfo.set(xPropertySet, uno::UNO_QUERY);
    1392           1 :     CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo->supportsService("com.sun.star.form.component.ComboBox")));
    1393           1 :     CPPUNIT_ASSERT_EQUAL(OUString("dropdown default text"), getProperty<OUString>(xPropertySet, "DefaultText"));
    1394           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty< uno::Sequence<OUString> >(xPropertySet, "StringItemList").getLength());
    1395           2 :     CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xPropertySet, "Dropdown")));
    1396           1 : }
    1397             : 
    1398           1 : void Test::testIndentation()
    1399             : {
    1400           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY);
    1401             :     // This was RL_TB (e.g. right-to-left).
    1402           1 :     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, getProperty<sal_Int16>(xPropertySet, "WritingMode"));
    1403           1 : }
    1404             : 
    1405           1 : void Test::testPageBorderShadow()
    1406             : {
    1407             :     // The problem was that in w:pgBorders, child elements had a w:shadow attribute, but that was ignored.
    1408           1 :     table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "ShadowFormat");
    1409           1 :     CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color));
    1410           1 :     CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
    1411             :     // w:sz="48" is in eights of a point, 1 pt is 20 twips.
    1412           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(48/8*20)), aShadow.ShadowWidth);
    1413           1 : }
    1414             : 
    1415           1 : void Test::testN816593()
    1416             : {
    1417             :     // Two consecutive <w:tbl> without any paragraph in between, but with different tblpPr. In this
    1418             :     // case we need to have 2 different tables instead of 1
    1419           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1420           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1421           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
    1422           1 : }
    1423             : 
    1424           1 : void Test::testN820509()
    1425             : {
    1426             :     // Design mode was enabled.
    1427           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
    1428           2 :     uno::Reference<view::XFormLayerAccess> xFormLayerAccess(xModel->getCurrentController(), uno::UNO_QUERY);
    1429           1 :     CPPUNIT_ASSERT_EQUAL(false, bool(xFormLayerAccess->isFormDesignMode()));
    1430             : 
    1431             :     // M.d.yyyy date format was unhandled.
    1432           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1433           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1434           2 :     uno::Reference<drawing::XControlShape> xControlShape(xDraws->getByIndex(0), uno::UNO_QUERY);
    1435           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
    1436           2 :     uno::Reference<lang::XServiceInfo> xServiceInfo(xPropertySet, uno::UNO_QUERY);
    1437           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty<sal_Int16>(xPropertySet, "DateFormat"));
    1438           1 : }
    1439             : 
    1440           1 : void Test::testN820788()
    1441             : {
    1442             :     // The problem was that AutoSize was not enabled for the text frame.
    1443           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
    1444           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
    1445           2 :     uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
    1446             :     // This was text::SizeType::FIX.
    1447           2 :     CPPUNIT_ASSERT_EQUAL(text::SizeType::MIN, getProperty<sal_Int16>(xFrame, "SizeType"));
    1448           1 : }
    1449             : 
    1450           1 : void Test::testN820504()
    1451             : {
    1452           1 :     uno::Reference<style::XStyleFamiliesSupplier> xFamiliesSupplier(mxComponent, uno::UNO_QUERY);
    1453           2 :     uno::Reference<container::XNameAccess> xFamiliesAccess(xFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
    1454           2 :     uno::Reference<container::XNameAccess> xStylesAccess(xFamiliesAccess->getByName("ParagraphStyles"), uno::UNO_QUERY);
    1455           2 :     uno::Reference<beans::XPropertySet> xStyle(xStylesAccess->getByName("Default Style"), uno::UNO_QUERY);
    1456             :     // The problem was that the CharColor was set to AUTO (-1) even if we have some default char color set
    1457           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4040635), getProperty<sal_Int32>(xStyle, "CharColor"));
    1458             : 
    1459             :     // Also, the groupshape was anchored at-page instead of at-character
    1460             :     // (that's incorrect as Word only supports at-character and as-character).
    1461           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1462           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1463           2 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(xDraws->getByIndex(0), "AnchorType"));
    1464           1 : }
    1465             : 
    1466           1 : void Test::testFdo43641()
    1467             : {
    1468           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1469           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1470           2 :     uno::Reference<container::XIndexAccess> xGroupShape(xDraws->getByIndex(0), uno::UNO_QUERY);
    1471           2 :     uno::Reference<drawing::XShape> xLine(xGroupShape->getByIndex(1), uno::UNO_QUERY);
    1472             :     // This was 2200, not 2579 in mm100, i.e. the size of the line shape was incorrect.
    1473           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(928694)), xLine->getSize().Width);
    1474           1 : }
    1475             : 
    1476           1 : void Test::testTableAutoColumnFixedSize()
    1477             : {
    1478           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1479           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1480           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1481             : 
    1482             :     // Width was not recognized during import when table size was 'auto'
    1483           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(3996)), getProperty<sal_Int32>(xTextTable, "Width"));
    1484           1 : }
    1485             : 
    1486           1 : void Test::testFdo46361()
    1487             : {
    1488           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1489           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1490           2 :     uno::Reference<container::XIndexAccess> xGroupShape(xDraws->getByIndex(0), uno::UNO_QUERY);
    1491           2 :     uno::Reference<drawing::XShape> xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY);
    1492             :     // This was CENTER.
    1493           1 :     CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xShape, "TextVerticalAdjust"));
    1494           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
    1495           2 :     uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText);
    1496             :     // This was LEFT.
    1497           1 :     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xParagraph, "ParaAdjust")));
    1498             :     // This was black, not green.
    1499           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x008000), getProperty<sal_Int32>(getRun(xParagraph, 1), "CharColor"));
    1500             :     // \n char was missing due to unhandled w:br.
    1501           1 :     CPPUNIT_ASSERT_EQUAL(OUString("text\ntext"), uno::Reference<text::XTextRange>(xGroupShape->getByIndex(1), uno::UNO_QUERY)->getString());
    1502             :     // \n chars were missing, due to unhandled multiple w:p tags.
    1503           2 :     CPPUNIT_ASSERT_EQUAL(OUString("text\ntext\n"), uno::Reference<text::XTextRange>(xGroupShape->getByIndex(2), uno::UNO_QUERY)->getString());
    1504           1 : }
    1505             : 
    1506           1 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
    1507             : 
    1508           4 : CPPUNIT_PLUGIN_IMPLEMENT();
    1509             : 
    1510             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10