Kaydet (Commit) d18308cf authored tarafından Michael Stahl's avatar Michael Stahl

fdo#79358: ODF export: fix index boolean property export

Due to inverted conditional, only the default values were exported, not
the non-default ones...

(regression from 8a81f542)

Change-Id: I0b1fc828230695709db49e1643801842d947403c
üst 2292f002
...@@ -11,9 +11,11 @@ ...@@ -11,9 +11,11 @@
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
#include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/awt/Gradient.hpp>
#include <com/sun/star/container/XIndexReplace.hpp>
#include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/table/ShadowFormat.hpp>
#include <com/sun/star/text/RelOrientation.hpp> #include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/XDocumentIndex.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
class Test : public SwModelTestBase class Test : public SwModelTestBase
...@@ -58,6 +60,26 @@ DECLARE_ODFEXPORT_TEST(testFdo38244, "fdo38244.odt") ...@@ -58,6 +60,26 @@ DECLARE_ODFEXPORT_TEST(testFdo38244, "fdo38244.odt")
CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials")); CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials"));
} }
DECLARE_ODFEXPORT_TEST(testFdo79358, "fdo79358.odt")
{
// the boolean properties of the index were not exported properly
uno::Reference<text::XDocumentIndexesSupplier> xIndexSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexes(xIndexSupplier->getDocumentIndexes(), uno::UNO_QUERY);
uno::Reference<text::XDocumentIndex> xTOCIndex(xIndexes->getByIndex(0), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xTOCProps(xTOCIndex, uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTOCProps, "CreateFromOutline"));
CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTOCProps, "CreateFromMarks"));
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTOCProps, "CreateFromLevelParagraphStyles"));
// check that the source styles are preserved too while at it
uno::Reference<container::XIndexReplace> xLevels(
getProperty< uno::Reference<container::XIndexReplace> >(xTOCProps,
"LevelParagraphStyles"));
uno::Sequence<OUString> seq(1);
seq[0] = "Heading";
CPPUNIT_ASSERT_EQUAL(uno::makeAny(seq), xLevels->getByIndex(1));
CPPUNIT_ASSERT_EQUAL(uno::makeAny(uno::Sequence<OUString>()), xLevels->getByIndex(2));
}
DECLARE_ODFEXPORT_TEST(testFirstHeaderFooter, "first-header-footer.odt") DECLARE_ODFEXPORT_TEST(testFirstHeaderFooter, "first-header-footer.odt")
{ {
// Test import and export of the header-first token. // Test import and export of the header-first token.
......
...@@ -1608,7 +1608,7 @@ void XMLSectionExport::ExportBoolean( ...@@ -1608,7 +1608,7 @@ void XMLSectionExport::ExportBoolean(
// value = value ^ bInvert // value = value ^ bInvert
// omit if value == default // omit if value == default
if ( (bTmp != bInvert) == bDefault ) if ( (bTmp != bInvert) != bDefault )
{ {
// export non-default value (since default is omitted) // export non-default value (since default is omitted)
GetExport().AddAttribute(XML_NAMESPACE_TEXT, GetExport().AddAttribute(XML_NAMESPACE_TEXT,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment