Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/sw/qa/extras/odfexport/   (Office von Apache Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 99 kB image not shown  

Quelle  odfexport3.cxx   Sprache: C

 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */


#include <tools/color.hxx>
#include <memory>
#include <swmodeltestbase.hxx>

#include <com/sun/star/awt/FontSlant.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/table/XCellRange.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/text/XTextDocument.hpp>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/text/XTextTable.hpp>

#include <comphelper/sequenceashashmap.hxx>
#include <vcl/filter/PDFiumLibrary.hxx>

#include <sortedobjs.hxx>
#include <flyfrm.hxx>
#include <IDocumentLayoutAccess.hxx>
#include <rootfrm.hxx>

namespace
{
class Test : public SwModelTestBase
{
public:
    Test()
        : SwModelTestBase(u"/sw/qa/extras/odfexport/data/"_ustr, u"writer8"_ustr)
    {
    }
};

DECLARE_ODFEXPORT_TEST(testTdf111891_frameVertStyle, "tdf111891_frameVertStyle.odt")
{
    CPPUNIT_ASSERT_EQUAL(1, getShapes());
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(
        drawing::TextVerticalAdjust_BOTTOM,
        getProperty<drawing::TextVerticalAdjust>(xFrame, u"TextVerticalAdjust"_ustr));
}

DECLARE_ODFEXPORT_TEST(testShapeRelsize, "shape-relsize.odt")
{
    CPPUNIT_ASSERT_EQUAL(1, getShapes());
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    uno::Reference<drawing::XShape> xShape = getShape(1);
    // These were all 0, as style:rel-width/height was ignored on import for shapes.
    CPPUNIT_ASSERT_EQUAL(sal_Int16(40), getProperty<sal_Int16>(xShape, u"RelativeWidth"_ustr));
    CPPUNIT_ASSERT_EQUAL(sal_Int16(20), getProperty<sal_Int16>(xShape, u"RelativeHeight"_ustr));

    // Relation was "page" for both width and height, should be "paragraph" for width.
    CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME,
                         getProperty<sal_Int16>(xShape, u"RelativeWidthRelation"_ustr));
    // And make sure that height stays "page".
    CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME,
                         getProperty<sal_Int16>(xShape, u"RelativeHeightRelation"_ustr));
}

CPPUNIT_TEST_FIXTURE(Test, testTextboxRoundedCorners)
{
    auto verify = [this]() {
        CPPUNIT_ASSERT_EQUAL(1, getShapes());
        CPPUNIT_ASSERT_EQUAL(1, getPages());
        uno::Reference<drawing::XShape> xShape = getShape(1);
        comphelper::SequenceAsHashMap aCustomShapeGeometry(
            getProperty<uno::Sequence<beans::PropertyValue>>(xShape, u"CustomShapeGeometry"_ustr));

        // Test that the shape is a rounded rectangle.
        CPPUNIT_ASSERT_EQUAL(u"round-rectangle"_ustr,
                             aCustomShapeGeometry[u"Type"_ustr].get<OUString>());

        // The shape text should start with a table, with "a" in its A1 cell.
        uno::Reference<text::XText> xText
            = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY_THROW)->getText();
        uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1, xText), uno::UNO_QUERY);
        uno::Reference<text::XTextRange> xCell(xTable->getCellByName(u"A1"_ustr), uno::UNO_QUERY);
        CPPUNIT_ASSERT_EQUAL(u"a"_ustr, xCell->getString());
    };

    createSwDoc("textbox-rounded-corners.odt");
    verify();
    saveAndReload(mpFilter);
    verify();

    // Table inside a textbox should be in the extension namespace.
    xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr);
    // This failed, as draw:custom-shape had a table:table child.
    assertXPath(pXmlDoc, "//draw:custom-shape/loext:table", "name", u"Table1");
}

// test that import whitespace collapsing is compatible with old docs
DECLARE_ODFEXPORT_TEST(testWhitespace, "whitespace.odt")
{
    CPPUNIT_ASSERT_EQUAL(4, getShapes());
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    uno::Reference<container::XEnumerationAccess> xPara;
    uno::Reference<container::XEnumeration> xPortions;
    uno::Reference<text::XTextRange> xPortion;
    xPara.set(getParagraphOrTable(1), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(2), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" "_ustr, xPortion->getString());
    CPPUNIT_ASSERT_EQUAL(u"http://example.com/"_ustr,
                         getProperty<OUString>(xPortion, u"HyperLinkURL"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(3), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Ruby"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(OUString(), xPortion->getString());
    CPPUNIT_ASSERT_EQUAL(u"foo"_ustr, getProperty<OUString>(xPortion, u"RubyText"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Ruby"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(OUString(), xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(4), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"InContentMetadata"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    {
        // what a stupid idea to require recursively enumerating this
        uno::Reference<container::XEnumerationAccess> xMeta(
            getProperty<uno::Reference<text::XTextContent>>(xPortion, u"InContentMetadata"_ustr),
            uno::UNO_QUERY);
        uno::Reference<container::XEnumeration> xMetaPortions = xMeta->createEnumeration();
        uno::Reference<text::XTextRange> xMP(xMetaPortions->nextElement(), uno::UNO_QUERY);
        CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xMP, u"TextPortionType"_ustr));
        CPPUNIT_ASSERT_EQUAL(u" "_ustr, xMP->getString());
        CPPUNIT_ASSERT(!xMetaPortions->hasMoreElements());
    }
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(5), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"TextField"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    {
        // what a stupid idea to require recursively enumerating this
        uno::Reference<container::XEnumerationAccess> xMeta(
            getProperty<uno::Reference<text::XTextContent>>(xPortion, u"TextField"_ustr),
            uno::UNO_QUERY);
        uno::Reference<container::XEnumeration> xMetaPortions = xMeta->createEnumeration();
        uno::Reference<text::XTextRange> xMP(xMetaPortions->nextElement(), uno::UNO_QUERY);
        CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xMP, u"TextPortionType"_ustr));
        CPPUNIT_ASSERT_EQUAL(u" "_ustr, xMP->getString());
        CPPUNIT_ASSERT(!xMetaPortions->hasMoreElements());
    }
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(7), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Frame"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(8), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Frame"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(9), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Frame"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(10), uno::UNO_QUERY);
    uno::Reference<container::XContentEnumerationAccess> xCEA(xPara, uno::UNO_QUERY);
    uno::Reference<container::XEnumeration> xFrames(
        xCEA->createContentEnumeration(u"com.sun.star.text.TextContent"_ustr));
    xFrames->nextElement(); // one at-paragraph frame
    CPPUNIT_ASSERT(!xFrames->hasMoreElements());
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(11), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Footnote"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(12), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"TextField"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(13), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Annotation"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"AnnotationEnd"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(15), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Bookmark"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(16), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Bookmark"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(!getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Bookmark"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(!getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(17), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Redline"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(!getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Redline"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(!getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(18), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Redline"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(!getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Redline"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(!getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(19), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"ReferenceMark"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(20), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"ReferenceMark"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(!getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"ReferenceMark"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(!getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(21), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"DocumentIndexMark"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());

    xPara.set(getParagraphOrTable(22), uno::UNO_QUERY);
    xPortions.set(xPara->createEnumeration());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"X "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"DocumentIndexMark"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(!getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" "_ustr, xPortion->getString());
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"DocumentIndexMark"_ustr,
                         getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT(!getProperty<bool>(xPortion, u"IsCollapsed"_ustr));
    xPortion.set(xPortions->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, getProperty<OUString>(xPortion, u"TextPortionType"_ustr));
    CPPUNIT_ASSERT_EQUAL(u" X"_ustr, xPortion->getString());
    CPPUNIT_ASSERT(!xPortions->hasMoreElements());
}

DECLARE_ODFEXPORT_TEST(testTdf136645, "tdf136645.odt")
{
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    xmlDocUniquePtr pXmlDoc = parseLayoutDump();

    // Without the fix in place, this would have failed with
    //- Expected: 2640
    //- Actual  : 3000
    CPPUNIT_ASSERT_EQUAL(
        sal_Int32(2640),
        getXPath(pXmlDoc, "/root/page/body/section/column[1]/body/infos/bounds""width")
            .toInt32());

    //- Expected: 6000
    //- Actual  : 6360
    CPPUNIT_ASSERT_EQUAL(
        sal_Int32(6000),
        getXPath(pXmlDoc, "/root/page/body/section/column[2]/body/infos/bounds""width")
            .toInt32());
}

DECLARE_ODFEXPORT_TEST(testBtlrCell, "btlr-cell.odt")
{
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    // Without the accompanying fix in place, this test would have failed, as
    // the btlr text direction in the A1 cell was lost on ODF import and
    // export.
    uno::Reference<text::XTextTablesSupplier> xSupplier(mxComponent, uno::UNO_QUERY);
    uno::Reference<container::XNameAccess> xTables = xSupplier->getTextTables();
    uno::Reference<text::XTextTable> xTable(xTables->getByName(u"Table1"_ustr), uno::UNO_QUERY);
    uno::Reference<beans::XPropertySet> xA1(xTable->getCellByName(u"A1"_ustr), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR,
                         getProperty<sal_Int16>(xA1, u"WritingMode"_ustr));

    uno::Reference<beans::XPropertySet> xB1(xTable->getCellByName(u"B1"_ustr), uno::UNO_QUERY);
    auto nActual = getProperty<sal_Int16>(xB1, u"WritingMode"_ustr);
    CPPUNIT_ASSERT(nActual == text::WritingMode2::LR_TB || nActual == text::WritingMode2::CONTEXT);

    uno::Reference<beans::XPropertySet> xC1(xTable->getCellByName(u"C1"_ustr), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL,
                         getProperty<sal_Int16>(xC1, u"WritingMode"_ustr));
}

CPPUNIT_TEST_FIXTURE(Test, testBtlrFrame)
{
    auto verify = [this](bool bIsExport = false) {
        CPPUNIT_ASSERT_EQUAL(1, getShapes());
        CPPUNIT_ASSERT_EQUAL(1, getPages());
        // Without the accompanying fix in place, this test would have failed, as
        // the btlr text direction in the text frame was lost on ODF import and
        // export.
        uno::Reference<beans::XPropertySet> xTextFrame(getShape(1), uno::UNO_QUERY);
        CPPUNIT_ASSERT(xTextFrame.is());

        auto nActual = getProperty<sal_Int16>(xTextFrame, u"WritingMode"_ustr);
        CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, nActual);

        // Without the accompanying fix in place, this test would have failed, as the fly frame had
        // mbVertical==true, but mbVertLRBT==false, even if the writing direction in the doc model was
        // btlr.
        SwDoc* pDoc = getSwDoc();

        SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
        CPPUNIT_ASSERT(pLayout);

        SwFrame* pPageFrame = pLayout->GetLower();
        CPPUNIT_ASSERT(pPageFrame);
        CPPUNIT_ASSERT(pPageFrame->IsPageFrame());

        SwFrame* pBodyFrame = pPageFrame->GetLower();
        CPPUNIT_ASSERT(pBodyFrame);
        CPPUNIT_ASSERT(pBodyFrame->IsBodyFrame());

        SwFrame* pBodyTextFrame = pBodyFrame->GetLower();
        CPPUNIT_ASSERT(pBodyTextFrame);
        CPPUNIT_ASSERT(pBodyTextFrame->IsTextFrame());

        CPPUNIT_ASSERT(pBodyTextFrame->GetDrawObjs());
        const SwSortedObjs& rAnchored = *pBodyTextFrame->GetDrawObjs();
        CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rAnchored.size());

        auto* pFlyFrame = dynamic_cast<SwFlyFrame*>(rAnchored[0]);
        CPPUNIT_ASSERT(pFlyFrame);
        CPPUNIT_ASSERT(pFlyFrame->IsVertLRBT());

        if (!bIsExport)
            // Not yet exported, don't modify the doc model for test purposes.
            return;

        // Make sure that btlr -> tbrl transition clears the "BT" flag.
        xTextFrame->setPropertyValue(u"WritingMode"_ustr, uno::Any(text::WritingMode2::TB_LR));
        pFlyFrame = dynamic_cast<SwFlyFrame*>(rAnchored[0]);
        CPPUNIT_ASSERT(pFlyFrame);
        CPPUNIT_ASSERT(!pFlyFrame->IsVertLRBT());
    };

    createSwDoc("btlr-frame.odt");
    verify();
    saveAndReload(mpFilter);
    verify(/*bIsExport*/ true);
}

CPPUNIT_TEST_FIXTURE(Test, testTdf129520)
{
    loadAndReload("tdf129520.docx");
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    CPPUNIT_ASSERT_EQUAL(u"M"_ustr, getParagraph(1)->getString());

    // Without this fix in place, this test would have failed with
    // - Expected: Ma
    // - Actual  :
    CPPUNIT_ASSERT_EQUAL(u"Ma"_ustr, getParagraph(2)->getString());
    CPPUNIT_ASSERT_EQUAL(u"1815"_ustr, getParagraph(3)->getString());
}

DECLARE_ODFEXPORT_TEST(testFdo86963, "fdo86963.odt")
{
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    // Export of this document failed with beans::UnknownPropertyException.
    CPPUNIT_ASSERT_EQUAL(1, getShapes());
}

DECLARE_ODFEXPORT_TEST(testTdf135338_firstLeftPageFooter, "tdf135338_firstLeftPageFooter.odt")
{
    CPPUNIT_ASSERT_EQUAL(6, getPages());
    // The first page is a left page only style, but it should still show the first page footer
    // instead of the left footer text "EVEN/LEFT (Left page only)"
    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
    assertXPathContent(pXmlDoc, "/root/page[2]/footer/txt/text()", u"First (Left page only)");
}

DECLARE_ODFEXPORT_TEST(testGerrit13858, "gerrit13858.odt")
{
    CPPUNIT_ASSERT_EQUAL(1, getShapes());
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    // Just make sure the output is valid.
}
DECLARE_ODFEXPORT_TEST(testOdtBorderTypes, "border_types.odt")
{
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    static const sal_Int32 lineStyles[] = { 0, 1, 2, 14, 16, 17, 3, 15 };
    uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
    uno::Reference<container::XEnumerationAccess> xParaEnumAccess(textDocument->getText(),
                                                                  uno::UNO_QUERY);
    // list of paragraphs
    uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
    do
    {
        uno::Reference<lang::XServiceInfo> xServiceInfo;
        if (xParaEnum->nextElement() >>= xServiceInfo)
        {
            if (xServiceInfo->supportsService(u"com.sun.star.text.TextTable"_ustr))
            {
                uno::Reference<table::XCellRange> const xCellRange(xServiceInfo,
                                                                   uno::UNO_QUERY_THROW);

                for (sal_Int32 row = 0; row < 15; row += 2)
                {
                    uno::Reference<table::XCell> xCell = xCellRange->getCellByPosition(1, row);
                    uno::Reference<beans::XPropertySet> xPropSet(xCell, uno::UNO_QUERY_THROW);

                    uno::Any aTopBorder = xPropSet->getPropertyValue(u"TopBorder"_ustr);
                    table::BorderLine2 aTopBorderLine;
                    if (aTopBorder >>= aTopBorderLine)
                    {
                        sal_Int32 lineStyle = aTopBorderLine.LineStyle;
                        CPPUNIT_ASSERT_EQUAL(lineStyles[row / 2], lineStyle);
                    }
                } //end of the 'for' loop
            }
        }
    } while (xParaEnum->hasMoreElements());
}

DECLARE_ODFEXPORT_TEST(testMasterPageWithDrawingPage, "sw_hatch.odt")
{
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    uno::Reference<container::XNameAccess> xStyles(getStyles(u"PageStyles"_ustr));
    uno::Reference<beans::XPropertySet> xStyle(xStyles->getByName(u"Standard"_ustr),
                                               uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH,
                         getProperty<drawing::FillStyle>(xStyle, u"FillStyle"_ustr));
    CPPUNIT_ASSERT_EQUAL(u"Blue -45 Degrees"_ustr,
                         getProperty<OUString>(xStyle, u"FillHatchName"_ustr));
    CPPUNIT_ASSERT(!getProperty<sal_Bool>(xStyle, u"FillBackground"_ustr));
    CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xStyle, u"FillTransparence"_ustr));
}

CPPUNIT_TEST_FIXTURE(Test, testPageStyleBackgroundFullSizeOOo)
{
    loadAndReload("pagestyle_background_ooo33.odt");
    CPPUNIT_ASSERT_EQUAL(3, getPages());
    xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr);
    // Standard
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"border");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"solid");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-color", u"#99ccff");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "opacity", u"100%");
    // Endnote
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"border");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "repeat", u"repeat");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-image-ref-point", u"top-left");
    // Footnote
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"border");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "repeat", u"stretch");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-image-ref-point", u"top-left");
}

CPPUNIT_TEST_FIXTURE(Test, testPageStyleBackgroundFullSizeLO64)
{
    loadAndReload("pagestyle_background_lo64.odt");
    CPPUNIT_ASSERT_EQUAL(6, getPages());
    xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr);
    // Standard
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"full");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"solid");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-color", u"#99ccff");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "opacity", u"100%");
    // Endnote
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"full");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "repeat", u"repeat");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-image-ref-point", u"top-left");
    // Footnote
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"border");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "repeat", u"stretch");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-image-ref-point", u"top-left");
    // Landscape
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Landscape']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"border");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Landscape']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Landscape']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "repeat", u"no-repeat");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Landscape']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-image-ref-point", u"top-left");
    // Index
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Index']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"full");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Index']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"gradient");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Index']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "gradient-step-count", u"0");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Index']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "opacity", u"100%");
    // First Page
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"full");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"hatch");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-hatch-solid", u"false");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "opacity", u"100%");
}

CPPUNIT_TEST_FIXTURE(Test, testPageStyleBackgroundFullSizeLO70)
{
    loadAndReload("pagestyle_background_lo70.odt");
    CPPUNIT_ASSERT_EQUAL(6, getPages());
    xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr);
    // Standard
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"full");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"solid");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-color", u"#99ccff");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Standard']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "opacity", u"100%");
    // Endnote
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"full");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "repeat", u"repeat");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Endnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-image-ref-point", u"top-left");
    // Footnote
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"border");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "repeat", u"stretch");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Footnote']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-image-ref-point", u"top-left");
    // Landscape
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Landscape']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"border");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Landscape']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Landscape']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "repeat", u"no-repeat");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Landscape']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-image-ref-point", u"top-left");
    // Index
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Index']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"full");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Index']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"gradient");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Index']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "gradient-step-count", u"0");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='Index']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "opacity", u"100%");
    // First Page
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "background-size", u"full");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill", u"hatch");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "fill-hatch-solid", u"false");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:style[@style:family='drawing-page' and @style:name = "
                "/office:document-styles/office:master-styles/"
                "style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
                "]/style:drawing-page-properties",
                "opacity", u"100%");
}

CPPUNIT_TEST_FIXTURE(Test, testFillBitmapUnused)
{
    loadAndReload("fillbitmap3.odt");
    CPPUNIT_ASSERT_EQUAL(4, getShapes());
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    // nav_5f_home and all its references are completely gone
    xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr);

    // paragraph style
    assertXPath(pXmlDoc,
                "/office:document-styles/office:styles/style:style[@style:name='Text_20_body']/"
                "loext:graphic-properties",
                "fill", u"solid");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:styles/style:style[@style:name='Text_20_body']/"
                "loext:graphic-properties",
                "fill-color", u"#c0c0c0");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:styles/style:style[@style:name='Text_20_body']/"
                "loext:graphic-properties[@draw:fill-image-name]",
                0);

    // page style page-layout
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm1']/style:page-layout-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm1']/style:page-layout-properties",
                "fill-image-name", u"nav_5f_up");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm1']/style:header-style/"
                "style:header-footer-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm1']/style:header-style/"
                "style:header-footer-properties",
                "fill-image-name", u"nav_5f_up");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm1']/style:footer-style/"
                "style:header-footer-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm1']/style:footer-style/"
                "style:header-footer-properties",
                "fill-image-name", u"nav_5f_up");

    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm2']/style:page-layout-properties",
                "fill", u"solid");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm2']/"
                "style:page-layout-properties[@draw:fill-image-name]",
                0);
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm2']/style:header-style/"
                "style:header-footer-properties",
                "fill", u"solid");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm2']/style:header-style/"
                "style:header-footer-properties[@draw:fill-image-name]",
                0);
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm2']/style:footer-style/"
                "style:header-footer-properties",
                "fill", u"solid");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/"
                "style:page-layout[@style:name='Mpm2']/style:footer-style/"
                "style:header-footer-properties[@draw:fill-image-name]",
                0);

    // page style drawing-page
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/style:style[@style:name='Mdp1']/"
                "style:drawing-page-properties",
                "fill", u"bitmap");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/style:style[@style:name='Mdp1']/"
                "style:drawing-page-properties",
                "fill-image-name", u"nav_5f_up");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/style:style[@style:name='Mdp2']/"
                "style:drawing-page-properties",
                "fill", u"solid");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/style:style[@style:name='Mdp2']/"
                "style:drawing-page-properties",
                "fill-color", u"#c0c0c0");
    assertXPath(pXmlDoc,
                "/office:document-styles/office:automatic-styles/style:style[@style:name='Mdp2']/"
                "style:drawing-page-properties[@draw:fill-image-name]",
                0);

    // the named items
    assertXPath(pXmlDoc, "/office:document-styles/office:styles/draw:fill-image", 1);
    assertXPath(pXmlDoc, "/office:document-styles/office:styles/draw:fill-image""name",
                u"nav_5f_up");
}

DECLARE_ODFEXPORT_TEST(testCellUserDefineAttr, "userdefattr-tablecell.odt")
{
    CPPUNIT_ASSERT_EQUAL(1, getPages());
    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
    uno::Reference<table::XCell> const xCellA1(xTable->getCellByName(u"A1"_ustr),
                                               uno::UNO_SET_THROW);
    uno::Reference<table::XCell> const xCellB1(xTable->getCellByName(u"B1"_ustr),
                                               uno::UNO_SET_THROW);
    uno::Reference<table::XCell> const xCellC1(xTable->getCellByName(u"C1"_ustr),
                                               uno::UNO_SET_THROW);
    getUserDefineAttribute(uno::Any(xCellA1), u"proName"_ustr, u"v1"_ustr);
    getUserDefineAttribute(uno::Any(xCellB1), u"proName"_ustr, u"v2"_ustr);
    getUserDefineAttribute(uno::Any(xCellC1), u"proName"_ustr, u"v3"_ustr);
}

CPPUNIT_TEST_FIXTURE(Test, testEmbeddedPdf)
{
    auto pPdfium = vcl::pdf::PDFiumLibrary::get();
    if (!pPdfium)
    {
        return;
    }

    auto verify = [this]() {
--> --------------------

--> maximum size reached

--> --------------------

Messung V0.5
C=96 H=96 G=95

¤ Dauer der Verarbeitung: 0.20 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.