[Libreoffice-commits] core.git: sw/qa sw/source
Szymon Kłos
szymon.klos at collabora.com
Wed Nov 29 06:38:49 UTC 2017
sw/qa/extras/ooxmlexport/data/tdf65955_2.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 13 +++++++++++++
sw/source/filter/ww8/docxexport.cxx | 4 +---
3 files changed, 14 insertions(+), 3 deletions(-)
New commits:
commit 76f28863e7974da5a7280b3efa8a157c114ca03c
Author: Szymon Kłos <szymon.klos at collabora.com>
Date: Tue Nov 28 18:57:52 2017 +0100
tdf#65955 Bookmarks on two paragraphs
Change-Id: I61fe660ee4fc5d3f6fc86c29e07369811eb38935
Reviewed-on: https://gerrit.libreoffice.org/45434
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf65955_2.odt b/sw/qa/extras/ooxmlexport/data/tdf65955_2.odt
new file mode 100755
index 000000000000..5ad9146dc2b3
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf65955_2.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 199aac5398a4..24e57e21c369 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -759,6 +759,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf65955, "tdf65955.odt")
CPPUNIT_ASSERT_EQUAL(OUString("r"), xRange2->getString());
}
+DECLARE_OOXMLEXPORT_TEST(testTdf65955_2, "tdf65955_2.odt")
+{
+ uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(xBookmarksByIdx->getCount(), static_cast<sal_Int32>(1));
+ uno::Reference<container::XNameAccess> xBookmarksByName(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xBookmarksByName->hasByName("test"));
+
+ uno::Reference<text::XTextContent> xContent3(xBookmarksByName->getByName("test"), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xRange3(xContent3->getAnchor(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(xRange3->getString(), OUString("foo bar"));
+}
+
DECLARE_OOXMLEXPORT_TEST(testChtOutlineNumberingOoxml, "chtoutline.docx")
{
const sal_Unicode aExpectedPrefix[2] = { 0x7b2c, 0x0020 };
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 03a225fd9792..2a76ae0cfc40 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -167,12 +167,10 @@ void DocxExport::AppendBookmarks( const SwTextNode& rNode, sal_Int32 nAktPos, sa
}
}
- SwWW8AttrIter aAttrIter( *this, rNode );
- const sal_Int32 nNextAttr = GetNextPos( &aAttrIter, rNode, nAktPos );
const OUString& aStr( rNode.GetText() );
const sal_Int32 nEnd = aStr.getLength();
- if ( nNextAttr == nEnd && nAktPos == nEnd )
+ if ( nAktPos == nEnd )
m_pAttrOutput->WriteFinalBookmarks_Impl( aStarts, aEnds );
else
m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds );
More information about the Libreoffice-commits
mailing list