summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-07-29 09:08:00 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-07-29 09:16:52 +0200
commit89d615360e80a13fff6bc69885e5780d8fedf149 (patch)
treea93343dc81f421de68cc61f5df8b685f9887ac51
parentc00760b1379023d8b45f54c0282051fcc7a240dd (diff)
tdf#89954 sw: let annotation have CH_TXTATR_INWORD placeholder again
Regression from commit 0761f81643a6890457e9ef7d913ab5c88c2593a4 (123792: complete annotations on text ranges feature, 2013-12-19), the problem was that while sw wanted CH_TXTATR_INWORD as a placeholder character for anchor positions that do not count as a word boundary, the commit changed GetCharOfTextAttr() so that annotations have CH_TXTATR_BREAKWORD as the placeholder. Fix the problem by reverting the last hunk of sw/source/core/txtnode/thints.cxx changes in that commit. Change-Id: Ia8c97efda9c1e90ae3c27ddb8247e3f3203a63fb
-rw-r--r--sw/qa/extras/uiwriter/data/tdf89954.odtbin0 -> 10022 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx22
-rw-r--r--sw/source/core/txtnode/thints.cxx2
3 files changed, 23 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf89954.odt b/sw/qa/extras/uiwriter/data/tdf89954.odt
new file mode 100644
index 000000000000..538d9780a2e6
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf89954.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index ebac88b905d1..8c06b0d22068 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -68,6 +68,7 @@
#include "com/sun/star/text/TextMarkupType.hpp"
#include <osl/file.hxx>
#include <comphelper/propertysequence.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/";
@@ -136,6 +137,7 @@ public:
void testTextTableCellNames();
void testShapeAnchorUndo();
void testDde();
+ void testTdf89954();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -197,6 +199,7 @@ public:
CPPUNIT_TEST(testTextTableCellNames);
CPPUNIT_TEST(testShapeAnchorUndo);
CPPUNIT_TEST(testDde);
+ CPPUNIT_TEST(testTdf89954);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2041,6 +2044,25 @@ void SwUiWriterTest::testDde()
CPPUNIT_ASSERT(xField->getString().endsWith("asdf"));
}
+void SwUiWriterTest::testTdf89954()
+{
+ SwDoc* pDoc = createDoc("tdf89954.odt");
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ pWrtShell->EndPara();
+ SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 't', 0);
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'e', 0);
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 's', 0);
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 't', 0);
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, '.', 0);
+
+ SwNodeIndex aNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1);
+ // Placeholder character for the comment anchor was ^A (CH_TXTATR_BREAKWORD), not <fff9> (CH_TXTATR_INWORD).
+ // As a result, autocorrect did not turn the 't' input into 'T'.
+ OUString aExpected("Tes\xef\xbf\xb9t. Test.", 14, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_EQUAL(aExpected, aNodeIndex.GetNode().GetTextNode()->GetText());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 2b8c0f5a1040..59205c288e8c 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -3446,6 +3446,7 @@ sal_Unicode GetCharOfTextAttr( const SwTextAttr& rAttr )
{
case RES_TXTATR_REFMARK:
case RES_TXTATR_TOXMARK:
+ case RES_TXTATR_ANNOTATION:
cRet = CH_TXTATR_INWORD;
break;
@@ -3454,7 +3455,6 @@ sal_Unicode GetCharOfTextAttr( const SwTextAttr& rAttr )
case RES_TXTATR_FTN:
case RES_TXTATR_META:
case RES_TXTATR_METAFIELD:
- case RES_TXTATR_ANNOTATION:
{
cRet = CH_TXTATR_BREAKWORD;
}