LCOV - code coverage report
Current view: top level - sw/qa/extras/ooxmlimport - ooxmlimport.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1560 1562 99.9 %
Date: 2015-06-13 12:38:46 Functions: 1981 2163 91.6 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include "config_test.h"
      11             : 
      12             : #ifdef MACOSX
      13             : #define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
      14             : #include <premac.h>
      15             : #include <AppKit/AppKit.h>
      16             : #include <postmac.h>
      17             : #endif
      18             : 
      19             : #include <swmodeltestbase.hxx>
      20             : 
      21             : #if !defined(WNT)
      22             : 
      23             : #include <basegfx/polygon/b2dpolypolygontools.hxx>
      24             : #include <com/sun/star/awt/XBitmap.hpp>
      25             : #include <com/sun/star/awt/FontUnderline.hpp>
      26             : #include <com/sun/star/awt/FontWeight.hpp>
      27             : #include <com/sun/star/beans/XPropertySet.hpp>
      28             : #include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp>
      29             : #include <com/sun/star/drawing/XControlShape.hpp>
      30             : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
      31             : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
      32             : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      33             : #include <com/sun/star/lang/XServiceInfo.hpp>
      34             : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      35             : #include <com/sun/star/text/HoriOrientation.hpp>
      36             : #include <com/sun/star/text/RelOrientation.hpp>
      37             : #include <com/sun/star/text/SetVariableType.hpp>
      38             : #include <com/sun/star/text/TableColumnSeparator.hpp>
      39             : #include <com/sun/star/text/TextContentAnchorType.hpp>
      40             : #include <com/sun/star/text/VertOrientation.hpp>
      41             : #include <com/sun/star/text/WrapTextMode.hpp>
      42             : #include <com/sun/star/text/WritingMode2.hpp>
      43             : #include <com/sun/star/text/XBookmarksSupplier.hpp>
      44             : #include <com/sun/star/text/XDependentTextField.hpp>
      45             : #include <com/sun/star/text/XFormField.hpp>
      46             : #include <com/sun/star/text/XPageCursor.hpp>
      47             : #include <com/sun/star/text/XTextColumns.hpp>
      48             : #include <com/sun/star/text/XTextFieldsSupplier.hpp>
      49             : #include <com/sun/star/text/XTextFrame.hpp>
      50             : #include <com/sun/star/text/XTextFramesSupplier.hpp>
      51             : #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
      52             : #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
      53             : #include <com/sun/star/style/BreakType.hpp>
      54             : #include <com/sun/star/style/ParagraphAdjust.hpp>
      55             : #include <com/sun/star/style/LineSpacing.hpp>
      56             : #include <com/sun/star/style/LineSpacingMode.hpp>
      57             : #include <com/sun/star/table/ShadowFormat.hpp>
      58             : #include <com/sun/star/view/XSelectionSupplier.hpp>
      59             : #include <com/sun/star/view/XFormLayerAccess.hpp>
      60             : #include <com/sun/star/table/BorderLine2.hpp>
      61             : #include <com/sun/star/table/TableBorder2.hpp>
      62             : #include <com/sun/star/text/SizeType.hpp>
      63             : #include <com/sun/star/xml/dom/XDocument.hpp>
      64             : #include <com/sun/star/text/XDocumentIndex.hpp>
      65             : #include <com/sun/star/style/CaseMap.hpp>
      66             : #include <com/sun/star/style/PageStyleLayout.hpp>
      67             : #include <com/sun/star/style/ParagraphAdjust.hpp>
      68             : #include <com/sun/star/util/DateTime.hpp>
      69             : #include <vcl/bmpacc.hxx>
      70             : #include <vcl/svapp.hxx>
      71             : #include <unotest/assertion_traits.hxx>
      72             : #include <unotools/fltrcfg.hxx>
      73             : #include <comphelper/sequenceashashmap.hxx>
      74             : #include <com/sun/star/text/GraphicCrop.hpp>
      75             : #include <swtypes.hxx>
      76             : #include <tools/datetimeutils.hxx>
      77             : #include <oox/drawingml/drawingmltypes.hxx>
      78             : 
      79             : #include <bordertest.hxx>
      80             : 
      81         179 : class Test : public SwModelTestBase
      82             : {
      83             : public:
      84         179 :     Test() : SwModelTestBase("/sw/qa/extras/ooxmlimport/data/", "Office Open XML Text")
      85             :     {
      86         179 :     }
      87             : 
      88         179 :     virtual void preTest(const char* filename) SAL_OVERRIDE
      89             :     {
      90         179 :         if (OString(filename) == "smartart.docx" || OString(filename) == "strict-smartart.docx" || OString(filename) == "fdo87488.docx")
      91           3 :             SvtFilterOptions::Get().SetSmartArt2Shape(true);
      92         179 :     }
      93             : 
      94         179 :     virtual void postTest(const char* filename) SAL_OVERRIDE
      95             :     {
      96         179 :         if (OString(filename) == "smartart.docx" || OString(filename) == "strict-smartart.docx" || OString(filename) == "fdo87488.docx")
      97           3 :             SvtFilterOptions::Get().SetSmartArt2Shape(false);
      98         179 :     }
      99             : };
     100             : 
     101           2 : class FailTest : public Test
     102             : {
     103             : public:
     104             :     // UGLY: hacky manual override of MacrosTest::loadFromDesktop
     105           1 :     void executeImportTest(const char* filename)
     106             :     {
     107           1 :         header();
     108           1 :         preTest(filename);
     109             :         {
     110           1 :             if (mxComponent.is())
     111           0 :                 mxComponent->dispose();
     112           1 :             std::cout << filename << ",";
     113           1 :             mnStartTime = osl_getGlobalTimer();
     114             :             {
     115           1 :                 OUString aURL(getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(filename));
     116           1 :                 CPPUNIT_ASSERT_MESSAGE("no desktop", mxDesktop.is());
     117           2 :                 uno::Reference<frame::XComponentLoader> xLoader = uno::Reference<frame::XComponentLoader>(mxDesktop, uno::UNO_QUERY);
     118           1 :                 CPPUNIT_ASSERT_MESSAGE("no loader", xLoader.is());
     119           2 :                 uno::Sequence<beans::PropertyValue> args(1);
     120           1 :                 args[0].Name = "DocumentService";
     121           1 :                 args[0].Handle = -1;
     122           1 :                 args[0].Value <<= OUString("com.sun.star.text.TextDocument");
     123           1 :                 args[0].State = beans::PropertyState_DIRECT_VALUE;
     124             : 
     125           2 :                 uno::Reference<lang::XComponent> xComponent = xLoader->loadComponentFromURL(aURL, OUString("_default"), 0, args);
     126           2 :                 OUString sMessage = "loading succeeded: " + aURL;
     127           2 :                 CPPUNIT_ASSERT_MESSAGE(OUStringToOString(sMessage, RTL_TEXTENCODING_UTF8).getStr(), !xComponent.is());
     128             :             }
     129             :         }
     130           1 :         postTest(filename);
     131           1 :         verify();
     132           1 :         finish();
     133           1 :     }
     134             : };
     135             : 
     136          12 : DECLARE_SW_IMPORT_TEST(testMathMalformedXml, "math-malformed_xml.docx", FailTest)
     137             : {
     138           1 :     CPPUNIT_ASSERT(!mxComponent.is());
     139           1 : }
     140             : 
     141          12 : DECLARE_OOXMLIMPORT_TEST(testN751054, "n751054.docx")
     142             : {
     143           1 :     text::TextContentAnchorType eValue = getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType");
     144           1 :     CPPUNIT_ASSERT(eValue != text::TextContentAnchorType_AS_CHARACTER);
     145           1 : }
     146             : 
     147          12 : DECLARE_OOXMLIMPORT_TEST(testN751117, "n751117.docx")
     148             : {
     149             :     // First shape: the end should be an arrow, should be rotated and should be flipped.
     150           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
     151           2 :     OUString aValue;
     152           1 :     xPropertySet->getPropertyValue("LineEndName") >>= aValue;
     153           1 :     CPPUNIT_ASSERT(aValue.indexOf("Arrow") != -1);
     154             : 
     155             :     // Rotating & Flipping will cause the angle to change from 90 degrees to 270 degrees
     156           1 :     sal_Int32 nValue = 0;
     157           1 :     xPropertySet->getPropertyValue("RotateAngle") >>= nValue;
     158           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(270 * 100), nValue);
     159             : 
     160           2 :     uno::Reference<drawing::XShape> xShape(xPropertySet, uno::UNO_QUERY);
     161           1 :     awt::Size aActualSize(xShape->getSize());
     162           1 :     CPPUNIT_ASSERT(aActualSize.Width > 0);
     163             : 
     164             :     // The second shape should be a line
     165           2 :     uno::Reference<lang::XServiceInfo> xServiceInfo(getShape(2), uno::UNO_QUERY);
     166           2 :     CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.drawing.LineShape"));
     167           1 : }
     168             : 
     169          12 : DECLARE_OOXMLIMPORT_TEST(testN751017, "n751017.docx")
     170             : {
     171           1 :     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     172           2 :     uno::Reference<container::XNameAccess> xMasters(xTextFieldsSupplier->getTextFieldMasters());
     173             :     // Make sure we have a variable named foo.
     174           1 :     CPPUNIT_ASSERT(xMasters->hasByName("com.sun.star.text.FieldMaster.SetExpression.foo"));
     175             : 
     176           2 :     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     177           2 :     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
     178           1 :     bool bFoundSet(false), bFoundGet(false);
     179           4 :     while (xFields->hasMoreElements())
     180             :     {
     181           2 :         uno::Reference<lang::XServiceInfo> xServiceInfo(xFields->nextElement(), uno::UNO_QUERY);
     182           4 :         uno::Reference<beans::XPropertySet> xPropertySet(xServiceInfo, uno::UNO_QUERY);
     183           2 :         sal_Int16 nValue = 0;
     184           4 :         OUString aValue;
     185           2 :         if (xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression"))
     186             :         {
     187           1 :             bFoundSet = true;
     188           1 :             uno::Reference<text::XDependentTextField> xDependentTextField(xServiceInfo, uno::UNO_QUERY);
     189           2 :             uno::Reference<beans::XPropertySet> xMasterProps(xDependentTextField->getTextFieldMaster());
     190             : 
     191             :             // First step: did we set foo to "bar"?
     192           1 :             xMasterProps->getPropertyValue("Name") >>= aValue;
     193           1 :             CPPUNIT_ASSERT_EQUAL(OUString("foo"), aValue);
     194           1 :             xPropertySet->getPropertyValue("SubType") >>= nValue;
     195           1 :             CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING, nValue);
     196           1 :             xPropertySet->getPropertyValue("Content") >>= aValue;
     197           2 :             CPPUNIT_ASSERT_EQUAL(OUString("bar"), aValue);
     198             :         }
     199           1 :         else if (xServiceInfo->supportsService("com.sun.star.text.TextField.GetExpression"))
     200             :         {
     201             :             // Second step: check the value of foo.
     202           1 :             bFoundGet = true;
     203           1 :             xPropertySet->getPropertyValue("Content") >>= aValue;
     204           1 :             CPPUNIT_ASSERT_EQUAL(OUString("foo"), aValue);
     205           1 :             xPropertySet->getPropertyValue("SubType") >>= nValue;
     206           1 :             CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING, nValue);
     207           1 :             xPropertySet->getPropertyValue("CurrentPresentation") >>= aValue;
     208           1 :             CPPUNIT_ASSERT_EQUAL(OUString("bar"), aValue);
     209             :         }
     210           2 :     }
     211           1 :     CPPUNIT_ASSERT(bFoundSet);
     212           2 :     CPPUNIT_ASSERT(bFoundGet);
     213           1 : }
     214             : 
     215          12 : DECLARE_OOXMLIMPORT_TEST(testN750935, "n750935.docx")
     216             : {
     217           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     218           2 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
     219           2 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
     220           1 :     xCursor->jumpToLastPage();
     221             :     // Some page break types were ignores, resulting in less pages.
     222           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor->getPage());
     223             : 
     224             :     /*
     225             :      * The problem was that the header and footer was not shared.
     226             :      *
     227             :      * xray ThisComponent.StyleFamilies.PageStyles.Default.FooterIsShared
     228             :      */
     229           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     230           1 :     bool bValue = false;
     231           1 :     xPropertySet->getPropertyValue("HeaderIsShared") >>= bValue;
     232           1 :     CPPUNIT_ASSERT_EQUAL(true, bValue);
     233           1 :     xPropertySet->getPropertyValue("FooterIsShared") >>= bValue;
     234           2 :     CPPUNIT_ASSERT_EQUAL(true, bValue);
     235           1 : }
     236             : 
     237          12 : DECLARE_OOXMLIMPORT_TEST(testN757890, "n757890.docx")
     238             : {
     239             :     // The w:pStyle token affected the text outside the textbox.
     240           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     241           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     242           2 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     243           2 :     uno::Reference<beans::XPropertySet> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
     244           2 :     OUString aValue;
     245           1 :     xPara->getPropertyValue("ParaStyleName") >>= aValue;
     246           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), aValue);
     247             : 
     248             :     // This wan't centered
     249           2 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     250           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     251           2 :     uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     252             :     sal_Int16 nValue;
     253           1 :     xFrame->getPropertyValue("HoriOrient") >>= nValue;
     254           2 :     CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue);
     255           1 : }
     256             : 
     257          12 : DECLARE_OOXMLIMPORT_TEST(testRhbz988516, "rhbz988516.docx")
     258             : {
     259             :     // The problem was that the list properties of the footer leaked into body
     260           2 :     CPPUNIT_ASSERT_EQUAL(OUString(),
     261           1 :             getProperty<OUString>(getParagraph(1), "NumberingStyleName"));
     262           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), getParagraph(2)->getString());
     263           2 :     CPPUNIT_ASSERT_EQUAL(OUString(),
     264           1 :             getProperty<OUString>(getParagraph(2), "NumberingStyleName"));
     265           2 :     CPPUNIT_ASSERT_EQUAL(OUString(),
     266           1 :             getProperty<OUString>(getParagraph(3), "NumberingStyleName"));
     267           1 : }
     268             : 
     269          12 : DECLARE_OOXMLIMPORT_TEST(testFdo49940, "fdo49940.docx")
     270             : {
     271           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     272           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     273           2 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     274           2 :     uno::Reference<beans::XPropertySet> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
     275           2 :     OUString aValue;
     276           1 :     xPara->getPropertyValue("PageStyleName") >>= aValue;
     277           2 :     CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue);
     278           1 : }
     279             : 
     280          12 : DECLARE_OOXMLIMPORT_TEST(testFdo74745, "fdo74745.docx")
     281             : {
     282           1 :     uno::Reference<text::XTextRange > paragraph = getParagraph(3);
     283           2 :     uno::Reference<text::XTextRange> text(paragraph, uno::UNO_QUERY);
     284           2 :     CPPUNIT_ASSERT_EQUAL(text->getString(),OUString("09/02/14"));
     285           1 : }
     286             : 
     287          12 : DECLARE_OOXMLIMPORT_TEST(testFdo81486, "fdo81486.docx")
     288             : {
     289           1 :     uno::Reference<text::XTextRange > paragraph = getParagraph(1);
     290           2 :     uno::Reference<text::XTextRange> text(paragraph, uno::UNO_QUERY);
     291           2 :     CPPUNIT_ASSERT_EQUAL(text->getString(),OUString("CustomTitle"));
     292           1 : }
     293             : 
     294          12 : DECLARE_OOXMLIMPORT_TEST(testFdo79738, "fdo79738.docx")
     295             : {
     296           1 :     uno::Reference< style::XStyleFamiliesSupplier > xStylesSupplier( mxComponent, uno::UNO_QUERY_THROW );
     297           2 :     uno::Reference< container::XNameAccess > xStyleFamilies = xStylesSupplier->getStyleFamilies();
     298           2 :     uno::Reference<container::XNameContainer> xStyles;
     299           1 :     xStyleFamilies->getByName("ParagraphStyles") >>= xStyles;
     300           2 :     uno::Reference<beans::XPropertySet> xPropertySetHeader( xStyles->getByName("Header"), uno::UNO_QUERY );
     301           1 :     CPPUNIT_ASSERT_EQUAL(false, xPropertySetHeader->getPropertyValue("ParaLineNumberCount").get<bool>());
     302           2 :     uno::Reference<beans::XPropertySet> xPropertySetFooter( xStyles->getByName("Footer"), uno::UNO_QUERY );
     303           2 :     CPPUNIT_ASSERT_EQUAL(false, xPropertySetFooter->getPropertyValue("ParaLineNumberCount").get<bool>());
     304           1 : }
     305             : 
     306          12 : DECLARE_OOXMLIMPORT_TEST(testN751077, "n751077.docx")
     307             : {
     308             : /*
     309             : xray ThisComponent.DrawPage(1).getByIndex(0).String
     310             : xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName
     311             : */
     312           1 :     uno::Reference<drawing::XShapes> xShapes(getShape(2), uno::UNO_QUERY);
     313           2 :     uno::Reference<text::XTextRange> xShape(xShapes->getByIndex(0), uno::UNO_QUERY);
     314           1 :     CPPUNIT_ASSERT_EQUAL(OUString("TEXT1\n"), xShape->getString());
     315             :     // we want to test the textbox is on the first page (it was put onto another page without the fix),
     316             :     // use a small trick and instead of checking the page layout, check the page style
     317           2 :     uno::Reference<text::XTextContent> xTextContent(xShape, uno::UNO_QUERY);
     318           2 :     CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty<OUString>(xTextContent->getAnchor(), "PageStyleName"));
     319           1 : }
     320             : 
     321          12 : DECLARE_OOXMLIMPORT_TEST(testN705956_1, "n705956-1.docx")
     322             : {
     323             : /*
     324             : Get the first image in the document and check it's the one image in the document.
     325             : It should be also anchored inline (as character) and be inside a groupshape.
     326             : image = ThisComponent.DrawPage.getByIndex(0)
     327             : graphic = image(0).Graphic
     328             : xray graphic.Size
     329             : xray image.AnchorType
     330             : */
     331           1 :     uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
     332           2 :     uno::Reference<drawing::XDrawPageSupplier> drawPageSupplier(textDocument, uno::UNO_QUERY);
     333           2 :     uno::Reference<drawing::XDrawPage> drawPage = drawPageSupplier->getDrawPage();
     334           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), drawPage->getCount());
     335           2 :     uno::Reference<drawing::XShapes> shapes(getShape(1), uno::UNO_QUERY);
     336           2 :     uno::Reference<drawing::XShape> image;
     337           1 :     shapes->getByIndex(0) >>= image;
     338           2 :     uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
     339           2 :     uno::Reference<graphic::XGraphic> graphic;
     340           1 :     imageProperties->getPropertyValue( "Graphic" ) >>= graphic;
     341           2 :     uno::Reference<awt::XBitmap> bitmap(graphic, uno::UNO_QUERY);
     342           1 :     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(120), bitmap->getSize().Width );
     343           1 :     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(106), bitmap->getSize().Height );
     344             :     text::TextContentAnchorType anchorType;
     345           1 :     imageProperties->getPropertyValue( "AnchorType" ) >>= anchorType;
     346           2 :     CPPUNIT_ASSERT_EQUAL( text::TextContentAnchorType_AS_CHARACTER, anchorType );
     347           1 : }
     348             : 
     349          12 : DECLARE_OOXMLIMPORT_TEST(testN705956_2, "n705956-2.docx")
     350             : {
     351             : /*
     352             : <v:shapetype> must be global, reachable even from <v:shape> inside another <w:pict>
     353             : image = ThisComponent.DrawPage.getByIndex(0)
     354             : xray image.FillColor
     355             : */
     356           1 :     uno::Reference<drawing::XShape> image = getShape(1);
     357           2 :     uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
     358             :     sal_Int32 fillColor;
     359           1 :     imageProperties->getPropertyValue( "FillColor" ) >>= fillColor;
     360           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0xc0504d ), fillColor );
     361           1 : }
     362             : 
     363          12 : DECLARE_OOXMLIMPORT_TEST(testfdo90720, "testfdo90720.docx")
     364             : {
     365           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     366           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     367           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
     368           2 :     uno::Reference<text::XTextFrame> textbox(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     369           2 :     uno::Reference<beans::XPropertySet> properties(textbox, uno::UNO_QUERY);
     370             :     sal_Int32 fill_transperence;
     371           1 :     properties->getPropertyValue( "FillTransparence" ) >>= fill_transperence;
     372           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(100), fill_transperence );
     373           1 : }
     374             : 
     375          12 : DECLARE_OOXMLIMPORT_TEST(testN747461, "n747461.docx")
     376             : {
     377             : /*
     378             : The document contains 3 images (Red, Black, Green, in this order), with explicit
     379             : w:relativeHeight (300, 0, 225763766). Check that they are in the right ZOrder
     380             : after they are loaded.
     381             : */
     382           2 :     uno::Reference<drawing::XShape> image1 = getShape(1), image2 = getShape(2), image3 = getShape(3);
     383             :     sal_Int32 zOrder1, zOrder2, zOrder3;
     384           2 :     OUString descr1, descr2, descr3;
     385           2 :     uno::Reference<beans::XPropertySet> imageProperties1(image1, uno::UNO_QUERY);
     386           1 :     imageProperties1->getPropertyValue( "ZOrder" ) >>= zOrder1;
     387           1 :     imageProperties1->getPropertyValue( "Description" ) >>= descr1;
     388           2 :     uno::Reference<beans::XPropertySet> imageProperties2(image2, uno::UNO_QUERY);
     389           1 :     imageProperties2->getPropertyValue( "ZOrder" ) >>= zOrder2;
     390           1 :     imageProperties2->getPropertyValue( "Description" ) >>= descr2;
     391           2 :     uno::Reference<beans::XPropertySet> imageProperties3(image3, uno::UNO_QUERY);
     392           1 :     imageProperties3->getPropertyValue( "ZOrder" ) >>= zOrder3;
     393           1 :     imageProperties3->getPropertyValue( "Description" ) >>= descr3;
     394           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), zOrder1 );
     395           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), zOrder2 );
     396           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 2 ), zOrder3 );
     397           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "Black" ), descr1 );
     398           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "Red" ), descr2 );
     399           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "Green" ), descr3 );
     400           1 : }
     401             : 
     402          12 : DECLARE_OOXMLIMPORT_TEST(testN750255, "n750255.docx")
     403             : {
     404             : 
     405             : /*
     406             : Column break without columns on the page is a page break, so check those paragraphs
     407             : are on page 2 (page style 'Converted1') and page 3 (page style 'Converted2')
     408             : enum = ThisComponent.Text.createEnumeration
     409             : enum.nextElement
     410             : para1 = enum.nextElement
     411             : xray para1.String
     412             : xray para1.PageStyleName
     413             : para2 = enum.nextElement
     414             : xray para2.String
     415             : xray para2.PageStyleName
     416             : */
     417             :     // get the 2nd and 3rd paragraph
     418           1 :     uno::Reference<uno::XInterface> paragraph1(getParagraph( 2, "one" ));
     419           2 :     uno::Reference<uno::XInterface> paragraph2(getParagraph( 3, "two" ));
     420           2 :     OUString pageStyle1 = getProperty< OUString >( paragraph1, "PageStyleName" );
     421           2 :     OUString pageStyle2 = getProperty< OUString >( paragraph2, "PageStyleName" );
     422           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "Converted1" ), pageStyle1 );
     423           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "Converted2" ), pageStyle2 );
     424             : 
     425           1 : }
     426             : 
     427          12 : DECLARE_OOXMLIMPORT_TEST(testN652364, "n652364.docx")
     428             : {
     429             : /*
     430             : Related to 750255 above, column break with columns on the page however should be a column break.
     431             : enum = ThisComponent.Text.createEnumeration
     432             : enum.nextElement
     433             : para1 = enum.nextElement
     434             : xray para1.String
     435             : xray para1.PageStyleName
     436             : enum.nextElement
     437             : para2 = enum.nextElement
     438             : xray para2.String
     439             : xray para2.PageStyleName
     440             : */
     441             :     // get the 2nd and 4th paragraph
     442           1 :     uno::Reference<uno::XInterface> paragraph1(getParagraph( 2, "text1" ));
     443           2 :     uno::Reference<uno::XInterface> paragraph2(getParagraph( 4, "text2" ));
     444           2 :     OUString pageStyle1 = getProperty< OUString >( paragraph1, "PageStyleName" );
     445           2 :     OUString pageStyle2 = getProperty< OUString >( paragraph2, "PageStyleName" );
     446             :     // "Standard" is the style for the first page (2nd is "Converted1").
     447           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle1 );
     448           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle2 );
     449           1 : }
     450             : 
     451          12 : DECLARE_OOXMLIMPORT_TEST(testN760764, "n760764.docx")
     452             : {
     453           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     454           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     455           2 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     456           2 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     457           2 :     uno::Reference<container::XEnumeration> xRunEnum(xRunEnumAccess->createEnumeration());
     458             : 
     459             :     // Access the second run, which is a textfield
     460           1 :     xRunEnum->nextElement();
     461           2 :     uno::Reference<beans::XPropertySet> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
     462             :     float fValue;
     463           1 :     xRun->getPropertyValue("CharHeight") >>= fValue;
     464             :     // This used to be 11, as character properties were ignored.
     465           2 :     CPPUNIT_ASSERT_EQUAL(8.f, fValue);
     466           1 : }
     467             : 
     468          12 : DECLARE_OOXMLIMPORT_TEST(testN764005, "n764005.docx")
     469             : {
     470           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
     471             : 
     472             :     // The picture in the header wasn't absolutely positioned and wasn't in the background.
     473             :     text::TextContentAnchorType eValue;
     474           1 :     xPropertySet->getPropertyValue("AnchorType") >>= eValue;
     475           1 :     CPPUNIT_ASSERT(eValue != text::TextContentAnchorType_AS_CHARACTER);
     476           1 :     bool bValue = true;
     477           1 :     xPropertySet->getPropertyValue("Opaque") >>= bValue;
     478           1 :     CPPUNIT_ASSERT_EQUAL(false, bool(bValue));
     479           1 : }
     480             : 
     481          12 : DECLARE_OOXMLIMPORT_TEST(testN764745, "n764745-alignment.docx")
     482             : {
     483             : /*
     484             : shape = ThisComponent.DrawPage.getByIndex(0)
     485             : xray shape.AnchorType
     486             : xray shape.AnchorPosition.X
     487             : xray ThisComponent.StyleFamilies.PageStyles.Default.Width
     488             : */
     489           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
     490             :     // The paragraph is right-aligned and the picture does not explicitly specify position,
     491             :     // so check it's anchored as character and in the right side of the document.
     492             :     text::TextContentAnchorType anchorType;
     493           1 :     xPropertySet->getPropertyValue("AnchorType") >>= anchorType;
     494           1 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, anchorType);
     495           1 :     awt::Point pos;
     496           1 :     xPropertySet->getPropertyValue("AnchorPosition") >>= pos;
     497           2 :     uno::Reference<style::XStyleFamiliesSupplier> styleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
     498           2 :     uno::Reference<container::XNameAccess> styleFamilies = styleFamiliesSupplier->getStyleFamilies();
     499           2 :     uno::Reference<container::XNameAccess> pageStyles;
     500           1 :     styleFamilies->getByName("PageStyles") >>= pageStyles;
     501           2 :     uno::Reference<uno::XInterface> defaultStyle;
     502           1 :     pageStyles->getByName(DEFAULT_STYLE) >>= defaultStyle;
     503           2 :     uno::Reference<beans::XPropertySet> styleProperties( defaultStyle, uno::UNO_QUERY );
     504           1 :     sal_Int32 width = 0;
     505           1 :     styleProperties->getPropertyValue( "Width" ) >>= width;
     506           2 :     CPPUNIT_ASSERT( pos.X > width / 2 );
     507           1 : }
     508             : 
     509          12 : DECLARE_OOXMLIMPORT_TEST(testN766477, "n766477.docx")
     510             : {
     511             :     /*
     512             :      * The problem was that the checkbox was not checked.
     513             :      *
     514             :      * oParas = ThisComponent.Text.createEnumeration
     515             :      * oPara = oParas.nextElement
     516             :      * oRuns = oPara.createEnumeration
     517             :      * oRun = oRuns.nextElement
     518             :      * xray oRun.Bookmark.Parameters.ElementNames(0) 'Checkbox_Checked
     519             :      */
     520           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     521           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     522           2 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     523           2 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     524           2 :     uno::Reference<container::XEnumeration> xRunEnum(xRunEnumAccess->createEnumeration());
     525           2 :     uno::Reference<beans::XPropertySet> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
     526           2 :     uno::Reference<text::XFormField> xFormField(xRun->getPropertyValue("Bookmark"), uno::UNO_QUERY);
     527           2 :     uno::Reference<container::XNameContainer> xParameters(xFormField->getParameters());
     528           2 :     uno::Sequence<OUString> aElementNames(xParameters->getElementNames());
     529           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Checkbox_Checked"), aElementNames[0]);
     530           1 : }
     531             : 
     532          12 : DECLARE_OOXMLIMPORT_TEST(testN758883, "n758883.docx")
     533             : {
     534             :     /*
     535             :      * The problem was that direct formatting of the paragraph was not applied
     536             :      * to the numbering. This is easier to test using a layout dump.
     537             :      */
     538           1 :     OUString aHeight = parseDump("/root/page/body/txt/Special", "nHeight");
     539           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(220), aHeight.toInt32()); // It was 280
     540             : 
     541             :     /*
     542             :      * Next problem was that the page margin contained the width of the page border as well.
     543             :      *
     544             :      * xray ThisComponent.StyleFamilies.PageStyles.Default.LeftMargin
     545             :      */
     546           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     547           1 :     sal_Int32 nValue = 0;
     548           1 :     xPropertySet->getPropertyValue("LeftMargin") >>= nValue;
     549           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(794), nValue);
     550             : 
     551             :     // No assert for the 3rd problem: see the comment in the test doc.
     552             : 
     553             :     /*
     554             :      * 4th problem: Wrap type of the textwrape was not 'through'.
     555             :      *
     556             :      * xray ThisComponent.DrawPage(0).Surround ' was 2, should be 1
     557             :      */
     558           1 :     xPropertySet.set(getShape(1), uno::UNO_QUERY);
     559             :     text::WrapTextMode eValue;
     560           1 :     xPropertySet->getPropertyValue("Surround") >>= eValue;
     561           1 :     CPPUNIT_ASSERT_EQUAL(eValue, text::WrapTextMode_THROUGHT);
     562             : 
     563             :     /*
     564             :      * 5th problem: anchor type of the second textbox was wrong.
     565             :      *
     566             :      * xray ThisComponent.DrawPage(1).AnchorType ' was 1, should be 4
     567             :      */
     568           1 :     xPropertySet.set(getShape(2), uno::UNO_QUERY);
     569             :     text::TextContentAnchorType eAnchorType;
     570           1 :     xPropertySet->getPropertyValue("AnchorType") >>= eAnchorType;
     571           1 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eAnchorType);
     572             : 
     573             :     // 6th problem: xray ThisComponent.DrawPage(2).AnchorType ' was 2, should be 4
     574           1 :     xPropertySet.set(getShape(3), uno::UNO_QUERY);
     575           1 :     xPropertySet->getPropertyValue("AnchorType") >>= eAnchorType;
     576           2 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eAnchorType);
     577           1 : }
     578             : 
     579          12 : DECLARE_OOXMLIMPORT_TEST(testN766481, "n766481.docx")
     580             : {
     581             :     /*
     582             :      * The problem was that we had an additional paragraph before the pagebreak.
     583             :      *
     584             :      * oParas = ThisComponent.Text.createEnumeration
     585             :      * oPara = oParas.nextElement
     586             :      * oPara = oParas.nextElement
     587             :      * xray oParas.hasMoreElements ' should be false
     588             :      */
     589           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     590           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     591           2 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     592           3 :     for (int i = 0; i < 2; ++i)
     593           2 :         xParaEnum->nextElement();
     594           2 :     CPPUNIT_ASSERT_EQUAL(sal_False, xParaEnum->hasMoreElements());
     595           1 : }
     596             : 
     597          12 : DECLARE_OOXMLIMPORT_TEST(testN766487, "n766487.docx")
     598             : {
     599             :     /*
     600             :      * The problem was that 1) the font size of the first para was too large 2) numbering had no first-line-indent.
     601             :      *
     602             :      * oParas = ThisComponent.Text.createEnumeration
     603             :      * oPara = oParas.nextElement
     604             :      * oRuns = oPara.createEnumeration
     605             :      * oRun = oRuns.nextElement
     606             :      * xray oRun.CharHeight ' 12, was larger
     607             :      * oPara = oParas.nextElement
     608             :      * xray oPara.ParaFirstLineIndent ' -635, was 0
     609             :      */
     610           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     611           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     612           2 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     613             : 
     614           2 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     615           2 :     uno::Reference<container::XEnumeration> xRunEnum(xRunEnumAccess->createEnumeration());
     616           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
     617           1 :     float fValue = 0;
     618           1 :     xPropertySet->getPropertyValue("CharHeight") >>= fValue;
     619           1 :     CPPUNIT_ASSERT_EQUAL(12.f, fValue);
     620             : 
     621           1 :     xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
     622           1 :     sal_Int32 nValue = 0;
     623           1 :     xPropertySet->getPropertyValue("ParaFirstLineIndent") >>= nValue;
     624           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-360)), nValue);
     625           1 : }
     626             : 
     627          12 : DECLARE_OOXMLIMPORT_TEST(testN693238, "n693238.docx")
     628             : {
     629             :     /*
     630             :      * The problem was that a continuous section break at the end of the doc caused the margins to be ignored.
     631             :      *
     632             :      * xray ThisComponent.StyleFamilies.PageStyles.Default.LeftMargin ' was 2000, should be 635
     633             :      */
     634           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     635           1 :     sal_Int32 nValue = 0;
     636           1 :     xPropertySet->getPropertyValue("LeftMargin") >>= nValue;
     637           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nValue);
     638           1 : }
     639             : 
     640          12 : DECLARE_OOXMLIMPORT_TEST(testNumbering1, "numbering1.docx")
     641             : {
     642             : /* <w:numPr> in the paragraph itself was overridden by <w:numpr> introduced by the paragraph's <w:pStyle>
     643             : enum = ThisComponent.Text.createEnumeration
     644             : para = enum.NextElement
     645             : xray para.NumberingStyleName
     646             : numberingstyle = ThisComponent.NumberingRules.getByIndex(6)
     647             : xray numberingstyle.name   - should match name above
     648             : numbering = numberingstyle.getByIndex(0)
     649             : xray numbering(11)  - should be 4, arabic
     650             : note that the indexes may get off as the implementation evolves, C++ code searches in loops
     651             : */
     652           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     653           2 :     uno::Reference< text::XTextRange > paragraph(getParagraph( 1, "Text1." ));
     654           2 :     OUString numberingStyleName = getProperty< OUString >( paragraph, "NumberingStyleName" );
     655           2 :     uno::Reference<text::XNumberingRulesSupplier> xNumberingRulesSupplier(mxComponent, uno::UNO_QUERY);
     656           2 :     uno::Reference<container::XIndexAccess> numberingRules(xNumberingRulesSupplier->getNumberingRules(), uno::UNO_QUERY);
     657           2 :     uno::Reference<container::XIndexAccess> numberingRule;
     658          16 :     for( int i = 0;
     659           8 :          i < numberingRules->getCount();
     660             :          ++i )
     661             :     {
     662           8 :         OUString name = getProperty< OUString >( numberingRules->getByIndex( i ), "Name" );
     663           8 :         if( name == numberingStyleName )
     664             :         {
     665           1 :             numberingRule.set( numberingRules->getByIndex( i ), uno::UNO_QUERY );
     666           1 :             break;
     667             :         }
     668           7 :     }
     669           1 :     CPPUNIT_ASSERT( numberingRule.is());
     670           2 :     uno::Sequence< beans::PropertyValue > numbering;
     671           1 :     numberingRule->getByIndex( 0 ) >>= numbering;
     672           1 :     sal_Int16 numberingType = style::NumberingType::NUMBER_NONE;
     673          24 :     for( int i = 0;
     674          12 :          i < numbering.getLength();
     675             :          ++i )
     676             :         {
     677          12 :         if( numbering[ i ].Name == "NumberingType" )
     678             :             {
     679           1 :             numbering[ i ].Value >>= numberingType;
     680           1 :             break;
     681             :             }
     682             :         }
     683           2 :     CPPUNIT_ASSERT_EQUAL( style::NumberingType::ARABIC, numberingType );
     684           1 : }
     685             : 
     686          12 : DECLARE_OOXMLIMPORT_TEST(testBnc773061, "bnc773061.docx")
     687             : {
     688           1 :     uno::Reference< text::XTextRange > paragraph = getParagraph( 1 );
     689           2 :     uno::Reference< text::XTextRange > normal = getRun( paragraph, 1, "Normal " );
     690           2 :     uno::Reference< text::XTextRange > raised = getRun( paragraph, 2, "Raised" );
     691           2 :     uno::Reference< text::XTextRange > lowered = getRun( paragraph, 4, "Lowered" );
     692           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), getProperty< sal_Int32 >( normal, "CharEscapement" ));
     693           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 50 ), getProperty< sal_Int32 >( raised, "CharEscapement" ));
     694           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( -25 ), getProperty< sal_Int32 >( lowered, "CharEscapement" ));
     695           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( normal, "CharEscapementHeight" ));
     696           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( raised, "CharEscapementHeight" ));
     697           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( lowered, "CharEscapementHeight" ));
     698           1 : }
     699             : 
     700          12 : DECLARE_OOXMLIMPORT_TEST(testAllGapsWord, "all_gaps_word.docx")
     701             : {
     702           1 :     BorderTest borderTest;
     703           1 :     BorderTest::testTheBorders(mxComponent, false);
     704           1 : }
     705             : 
     706          12 : DECLARE_OOXMLIMPORT_TEST(testN775906, "n775906.docx")
     707             : {
     708             :     /*
     709             :      * The problem was that right margin (via direct formatting) erased the left/first margin (inherited from numbering style).
     710             :      *
     711             :      * oParas = ThisComponent.Text.createEnumeration
     712             :      * oPara = oParas.nextElement
     713             :      * xray oPara.ParaFirstLineIndent ' was 0
     714             :      * xray oPara.ParaLeftMargin ' was 0
     715             :      */
     716           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-635), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent"));
     717           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1905), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
     718           1 : }
     719             : 
     720          12 : DECLARE_OOXMLIMPORT_TEST(testN775899, "n775899.docx")
     721             : {
     722             :     /*
     723             :      * The problem was that a floating table wasn't imported as a frame, then it contained fake paragraphs.
     724             :      *
     725             :      * ThisComponent.TextFrames.Count ' was 0
     726             :      * oParas = ThisComponent.TextFrames(0).Text.createEnumeration
     727             :      * oPara = oParas.nextElement
     728             :      * oPara.supportsService("com.sun.star.text.TextTable") 'was a fake paragraph
     729             :      * oParas.hasMoreElements 'was true
     730             :      */
     731           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     732           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     733           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
     734             : 
     735           2 :     uno::Reference<text::XTextFrame> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     736           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xFrame->getText(), uno::UNO_QUERY);
     737           2 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     738           2 :     uno::Reference<lang::XServiceInfo> xServiceInfo(xParaEnum->nextElement(), uno::UNO_QUERY);
     739           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, xServiceInfo->supportsService("com.sun.star.text.TextTable"));
     740             : 
     741           2 :     CPPUNIT_ASSERT_EQUAL(sal_False, xParaEnum->hasMoreElements());
     742           1 : }
     743             : 
     744          12 : DECLARE_OOXMLIMPORT_TEST(testN777345, "n777345.docx")
     745             : {
     746             : #if !defined(MACOSX)
     747             :     // The problem was that v:imagedata inside v:rect was ignored.
     748           1 :     uno::Reference<document::XEmbeddedObjectSupplier2> xSupplier(getShape(1), uno::UNO_QUERY);
     749           2 :     uno::Reference<graphic::XGraphic> xGraphic = xSupplier->getReplacementGraphic();
     750           2 :     Graphic aGraphic(xGraphic);
     751             :     // If this changes later, feel free to update it, but make sure it's not
     752             :     // the checksum of a white/transparent placeholder rectangle.
     753           2 :     CPPUNIT_ASSERT_EQUAL(sal_uLong(2529763117U), aGraphic.GetChecksum());
     754             : #endif
     755           1 : }
     756             : 
     757          12 : DECLARE_OOXMLIMPORT_TEST(testN777337, "n777337.docx")
     758             : {
     759             :     /*
     760             :      * The problem was that the top and bottom margin on the first page was only 0.1cm instead of 1.7cm.
     761             :      *
     762             :      * oFirst = ThisComponent.StyleFamilies.PageStyles.getByName("First Page")
     763             :      * xray oFirst.TopMargin
     764             :      * xray oFirst.BottomMargin
     765             :      */
     766           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("First Page"), uno::UNO_QUERY);
     767           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty<sal_Int32>(xPropertySet, "TopMargin"));
     768           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty<sal_Int32>(xPropertySet, "BottomMargin"));
     769           1 : }
     770             : 
     771          12 : DECLARE_OOXMLIMPORT_TEST(testN778836, "n778836.docx")
     772             : {
     773             :     /*
     774             :      * The problem was that the paragraph inherited margins from the numbering
     775             :      * and parent paragraph styles and the result was incorrect.
     776             :      */
     777           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1270), getProperty<sal_Int32>(getParagraph(0), "ParaRightMargin"));
     778           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3810), getProperty<sal_Int32>(getParagraph(0), "ParaLeftMargin"));
     779           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-635), getProperty<sal_Int32>(getParagraph(0), "ParaFirstLineIndent"));
     780           1 : }
     781             : 
     782          12 : DECLARE_OOXMLIMPORT_TEST(testN778140, "n778140.docx")
     783             : {
     784             :     /*
     785             :      * The problem was that the paragraph top/bottom margins were incorrect due
     786             :      * to unhandled w:doNotUseHTMLParagraphAutoSpacing.
     787             :      */
     788           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty<sal_Int32>(getParagraph(0), "ParaTopMargin"));
     789           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty<sal_Int32>(getParagraph(0), "ParaBottomMargin"));
     790           1 : }
     791             : 
     792          12 : DECLARE_OOXMLIMPORT_TEST(testN778828, "n778828.docx")
     793             : {
     794             :     /*
     795             :      * The problem was that a page break after a continuous section break caused
     796             :      * double page break on title page.
     797             :      */
     798           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     799           2 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
     800           2 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
     801           1 :     xCursor->jumpToLastPage();
     802           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage());
     803           1 : }
     804             : 
     805          12 : DECLARE_OOXMLIMPORT_TEST(testInk, "ink.docx")
     806             : {
     807             :     /*
     808             :      * The problem was that ~nothing was imported, except an empty CustomShape.
     809             :      *
     810             :      * xray ThisComponent.DrawPage(0).supportsService("com.sun.star.drawing.OpenBezierShape")
     811             :      */
     812           1 :     uno::Reference<lang::XServiceInfo> xServiceInfo(getShape(1), uno::UNO_QUERY);
     813           1 :     CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.drawing.OpenBezierShape"));
     814           1 : }
     815             : 
     816          12 : DECLARE_OOXMLIMPORT_TEST(testN779834, "n779834.docx")
     817             : {
     818             :     // This document simply crashed the importer.
     819           1 : }
     820             : 
     821          12 : DECLARE_OOXMLIMPORT_TEST(testRHBZ1180114, "rhbz1180114.docx")
     822             : {
     823             :     // This document simply crashed the importer.
     824           1 : }
     825             : 
     826          12 : DECLARE_OOXMLIMPORT_TEST(testN779627, "n779627.docx")
     827             : {
     828             :     /*
     829             :      * The problem was that the table left position was based on the tableCellMar left value
     830             :      * even for nested tables, while it shouldn't.
     831             :      */
     832           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     833           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
     834           2 :     uno::Reference<beans::XPropertySet> xTableProperties(xTables->getByIndex(0), uno::UNO_QUERY);
     835           2 :     uno::Any aValue = xTableProperties->getPropertyValue("LeftMargin");
     836             :     sal_Int32 nLeftMargin;
     837           1 :     aValue >>= nLeftMargin;
     838           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Left margin shouldn't take tableCellMar into account in nested tables",
     839           1 :             sal_Int32(0), nLeftMargin);
     840             : 
     841             :     /*
     842             :      * Another problem tested with this document is the unnecessary loading of the shapes
     843             :      * anchored to a discarded header or footer
     844             :      */
     845           2 :     uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
     846           2 :     uno::Reference<drawing::XDrawPageSupplier> drawPageSupplier(textDocument, uno::UNO_QUERY);
     847           2 :     uno::Reference<drawing::XDrawPage> drawPage = drawPageSupplier->getDrawPage();
     848           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), drawPage->getCount());
     849           1 : }
     850             : 
     851          12 : DECLARE_OOXMLIMPORT_TEST(testN779627b, "n779627b.docx")
     852             : {
     853             :     /*
     854             :      * Another problem tested with the original n779627.docx document (before removing its unnecessary
     855             :      * shape loading) is that the roundrect is centered vertically and horizontally.
     856             :      */
     857           1 :     uno::Reference<beans::XPropertySet> xShapeProperties( getShape(1), uno::UNO_QUERY );
     858           2 :     uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xShapeProperties, uno::UNO_QUERY);
     859             :     // If this goes wrong, probably the index of the shape is changed and the test should be adjusted.
     860           1 :     CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.RectangleShape"), xShapeDescriptor->getShapeType());
     861             :     sal_Int16 nValue;
     862           1 :     xShapeProperties->getPropertyValue("HoriOrient") >>= nValue;
     863           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally", text::HoriOrientation::CENTER, nValue);
     864           1 :     xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
     865           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally relatively to page", text::RelOrientation::PAGE_FRAME, nValue);
     866           1 :     xShapeProperties->getPropertyValue("VertOrient") >>= nValue;
     867           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically", text::VertOrientation::CENTER, nValue);
     868           1 :     xShapeProperties->getPropertyValue("VertOrientRelation") >>= nValue;
     869           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically relatively to page", text::RelOrientation::PAGE_FRAME, nValue);
     870           1 : }
     871             : 
     872          12 : DECLARE_OOXMLIMPORT_TEST(testTDF91122, "tdf91122.docx")
     873             : {
     874             :     /*
     875             :      * OLE object shape: default vertical position is top in MSO, not bottom
     876             :      */
     877           3 :     for (int i = 1; i <= 2; ++i)
     878             :     {
     879           2 :         uno::Reference<beans::XPropertySet> xShapeProperties( getShape(i), uno::UNO_QUERY );
     880           4 :         uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xShapeProperties, uno::UNO_QUERY);
     881           2 :         CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), xShapeDescriptor->getShapeType());
     882             :         sal_Int16 nValue;
     883           2 :         xShapeProperties->getPropertyValue("VertOrient") >>= nValue;
     884           2 :         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation", text::VertOrientation::TOP, nValue);
     885           2 :     }
     886           1 : }
     887             : 
     888          12 : DECLARE_OOXMLIMPORT_TEST(testTDF91260, "tdf91260.docx")
     889             : {
     890             :     /*
     891             :      * textbox can't extend beyond the page bottom
     892             :      * solution: shrinking textbox (its text frame) height, if needed
     893             :      */
     894           1 :     uno::Reference<text::XTextRange> xFrame(getShape(1), uno::UNO_QUERY);
     895           1 :     CPPUNIT_ASSERT(xFrame->getString().startsWith( "Lorem ipsum" ) );
     896           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3454), getProperty<sal_Int32>(xFrame, "Height"));
     897           1 : }
     898             : 
     899          12 : DECLARE_OOXMLIMPORT_TEST(testFdo74357, "fdo74357.docx")
     900             : {
     901             :     // Floating table wasn't converted to a textframe.
     902           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     903           2 :     uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     904             :     // This was 0.
     905           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
     906             : 
     907             :     // Bottom margin of the first paragraph was too large, causing a layout problem.
     908             :     // This was 494.
     909           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(86), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
     910           1 : }
     911             : 
     912          12 : DECLARE_OOXMLIMPORT_TEST(testFdo55187, "fdo55187.docx")
     913             : {
     914             :     // 0x010d was imported as a newline.
     915           1 :     getParagraph(1, OUString("lup\xc4\x8dka", 7, RTL_TEXTENCODING_UTF8));
     916           1 : }
     917             : 
     918          12 : DECLARE_OOXMLIMPORT_TEST(testN780563, "n780563.docx")
     919             : {
     920             :     /*
     921             :      * Make sure we have the table in the fly frame created
     922             :      */
     923           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     924           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
     925           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount( ));
     926           1 : }
     927             : 
     928          12 : DECLARE_OOXMLIMPORT_TEST(testN780853, "n780853.docx")
     929             : {
     930             :     /*
     931             :      * The problem was that the table was not imported.
     932             :      *
     933             :      * xray ThisComponent.TextTables.Count 'was 0
     934             :      */
     935           1 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     936           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     937           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
     938           1 : }
     939             : 
     940          12 : DECLARE_OOXMLIMPORT_TEST(testN780843, "n780843.docx")
     941             : {
     942             :     /*
     943             :      * The problem was that wrong footer was picked.
     944             :      *
     945             :      * oParas = ThisComponent.Text.createEnumeration
     946             :      * oPara = oParas.nextElement
     947             :      * oPara = oParas.nextElement
     948             :      * oPara = oParas.nextElement
     949             :      * sStyle = oPara.PageStyleName
     950             :      * oStyle = ThisComponent.StyleFamilies.PageStyles.getByName(sStyle)
     951             :      * xray oStyle.FooterText.String ' was "hidden footer"
     952             :      */
     953           1 :     uno::Reference< text::XTextRange > xPara = getParagraph(3);
     954           2 :     OUString aStyleName = getProperty<OUString>(xPara, "PageStyleName");
     955           2 :     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(aStyleName), uno::UNO_QUERY);
     956           2 :     uno::Reference<text::XTextRange> xFooter = getProperty< uno::Reference<text::XTextRange> >(xPageStyle, "FooterText");
     957           2 :     CPPUNIT_ASSERT_EQUAL(OUString("shown footer"), xFooter->getString());
     958           1 : }
     959             : 
     960          12 : DECLARE_OOXMLIMPORT_TEST(testShadow, "imgshadow.docx")
     961             : {
     962             :     /*
     963             :      * The problem was that drop shadows on inline images were not being
     964             :      * imported and applied.
     965             :      */
     966           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(2), uno::UNO_QUERY);
     967             : 
     968           1 :     bool bShadow = getProperty<bool>(xPropertySet, "Shadow");
     969           1 :     CPPUNIT_ASSERT(bShadow);
     970             : 
     971           1 :     sal_Int32 nShadowXDistance = getProperty<sal_Int32>(xPropertySet, "ShadowXDistance");
     972           1 :     CPPUNIT_ASSERT(nShadowXDistance != 0);
     973           1 : }
     974             : 
     975          12 : DECLARE_OOXMLIMPORT_TEST(testN782061, "n782061.docx")
     976             : {
     977             :     /*
     978             :      * The problem was that the character escapement in the second run was -58.
     979             :      */
     980           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-9), getProperty<sal_Int32>(getRun(getParagraph(1), 2), "CharEscapement"));
     981           1 : }
     982             : 
     983          12 : DECLARE_OOXMLIMPORT_TEST(testN782345, "n782345.docx")
     984             : {
     985             :     /*
     986             :      * The problem was that the page break was inserted before the 3rd para, instead of before the 2nd para.
     987             :      */
     988           1 :     CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType"));
     989           1 : }
     990             : 
     991          12 : DECLARE_OOXMLIMPORT_TEST(testN779941, "n779941.docx")
     992             : {
     993             :     /*
     994             :      * Make sure top/bottom margins of tables are set to 0 (problem was: bottom margin set to 0.35cm)
     995             :      */
     996           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     997           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
     998           2 :     uno::Reference<beans::XPropertySet> xTableProperties(xTables->getByIndex(0), uno::UNO_QUERY);
     999             :     {
    1000           1 :         uno::Any aValue = xTableProperties->getPropertyValue("TopMargin");
    1001             :         sal_Int32 nTopMargin;
    1002           1 :         aValue >>= nTopMargin;
    1003           1 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nTopMargin);
    1004             :     }
    1005             :     {
    1006           1 :         uno::Any aValue = xTableProperties->getPropertyValue("BottomMargin");
    1007             :         sal_Int32 nBottomMargin;
    1008           1 :         aValue >>= nBottomMargin;
    1009           1 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nBottomMargin);
    1010           1 :     }
    1011           1 : }
    1012             : 
    1013          12 : DECLARE_OOXMLIMPORT_TEST(testN783638, "n783638.docx")
    1014             : {
    1015             :     // The problem was that the margins of inline images were not zero.
    1016           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
    1017           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPropertySet, "LeftMargin"));
    1018           1 : }
    1019             : 
    1020          12 : DECLARE_OOXMLIMPORT_TEST(testFdo52208, "fdo52208.docx")
    1021             : {
    1022             :     // The problem was that the document had 2 pages instead of 1.
    1023           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
    1024           2 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
    1025           2 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
    1026           1 :     xCursor->jumpToLastPage();
    1027           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
    1028           1 : }
    1029             : 
    1030          12 : DECLARE_OOXMLIMPORT_TEST(testN785767, "n785767.docx")
    1031             : {
    1032           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1033           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1034           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1035           2 :     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
    1036             :     // 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).
    1037           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);
    1038           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);
    1039           1 : }
    1040             : 
    1041          12 : DECLARE_OOXMLIMPORT_TEST(testN773061, "n773061.docx")
    1042             : {
    1043             : // xray ThisComponent.TextFrames(0).LeftBorderDistance
    1044           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
    1045           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
    1046           2 :     uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
    1047           1 :     CPPUNIT_ASSERT_EQUAL( getProperty< sal_Int32 >( xFrame, "LeftBorderDistance" ), sal_Int32( 0 ));
    1048           1 :     CPPUNIT_ASSERT_EQUAL( getProperty< sal_Int32 >( xFrame, "TopBorderDistance" ), sal_Int32( 0 ));
    1049           1 :     CPPUNIT_ASSERT_EQUAL( getProperty< sal_Int32 >( xFrame, "RightBorderDistance" ), sal_Int32( 0 ));
    1050           2 :     CPPUNIT_ASSERT_EQUAL( getProperty< sal_Int32 >( xFrame, "BottomBorderDistance" ), sal_Int32( 0 ));
    1051           1 : }
    1052             : 
    1053          12 : DECLARE_OOXMLIMPORT_TEST(testN780645, "n780645.docx")
    1054             : {
    1055             :     // The problem was that when the number of cells didn't match the grid, we
    1056             :     // didn't take care of direct cell widths.
    1057           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1058           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1059           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1060           2 :     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
    1061           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(2135), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); // was 1999
    1062           1 : }
    1063             : 
    1064          12 : DECLARE_OOXMLIMPORT_TEST(testFineTableDash, "tableborder-finedash.docx")
    1065             : {
    1066             :     // The problem was that finely dashed borders on tables were unsupported
    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<beans::XPropertySet> xTableProperties(xTables->getByIndex(0), uno::UNO_QUERY);
    1070           1 :     table::TableBorder2 aBorder;
    1071           1 :     xTableProperties->getPropertyValue("TableBorder2") >>= aBorder;
    1072           2 :     CPPUNIT_ASSERT_EQUAL(aBorder.RightLine.LineStyle, table::BorderLineStyle::FINE_DASHED);
    1073           1 : }
    1074             : 
    1075          12 : DECLARE_OOXMLIMPORT_TEST(testN792778, "n792778.docx")
    1076             : {
    1077             :     /*
    1078             :      * The problem was that the importer didn't handle complex groupshapes with groupshapes, textboxes and graphics inside.
    1079             :      *
    1080             :      * xray ThisComponent.DrawPage.Count ' 1 groupshape
    1081             :      * xray ThisComponent.DrawPage(0).Count ' 2 sub-groupshapes
    1082             :      * xray ThisComponent.DrawPage(0).getByIndex(0).Count ' first sub-groupshape: 1 pic
    1083             :      * xray ThisComponent.DrawPage(0).getByIndex(1).Count ' second sub-groupshape: 1 pic
    1084             :      * xray ThisComponent.DrawPage(0).getByIndex(0).getByIndex(0).Position.Y ' 11684, the vertical position of the shapes were also wrong
    1085             :      * xray ThisComponent.DrawPage(0).getByIndex(1).getByIndex(0).Position.Y ' 11684
    1086             :      */
    1087           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1088           2 :     uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1089           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
    1090             : 
    1091           2 :     uno::Reference<drawing::XShapes> xGroupShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
    1092           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupShape->getCount());
    1093             : 
    1094           2 :     uno::Reference<drawing::XShapes> xInnerGroupShape(xGroupShape->getByIndex(0), uno::UNO_QUERY);
    1095           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xInnerGroupShape->getCount());
    1096             : 
    1097           2 :     uno::Reference<drawing::XShape> xInnerShape(xInnerGroupShape->getByIndex(0), uno::UNO_QUERY);
    1098           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(11684), xInnerShape->getPosition().Y);
    1099             : 
    1100           1 :     xInnerGroupShape.set(xGroupShape->getByIndex(1), uno::UNO_QUERY);
    1101           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xInnerGroupShape->getCount());
    1102             : 
    1103           1 :     xInnerShape.set(xInnerGroupShape->getByIndex(0), uno::UNO_QUERY);
    1104           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(11684), xInnerShape->getPosition().Y);
    1105           1 : }
    1106             : 
    1107          12 : DECLARE_OOXMLIMPORT_TEST(testWordArtResizing, "WordArt.docx")
    1108             : {
    1109             :     /* The Word-Arts and watermarks were getting resized automatically, It was as if they were
    1110             :        getting glued to the fallback geometry(the sdrObj) and were getting bound to the font size.
    1111             :        The test-case esures the original height and width of the word-art is not changed while importing*/
    1112             : 
    1113           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1114           2 :     uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1115           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
    1116             : 
    1117           2 :     uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
    1118           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(10105), xShape->getSize().Width);
    1119           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4755), xShape->getSize().Height);
    1120           1 : }
    1121             : 
    1122          12 : DECLARE_OOXMLIMPORT_TEST(testGroupshapeLine, "groupshape-line.docx")
    1123             : {
    1124             :     /*
    1125             :      * Another fallout from n#792778, this time first the lines inside a
    1126             :      * groupshape wasn't imported, then the fix broke the size/position of
    1127             :      * non-groupshape lines. Test both here.
    1128             :      *
    1129             :      * xray ThisComponent.DrawPage.Count ' 2 shapes
    1130             :      * xray ThisComponent.DrawPage(0).Position 'x: 2656, y: 339
    1131             :      * xray ThisComponent.DrawPage(0).Size ' width: 3270, height: 1392
    1132             :      * xray ThisComponent.DrawPage(1).getByIndex(0).Position 'x: 1272, y: 2286
    1133             :      * xray ThisComponent.DrawPage(1).getByIndex(0).Size 'width: 10160, height: 0
    1134             :      */
    1135           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1136           2 :     uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1137           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDrawPage->getCount());
    1138             : 
    1139           2 :     uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
    1140           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2656), xShape->getPosition().X);
    1141           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(339), xShape->getPosition().Y);
    1142           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3270), xShape->getSize().Width);
    1143           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1392), xShape->getSize().Height);
    1144             : 
    1145           2 :     uno::Reference<drawing::XShapes> xGroupShape(xDrawPage->getByIndex(1), uno::UNO_QUERY);
    1146           1 :     xShape.set(xGroupShape->getByIndex(0), uno::UNO_QUERY);
    1147           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1272), xShape->getPosition().X);
    1148           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2286), xShape->getPosition().Y);
    1149           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(10160), xShape->getSize().Width);
    1150           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getSize().Height);
    1151           1 : }
    1152             : 
    1153          12 : DECLARE_OOXMLIMPORT_TEST(testGroupshapeChildRotation, "groupshape-child-rotation.docx")
    1154             : {
    1155             :     // The problem was that (due to incorrect handling of rotation inside
    1156             :     // groupshapes), the first child wasn't in the top left corner of an inline
    1157             :     // groupshape.
    1158           1 :     uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY);
    1159           2 :     uno::Reference<drawing::XShape> xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY);
    1160           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getPosition().X);
    1161           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getPosition().Y);
    1162             : 
    1163             : #if ! TEST_FONTS_MISSING
    1164           1 :     xShape.set(xGroupShape->getByIndex(4), uno::UNO_QUERY);
    1165             :     // This was 887, i.e. border distances were included in the height.
    1166           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(686), xShape->getSize().Height);
    1167             : #endif
    1168             : 
    1169           2 :     uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xGroupShape->getByIndex(5), uno::UNO_QUERY);
    1170             :     // This was com.sun.star.drawing.RectangleShape, all shape text in a single line.
    1171           2 :     CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.TextShape"), xShapeDescriptor->getShapeType());
    1172           1 : }
    1173             : 
    1174          12 : DECLARE_OOXMLIMPORT_TEST(testGroupshapeSmarttag, "groupshape-smarttag.docx")
    1175             : {
    1176           1 :     uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY);
    1177           2 :     uno::Reference<text::XTextRange> xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY);
    1178             :     // First run of shape text was missing due to the w:smartTag wrapper around it.
    1179           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Box 2"), xShape->getString());
    1180             : 
    1181             :     // Font size of the shape text was 10.
    1182           2 :     CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(xShape->getText(), "CharHeight"));
    1183           1 : }
    1184             : 
    1185          12 : DECLARE_OOXMLIMPORT_TEST(testN793262, "n793262.docx")
    1186             : {
    1187           1 :     uno::Reference<container::XEnumerationAccess> xHeaderText = getProperty< uno::Reference<container::XEnumerationAccess> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
    1188           2 :     uno::Reference<container::XEnumeration> xHeaderParagraphs(xHeaderText->createEnumeration());
    1189           1 :     xHeaderParagraphs->nextElement();
    1190             :     // Font size of the last empty paragraph in the header was ignored, this was 11.
    1191           1 :     CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xHeaderParagraphs->nextElement(), "CharHeight"));
    1192             : 
    1193           2 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1194           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1195           2 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1196             :     // Cell margins as direct formatting were ignored, this was 0.
    1197           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(76), getProperty<sal_Int32>(xTable->getCellByName("A1"), "TopBorderDistance"));
    1198           1 : }
    1199             : 
    1200          12 : DECLARE_OOXMLIMPORT_TEST(testN793998, "n793998.docx")
    1201             : {
    1202           1 :     sal_Int32 nTextPortion = parseDump("/root/page/body/txt/Text[1]", "nWidth").toInt32(); // Width of the first (text) portion
    1203           1 :     sal_Int32 nTabPortion = parseDump("/root/page/body/txt/Text[2]", "nWidth").toInt32(); // Width of the second (tab) portion
    1204           1 :     sal_Int32 nParagraph = parseDump("/root/page/body/txt/infos/bounds", "width").toInt32(); // Width of the paragraph
    1205           1 :     sal_Int32 nRightMargin = 3000;
    1206             :     // 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.
    1207           1 :     CPPUNIT_ASSERT(nTextPortion + nTabPortion > nParagraph - nRightMargin);
    1208           1 : }
    1209             : 
    1210          12 : DECLARE_OOXMLIMPORT_TEST(testN779642, "n779642.docx")
    1211             : {
    1212           1 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1213             : 
    1214             :     // First problem: check that we have 2 tables, nesting caused the
    1215             :     // creation of outer one to fail
    1216           2 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1217           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong number of imported tables", sal_Int32(2), xTables->getCount());
    1218             : 
    1219             :     // Second problem: check that the outer table is in a frame, at the bottom of the page
    1220           2 :     uno::Reference<text::XTextTable> xTextTable(xTextTablesSupplier->getTextTables()->getByName("Table2"), uno::UNO_QUERY);
    1221           2 :     uno::Reference<beans::XPropertySet> xAnchor(xTextTable->getAnchor(), uno::UNO_QUERY);
    1222           2 :     uno::Any aFrame = xAnchor->getPropertyValue("TextFrame");
    1223           2 :     uno::Reference<beans::XPropertySet> xFrame;
    1224           1 :     aFrame >>= xFrame;
    1225             :     sal_Int16 nValue;
    1226           1 :     xFrame->getPropertyValue("VertOrient") >>= nValue;
    1227           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation", nValue, text::VertOrientation::BOTTOM);
    1228           1 :     xFrame->getPropertyValue("VertOrientRelation") >>= nValue;
    1229           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation relation", nValue, text::RelOrientation::PAGE_PRINT_AREA);
    1230           1 : }
    1231             : 
    1232          12 : DECLARE_OOXMLIMPORT_TEST(testTbLrHeight, "tblr-height.docx")
    1233             : {
    1234           1 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1235           2 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1236           2 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1237           2 :     uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
    1238             :     // btLr text direction was imported as MIN, it should be FIX to avoid incorrectly large height in case of too much content.
    1239           2 :     CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty<sal_Int16>(xTableRows->getByIndex(0), "SizeType"));
    1240           1 : }
    1241             : 
    1242          12 : DECLARE_OOXMLIMPORT_TEST(testBnc865381, "bnc865381.docx")
    1243             : {
    1244           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1245           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1246           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1247           2 :     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
    1248             :     // Second row has a vertically merged cell, make sure size type is not FIX in that case (otherwise B2 is not readable).
    1249           1 :     CPPUNIT_ASSERT(text::SizeType::FIX != getProperty<sal_Int16>(xTableRows->getByIndex(1), "SizeType"));
    1250             :     // Explicit size of 41 mm100 was set, so the vertical text in A2 was not readable.
    1251           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xTableRows->getByIndex(1), "Height"));
    1252           1 : }
    1253             : 
    1254          12 : DECLARE_OOXMLIMPORT_TEST(testFdo53985, "fdo53985.docx")
    1255             : {
    1256             :     // Unhandled excetion prevented import of the rest of the document.
    1257             : 
    1258           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1259           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1260           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTables->getCount()); // Only 4 tables were imported.
    1261           1 : }
    1262             : 
    1263          12 : DECLARE_OOXMLIMPORT_TEST(testFdo59638, "fdo59638.docx")
    1264             : {
    1265             :     // The problem was that w:lvlOverride inside w:num was ignores by dmapper.
    1266             : 
    1267           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
    1268           1 :     uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
    1269           1 :     uno::Sequence<beans::PropertyValue> aProps;
    1270           1 :     xLevels->getByIndex(0) >>= aProps; // 1st level
    1271             : 
    1272          14 :     for (int i = 0; i < aProps.getLength(); ++i)
    1273             :     {
    1274          14 :         const beans::PropertyValue& rProp = aProps[i];
    1275             : 
    1276          14 :         if (rProp.Name == "BulletChar")
    1277             :         {
    1278             :             // Was '*', should be 'o'.
    1279           1 :             CPPUNIT_ASSERT_EQUAL(OUString("\xEF\x82\xB7", 3, RTL_TEXTENCODING_UTF8), rProp.Value.get<OUString>());
    1280           2 :             return;
    1281             :         }
    1282             :     }
    1283           0 :     CPPUNIT_FAIL("no BulletChar property");
    1284             : }
    1285             : 
    1286          12 : DECLARE_OOXMLIMPORT_TEST(testFdo61343, "fdo61343.docx")
    1287             : {
    1288             :     // The problem was that there were a groupshape in the doc, followed by an
    1289             :     // OLE object, and this lead to a crash.
    1290           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1291           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1292           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
    1293           1 : }
    1294             : 
    1295          12 : DECLARE_OOXMLIMPORT_TEST(testToolsLineNumbering, "tools-line-numbering.docx")
    1296             : {
    1297             :     /*
    1298             :      * Test the line numbering feature import (Tools->Line Numbering ...)
    1299             :      *
    1300             :      * xray ThisComponent.getLineNumberingProperties().IsOn == True
    1301             :      * xray ThisComponent.getLineNumberingProperties().CountEmptyLines == True
    1302             :      * xray ThisComponent.getLineNumberingProperties().NumberPosition == 0
    1303             :      * xray ThisComponent.getLineNumberingProperties().NumberingType == 4
    1304             :      * xray ThisComponent.getLineNumberingProperties().SeparatorInterval == 3
    1305             :      */
    1306             : 
    1307           1 :     bool bValue = false;
    1308           1 :     sal_Int32 nValue = -1;
    1309             : 
    1310           1 :     uno::Reference< text::XTextDocument > xtextDocument(mxComponent, uno::UNO_QUERY);
    1311           2 :     uno::Reference< text::XLineNumberingProperties > xLineProperties( xtextDocument, uno::UNO_QUERY_THROW );
    1312           2 :     uno::Reference< beans::XPropertySet > xPropertySet = xLineProperties->getLineNumberingProperties();
    1313             : 
    1314           1 :     xPropertySet->getPropertyValue("IsOn") >>= bValue;
    1315           1 :     CPPUNIT_ASSERT_EQUAL(true, bValue);
    1316             : 
    1317           1 :     xPropertySet->getPropertyValue("CountEmptyLines") >>= bValue;
    1318           1 :     CPPUNIT_ASSERT_EQUAL(true, bValue);
    1319             : 
    1320           1 :     xPropertySet->getPropertyValue("NumberPosition") >>= nValue;
    1321           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nValue);
    1322             : 
    1323           1 :     xPropertySet->getPropertyValue("NumberingType") >>= nValue;
    1324           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4), nValue);
    1325             : 
    1326           1 :     xPropertySet->getPropertyValue("SeparatorInterval") >>= nValue;
    1327           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nValue);
    1328           1 : }
    1329             : 
    1330          12 : DECLARE_OOXMLIMPORT_TEST(testfdo78904, "fdo78904.docx")
    1331             : {
    1332           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
    1333           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
    1334           1 :     if (xIndexAccess->getCount())
    1335             :     {
    1336           1 :         uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
    1337           1 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(0)), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
    1338           1 :     }
    1339           1 : }
    1340             : 
    1341          12 : DECLARE_OOXMLIMPORT_TEST(testFdo60922, "fdo60922.docx")
    1342             : {
    1343             :     // This was 0, not 100, due to wrong import of w:position w:val="0"
    1344           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharEscapementHeight"));
    1345           1 : }
    1346             : 
    1347          12 : DECLARE_OOXMLIMPORT_TEST(testFdo59273, "fdo59273.docx")
    1348             : {
    1349           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1350           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1351           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1352             :     // Was 115596 (i.e. 10 times wider than necessary), as w:tblW was missing and the importer didn't set it.
    1353           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(12961), getProperty<sal_Int32>(xTextTable, "Width"));
    1354             : 
    1355           2 :     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
    1356             :     // Was 9997, so the 4th column had ~zero width
    1357           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[2].Position);
    1358           1 : }
    1359             : 
    1360          12 : DECLARE_OOXMLIMPORT_TEST(testTableWidth, "table_width.docx")
    1361             : {
    1362           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1363           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1364             :     // Relative width wasn't recognized during import.
    1365           1 :     CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xTables->getByIndex(0), "IsWidthRelative")));
    1366             : 
    1367           2 :     uno::Reference<text::XTextFramesSupplier> xFramesSupplier(mxComponent, uno::UNO_QUERY);
    1368           2 :     uno::Reference<container::XIndexAccess> xFrames(xFramesSupplier->getTextFrames(), uno::UNO_QUERY);
    1369           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(xFrames->getByIndex(0), "FrameWidthPercent"));
    1370           1 : }
    1371             : 
    1372          12 : DECLARE_OOXMLIMPORT_TEST(testConditionalstylesTablelook, "conditionalstyles-tbllook.docx")
    1373             : {
    1374           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1375           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1376           2 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1377             :     // Background was -1.
    1378           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x7F7F7F), getProperty<sal_Int32>(xTable->getCellByName("A1"), "BackColor"));
    1379           1 : }
    1380             : 
    1381          12 : DECLARE_OOXMLIMPORT_TEST(testFdo63685, "fdo63685.docx")
    1382             : {
    1383             :     // Was 85697, i.e. original 114120 was converted to mm100 from twips, not from EMUs.
    1384           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(318), getProperty<sal_Int32>(getShape(1), "TopMargin"));
    1385           1 : }
    1386             : 
    1387          12 : DECLARE_OOXMLIMPORT_TEST(testN592908_Frame, "n592908-frame.docx")
    1388             : {
    1389           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
    1390             :     text::WrapTextMode eValue;
    1391           1 :     xPropertySet->getPropertyValue("Surround") >>= eValue;
    1392           1 :     CPPUNIT_ASSERT_EQUAL(eValue, text::WrapTextMode_PARALLEL);
    1393           1 : }
    1394             : 
    1395          12 : DECLARE_OOXMLIMPORT_TEST(testN592908_Picture, "n592908-picture.docx")
    1396             : {
    1397           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
    1398             :     text::WrapTextMode eValue;
    1399           1 :     xPropertySet->getPropertyValue("Surround") >>= eValue;
    1400           1 :     CPPUNIT_ASSERT_EQUAL(eValue, text::WrapTextMode_PARALLEL);
    1401           1 : }
    1402             : 
    1403          12 : DECLARE_OOXMLIMPORT_TEST(testN779630, "n779630.docx")
    1404             : {
    1405             :     // First shape: date picker
    1406           1 :     uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY);
    1407           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
    1408           2 :     uno::Reference<lang::XServiceInfo> xServiceInfo(xPropertySet, uno::UNO_QUERY);
    1409           1 :     CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo->supportsService("com.sun.star.form.component.DateField")));
    1410           1 :     CPPUNIT_ASSERT_EQUAL(OUString("date default text"), getProperty<OUString>(xPropertySet, "HelpText"));
    1411           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty<sal_Int16>(xPropertySet, "DateFormat"));
    1412           1 :     CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xPropertySet, "Dropdown")));
    1413             : 
    1414             :     // Second shape: combo box
    1415           1 :     xControlShape.set(getShape(2), uno::UNO_QUERY);
    1416           1 :     xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY);
    1417           1 :     xServiceInfo.set(xPropertySet, uno::UNO_QUERY);
    1418           1 :     CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo->supportsService("com.sun.star.form.component.ComboBox")));
    1419           1 :     CPPUNIT_ASSERT_EQUAL(OUString("dropdown default text"), getProperty<OUString>(xPropertySet, "DefaultText"));
    1420           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty< uno::Sequence<OUString> >(xPropertySet, "StringItemList").getLength());
    1421           2 :     CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xPropertySet, "Dropdown")));
    1422           1 : }
    1423             : 
    1424          12 : DECLARE_OOXMLIMPORT_TEST(testIndentation, "indentation.docx")
    1425             : {
    1426           1 :     uno::Reference<uno::XInterface> xParaLTRTitle(getParagraph( 1, "Title aligned"));
    1427           2 :     uno::Reference<uno::XInterface> xParaLTRNormal(getParagraph( 2, ""));
    1428             : 
    1429             :     // this will test the text direction for paragraphs
    1430           1 :     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, getProperty<sal_Int16>( xParaLTRTitle, "WritingMode" ));
    1431           2 :     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, getProperty<sal_Int16>( xParaLTRNormal, "WritingMode" ));
    1432           1 : }
    1433             : 
    1434          12 : DECLARE_OOXMLIMPORT_TEST(testPageBorderShadow, "page-border-shadow.docx")
    1435             : {
    1436             :     // The problem was that in w:pgBorders, child elements had a w:shadow attribute, but that was ignored.
    1437           1 :     table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "ShadowFormat");
    1438           1 :     CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color));
    1439           1 :     CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
    1440             :     // w:sz="48" is in eights of a point, 1 pt is 20 twips.
    1441           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(convertTwipToMm100(48/8*20)), aShadow.ShadowWidth);
    1442           1 : }
    1443             : 
    1444          12 : DECLARE_OOXMLIMPORT_TEST(testN816593, "n816593.docx")
    1445             : {
    1446             :     // Two consecutive <w:tbl> without any paragraph in between, but with different tblpPr. In this
    1447             :     // case we need to have 2 different tables instead of 1
    1448           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1449           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1450           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
    1451           1 : }
    1452             : 
    1453          12 : DECLARE_OOXMLIMPORT_TEST(testN820509, "n820509.docx")
    1454             : {
    1455             :     // Design mode was enabled.
    1456           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
    1457           2 :     uno::Reference<view::XFormLayerAccess> xFormLayerAccess(xModel->getCurrentController(), uno::UNO_QUERY);
    1458           1 :     CPPUNIT_ASSERT_EQUAL(false, bool(xFormLayerAccess->isFormDesignMode()));
    1459             : 
    1460             :     // M.d.yyyy date format was unhandled.
    1461           2 :     uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY);
    1462           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
    1463           2 :     uno::Reference<lang::XServiceInfo> xServiceInfo(xPropertySet, uno::UNO_QUERY);
    1464           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty<sal_Int16>(xPropertySet, "DateFormat"));
    1465           1 : }
    1466             : 
    1467          12 : DECLARE_OOXMLIMPORT_TEST(testN820788, "n820788.docx")
    1468             : {
    1469             :     // The problem was that AutoSize was not enabled for the text frame.
    1470           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
    1471           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
    1472           2 :     uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
    1473             :     // This was text::SizeType::FIX.
    1474           2 :     CPPUNIT_ASSERT_EQUAL(text::SizeType::MIN, getProperty<sal_Int16>(xFrame, "SizeType"));
    1475           1 : }
    1476             : 
    1477          12 : DECLARE_OOXMLIMPORT_TEST(testN820504, "n820504.docx")
    1478             : {
    1479           1 :     uno::Reference<style::XStyleFamiliesSupplier> xFamiliesSupplier(mxComponent, uno::UNO_QUERY);
    1480           2 :     uno::Reference<container::XNameAccess> xFamiliesAccess(xFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
    1481           2 :     uno::Reference<container::XNameAccess> xStylesAccess(xFamiliesAccess->getByName("ParagraphStyles"), uno::UNO_QUERY);
    1482           2 :     uno::Reference<beans::XPropertySet> xStyle(xStylesAccess->getByName("Default Style"), uno::UNO_QUERY);
    1483             :     // The problem was that the CharColor was set to AUTO (-1) even if we have some default char color set
    1484           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4040635), getProperty<sal_Int32>(xStyle, "CharColor"));
    1485             : 
    1486             :     // Also, the groupshape was anchored at-page instead of at-character
    1487             :     // (that's incorrect as Word only supports at-character and as-character).
    1488           2 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
    1489           1 : }
    1490             : 
    1491          12 : DECLARE_OOXMLIMPORT_TEST(testN830205, "n830205.docx")
    1492             : {
    1493             :     // Previously import just crashed (due to infinite recursion).
    1494           1 :     getParagraph(1, "XXX");
    1495           1 : }
    1496             : 
    1497          12 : DECLARE_OOXMLIMPORT_TEST(testFdo43641, "fdo43641.docx")
    1498             : {
    1499           1 :     uno::Reference<container::XIndexAccess> xGroupShape(getShape(1), uno::UNO_QUERY);
    1500           2 :     uno::Reference<drawing::XShape> xLine(xGroupShape->getByIndex(1), uno::UNO_QUERY);
    1501             :     // This was 2200, not 2579 in mm100, i.e. the size of the line shape was incorrect.
    1502           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(928440)), xLine->getSize().Width);
    1503           1 : }
    1504             : 
    1505          12 : DECLARE_OOXMLIMPORT_TEST(testTableAutoColumnFixedSize, "table-auto-column-fixed-size.docx")
    1506             : {
    1507           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1508           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1509           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1510             : 
    1511             :     // Width was not recognized during import when table size was 'auto'
    1512           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(3996)), getProperty<sal_Int32>(xTextTable, "Width"));
    1513           1 : }
    1514             : 
    1515          12 : DECLARE_OOXMLIMPORT_TEST(testTableAutoColumnFixedSize2, "table-auto-column-fixed-size2.docx")
    1516             : {
    1517           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1518           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1519           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1520             :     // This was 17907, i.e. the sum of the width of the 3 cells (10152 twips each), which is too wide.
    1521           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(16891), getProperty<sal_Int32>(xTextTable, "Width"));
    1522           1 : }
    1523             : 
    1524          12 : DECLARE_OOXMLIMPORT_TEST(testFdo46361, "fdo46361.docx")
    1525             : {
    1526           1 :     uno::Reference<container::XIndexAccess> xGroupShape(getShape(1), uno::UNO_QUERY);
    1527           2 :     uno::Reference<drawing::XShape> xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY);
    1528             :     // This was CENTER.
    1529           1 :     CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xShape, "TextVerticalAdjust"));
    1530           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
    1531           2 :     uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText);
    1532             :     // This was LEFT.
    1533           1 :     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xParagraph, "ParaAdjust")));
    1534             :     // This was black, not green.
    1535           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x008000), getProperty<sal_Int32>(getRun(xParagraph, 1), "CharColor"));
    1536             :     // \n char was missing due to unhandled w:br.
    1537           1 :     CPPUNIT_ASSERT_EQUAL(OUString("text\ntext"), uno::Reference<text::XTextRange>(xGroupShape->getByIndex(1), uno::UNO_QUERY)->getString());
    1538             :     // \n chars were missing, due to unhandled multiple w:p tags.
    1539           2 :     CPPUNIT_ASSERT_EQUAL(OUString("text\ntext\n"), uno::Reference<text::XTextRange>(xGroupShape->getByIndex(2), uno::UNO_QUERY)->getString());
    1540           1 : }
    1541             : 
    1542          12 : DECLARE_OOXMLIMPORT_TEST(testFdo65632, "fdo65632.docx")
    1543             : {
    1544             :     // The problem was that the footnote text had fake redline: only the body
    1545             :     // text has redline in fact.
    1546           1 :     uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
    1547           2 :     uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
    1548           2 :     uno::Reference<text::XText> xText(xFootnotes->getByIndex(0), uno::UNO_QUERY);
    1549             :     //uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText);
    1550           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty<OUString>(getRun(getParagraphOfText(1, xText), 1), "TextPortionType"));
    1551           1 : }
    1552             : 
    1553          12 : DECLARE_OOXMLIMPORT_TEST(testFdo66474, "fdo66474.docx")
    1554             : {
    1555             :     // The table width was too small, so the text in the second cell was unreadable: this was 1397.
    1556           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1557           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1558           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(10492), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
    1559           1 : }
    1560             : 
    1561          12 : DECLARE_OOXMLIMPORT_TEST(testGroupshapeRotation, "groupshape-rotation.docx")
    1562             : {
    1563             :     // Rotation on groupshapes wasn't handled at all by the VML importer.
    1564           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(315 * 100), getProperty<sal_Int32>(getShape(1), "RotateAngle"));
    1565           1 : }
    1566             : 
    1567          12 : DECLARE_OOXMLIMPORT_TEST(testBnc780044Spacing, "bnc780044_spacing.docx")
    1568             : {
    1569             :     // The document has global w:spacing in styles.xml , and local w:spacing in w:pPr, which however
    1570             :     // only applied to text runs, not to as-character pictures. So the picture made the line higher.
    1571           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
    1572           2 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
    1573           2 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
    1574           1 :     xCursor->jumpToLastPage();
    1575           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
    1576           1 : }
    1577             : 
    1578          12 : DECLARE_OOXMLIMPORT_TEST(testTableAutoNested, "table-auto-nested.docx")
    1579             : {
    1580             :     // This was 176, when compat option is not enabled, the auto paragraph bottom margin value was incorrect.
    1581           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(494), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
    1582             : 
    1583           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1584           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1585             :     // This was 115596, i.e. the width of the outer table was too large.
    1586           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(23051), getProperty<sal_Int32>(xTables->getByIndex(1), "Width"));
    1587           1 : }
    1588             : 
    1589          12 : DECLARE_OOXMLIMPORT_TEST(testTableStyleParprop, "table-style-parprop.docx")
    1590             : {
    1591             :     // The problem was that w:spacing's w:after=0 (a paragraph property) wasn't imported from table style.
    1592           1 :     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
    1593           2 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1594             :     // This was 353, the document default, i.e. paragraph property from table style had no effect.
    1595           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaBottomMargin"));
    1596           1 : }
    1597             : 
    1598          12 : DECLARE_OOXMLIMPORT_TEST(testTablePagebreak, "table-pagebreak.docx")
    1599             : {
    1600             :     // Page break inside table: should be ignored (was style::BreakType_PAGE_BEFORE before).
    1601           1 :     CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, getProperty<style::BreakType>(getParagraphOrTable(2), "BreakType"));
    1602             : 
    1603             :     // This one is outside the table: should not be ignored.
    1604           1 :     CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, getProperty<style::BreakType>(getParagraph(3), "BreakType"));
    1605           1 : }
    1606             : 
    1607          12 : DECLARE_OOXMLIMPORT_TEST(testFdo68607, "fdo68607.docx")
    1608             : {
    1609             :     // Bugdoc was 8 pages in Word, 1 in Writer due to pointlessly wrapping the
    1610             :     // table in a frame. Exact layout may depend on fonts available, etc. --
    1611             :     // but at least make sure that our table spans over multiple pages now.
    1612           1 :     CPPUNIT_ASSERT(getPages() > 1);
    1613           1 : }
    1614             : 
    1615          12 : DECLARE_OOXMLIMPORT_TEST(testVmlTextVerticalAdjust, "vml-text-vertical-adjust.docx")
    1616             : {
    1617           1 :     uno::Reference<drawing::XShapes> xOuterGroupShape(getShape(1), uno::UNO_QUERY);
    1618           2 :     uno::Reference<drawing::XShapes> xInnerGroupShape(xOuterGroupShape->getByIndex(0), uno::UNO_QUERY);
    1619           2 :     uno::Reference<drawing::XShape> xShape(xInnerGroupShape->getByIndex(0), uno::UNO_QUERY);
    1620             :     // Was CENTER.
    1621           2 :     CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xShape, "TextVerticalAdjust"));
    1622           1 : }
    1623             : 
    1624          12 : DECLARE_OOXMLIMPORT_TEST(testGroupshapeSdt, "groupshape-sdt.docx")
    1625             : {
    1626             :     // All problems here are due to the groupshape: we have a drawinglayer rectangle, not a writer textframe.
    1627           1 :     uno::Reference<drawing::XShapes> xOuterGroupShape(getShape(1), uno::UNO_QUERY);
    1628           2 :     uno::Reference<drawing::XShapes> xInnerGroupShape(xOuterGroupShape->getByIndex(0), uno::UNO_QUERY);
    1629           2 :     uno::Reference<text::XTextRange> xShape(xInnerGroupShape->getByIndex(0), uno::UNO_QUERY);
    1630             :     // Border distances were not implemented, this was 0.
    1631           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1905), getProperty<sal_Int32>(xShape, "TextUpperDistance"));
    1632             :     // Sdt field result wasn't imported, this was "".
    1633           1 :     CPPUNIT_ASSERT_EQUAL(OUString("placeholder text"), xShape->getString());
    1634             :     // w:spacing was ignored in oox, this was 0.
    1635           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(20), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xShape->getText()), 1), "CharKerning"));
    1636           1 : }
    1637             : 
    1638          12 : DECLARE_OOXMLIMPORT_TEST(testDefaultSectBreakCols, "default-sect-break-cols.docx")
    1639             : {
    1640             :     // First problem: the first two paragraphs did not have their own text section, so the whole document had two columns.
    1641           1 :     uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(1, "First."), "TextSection");
    1642           1 :     CPPUNIT_ASSERT(xTextSection.is());
    1643           2 :     uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
    1644           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
    1645             : 
    1646             :     // Second problem: the page style had two columns, while it shouldn't have any.
    1647           2 :     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
    1648           1 :     xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xPageStyle, "TextColumns");
    1649           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount());
    1650             :     // Check for the Column Separator value.It should be FALSE as the document does not contain separator line.
    1651           1 :     bool bValue = getProperty< bool >(xTextColumns, "SeparatorLineIsOn");
    1652           2 :     CPPUNIT_ASSERT(!bValue) ;
    1653           1 : }
    1654             : 
    1655          12 : DECLARE_OOXMLIMPORT_TEST(testFdo69636, "fdo69636.docx")
    1656             : {
    1657             :     // The problem was that the mso-layout-flow-alt:bottom-to-top VML shape property wasn't handled for sw text frames.
    1658           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
    1659           2 :     comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
    1660           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-270), aCustomShapeGeometry["TextPreRotateAngle"].get<sal_Int32>());
    1661           1 : }
    1662             : 
    1663          12 : DECLARE_OOXMLIMPORT_TEST(testChartProp, "chart-prop.docx")
    1664             : {
    1665             :     // The problem was that chart was not getting parsed in writer module.
    1666           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1667           2 :     uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1668           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
    1669             : 
    1670           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
    1671           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(15240), getProperty<sal_Int32>(xPropertySet, "Width"));
    1672           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(8890), getProperty<sal_Int32>(xPropertySet, "Height"));
    1673           1 : }
    1674             : 
    1675           2 : void lcl_countTextFrames(com::sun::star::uno::Reference< lang::XComponent >& xComponent,
    1676             :    sal_Int32 nExpected )
    1677             : {
    1678           2 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(xComponent, uno::UNO_QUERY);
    1679           4 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
    1680           4 :     CPPUNIT_ASSERT_EQUAL( nExpected, xIndexAccess->getCount());
    1681           2 : }
    1682             : 
    1683          12 : DECLARE_OOXMLIMPORT_TEST(testBnc779620, "bnc779620.docx")
    1684             : {
    1685             :     // The problem was that the floating table was imported as a non-floating one.
    1686           1 :     lcl_countTextFrames( mxComponent, 1 );
    1687           1 : }
    1688             : 
    1689          12 : DECLARE_OOXMLIMPORT_TEST(testfdo76583, "fdo76583.docx")
    1690             : {
    1691             :     // The problem was that the floating table was imported as a non-floating one.
    1692             :     // floating tables are imported as text frames, therefore the document should
    1693             :     // exactly 1 text frame.
    1694           1 :     lcl_countTextFrames( mxComponent, 1 );
    1695           1 : }
    1696             : 
    1697          12 : DECLARE_OOXMLIMPORT_TEST(testFdo43093, "fdo43093.docx")
    1698             : {
    1699             :     // The problem was that the direction and alignment are not correct for RTL paragraphs.
    1700           1 :     uno::Reference<uno::XInterface> xParaRtlRight(getParagraph( 1, "Right and RTL in M$"));
    1701           1 :     sal_Int32 nRtlRight = getProperty< sal_Int32 >( xParaRtlRight, "ParaAdjust" );
    1702           1 :     sal_Int16 nRRDir  = getProperty< sal_Int32 >( xParaRtlRight, "WritingMode" );
    1703             : 
    1704           2 :     uno::Reference<uno::XInterface> xParaRtlLeft(getParagraph( 2, "Left and RTL in M$"));
    1705           1 :     sal_Int32 nRtlLeft = getProperty< sal_Int32 >( xParaRtlLeft, "ParaAdjust" );
    1706           1 :     sal_Int16 nRLDir  = getProperty< sal_Int32 >( xParaRtlLeft, "WritingMode" );
    1707             : 
    1708           2 :     uno::Reference<uno::XInterface> xParaLtrRight(getParagraph( 3, "Right and LTR in M$"));
    1709           1 :     sal_Int32 nLtrRight = getProperty< sal_Int32 >( xParaLtrRight, "ParaAdjust" );
    1710           1 :     sal_Int16 nLRDir  = getProperty< sal_Int32 >( xParaLtrRight, "WritingMode" );
    1711             : 
    1712           2 :     uno::Reference<uno::XInterface> xParaLtrLeft(getParagraph( 4, "Left and LTR in M$"));
    1713           1 :     sal_Int32 nLtrLeft = getProperty< sal_Int32 >( xParaLtrLeft, "ParaAdjust" );
    1714           1 :     sal_Int16 nLLDir  = getProperty< sal_Int32 >( xParaLtrLeft, "WritingMode" );
    1715             : 
    1716             :     // this will test the both the text direction and alignment for each paragraph
    1717           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_RIGHT), nRtlRight);
    1718           1 :     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, nRRDir);
    1719             : 
    1720           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT), nRtlLeft);
    1721           1 :     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, nRLDir);
    1722             : 
    1723           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_RIGHT), nLtrRight);
    1724           1 :     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nLRDir);
    1725             : 
    1726           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT), nLtrLeft);
    1727           2 :     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nLLDir);
    1728           1 : }
    1729             : 
    1730          12 : DECLARE_OOXMLIMPORT_TEST(testSmartart, "smartart.docx")
    1731             : {
    1732           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
    1733           2 :     uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY);
    1734           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1735           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1736           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); // One groupshape in the doc
    1737             : 
    1738           2 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
    1739           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xGroup->getCount()); // 3 rectangles and an arrow in the group
    1740             : 
    1741           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xGroup->getByIndex(1), uno::UNO_QUERY);
    1742           1 :     sal_Int32 nValue(0);
    1743           1 :     xPropertySet->getPropertyValue("FillColor") >>= nValue;
    1744           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), nValue); // If fill color is right, theme import is OK
    1745             : 
    1746           2 :     uno::Reference<text::XTextRange> xTextRange(xGroup->getByIndex(1), uno::UNO_QUERY);
    1747           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Sample"), xTextRange->getString()); // Shape has text
    1748             : 
    1749           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextRange->getText(), uno::UNO_QUERY);
    1750           2 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
    1751           1 :     xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
    1752           1 :     xPropertySet->getPropertyValue("ParaAdjust") >>= nValue;
    1753           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_CENTER), nValue); // Paragraph properties are imported
    1754           1 : }
    1755             : 
    1756          12 : DECLARE_OOXMLIMPORT_TEST(testMultiColumnSeparator, "multi-column-separator-with-line.docx")
    1757             : {
    1758           1 :     uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(1, "First data."), "TextSection");
    1759           1 :     CPPUNIT_ASSERT(xTextSection.is());
    1760           2 :     uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
    1761           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
    1762             :     // Check for the Column Separator value.It should be TRUE as the document contains separator line.
    1763           1 :     bool  bValue = getProperty< bool >(xTextColumns, "SeparatorLineIsOn");
    1764           2 :     CPPUNIT_ASSERT(bValue);
    1765           1 : }
    1766             : 
    1767          12 : DECLARE_OOXMLIMPORT_TEST(testFdo69548, "fdo69548.docx")
    1768             : {
    1769             :     // The problem was that the last space in target URL was removed
    1770           1 :     CPPUNIT_ASSERT_EQUAL(OUString("#this is a bookmark"), getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL"));
    1771           1 : }
    1772             : 
    1773          12 : DECLARE_OOXMLIMPORT_TEST(testWpsOnly, "wps-only.docx")
    1774             : {
    1775             :     // Document has wp:anchor, not wp:inline, so handle it accordingly.
    1776           1 :     uno::Reference<drawing::XShape> xShape = getShape(1);
    1777           1 :     text::TextContentAnchorType eValue = getProperty<text::TextContentAnchorType>(xShape, "AnchorType");
    1778           1 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_PARAGRAPH, eValue);
    1779             : 
    1780             :     // Check position, it was 0. This is a shape, so use getPosition(), not a property.
    1781           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(671830)), xShape->getPosition().X);
    1782             : 
    1783             :     // Left margin was 0, instead of 114300 EMU's.
    1784           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(318), getProperty<sal_Int32>(xShape, "LeftMargin"));
    1785             :     // Wrap type was PARALLEL.
    1786           1 :     CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(xShape, "Surround"));
    1787             : 
    1788             :     // This should be in front of text.
    1789           1 :     CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xShape, "Opaque")));
    1790             :     // And this should be behind the document.
    1791           1 :     CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "Opaque")));
    1792           1 : }
    1793             : 
    1794          12 : DECLARE_OOXMLIMPORT_TEST(lineWpsOnly, "line-wps-only.docx")
    1795             : {
    1796           1 :     uno::Reference<drawing::XShape> xShape = getShape(1);
    1797             :     // Check position, it was -7223 as it was set after the CustomShapeGeometry property.
    1798           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(210), xShape->getPosition().X);
    1799           1 : }
    1800             : 
    1801          12 : DECLARE_OOXMLIMPORT_TEST(lineRotation, "line-rotation.docx")
    1802             : {
    1803           1 :     uno::Reference<drawing::XShape> xShape = getShape(3);
    1804             :     // This was 5096: the line was shifted towards the bottom, so the end of
    1805             :     // the 3 different lines wasn't at the same point.
    1806           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4808), xShape->getPosition().Y);
    1807           1 : }
    1808             : 
    1809          12 : DECLARE_OOXMLIMPORT_TEST(textboxWpsOnly, "textbox-wps-only.docx")
    1810             : {
    1811           1 :     uno::Reference<text::XTextRange> xFrame(getShape(1), uno::UNO_QUERY);
    1812           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Hello world!"), xFrame->getString());
    1813             :     // Position wasn't horizontally centered.
    1814           1 :     CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(xFrame, "HoriOrient"));
    1815             : 
    1816             :     // Position was the default (hori center, vert top) for the textbox.
    1817           1 :     xFrame.set(getShape(2), uno::UNO_QUERY);
    1818           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2173), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
    1819             : #ifdef MACOSX
    1820             :     // FIXME: The assert below fails wildly on a Retina display. So use some (horrible)
    1821             :     // heuristics. Note that for instance on the 5K Retina iMac, [NSScreen mainScreen].frame.size is
    1822             :     // 2560x1440, not the true display size 5120x2880. But whatever, I don't have much time to spend
    1823             :     // on this.
    1824             :     if ([NSScreen mainScreen].frame.size.width > 2000)
    1825             :         return;
    1826             : #endif
    1827           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2805), getProperty<sal_Int32>(xFrame, "VertOrientPosition"));
    1828           1 : }
    1829             : 
    1830          12 : DECLARE_OOXMLIMPORT_TEST(testWpgOnly, "wpg-only.docx")
    1831             : {
    1832           1 :     uno::Reference<drawing::XShape> xShape = getShape(1);
    1833             :     // Check position, it was nearly 0. This is a shape, so use getPosition(), not a property.
    1834           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(548005)), xShape->getPosition().X);
    1835           1 : }
    1836             : 
    1837          12 : DECLARE_OOXMLIMPORT_TEST(testWpgNested, "wpg-nested.docx")
    1838             : {
    1839           1 :     uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY);
    1840           2 :     uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xGroup->getByIndex(0), uno::UNO_QUERY);
    1841             :     // This was a com.sun.star.drawing.CustomShape, due to lack of handling of groupshapes inside groupshapes.
    1842           1 :     CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), xShapeDescriptor->getShapeType());
    1843             :     // This was text::RelOrientation::PAGE_FRAME, effectively placing the group shape on the left side of the page instead of the right one.
    1844           2 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_RIGHT, getProperty<sal_Int16>(xGroup, "HoriOrientRelation"));
    1845           1 : }
    1846             : 
    1847          12 : DECLARE_OOXMLIMPORT_TEST(textboxWpgOnly, "textbox-wpg-only.docx")
    1848             : {
    1849           1 :     uno::Reference<drawing::XShape> xShape = getShape(1);
    1850             :     // The relativeFrom attribute was ignored for groupshapes, i.e. these were text::RelOrientation::FRAME.
    1851           1 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "HoriOrientRelation"));
    1852           1 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "VertOrientRelation"));
    1853             :     // Make sure the shape is not in the background, as we have behindDoc="0" in the doc.
    1854           1 :     CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xShape, "Opaque")));
    1855             : 
    1856             :     // The 3 paragraphs on the rectangles inside the groupshape ended up in the
    1857             :     // body text, make sure we don't have multiple paragraphs there anymore.
    1858           1 :     CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); // was 4
    1859             : 
    1860             :     // Character escapement was enabled by default, this was 58.
    1861           2 :     uno::Reference<container::XIndexAccess> xGroup(xShape, uno::UNO_QUERY);
    1862           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(0), uno::UNO_QUERY)->getText();
    1863           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xText), 1), "CharEscapementHeight"));
    1864           1 : }
    1865             : 
    1866          12 : DECLARE_OOXMLIMPORT_TEST(testMceWpg, "mce-wpg.docx")
    1867             : {
    1868             :     // Make sure that we read the primary branch, if wpg is requested as a feature.
    1869           1 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
    1870           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(0), uno::UNO_QUERY)->getText();
    1871             :     // This was VML1.
    1872           2 :     getParagraphOfText(1, xText, "DML1");
    1873           1 : }
    1874             : 
    1875          12 : DECLARE_OOXMLIMPORT_TEST(testMceNested, "mce-nested.docx")
    1876             : {
    1877             :     // Vertical position of the shape was incorrect due to incorrect nested mce handling.
    1878           1 :     uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
    1879             :     // positionV's posOffset from the bugdoc, was 0.
    1880           1 :     CPPUNIT_ASSERT(6985 <= getProperty<sal_Int32>(xShape, "VertOrientPosition"));
    1881             :     // This was -1 (default), make sure the background color is set.
    1882           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), getProperty<sal_Int32>(xShape, "FillColor"));
    1883             : 
    1884           2 :     uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(getShape(2), uno::UNO_QUERY);
    1885             :     // This was a com.sun.star.drawing.CustomShape, due to incorrect handling of wpg elements after a wps textbox.
    1886           1 :     CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), xShapeDescriptor->getShapeType());
    1887             : 
    1888             :     // Now check the top right textbox.
    1889           2 :     uno::Reference<container::XIndexAccess> xGroup(getShape(2), uno::UNO_QUERY);
    1890           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(1), uno::UNO_QUERY)->getText();
    1891           2 :     uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText, "[Year]");
    1892           1 :     CPPUNIT_ASSERT_EQUAL(48.f, getProperty<float>(getRun(xParagraph, 1), "CharHeight"));
    1893           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(getRun(xParagraph, 1), "CharColor"));
    1894           1 :     CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(xParagraph, 1), "CharWeight"));
    1895           2 :     CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty<drawing::TextVerticalAdjust>(xGroup->getByIndex(1), "TextVerticalAdjust"));
    1896           1 : }
    1897             : 
    1898          12 : DECLARE_OOXMLIMPORT_TEST(testMissingPath, "missing-path.docx")
    1899             : {
    1900           1 :     comphelper::SequenceAsHashMap aCustomShapeGeometry(getProperty<beans::PropertyValues>(getShape(1), "CustomShapeGeometry"));
    1901           2 :     comphelper::SequenceAsHashMap aPath(aCustomShapeGeometry["Path"].get<beans::PropertyValues>());
    1902           2 :     uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates = aPath["Coordinates"].get< uno::Sequence<drawing::EnhancedCustomShapeParameterPair> >();
    1903             :     // This was 0, the coordinate list was empty.
    1904           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(19), aCoordinates.getLength());
    1905           1 : }
    1906             : 
    1907          12 : DECLARE_OOXMLIMPORT_TEST(testFdo70457, "fdo70457.docx")
    1908             : {
    1909             :     // The document contains a rotated bitmap
    1910             :     // It must be imported as a XShape object with the proper rotation value
    1911             : 
    1912             :     // Check: there is one shape in the doc
    1913           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1914           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1915           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
    1916             : 
    1917             :     // Check: the angle of the shape is 45º
    1918           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4500), getProperty<sal_Int32>(getShape(1), "RotateAngle"));
    1919           1 : }
    1920             : 
    1921          12 : DECLARE_OOXMLIMPORT_TEST(testLOCrash,"file_crash.docx")
    1922             : {
    1923             :     //The problem was libreoffice crash while opening the file.
    1924           1 :     getParagraph(1,"Contents");
    1925           1 : }
    1926             : 
    1927          12 : DECLARE_OOXMLIMPORT_TEST(testFdo72560, "fdo72560.docx")
    1928             : {
    1929             :     // The problem was libreoffice confuse when there RTL default style for paragraph
    1930           1 :     uno::Reference<uno::XInterface> xParaLeftRTL(getParagraph( 1, "RTL LEFT"));
    1931           2 :     uno::Reference<uno::XInterface> xParaRightLTR(getParagraph( 2, "LTR RIGHT"));
    1932             : 
    1933             :     // this will test the text direction and alignment for paragraphs
    1934           1 :     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, getProperty<sal_Int16>( xParaLeftRTL, "WritingMode" ));
    1935           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT), getProperty< sal_Int32 >( xParaLeftRTL, "ParaAdjust" ));
    1936             : 
    1937           1 :     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, getProperty<sal_Int16>( xParaRightLTR, "WritingMode" ));
    1938           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_RIGHT), getProperty< sal_Int32 >( xParaRightLTR, "ParaAdjust" ));
    1939           1 : }
    1940             : 
    1941          12 : DECLARE_OOXMLIMPORT_TEST(testRPrChangeClosed, "rprchange_closed.docx")
    1942             : {
    1943             :     // Redline defined by rPrChanged wasn't removed.
    1944             :     // First paragraph has an rPrChange element, make sure it doesn't appear in the second paragraph.
    1945           1 :     CPPUNIT_ASSERT_EQUAL(false, hasProperty(getRun(getParagraph(2), 1), "RedlineType"));
    1946           1 : }
    1947             : 
    1948          12 : DECLARE_OOXMLIMPORT_TEST(testFdo65090, "fdo65090.docx")
    1949             : {
    1950           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1951           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    1952           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1953           2 :     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
    1954             :     // The first row had two cells, instead of a single horizontally merged one.
    1955           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength());
    1956           1 : }
    1957             : 
    1958          12 : DECLARE_OOXMLIMPORT_TEST(testFdo69649, "fdo69649.docx")
    1959             : {
    1960             :     // The DOCX containing the Table of Contents was not imported with correct page nos
    1961           1 :     uno::Reference<text::XDocumentIndexesSupplier> xIndexSupplier(mxComponent, uno::UNO_QUERY);
    1962           2 :     uno::Reference<container::XIndexAccess> xIndexes(xIndexSupplier->getDocumentIndexes( ), uno::UNO_QUERY);
    1963           2 :     uno::Reference<text::XDocumentIndex> xTOCIndex(xIndexes->getByIndex(0), uno::UNO_QUERY);
    1964           2 :     uno::Reference<text::XTextRange> xTextRange(xTOCIndex->getAnchor(), uno::UNO_QUERY);
    1965           2 :     uno::Reference<text::XText> xText(xTextRange->getText( ), uno::UNO_QUERY);
    1966           2 :     uno::Reference<text::XTextCursor> xTextCursor(xText->createTextCursor( ), uno::UNO_QUERY);
    1967           1 :     xTextCursor->gotoRange(xTextRange->getStart(),false);
    1968           1 :     xTextCursor->gotoRange(xTextRange->getEnd(),true);
    1969           2 :     OUString xTocString(xTextCursor->getString());
    1970           1 :     xTocString = xTocString.copy(256);
    1971           2 :     CPPUNIT_ASSERT(xTocString.startsWithIgnoreAsciiCase( "Heading 15.1:\t15" ) );
    1972           1 : }
    1973             : 
    1974          12 : DECLARE_OOXMLIMPORT_TEST(testFdo73389,"fdo73389.docx")
    1975             : {
    1976           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1977           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1978             :     // This was 9340, i.e. the width of the inner table was too large.
    1979           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2842), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
    1980           1 : }
    1981             : 
    1982          12 : DECLARE_OOXMLIMPORT_TEST(testDMLGroupshapeSdt, "dml-groupshape-sdt.docx")
    1983             : {
    1984           1 :     uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY);
    1985             :     // The text in the groupshape was missing due to the w:sdt and w:sdtContent wrapper around it.
    1986           1 :     CPPUNIT_ASSERT_EQUAL(OUString("sdt and sdtContent inside groupshape"), uno::Reference<text::XTextRange>(xGroupShape->getByIndex(1), uno::UNO_QUERY)->getString());
    1987           1 : }
    1988             : 
    1989          12 : DECLARE_OOXMLIMPORT_TEST(testDmlCharheightDefault, "dml-charheight-default.docx")
    1990             : {
    1991           1 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
    1992           2 :     uno::Reference<text::XTextRange> xShape(xGroup->getByIndex(0), uno::UNO_QUERY);
    1993             :     // This was 16: the first run of the second para incorrectly inherited the char height of the first para.
    1994           2 :     CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(getRun(getParagraphOfText(2, xShape->getText()), 1), "CharHeight"));
    1995           1 : }
    1996             : 
    1997          12 : DECLARE_OOXMLIMPORT_TEST(testGroupshapeRelsize, "groupshape-relsize.docx")
    1998             : {
    1999             :     // This was 43760, i.e. the height of the groupshape was larger than the page height, which is obviously incorrect.
    2000           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(9142730)), getShape(1)->getSize().Height);
    2001           1 : }
    2002             : 
    2003          12 : DECLARE_OOXMLIMPORT_TEST(testOleAnchor, "ole-anchor.docx")
    2004             : {
    2005             :     // This was AS_CHARACTER, even if the VML style explicitly contains "position:absolute".
    2006           1 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
    2007             :     // This was DYNAMIC, even if the default is THROUGHT and there is no w10:wrap element in the bugdoc.
    2008           1 :     CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(getShape(1), "Surround"));
    2009           1 : }
    2010             : 
    2011          12 : DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeCapitalization, "dml-groupshape-capitalization.docx")
    2012             : {
    2013             :     // Capitalization inside a group shape was not imported
    2014           1 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
    2015           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(1), uno::UNO_QUERY)->getText();
    2016             :     // 2nd line is written with uppercase letters
    2017           1 :     CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getProperty<sal_Int16>(getRun(getParagraphOfText(2, xText), 1), "CharCaseMap"));
    2018             :     // 3rd line has no capitalization
    2019           1 :     CPPUNIT_ASSERT_EQUAL(style::CaseMap::NONE, getProperty<sal_Int16>(getRun(getParagraphOfText(3, xText), 1), "CharCaseMap"));
    2020             :     // 4th line has written with small capitals
    2021           1 :     CPPUNIT_ASSERT_EQUAL(style::CaseMap::SMALLCAPS, getProperty<sal_Int16>(getRun(getParagraphOfText(4, xText), 1), "CharCaseMap"));
    2022             :     // 5th line has no capitalization
    2023           2 :     CPPUNIT_ASSERT_EQUAL(style::CaseMap::NONE, getProperty<sal_Int16>(getRun(getParagraphOfText(5, xText), 1), "CharCaseMap"));
    2024           1 : }
    2025             : 
    2026          12 : DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeParaAdjust, "dml-groupshape-paraadjust.docx")
    2027             : {
    2028             :     // Paragraph adjustment inside a group shape was not imported
    2029           1 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
    2030           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(1), uno::UNO_QUERY)->getText();
    2031             :     // 2nd line is adjusted to the right
    2032           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), getProperty<sal_Int16>(getRun(getParagraphOfText(2, xText), 1), "ParaAdjust"));
    2033             :     // 3rd line has no adjustment
    2034           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getRun(getParagraphOfText(3, xText), 1), "ParaAdjust"));
    2035             :     // 4th line is adjusted to center
    2036           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), getProperty<sal_Int16>(getRun(getParagraphOfText(4, xText), 1), "ParaAdjust"));
    2037             :     // 5th line has no adjustment
    2038           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getRun(getParagraphOfText(5, xText), 1), "ParaAdjust"));
    2039             :     // 6th line is justified
    2040           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_BLOCK), getProperty<sal_Int16>(getRun(getParagraphOfText(6, xText), 1), "ParaAdjust"));
    2041             :     // 7th line has no adjustment
    2042           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getRun(getParagraphOfText(7, xText), 1), "ParaAdjust"));
    2043           1 : }
    2044             : 
    2045          12 : DECLARE_OOXMLIMPORT_TEST(testPictureWithSchemeColor, "picture-with-schemecolor.docx")
    2046             : {
    2047             :     // At the start of the document, a picture which has a color specified with a color scheme, lost
    2048             :     // it's color during import.
    2049           1 :     uno::Reference<beans::XPropertySet> xImage(getShape(1), uno::UNO_QUERY);
    2050           2 :     uno::Reference<graphic::XGraphic> xGraphic = getProperty<uno::Reference<graphic::XGraphic> >(xImage, "Graphic");
    2051           2 :     Graphic aVclGraphic(xGraphic);
    2052           2 :     Bitmap aBitmap(aVclGraphic.GetBitmap());
    2053           1 :     BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess();
    2054           1 :     CPPUNIT_ASSERT(pAccess);
    2055           1 :     CPPUNIT_ASSERT_EQUAL(341L, pAccess->Width());
    2056           1 :     CPPUNIT_ASSERT_EQUAL(181L, pAccess->Height());
    2057           1 :     Color aColor(pAccess->GetPixel(30, 120));
    2058           1 :     CPPUNIT_ASSERT_EQUAL(aColor.GetColor(), RGB_COLORDATA( 0xb1, 0xc8, 0xdd ));
    2059           1 :     aColor = pAccess->GetPixel(130, 260);
    2060           1 :     CPPUNIT_ASSERT_EQUAL(aColor.GetColor(), RGB_COLORDATA( 0xb1, 0xc8, 0xdd ));
    2061           2 :     Bitmap::ReleaseAccess(pAccess);
    2062           1 : }
    2063             : 
    2064          12 : DECLARE_OOXMLIMPORT_TEST(testFdo69656, "Table_cell_auto_width_fdo69656.docx")
    2065             : {
    2066           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    2067           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    2068           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(8154), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
    2069           1 : }
    2070             : 
    2071          12 : DECLARE_OOXMLIMPORT_TEST(testFloatingTablesAnchor, "floating-tables-anchor.docx")
    2072             : {
    2073             :     // Problem was one of the two text frames was anchored to the other text frame
    2074             :     // Both frames should be anchored to the paragraph with the text "Anchor point"
    2075           1 :     uno::Reference<text::XTextContent> xTextContent(getShape(1), uno::UNO_QUERY);
    2076           2 :     uno::Reference<text::XTextRange> xRange(xTextContent->getAnchor(), uno::UNO_QUERY);
    2077           2 :     uno::Reference<text::XText> xText(xRange->getText(), uno::UNO_QUERY);
    2078           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString());
    2079             : 
    2080           1 :     xTextContent.set(getShape(2), uno::UNO_QUERY);
    2081           1 :     xRange.set(xTextContent->getAnchor(), uno::UNO_QUERY);
    2082           1 :     xText.set(xRange->getText(), uno::UNO_QUERY);
    2083           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString());
    2084           1 : }
    2085             : 
    2086          12 : DECLARE_OOXMLIMPORT_TEST(testAnnotationFormatting, "annotation-formatting.docx")
    2087             : {
    2088           1 :     uno::Reference<beans::XPropertySet> xTextField = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(2), 2), "TextField");
    2089           2 :     uno::Reference<text::XText> xText = getProperty< uno::Reference<text::XText> >(xTextField, "TextRange");
    2090             :     // Make sure we test the right annotation.
    2091           2 :     uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText, "days");
    2092             :     // Formatting was lost: the second text portion was NONE, not SINGLE.
    2093           2 :     CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::SINGLE, getProperty<sal_Int16>(getRun(xParagraph, 1), "CharUnderline"));
    2094           1 : }
    2095             : 
    2096          12 : DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeRunFonts, "dml-groupshape-runfonts.docx")
    2097             : {
    2098             :     // Fonts defined by w:rFonts was not imported and so the font specified by a:fontRef was used.
    2099           1 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
    2100           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(1), uno::UNO_QUERY)->getText();
    2101           2 :     uno::Reference<text::XTextRange> xRun = getRun(getParagraphOfText(1, xText),1);
    2102           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty<OUString>(xRun, "CharFontName"));
    2103           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Arial Unicode MS"), getProperty<OUString>(xRun, "CharFontNameComplex"));
    2104           2 :     CPPUNIT_ASSERT_EQUAL(OUString("MS Mincho"), getProperty<OUString>(xRun, "CharFontNameAsian"));
    2105           1 : }
    2106             : 
    2107          12 : DECLARE_OOXMLIMPORT_TEST(testStrict, "strict.docx")
    2108             : {
    2109           1 :     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
    2110             :     // This was only 127, pt suffix was ignored, so this got parsed as twips instead of points.
    2111           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(72 * 20)), getProperty<sal_Int32>(xPageStyle, "BottomMargin"));
    2112             :     // This was only 1397, same issue
    2113           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(792 * 20)), getProperty<sal_Int32>(xPageStyle, "Height"));
    2114             :     // Text was missing, due to not handling the strict namespaces.
    2115           1 :     getParagraph(1, "Hello world!");
    2116             : 
    2117             :     // Header in the document caused a crash on import.
    2118           2 :     uno::Reference<text::XText> xHeaderText(xPageStyle->getPropertyValue("HeaderText"), uno::UNO_QUERY);
    2119           1 :     getParagraphOfText(1, xHeaderText, "This is a header.");
    2120             : 
    2121             :     // Picture was missing.
    2122           2 :     uno::Reference<lang::XServiceInfo> xServiceInfo(getShape(1), uno::UNO_QUERY);
    2123           1 :     CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextGraphicObject"));
    2124             : 
    2125             :     // SmartArt was missing.
    2126           1 :     xServiceInfo.set(getShape(2), uno::UNO_QUERY);
    2127           1 :     CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"));
    2128             : 
    2129             :     // Chart was missing.
    2130           1 :     xServiceInfo.set(getShape(3), uno::UNO_QUERY);
    2131           1 :     CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextEmbeddedObject"));
    2132             : 
    2133             :     // Math was missing.
    2134           1 :     xServiceInfo.set(getShape(4), uno::UNO_QUERY);
    2135           2 :     CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextEmbeddedObject"));
    2136           1 : }
    2137             : 
    2138          12 : DECLARE_OOXMLIMPORT_TEST(testStrictLockedcanvas, "strict-lockedcanvas.docx")
    2139             : {
    2140             :     // locked canvas shape was missing.
    2141           1 :     getShape(1);
    2142           1 : }
    2143             : 
    2144          12 : DECLARE_OOXMLIMPORT_TEST(testSmartartStrict, "strict-smartart.docx")
    2145             : {
    2146           1 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
    2147             :     // This was 0, SmartArt was visually missing.
    2148           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xGroup->getCount()); // 3 ellipses + 3 arrows
    2149           1 : }
    2150             : 
    2151          12 : DECLARE_OOXMLIMPORT_TEST(testLibreOfficeHang, "frame-wrap-auto.docx")
    2152             : {
    2153             :     // fdo#72775
    2154             :     // This was text::WrapTextMode_NONE.
    2155           1 :     CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_DYNAMIC, getProperty<text::WrapTextMode>(getShape(1), "Surround"));
    2156           1 : }
    2157             : 
    2158          12 : DECLARE_OOXMLIMPORT_TEST(testI124106, "i124106.docx")
    2159             : {
    2160             :     // This was 2.
    2161           1 :     CPPUNIT_ASSERT_EQUAL(1, getPages());
    2162           1 : }
    2163             : 
    2164          12 : DECLARE_OOXMLIMPORT_TEST(testLargeTwips, "large-twips.docx" )
    2165             : {
    2166             :     // cp#1000043: MSO seems to ignore large twips values, we didn't, which resulted in different
    2167             :     // layout of broken documents (text not visible in this specific document).
    2168           1 :     OUString width = parseDump( "/root/page/body/tab/row[1]/cell[1]/txt/infos/bounds", "width" );
    2169           1 :     CPPUNIT_ASSERT( width.toInt32() > 0 );
    2170           1 : }
    2171             : 
    2172          12 : DECLARE_OOXMLIMPORT_TEST(testNegativeCellMarginTwips, "negative-cell-margin-twips.docx" )
    2173             : {
    2174             :     // Sligtly related to cp#1000043, the twips value was negative, which wrapped around somewhere,
    2175             :     // while MSO seems to ignore that as well.
    2176           1 :     OUString width = parseDump( "/root/page/body/tab/row[1]/cell[1]/txt/infos/bounds", "width" );
    2177           1 :     CPPUNIT_ASSERT( width.toInt32() > 0 );
    2178           1 : }
    2179             : 
    2180          12 : DECLARE_OOXMLIMPORT_TEST(testFdo38414, "fdo38414.docx" )
    2181             : {
    2182             :     // The cells in the last (4th) column were merged properly and so the result didn't have the same height.
    2183             :     // (Since w:gridBefore is worked around by faking another cell in the row, so column count is thus 5
    2184             :     // instead of 4, therefore compare height of cells 4 and 5 rather than 3 and 4.)
    2185           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    2186           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    2187           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    2188           2 :     uno::Reference<table::XTableColumns> xTableColumns(xTextTable->getColumns(), uno::UNO_QUERY);
    2189           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 5 ), xTableColumns->getCount());
    2190           2 :     OUString height3 = parseDump("/root/page/body/tab/row[1]/cell[4]/infos/bounds", "height" );
    2191           2 :     OUString height4 = parseDump("/root/page/body/tab/row[1]/cell[5]/infos/bounds", "height" );
    2192           2 :     CPPUNIT_ASSERT_EQUAL( height3, height4 );
    2193           1 : }
    2194             : 
    2195          12 : DECLARE_OOXMLIMPORT_TEST(test_extra_image, "test_extra_image.docx" )
    2196             : {
    2197             :     // fdo#74652 Check there is no shape added to the doc during import
    2198           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    2199           2 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    2200           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xDraws->getCount());
    2201           1 : }
    2202             : 
    2203          12 : DECLARE_OOXMLIMPORT_TEST(testFdo74401, "fdo74401.docx")
    2204             : {
    2205           1 :     uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY);
    2206           2 :     uno::Reference<drawing::XShapeDescriptor> xShape(xGroupShape->getByIndex(1), uno::UNO_QUERY);
    2207             :     // The triangle (second child) was a TextShape before, so it was shown as a rectangle.
    2208           2 :     CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.CustomShape"), xShape->getShapeType());
    2209           1 : }
    2210             : 
    2211          12 : DECLARE_OOXMLIMPORT_TEST(testFdo75722vml, "fdo75722-vml.docx")
    2212             : {
    2213           1 :     uno::Reference<drawing::XShape> xShape = getShape(1);
    2214           1 :     awt::Point aPos = xShape->getPosition();
    2215           1 :     awt::Size aSize = xShape->getSize();
    2216           1 :     sal_Int64 nRot = getProperty<sal_Int64>(xShape, "RotateAngle");
    2217             : 
    2218           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3720), aPos.X);
    2219           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-392), aPos.Y);
    2220           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(5457), aSize.Width);
    2221           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3447), aSize.Height);
    2222           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int64(3100), nRot);
    2223           1 : }
    2224             : 
    2225          12 : DECLARE_OOXMLIMPORT_TEST(testFdo75722dml, "fdo75722-dml.docx")
    2226             : {
    2227           1 :     uno::Reference<drawing::XShape> xShape = getShape(1);
    2228           1 :     awt::Point aPos = xShape->getPosition();
    2229           1 :     awt::Size aSize = xShape->getSize();
    2230           1 :     sal_Int64 nRot = getProperty<sal_Int64>(xShape, "RotateAngle");
    2231             : 
    2232             :     // a slight difference regarding vml file is tolerated due to rounding errors
    2233           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3720), aPos.X);
    2234           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-397), aPos.Y);
    2235           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(5457), aSize.Width);
    2236           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3447), aSize.Height);
    2237           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int64(3128), nRot);
    2238           1 : }
    2239             : 
    2240          12 : DECLARE_OOXMLIMPORT_TEST(testFdo55381, "fdo55381.docx")
    2241             : {
    2242           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
    2243           2 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
    2244           2 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
    2245           1 :     xCursor->jumpToLastPage();
    2246           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(4), xCursor->getPage());
    2247           1 : }
    2248             : 
    2249          12 : DECLARE_OOXMLIMPORT_TEST(testGridBefore, "gridbefore.docx")
    2250             : {
    2251             :     // w:gridBefore is faked by inserting two cells without border (because Writer can't do non-rectangular tables).
    2252             :     // So check the first cell in the first row is in fact 3rd and that it's more to the right than the second
    2253             :     // cell on the second row.
    2254           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    2255           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    2256           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    2257           2 :     uno::Reference<table::XTableColumns> xTableColumns(xTextTable->getColumns(), uno::UNO_QUERY);
    2258           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 3 ), xTableColumns->getCount());
    2259           2 :     OUString textA3 = parseDump("/root/page/body/tab/row[1]/cell[3]/txt/text()" );
    2260           2 :     OUString leftA3 = parseDump("/root/page/body/tab/row[1]/cell[3]/infos/bounds", "left" );
    2261           2 :     OUString leftB2 = parseDump("/root/page/body/tab/row[2]/cell[2]/infos/bounds", "left" );
    2262           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "A3" ), textA3 );
    2263           2 :     CPPUNIT_ASSERT( leftA3.toInt32() > leftB2.toInt32());
    2264           1 : }
    2265             : 
    2266          12 : DECLARE_OOXMLIMPORT_TEST(testMsoBrightnessContrast, "msobrightnesscontrast.docx")
    2267             : {
    2268           1 :     uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
    2269           2 :     uno::Reference<drawing::XShape> image(getShape(1), uno::UNO_QUERY);
    2270           2 :     uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
    2271           2 :     uno::Reference<graphic::XGraphic> graphic;
    2272           1 :     imageProperties->getPropertyValue( "Graphic" ) >>= graphic;
    2273           2 :     uno::Reference<awt::XBitmap> bitmap(graphic, uno::UNO_QUERY);
    2274           2 :     Graphic aVclGraphic(graphic);
    2275           2 :     Bitmap aBitmap(aVclGraphic.GetBitmap());
    2276           1 :     BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess();
    2277           1 :     CPPUNIT_ASSERT(pAccess);
    2278           1 :     CPPUNIT_ASSERT_EQUAL(58L, pAccess->Width());
    2279           1 :     CPPUNIT_ASSERT_EQUAL(320L, pAccess->Height());
    2280           1 :     Color aColor(pAccess->GetPixel(30, 20));
    2281           1 :     CPPUNIT_ASSERT_EQUAL(aColor.GetColor(), RGB_COLORDATA( 0xce, 0xce, 0xce ));
    2282           2 :     Bitmap::ReleaseAccess(pAccess);
    2283           1 : }
    2284             : 
    2285          12 : DECLARE_OOXMLIMPORT_TEST(testChartSize, "chart-size.docx")
    2286             : {
    2287             :     // When chart was in a TextFrame, its size was too large.
    2288           1 :     uno::Reference<text::XTextEmbeddedObjectsSupplier> xTextEmbeddedObjectsSupplier(mxComponent, uno::UNO_QUERY);
    2289           2 :     uno::Reference<container::XIndexAccess> xEmbeddedObjects(xTextEmbeddedObjectsSupplier->getEmbeddedObjects(), uno::UNO_QUERY);
    2290             :     // This was 10954.
    2291           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(6008), getProperty<sal_Int32>(xEmbeddedObjects->getByIndex(0), "Width"));
    2292             : 
    2293             :     // Layout modified the document when it had this chart.
    2294           2 :     uno::Reference<util::XModifiable> xModifiable(mxComponent, uno::UNO_QUERY);
    2295           2 :     CPPUNIT_ASSERT_EQUAL(false, bool(xModifiable->isModified()));
    2296           1 : }
    2297             : 
    2298          12 : DECLARE_OOXMLIMPORT_TEST(testInlineGroupshape, "inline-groupshape.docx")
    2299             : {
    2300             :     // Inline groupshape was in the background, so it was hidden sometimes by other shapes.
    2301           1 :     CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getShape(1), "Opaque"));
    2302           1 : }
    2303             : 
    2304          12 : DECLARE_OOXMLIMPORT_TEST(testFdo78883, "fdo78883.docx")
    2305             : {
    2306             :     // fdo#78883 : LO was getting hang while opening document
    2307             :     // Checking there is a single page after loading a doc in LO.
    2308           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
    2309           2 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
    2310           2 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
    2311           1 :     xCursor->jumpToLastPage();
    2312             : 
    2313             :     // Check to make sure the document loaded.  Note that the page number may
    2314             :     // be 1 or 2 depending on the environment.
    2315           2 :     CPPUNIT_ASSERT(xCursor->getPage() > sal_Int16(0));
    2316           1 : }
    2317             : 
    2318          12 : DECLARE_OOXMLIMPORT_TEST(testFdo79535, "fdo79535.docx")
    2319             : {
    2320             :     // fdo#79535 : LO was crashing while opening document
    2321             :     // Checking there is a single page after loading a doc successfully in LO.
    2322           1 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
    2323           2 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
    2324           2 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
    2325           1 :     xCursor->jumpToLastPage();
    2326           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
    2327           1 : }
    2328             : 
    2329          12 : DECLARE_OOXMLIMPORT_TEST(testBnc875718, "bnc875718.docx")
    2330             : {
    2331             :     // The frame in the footer must not accidentally end up in the document body.
    2332             :     // The easiest way for this to test I've found is checking that
    2333             :     // xray ThisComponent.TextFrames.GetByIndex( index ).Anchor.Text.ImplementationName
    2334             :     // is not SwXBodyText but rather SwXHeadFootText
    2335           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
    2336           2 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
    2337           6 :     for( int i = 0;
    2338           3 :          i < xIndexAccess->getCount();
    2339             :          ++i )
    2340             :     {
    2341           2 :         uno::Reference<text::XTextFrame> frame(xIndexAccess->getByIndex( i ), uno::UNO_QUERY);
    2342           4 :         uno::Reference<text::XTextRange> range(frame->getAnchor(), uno::UNO_QUERY);
    2343           4 :         uno::Reference<lang::XServiceInfo> text(range->getText(), uno::UNO_QUERY);
    2344           2 :         CPPUNIT_ASSERT_EQUAL( OUString( "SwXHeadFootText" ), text->getImplementationName());
    2345           2 :     }
    2346             :     // Also check that the footer contents are not in the body text.
    2347           2 :     uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
    2348           2 :     uno::Reference<text::XText> text(textDocument->getText(), uno::UNO_QUERY);
    2349           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "Text" ), text->getString());
    2350           1 : }
    2351             : 
    2352          12 : DECLARE_OOXMLIMPORT_TEST(testCaption, "caption.docx")
    2353             : {
    2354           1 :     uno::Reference<beans::XPropertySet> xStyle(getStyles("ParagraphStyles")->getByName("Caption"), uno::UNO_QUERY);
    2355             :     // This was awt::FontSlant_ITALIC: Writer default was used instead of what is in the document.
    2356           1 :     CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, getProperty<awt::FontSlant>(xStyle, "CharPosture"));
    2357           1 : }
    2358             : 
    2359          12 : DECLARE_OOXMLIMPORT_TEST(testGroupshapeTrackedchanges, "groupshape-trackedchanges.docx")
    2360             : {
    2361           1 :     uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY);
    2362           2 :     uno::Reference<text::XTextRange> xShape(xGroup->getByIndex(0), uno::UNO_QUERY);
    2363             :     // Shape text was completely missing, ensure inserted text is available.
    2364           2 :     CPPUNIT_ASSERT_EQUAL(OUString(" Inserted"), xShape->getString());
    2365           1 : }
    2366             : 
    2367          12 : DECLARE_OOXMLIMPORT_TEST(testFdo78939, "fdo78939.docx")
    2368             : {
    2369             :     // fdo#78939 : LO hanged while opening issue document
    2370             : 
    2371             :     // Whenever a para-style was applied to a Numbering format level,
    2372             :     // LO incorrectly also changed the para-style..
    2373             : 
    2374             :     // check that file opens and does not hang while opening and also
    2375             :     // check that an incorrect numbering style is not applied ...
    2376           1 :     CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(1), "NumberingStyleName"));
    2377           1 : }
    2378             : 
    2379          12 : DECLARE_OOXMLIMPORT_TEST(testFootnote, "footnote.docx")
    2380             : {
    2381           1 :     uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
    2382           2 :     uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
    2383           2 :     uno::Reference<text::XTextRange> xFootnote(xFootnotes->getByIndex(0), uno::UNO_QUERY);
    2384           2 :     OUString aFootnote = xFootnote->getString();
    2385             :     // Ensure there are no additional newlines after "bar".
    2386           2 :     CPPUNIT_ASSERT(aFootnote.endsWith("bar"));
    2387           1 : }
    2388             : 
    2389          12 : DECLARE_OOXMLIMPORT_TEST(testTableBtlrCenter, "table-btlr-center.docx")
    2390             : {
    2391           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    2392           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    2393           2 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    2394             :     // Cell vertical alignment was NONE, should be CENTER.
    2395           2 :     CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(xTable->getCellByName("A2"), "VertOrient"));
    2396           1 : }
    2397             : 
    2398          12 : DECLARE_OOXMLIMPORT_TEST(testFdo80555, "fdo80555.docx")
    2399             : {
    2400           1 :     uno::Reference<drawing::XShape> xShape = getShape(1);
    2401             :     // Shape was wrongly placed at X=0, Y=0
    2402           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3318), xShape->getPosition().X);
    2403           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(247), xShape->getPosition().Y);
    2404           1 : }
    2405             : 
    2406          12 : DECLARE_OOXMLIMPORT_TEST(testFdo76803, "fdo76803.docx")
    2407             : {
    2408             :     // The ContourPolyPolygon was wrong
    2409           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
    2410             : 
    2411           2 :     drawing::PointSequenceSequence rContour = getProperty<drawing::PointSequenceSequence>(xPropertySet, "ContourPolyPolygon");
    2412           2 :     basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(rContour));
    2413             : 
    2414             :     // We've got exactly one polygon inside
    2415           1 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(1), aPolyPolygon.count());
    2416             : 
    2417             :     // Now check it deeply
    2418           2 :     basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0));
    2419             : 
    2420           1 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(4), aPolygon.count());
    2421             : 
    2422           1 :     CPPUNIT_ASSERT_EQUAL(double(-163), aPolygon.getB2DPoint(0).getX());
    2423           1 :     CPPUNIT_ASSERT_EQUAL(double(0), aPolygon.getB2DPoint(0).getY());
    2424             : 
    2425           1 :     CPPUNIT_ASSERT_EQUAL(double(-163), aPolygon.getB2DPoint(1).getX());
    2426           1 :     CPPUNIT_ASSERT_EQUAL(double(3661), aPolygon.getB2DPoint(1).getY());
    2427             : 
    2428           1 :     CPPUNIT_ASSERT_EQUAL(double(16988), aPolygon.getB2DPoint(2).getX());
    2429           1 :     CPPUNIT_ASSERT_EQUAL(double(3661), aPolygon.getB2DPoint(2).getY());
    2430             : 
    2431           1 :     CPPUNIT_ASSERT_EQUAL(double(16988), aPolygon.getB2DPoint(3).getX());
    2432           2 :     CPPUNIT_ASSERT_EQUAL(double(0), aPolygon.getB2DPoint(3).getY());
    2433           1 : }
    2434             : 
    2435          12 : DECLARE_OOXMLIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.docx")
    2436             : {
    2437           1 :     uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
    2438           2 :     uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
    2439             :     // This was false, last section was balanced, but it's unbalanced in Word.
    2440           2 :     CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(2), "DontBalanceTextColumns"));
    2441           1 : }
    2442             : 
    2443          12 : DECLARE_OOXMLIMPORT_TEST(testUnbalancedColumnsCompat, "unbalanced-columns-compat.docx")
    2444             : {
    2445           1 :     uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
    2446           2 :     uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
    2447             :     // This was false, we ignored the relevant compat setting to make this non-last section unbalanced.
    2448           2 :     CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns"));
    2449           1 : }
    2450             : 
    2451          12 : DECLARE_OOXMLIMPORT_TEST(testFloatingTableSectionColumns, "floating-table-section-columns.docx")
    2452             : {
    2453           1 :     OUString tableWidth = parseDump("/root/page[1]/body/section/column[2]/body/txt/anchored/fly/tab/infos/bounds", "width");
    2454             :     // table width was restricted by a column
    2455           1 :     CPPUNIT_ASSERT( tableWidth.toInt32() > 10000 );
    2456           1 : }
    2457             : 
    2458          12 : DECLARE_OOXMLIMPORT_TEST(testHidemark, "hidemark.docx")
    2459             : {
    2460             :     // Problem was that <w:hideMark> cell property was ignored.
    2461           1 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    2462           2 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
    2463           2 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    2464           2 :     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
    2465             :     // Height should be minimal
    2466           1 :     CPPUNIT_ASSERT_EQUAL(convertTwipToMm100(MINLAY), getProperty<sal_Int64>(xTableRows->getByIndex(1), "Height"));
    2467             :     // Size type was MIN, should be FIX to avoid considering the end of paragraph marker.
    2468           2 :     CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty<sal_Int16>(xTableRows->getByIndex(1), "SizeType"));
    2469           1 : }
    2470             : 
    2471          12 : DECLARE_OOXMLIMPORT_TEST(testBnc519228OddBreaks, "bnc519228_odd-breaks.docx")
    2472             : {
    2473             :     // Check that all the normal styles are not set as right-only, those should be only those used after odd page breaks.
    2474           1 :     uno::Reference<beans::XPropertySet> defaultStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
    2475           1 :     CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_ALL), defaultStyle->getPropertyValue("PageStyleLayout"));
    2476           2 :     uno::Reference<beans::XPropertySet> firstPage( getStyles("PageStyles")->getByName("First Page"), uno::UNO_QUERY );
    2477           1 :     CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_ALL), firstPage->getPropertyValue("PageStyleLayout"));
    2478             : 
    2479           2 :     OUString page1StyleName = getProperty<OUString>( getParagraph( 1, "This is the first page." ), "PageDescName");
    2480           2 :     uno::Reference<beans::XPropertySet> page1Style(getStyles("PageStyles")->getByName(page1StyleName), uno::UNO_QUERY);
    2481           1 :     CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_RIGHT), page1Style->getPropertyValue("PageStyleLayout"));
    2482           1 :     getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page1Style, "HeaderText"), "This is the header for odd pages");
    2483             : 
    2484             :     // Page2 comes from follow of style for page 1 and should be a normal page. Also check the two page style have the same properties,
    2485             :     // since page style for page1 was created from page style for page 2.
    2486             :     uno::Any page2StyleAny = uno::Reference<beans::XPropertySet>(
    2487             :         getParagraph(3, "This is page 2, which is obviously an even page."),
    2488           2 :         uno::UNO_QUERY_THROW)->getPropertyValue("PageDescName");
    2489           1 :     CPPUNIT_ASSERT_EQUAL(uno::Any(), page2StyleAny);
    2490           2 :     OUString page2StyleName = getProperty<OUString>( page1Style, "FollowStyle" );
    2491           2 :     uno::Reference<beans::XPropertySet> page2Style(getStyles("PageStyles")->getByName(page2StyleName), uno::UNO_QUERY);
    2492           1 :     CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_ALL), page2Style->getPropertyValue("PageStyleLayout"));
    2493           1 :     getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page2Style, "HeaderTextLeft"), "This is the even header");
    2494           1 :     getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page2Style, "HeaderTextRight"), "This is the header for odd pages");
    2495           1 :     CPPUNIT_ASSERT_EQUAL(getProperty<sal_Int32>(page1Style, "TopMargin"), getProperty<sal_Int32>(page2Style, "TopMargin"));
    2496             : 
    2497           2 :     OUString page5StyleName = getProperty<OUString>( getParagraph( 5, "Then an odd break after an odd page, should lead us to page #5." ), "PageDescName");
    2498           2 :     uno::Reference<beans::XPropertySet> page5Style(getStyles("PageStyles")->getByName(page5StyleName), uno::UNO_QUERY);
    2499           1 :     CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_RIGHT), page5Style->getPropertyValue("PageStyleLayout"));
    2500           2 :     getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page5Style, "HeaderText"), "This is the header for odd pages");
    2501           1 : }
    2502             : 
    2503          12 : DECLARE_OOXMLIMPORT_TEST(testBnc891663, "bnc891663.docx")
    2504             : {
    2505             :     // The image should be inside a cell, so the text in the following cell should be below it.
    2506           1 :     int imageTop = parseDump("/root/page/body/tab/row[1]/cell[2]/txt[1]/anchored/fly/infos/bounds", "top").toInt32();
    2507           1 :     int imageHeight = parseDump("/root/page/body/tab/row[1]/cell[2]/txt[1]/anchored/fly/infos/bounds", "height").toInt32();
    2508           1 :     int textNextRowTop = parseDump("/root/page/body/tab/row[2]/cell[1]/txt[1]/infos/bounds", "top").toInt32();
    2509           1 :     CPPUNIT_ASSERT( textNextRowTop >= imageTop + imageHeight );
    2510           1 : }
    2511             : 
    2512           5 : static OString dateTimeToString( const util::DateTime& dt )
    2513             : {
    2514           5 :     return DateTimeToOString( DateTime( Date( dt.Day, dt.Month, dt.Year ), tools::Time( dt.Hours, dt.Minutes, dt.Seconds )));
    2515             : }
    2516             : 
    2517          12 : DECLARE_OOXMLIMPORT_TEST(testTcwRounding, "tcw-rounding.docx")
    2518             : {
    2519             :     // Width of the A1 cell in twips was 3200, due to a rounding error.
    2520           1 :     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3201),  parseDump("/root/page/body/tab/row/cell[1]/infos/bounds", "width").toInt32());
    2521           1 : }
    2522             : 
    2523          12 : DECLARE_OOXMLIMPORT_TEST(testBnc821804, "bnc821804.docx")
    2524             : {
    2525           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "TITLE" ), getRun( getParagraph( 1 ), 1 )->getString());
    2526           1 :     CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(1), 1), "RedlineType"));
    2527             :     // Redline information (SwXRedlinePortion) are separate "runs" apparently.
    2528           1 :     CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(1), 2), "RedlineType"));
    2529           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(1), 2), "RedlineType"));
    2530           1 :     CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(1), 2), "IsStart"));
    2531           1 :     CPPUNIT_ASSERT_EQUAL(OUString("unknown1"),getProperty<OUString>(getRun(getParagraph(1), 2), "RedlineAuthor"));
    2532           1 :     CPPUNIT_ASSERT_EQUAL(OString("2006-08-29T09:46:00Z"),dateTimeToString(getProperty<util::DateTime>(getRun(getParagraph(1), 2), "RedlineDateTime")));
    2533             :     // So only the 3rd run is actual text (and the two runs have been merged into one, not sure why, but that shouldn't be a problem).
    2534           1 :     CPPUNIT_ASSERT_EQUAL(OUString(" (1st run of an insert) (2nd run of an insert)"), getRun(getParagraph(1),3)->getString());
    2535           1 :     CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(1), 3), "RedlineType"));
    2536             :     // And the end SwXRedlinePortion of the redline.
    2537           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(1), 4), "RedlineType"));
    2538           1 :     CPPUNIT_ASSERT_EQUAL(OUString("unknown1"),getProperty<OUString>(getRun(getParagraph(1), 4), "RedlineAuthor"));
    2539           1 :     CPPUNIT_ASSERT_EQUAL(OString("2006-08-29T09:46:00Z"),dateTimeToString(getProperty<util::DateTime>(getRun(getParagraph(1), 4), "RedlineDateTime")));
    2540           1 :     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(1), 4), "IsStart"));
    2541             : 
    2542           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Normal text"), getRun(getParagraph(2),1)->getString());
    2543           1 :     CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(2), 1), "RedlineType"));
    2544             : 
    2545           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty<OUString>(getRun(getParagraph(3), 1), "RedlineType"));
    2546           1 :     CPPUNIT_ASSERT_EQUAL(OUString("unknown2"),getProperty<OUString>(getRun(getParagraph(3), 1), "RedlineAuthor"));
    2547           1 :     CPPUNIT_ASSERT_EQUAL(OString("2006-08-29T09:47:00Z"),dateTimeToString(getProperty<util::DateTime>(getRun(getParagraph(3), 1), "RedlineDateTime")));
    2548           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Deleted"), getRun(getParagraph(3),2)->getString());
    2549             : 
    2550             :     // This is both inserted and formatted, so there are two SwXRedlinePortion "runs". Given that the redlines overlap and Writer core
    2551             :     // doesn't officially expect that (even though it copes, the redline info will be split depending on how Writer deal with it).
    2552           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(4), 1), "RedlineType"));
    2553           1 :     CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(4), 1), "IsStart"));
    2554           1 :     CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty<OUString>(getRun(getParagraph(4), 2), "RedlineType"));
    2555           1 :     CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(4), 2), "IsStart"));
    2556           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Inserted and formatted"), getRun(getParagraph(4),3)->getString());
    2557           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(4), 4), "RedlineType"));
    2558           1 :     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(4), 4), "IsStart"));
    2559           1 :     CPPUNIT_ASSERT_EQUAL(OUString(" and this is only formatted"), getRun(getParagraph(4),5)->getString());
    2560           1 :     CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty<OUString>(getRun(getParagraph(4), 6), "RedlineType"));
    2561           1 :     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(4), 6), "IsStart"));
    2562             : 
    2563           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Normal text"), getRun(getParagraph(5),1)->getString());
    2564           1 :     CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(5), 1), "RedlineType"));
    2565             : 
    2566           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Format"),getProperty<OUString>(getRun(getParagraph(6), 1), "RedlineType"));
    2567           1 :     CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(6), 1), "IsStart"));
    2568           1 :     CPPUNIT_ASSERT_EQUAL(OUString("unknown5"),getProperty<OUString>(getRun(getParagraph(6), 1), "RedlineAuthor"));
    2569           1 :     CPPUNIT_ASSERT_EQUAL(OString("2006-08-29T10:02:00Z"),dateTimeToString(getProperty<util::DateTime>(getRun(getParagraph(6), 1), "RedlineDateTime")));
    2570           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Formatted run"), getRun(getParagraph(6),2)->getString());
    2571           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Format"),getProperty<OUString>(getRun(getParagraph(6), 3), "RedlineType"));
    2572           1 :     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(6), 3), "IsStart"));
    2573           1 :     CPPUNIT_ASSERT_EQUAL(OUString(" and normal text here "), getRun(getParagraph(6),4)->getString());
    2574           1 :     CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(6), 4), "RedlineType"));
    2575           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(6), 5), "RedlineType"));
    2576           1 :     CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(6), 5), "IsStart"));
    2577           1 :     CPPUNIT_ASSERT_EQUAL(OUString("unknown6"),getProperty<OUString>(getRun(getParagraph(6), 5), "RedlineAuthor"));
    2578           1 :     CPPUNIT_ASSERT_EQUAL(OString("2006-08-29T09:48:00Z"),dateTimeToString(getProperty<util::DateTime>(getRun(getParagraph(6), 5), "RedlineDateTime")));
    2579           1 :     CPPUNIT_ASSERT_EQUAL(OUString("and inserted again"), getRun(getParagraph(6),6)->getString());
    2580           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(6), 7), "RedlineType"));
    2581           1 :     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(6), 7), "IsStart"));
    2582           1 :     CPPUNIT_ASSERT_EQUAL(OUString(" and normal text again "), getRun(getParagraph(6),8)->getString());
    2583           1 :     CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(6), 8), "RedlineType"));
    2584           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Format"),getProperty<OUString>(getRun(getParagraph(6), 9), "RedlineType"));
    2585           1 :     CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(6), 9), "IsStart"));
    2586           1 :     CPPUNIT_ASSERT_EQUAL(OUString("unknown7"),getProperty<OUString>(getRun(getParagraph(6), 9), "RedlineAuthor"));
    2587           1 :     CPPUNIT_ASSERT_EQUAL(OUString("and formatted"), getRun(getParagraph(6),10)->getString());
    2588           1 :     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(6), 11), "IsStart"));
    2589           1 :     CPPUNIT_ASSERT_EQUAL(OUString(" and normal."), getRun(getParagraph(6),12)->getString());
    2590           1 :     CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(6), 12), "RedlineType"));
    2591             : 
    2592           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(7), 1), "RedlineType"));
    2593           1 :     CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(7), 1), "IsStart"));
    2594           1 :     CPPUNIT_ASSERT_EQUAL(OUString("unknown8"),getProperty<OUString>(getRun(getParagraph(7), 1), "RedlineAuthor"));
    2595           1 :     CPPUNIT_ASSERT_EQUAL(OUString("One insert."), getRun(getParagraph(7),2)->getString());
    2596           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(7), 3), "RedlineType"));
    2597           1 :     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(7), 3), "IsStart"));
    2598           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(7), 4), "RedlineType"));
    2599           1 :     CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(7), 4), "IsStart"));
    2600           1 :     CPPUNIT_ASSERT_EQUAL(OUString("unknown9"),getProperty<OUString>(getRun(getParagraph(7), 4), "RedlineAuthor"));
    2601           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Second insert."), getRun(getParagraph(7),5)->getString());
    2602           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(7), 6), "RedlineType"));
    2603           1 :     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(7), 6), "IsStart"));
    2604             : 
    2605             :     // Overlapping again.
    2606           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty<OUString>(getRun(getParagraph(8), 1), "RedlineType"));
    2607           1 :     CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(8), 1), "IsStart"));
    2608           1 :     CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty<OUString>(getRun(getParagraph(8), 2), "RedlineType"));
    2609           1 :     CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(8), 2), "IsStart"));
    2610           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Deleted and formatted"), getRun(getParagraph(8),3)->getString());
    2611           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty<OUString>(getRun(getParagraph(8), 4), "RedlineType"));
    2612           1 :     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(8), 4), "IsStart"));
    2613           1 :     CPPUNIT_ASSERT_EQUAL(OUString(" and this is only formatted"), getRun(getParagraph(8),5)->getString());
    2614           1 :     CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty<OUString>(getRun(getParagraph(8), 6), "RedlineType"));
    2615           1 :     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(8), 6), "IsStart"));
    2616             : 
    2617           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Normal text"), getRun(getParagraph(9),1)->getString());
    2618           1 :     CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(9), 1), "RedlineType"));
    2619             : 
    2620           1 :     CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty<OUString>(getRun(getParagraph(10), 1), "RedlineType"));
    2621           1 :     CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(10), 1), "IsStart"));
    2622           1 :     CPPUNIT_ASSERT_EQUAL(OUString("This is only formatted."), getRun(getParagraph(10),2)->getString());
    2623           1 :     CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty<OUString>(getRun(getParagraph(10), 3), "RedlineType"));
    2624           1 :     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(10), 3), "IsStart"));
    2625           1 : }
    2626             : 
    2627          12 : DECLARE_OOXMLIMPORT_TEST(testFdo85542, "fdo85542.docx")
    2628             : {
    2629           1 :     uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
    2630           2 :     uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
    2631           1 :     CPPUNIT_ASSERT_EQUAL(xBookmarksByIdx->getCount(), static_cast<sal_Int32>(3));
    2632           2 :     uno::Reference<container::XNameAccess> xBookmarksByName(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
    2633           1 :     CPPUNIT_ASSERT(xBookmarksByName->hasByName("B1"));
    2634           1 :     CPPUNIT_ASSERT(xBookmarksByName->hasByName("B2"));
    2635           1 :     CPPUNIT_ASSERT(xBookmarksByName->hasByName("B3"));
    2636             :     // B1
    2637           2 :     uno::Reference<text::XTextContent> xContent1(xBookmarksByName->getByName("B1"), uno::UNO_QUERY);
    2638           2 :     uno::Reference<text::XTextRange> xRange1(xContent1->getAnchor(), uno::UNO_QUERY);
    2639           1 :     CPPUNIT_ASSERT_EQUAL(xRange1->getString(), OUString("ABB"));
    2640             :     // B2
    2641           2 :     uno::Reference<text::XTextContent> xContent2(xBookmarksByName->getByName("B2"), uno::UNO_QUERY);
    2642           2 :     uno::Reference<text::XTextRange> xRange2(xContent2->getAnchor(), uno::UNO_QUERY);
    2643           1 :     CPPUNIT_ASSERT_EQUAL(xRange2->getString(), OUString("BBC"));
    2644             :     // B3 -- testing a collapsed bookmark
    2645           2 :     uno::Reference<text::XTextContent> xContent3(xBookmarksByName->getByName("B3"), uno::UNO_QUERY);
    2646           2 :     uno::Reference<text::XTextRange> xRange3(xContent3->getAnchor(), uno::UNO_QUERY);
    2647           1 :     CPPUNIT_ASSERT_EQUAL(xRange3->getString(), OUString(""));
    2648           2 :     uno::Reference<text::XText> xText(xRange3->getText( ), uno::UNO_QUERY);
    2649           2 :     uno::Reference<text::XTextCursor> xNeighborhoodCursor(xText->createTextCursor( ), uno::UNO_QUERY);
    2650           1 :     xNeighborhoodCursor->gotoRange(xRange3, false);
    2651           1 :     xNeighborhoodCursor->goLeft(1, false);
    2652           1 :     xNeighborhoodCursor->goRight(2, true);
    2653           2 :     uno::Reference<text::XTextRange> xTextNeighborhood(xNeighborhoodCursor, uno::UNO_QUERY);
    2654           2 :     CPPUNIT_ASSERT_EQUAL(xTextNeighborhood->getString(), OUString("AB"));
    2655           1 : }
    2656             : 
    2657          12 : DECLARE_OOXMLIMPORT_TEST(testChtOutlineNumberingOoxml, "chtoutline.docx")
    2658             : {
    2659           1 :     const sal_Unicode aExpectedPrefix[2] = { 0x7b2c, 0x0020 };
    2660           1 :     const sal_Unicode aExpectedSuffix[2] = { 0x0020, 0x7ae0 };
    2661           1 :     uno::Reference< text::XChapterNumberingSupplier > xChapterNumberingSupplier(mxComponent, uno::UNO_QUERY);
    2662           2 :     uno::Reference< container::XIndexAccess> xLevels(xChapterNumberingSupplier->getChapterNumberingRules());
    2663           2 :     uno::Sequence<beans::PropertyValue> aProps;
    2664           1 :     xLevels->getByIndex(0) >>= aProps; // 1st level
    2665             : 
    2666           2 :     OUString aSuffix,aPrefix;
    2667          14 :     for (int i = 0; i < aProps.getLength(); ++i)
    2668             :     {
    2669          13 :         const beans::PropertyValue& rProp = aProps[i];
    2670             : 
    2671          13 :         if (rProp.Name == "Suffix")
    2672           1 :             aSuffix = rProp.Value.get<OUString>();
    2673          13 :         if (rProp.Name == "Prefix")
    2674           1 :             aPrefix = rProp.Value.get<OUString>();
    2675             :     }
    2676           1 :     CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix,SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix);
    2677           2 :     CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix,SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix);
    2678           1 : }
    2679             : 
    2680          12 : DECLARE_OOXMLIMPORT_TEST(testFdo87488, "fdo87488.docx")
    2681             : {
    2682             :     // The shape on the right (index 0, CustomShape within a
    2683             :     // GroupShape) is rotated 90 degrees clockwise and contains text
    2684             :     // rotated 90 degrees anticlockwise.  Must be read with SmartArt
    2685             :     // enabled in preTest above, otherwise it gets converted to a
    2686             :     // StarView MetaFile.
    2687           1 :     uno::Reference<container::XIndexAccess> group(getShape(1), uno::UNO_QUERY);
    2688             :     {
    2689           1 :         uno::Reference<text::XTextRange> text(group->getByIndex(0), uno::UNO_QUERY);
    2690           1 :         CPPUNIT_ASSERT_EQUAL(OUString("text2"), text->getString());
    2691             :     }
    2692             :     {
    2693           1 :         uno::Reference<beans::XPropertySet> props(group->getByIndex(0), uno::UNO_QUERY);
    2694           2 :         CPPUNIT_ASSERT_EQUAL(props->getPropertyValue("RotateAngle"),
    2695           1 :                              uno::makeAny<sal_Int32>(270 * 100));
    2696           2 :         comphelper::SequenceAsHashMap geom(props->getPropertyValue("CustomShapeGeometry"));
    2697           2 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(90), geom["TextPreRotateAngle"].get<sal_Int32>());
    2698           1 :     }
    2699           1 : }
    2700             : 
    2701          12 : DECLARE_OOXMLIMPORT_TEST(mathtype, "mathtype.docx")
    2702             : {
    2703           1 :     uno::Reference<text::XTextEmbeddedObjectsSupplier> xTextEmbeddedObjectsSupplier(mxComponent, uno::UNO_QUERY);
    2704           2 :     uno::Reference<container::XIndexAccess> xEmbeddedObjects(xTextEmbeddedObjectsSupplier->getEmbeddedObjects(), uno::UNO_QUERY);
    2705             :     // This failed as the Model property was empty.
    2706           2 :     auto xModel = getProperty< uno::Reference<lang::XServiceInfo> >(xEmbeddedObjects->getByIndex(0), "Model");
    2707           2 :     CPPUNIT_ASSERT(xModel->supportsService("com.sun.star.formula.FormulaProperties"));
    2708           1 : }
    2709             : 
    2710          12 : DECLARE_OOXMLIMPORT_TEST(testTdf8255, "tdf8255.docx")
    2711             : {
    2712           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
    2713           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xTextDocument, uno::UNO_QUERY);
    2714           2 :     uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
    2715             :     // This was 1: a full-page-wide multi-page floating table was imported as a TextFrame.
    2716           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount());
    2717           1 : }
    2718             : 
    2719             : #endif
    2720             : 
    2721           4 : CPPUNIT_PLUGIN_IMPLEMENT();
    2722             : 
    2723             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11