Kaydet (Commit) 89d61536 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#89954 sw: let annotation have CH_TXTATR_INWORD placeholder again

Regression from commit 0761f816 (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
üst c00760b1
......@@ -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();
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment