summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2017-11-28 18:57:52 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2017-11-29 07:38:19 +0100
commit76f28863e7974da5a7280b3efa8a157c114ca03c (patch)
tree473d16b935d06ca2451df0833d99b063e4094aad
parenta566fd1c1a50f9bcb4c69a19bdf4fb1955285d93 (diff)
tdf#65955 Bookmarks on two paragraphs
Change-Id: I61fe660ee4fc5d3f6fc86c29e07369811eb38935 Reviewed-on: https://gerrit.libreoffice.org/45434 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rwxr-xr-xsw/qa/extras/ooxmlexport/data/tdf65955_2.odtbin0 -> 8898 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport10.cxx13
-rw-r--r--sw/source/filter/ww8/docxexport.cxx4
3 files changed, 14 insertions, 3 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf65955_2.odt
Binary files 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 );