[Libreoffice-commits] core.git: Branch 'distro/vector/vector-5.4' - sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Apr 5 08:47:48 UTC 2018
sw/qa/extras/uiwriter/data/tdf116789.fodt | 27 +++++++++++++++++++++++++++
sw/qa/extras/uiwriter/uiwriter.cxx | 22 ++++++++++++++++++++++
sw/source/core/unocore/unotbl.cxx | 2 +-
3 files changed, 50 insertions(+), 1 deletion(-)
New commits:
commit d7c600b8927557999c1076fb00e497314186a1f4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Apr 4 14:46:29 2018 +0200
tdf#116789 sw: fix caching of the SwXCell UNO wrapper
Commit 9af3a0d44f5f3208c490eeacbc4a9a87af915d7c (unify with a template
class, 2015-03-28) extracted a common FindUnoInstanceHint from
FindXCellHint/FindXRowHint, but failed to still check for the UNO
wrapper in the condition, not the core object.
This resulted in handing out multiple SwXCell instances for the same
underlying SwTableBox, which means that if you had an UNO-level
selection listener and you wanted to know if your selection is in the
same XText as the XText of a bookmark, then that comparison (by ptr
value) failed in case the bookmark and the selection was in a table
cell.
Change-Id: I1d618cf150d515a9db51b1fe5d38cf262fd46af4
Reviewed-on: https://gerrit.libreoffice.org/52379
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit b9f7535e499002706f276c0275c1e6c3c7b6bdd4)
diff --git a/sw/qa/extras/uiwriter/data/tdf116789.fodt b/sw/qa/extras/uiwriter/data/tdf116789.fodt
new file mode 100644
index 000000000000..87caf309ff25
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf116789.fodt
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas
is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:
experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:body>
+ <office:text>
+ <table:table table:name="Table1">
+ <table:table-column table:number-columns-repeated="2"/>
+ <table:table-row>
+ <table:table-cell office:value-type="string">
+ <text:p><text:bookmark-start text:name="Bookmark 1"/>hello<text:bookmark-end text:name="Bookmark 1"/></text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string">
+ <text:p/>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row>
+ <table:table-cell office:value-type="string">
+ <text:p/>
+ </table:table-cell>
+ <table:table-cell office:value-type="string">
+ <text:p/>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:p text:style-name="Standard"/>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index bf0950166f6b..42fda5584ab8 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -255,6 +255,7 @@ public:
void testTdf107976();
void testTdf113790();
void testHtmlCopyImages();
+ void testTdf116789();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -394,6 +395,7 @@ public:
CPPUNIT_TEST(testTdf107976);
CPPUNIT_TEST(testTdf113790);
CPPUNIT_TEST(testHtmlCopyImages);
+ CPPUNIT_TEST(testTdf116789);
CPPUNIT_TEST_SUITE_END();
private:
@@ -5020,6 +5022,26 @@ void SwUiWriterTest::testHtmlCopyImages()
CPPUNIT_ASSERT(aImage.startsWith("file:///"));
}
+void SwUiWriterTest::testTdf116789()
+{
+ createDoc("tdf116789.fodt");
+ uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XText> xText1;
+ uno::Reference<text::XText> xText2;
+ {
+ uno::Reference<text::XTextContent> xBookmark(
+ xBookmarksSupplier->getBookmarks()->getByName("Bookmark 1"), uno::UNO_QUERY);
+ xText1 = xBookmark->getAnchor()->getText();
+ }
+ {
+ uno::Reference<text::XTextContent> xBookmark(
+ xBookmarksSupplier->getBookmarks()->getByName("Bookmark 1"), uno::UNO_QUERY);
+ xText2 = xBookmark->getAnchor()->getText();
+ }
+ // This failed, we got two different SwXCell for the same bookmark anchor text.
+ CPPUNIT_ASSERT_EQUAL(xText1, xText2);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 115e1814e1e7..17c9819dc26a 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1154,7 +1154,7 @@ void SwXCell::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
{
if(auto pFindHint = dynamic_cast<const FindUnoInstanceHint<SwTableBox, SwXCell>*>(&rHint))
{
- if(!pFindHint->m_pCore && pFindHint->m_pCore == GetTableBox())
+ if(!pFindHint->m_pResult && pFindHint->m_pCore == GetTableBox())
pFindHint->m_pResult = this;
}
else
More information about the Libreoffice-commits
mailing list