2016-10-21 13:27:42 +03:00
|
|
|
/* -*- 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 <swmodeltestbase.hxx>
|
|
|
|
|
|
|
|
#include <com/sun/star/graphic/XGraphic.hpp>
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#include <com/sun/star/text/XTextFramesSupplier.hpp>
|
|
|
|
#include <com/sun/star/text/XTextTablesSupplier.hpp>
|
|
|
|
#include <pagedesc.hxx>
|
|
|
|
|
|
|
|
class Test : public SwModelTestBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Test() : SwModelTestBase("/sw/qa/extras/ww8export/data/", "MS Word 97") {}
|
|
|
|
|
|
|
|
bool mustTestImportOf(const char* filename) const override
|
|
|
|
{
|
|
|
|
// If the testcase is stored in some other format, it's pointless to test.
|
|
|
|
return OString(filename).endsWith(".doc");
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
2016-11-02 10:13:49 +03:00
|
|
|
DECLARE_WW8EXPORT_TEST(testTdf41542_borderlessPadding, "tdf41542_borderlessPadding.odt")
|
|
|
|
{
|
|
|
|
// the page style's borderless padding should force this to 3 pages, not 1
|
|
|
|
CPPUNIT_ASSERT_EQUAL( 3, getPages() );
|
|
|
|
}
|
|
|
|
|
2016-12-30 17:30:56 +03:00
|
|
|
DECLARE_WW8EXPORT_TEST(testTdf49102_mergedCellNumbering, "tdf49102_mergedCellNumbering.doc")
|
|
|
|
{
|
|
|
|
CPPUNIT_ASSERT_EQUAL( OUString("2."), parseDump("/root/page/body/tab/row[4]/cell/txt/Special[@nType='POR_NUMBER']", "rText") );
|
|
|
|
}
|
2016-10-21 13:27:42 +03:00
|
|
|
|
|
|
|
DECLARE_WW8EXPORT_TEST(testTdf89377, "tdf89377_tableWithBreakBeforeParaStyle.doc")
|
|
|
|
{
|
|
|
|
// the paragraph style should set table's text-flow break-before-page
|
|
|
|
CPPUNIT_ASSERT_EQUAL( 2, getPages() );
|
|
|
|
}
|
|
|
|
|
tdf#104805 DOC import: fix non-0-starting LVL.xst with none-type prev level
Interesting parts of the bugdoc:
- it has a numbering definition with two levels
- first level's type is none
- second level has a numbering string: "\x01."
Usually these placeholder bytes in the numbering string start from 0x00,
but there it starts at 0x01, which means the layout has to replace it
with the numbering from the second level.
Mapping from the spec to the code:
- nLevelB is an index into rgbxchNums
- aOfsNumsXCH is rgbxchNums
- sNumString is xst
So when the rNotReallyThere added in commit
251ba90d863c2695c9f46ef922e49d72a65da9ea (INTEGRATION: CWS
soberfilterteam06 (1.44.26); FILE MERGED, 2003-05-19) wants to clear out
indexes from aOfsNumsXCH, it talks about numbering levels. The old code
assumed that nLevelB is the same as nPosValue, which is true in many
cases (when the levels are like 1, 1.1, 1.1.1), but not in this
particular case, where nLevelB is 0, but nPosValue is 1.
Change-Id: I590d9b2725a3330c26a04a526ce22d95970a974f
Reviewed-on: https://gerrit.libreoffice.org/32220
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-12-20 10:46:51 +01:00
|
|
|
DECLARE_WW8EXPORT_TEST(testTdf104805, "tdf104805.doc")
|
|
|
|
{
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WW8Num1"), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
|
|
|
|
uno::Sequence<beans::PropertyValue> aNumberingRule;
|
|
|
|
xLevels->getByIndex(1) >>= aNumberingRule; // 2nd level
|
|
|
|
for (const auto& rPair : aNumberingRule)
|
|
|
|
{
|
|
|
|
if (rPair.Name == "Prefix")
|
|
|
|
// This was "." instead of empty, so the second paragraph was
|
|
|
|
// rendered as ".1" instead of "1.".
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString(), rPair.Value.get<OUString>());
|
|
|
|
else if (rPair.Name == "Suffix")
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("."), rPair.Value.get<OUString>());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-21 13:27:42 +03:00
|
|
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|