diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-07-10 14:46:31 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-07-11 08:15:38 +0000 |
commit | c293f897191ac4057d71155ec884f3b3c6d6c1f5 (patch) | |
tree | 0ea88bee99cc71d46b87dff967c6f1eb13069ef9 | |
parent | 2dccbe0593acef135b6acd3b5dc49edcf9e24f2f (diff) |
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 8a81f542a6ca566661305c53899b7e422cbaa432)
Change-Id: I0b1fc828230695709db49e1643801842d947403c
(cherry picked from commit d18308cf3b25ee30815bcaae73d49b5f5b8e734e)
Reviewed-on: https://gerrit.libreoffice.org/10194
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit eb1ffce113e9110f87de25891f82b0a5752bd59c)
Reviewed-on: https://gerrit.libreoffice.org/10197
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Matúš Kukan <matus.kukan@collabora.com>
-rw-r--r-- | sw/qa/extras/odfexport/data/fdo79358.odt | bin | 0 -> 9356 bytes | |||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 22 | ||||
-rw-r--r-- | xmloff/source/text/XMLSectionExport.cxx | 2 |
3 files changed, 23 insertions, 1 deletions
diff --git a/sw/qa/extras/odfexport/data/fdo79358.odt b/sw/qa/extras/odfexport/data/fdo79358.odt Binary files differnew file mode 100644 index 000000000000..a1d2572a6d58 --- /dev/null +++ b/sw/qa/extras/odfexport/data/fdo79358.odt diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 128443542bdd..c0b42c08c3ac 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -11,9 +11,11 @@ #if !defined(MACOSX) && !defined(WNT) #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/table/ShadowFormat.hpp> #include <com/sun/star/text/RelOrientation.hpp> +#include <com/sun/star/text/XDocumentIndex.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp> class Test : public SwModelTestBase @@ -58,6 +60,26 @@ DECLARE_ODFEXPORT_TEST(testFdo38244, "fdo38244.odt") 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") { // Test import and export of the header-first token. diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index adff8dd46d5c..fb5ee6f9003d 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -1608,7 +1608,7 @@ void XMLSectionExport::ExportBoolean( // value = value ^ bInvert // omit if value == default - if ( (bTmp != bInvert) == bDefault ) + if ( (bTmp != bInvert) != bDefault ) { // export non-default value (since default is omitted) GetExport().AddAttribute(XML_NAMESPACE_TEXT, |