diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-07-29 09:08:00 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-08-11 13:29:47 +0000 |
commit | 4eb0e4ace354df4c633aebc2f525911dd50e6f06 (patch) | |
tree | 921a891b68c2108d1847a17311454c965ae6c8cf | |
parent | de44c2459b85a2a804155fb38b9b30c713789c3d (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.
(cherry picked from commit 89d615360e80a13fff6bc69885e5780d8fedf149)
Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx
Change-Id: Ia8c97efda9c1e90ae3c27ddb8247e3f3203a63fb
Reviewed-on: https://gerrit.libreoffice.org/17621
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf89954.odt | bin | 0 -> 10022 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 2 |
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 Binary files differnew file mode 100644 index 000000000000..538d9780a2e6 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf89954.odt diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index ed3122004a90..1fc636cb761d 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -51,6 +51,7 @@ #include "com/sun/star/util/SearchAlgorithms.hpp" #include "com/sun/star/i18n/TransliterationModulesExtra.hpp" #include <comphelper/propertysequence.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/"; @@ -96,6 +97,7 @@ public: void testTdf86639(); void testTdf90883TableBoxGetCoordinates(); void testDde(); + void testTdf89954(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -134,6 +136,7 @@ public: CPPUNIT_TEST(testTdf86639); CPPUNIT_TEST(testTdf90883TableBoxGetCoordinates); CPPUNIT_TEST(testDde); + CPPUNIT_TEST(testTdf89954); CPPUNIT_TEST_SUITE_END(); @@ -1022,6 +1025,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 452ae53001e9..a3a9047b56ad 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; } |