[Libreoffice-commits] .: 6 commits - i18npool/qa sw/inc sw/qa sw/source
Caolán McNamara
caolan at kemper.freedesktop.org
Wed Jul 18 09:27:46 PDT 2012
i18npool/qa/cppunit/test_breakiterator.cxx | 94 ++++++++++++++++++-----------
sw/inc/hintids.hxx | 2
sw/qa/core/swdoc-test.cxx | 20 ++++++
sw/source/core/crsr/crsrsh.cxx | 6 -
sw/source/core/edit/edlingu.cxx | 18 ++---
sw/source/core/txtnode/ndtxt.cxx | 2
sw/source/core/txtnode/thints.cxx | 6 -
sw/source/core/txtnode/txtedt.cxx | 10 +--
sw/source/filter/rtf/swparrtf.cxx | 2
sw/source/filter/ww8/ww8par.cxx | 8 +-
sw/source/ui/fldui/fldmgr.cxx | 9 +-
sw/source/ui/inc/wrtsh.hxx | 2
sw/source/ui/uiview/viewling.cxx | 9 +-
sw/source/ui/wrtsh/wrtsh2.cxx | 11 +++
14 files changed, 126 insertions(+), 73 deletions(-)
New commits:
commit b0f170d7df9cff12535d2ecfd146b32b745a8ef8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jul 18 17:00:52 2012 +0100
0xFFF9 is a better choice for CH_TXTATR_INWORD than 0x0002.
a) the default properties for the code point make it not split a word it
appears in into two different words in any break mode we have. Which is what we
want from a CH_TXTATR_INWORD
b) unicode TR#20 gives for the interlinear annotation anchor: "What to do if
detected: In a proxy context or browser context, remove U+FFF9", so when we
need to strip it from text to run that text through e.g. the spellchecker or
word counting then there's a solid precedent for stripping it
In addition I *do* want the footnote placeholder to break the word it appears
in, that gives the desired wordcount and cursor travelling behaviour
The BREAKWORD and other *random* selection of CH_TXTATR are still odd choices,
and there's way too many of them.
Change-Id: I930ff8ff806af448829bc1a1ae6cb92053e9a284
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index 56f117e..b72deda 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -252,7 +252,7 @@ void TestBreakIterator::testWordBoundaries()
}
}
- sal_Unicode aJoinTests[] = { 'X', 0x200C, 0x200D, 0x2060, 0xFEFF, 0xFFF9 };
+ sal_Unicode aJoinTests[] = { 'X', 0x200C, 0x200D, 0x2060, 0xFEFF, 0xFFF9, 0xFFFA, 0xFFFB };
for (int mode = i18n::WordType::ANY_WORD; mode <= i18n::WordType::WORD_COUNT; ++mode)
{
//make sure that in all cases isBeginWord and isEndWord matches getWordBoundary
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 9428072..9ea4bc4 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -35,7 +35,7 @@
// For SwTxtHints without end index the following char is added:
#define CH_TXTATR_BREAKWORD ((sal_Unicode)0x01)
-#define CH_TXTATR_INWORD ((sal_Unicode)0x02)
+#define CH_TXTATR_INWORD ((sal_Unicode)0xFFF9)
#define CH_TXTATR_TAB ((sal_Unicode)'\t')
#define CH_TXTATR_NEWLINE ((sal_Unicode)'\n')
#define CH_TXT_ATR_FIELDSTART ((sal_Unicode)0x04)
diff --git a/sw/qa/core/swdoc-test.cxx b/sw/qa/core/swdoc-test.cxx
index 49b0930..8c06e25 100644
--- a/sw/qa/core/swdoc-test.cxx
+++ b/sw/qa/core/swdoc-test.cxx
@@ -60,6 +60,7 @@
#include "swtypes.hxx"
#include "fmtftn.hxx"
#include "fmtrfmrk.hxx"
+#include "fmtfld.hxx"
SO2_DECL_REF(SwDocShell)
SO2_IMPL_REF(SwDocShell)
@@ -366,6 +367,25 @@ void SwDocTest::testSwScanner()
pTxtNode->CountWords(aDocStat, 0, pTxtNode->Len());
CPPUNIT_ASSERT(aDocStat.nWord == 1);
CPPUNIT_ASSERT_MESSAGE("refmark anchor should not be counted", aDocStat.nChar == 11);
+
+ m_pDoc->AppendTxtNode(*aPaM.GetPoint());
+ m_pDoc->InsertString(aPaM, rtl::OUString("Apple"));
+
+ DateTime aDate(DateTime::SYSTEM);
+ SwPostItField aPostIt(
+ (SwPostItFieldType*)m_pDoc->GetSysFldType(RES_POSTITFLD), rtl::OUString("An Author"),
+ rtl::OUString("Some Text"), rtl::OUString("WhatEver"), aDate );
+ m_pDoc->InsertPoolItem(aPaM, SwFmtFld(aPostIt), 0);
+
+ m_pDoc->InsertString(aPaM, rtl::OUString("Apple"));
+ pTxtNode = aPaM.GetNode()->GetTxtNode();
+ aDocStat.Reset();
+ pTxtNode->CountWords(aDocStat, 0, pTxtNode->Len());
+ CPPUNIT_ASSERT(aDocStat.nWord == 1);
+ CPPUNIT_ASSERT_MESSAGE("postit anchor should effectively not exist", aDocStat.nChar == 10);
+ CPPUNIT_ASSERT(pTxtNode->Len() == 11);
+
+ aDocStat.Reset();
}
//See https://bugs.freedesktop.org/show_bug.cgi?id=46757
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 54d0bb9..31bd6da 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3369,9 +3369,9 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect,
Pop(sal_False);
// make sure the selection build later from the data below does not
- // include footnotes and other "in word" character to the left and
- // right in order to preserve those. Therefore count those "in
- // words" in order to modify the selection accordingly.
+ // include "in word" character to the left and right in order to
+ // preserve those. Therefore count those "in words" in order to
+ // modify the selection accordingly.
const sal_Unicode* pChar = aText.GetBuffer();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index a5e6f9f..ffe27d3 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1049,11 +1049,10 @@ uno::Reference< XSpellAlternatives >
xub_StrLen nLineEnd = GetCrsr()->GetPoint()->nContent.GetIndex();
Pop(sal_False);
- // make sure the selection build later from the
- // data below does not include footnotes and other
- // "in word" character to the left and right in order
- // to preserve those. Therefore count those "in words"
- // in order to modify the selection accordingly.
+ // make sure the selection build later from the data below does
+ // not "in word" character to the left and right in order to
+ // preserve those. Therefore count those "in words" in order to
+ // modify the selection accordingly.
const sal_Unicode* pChar = aText.GetBuffer();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
@@ -1179,11 +1178,10 @@ bool SwEditShell::GetGrammarCorrection(
xub_StrLen nLineEnd = GetCrsr()->GetPoint()->nContent.GetIndex();
Pop(sal_False);
- // make sure the selection build later from the
- // data below does not include footnotes and other
- // "in word" character to the left and right in order
- // to preserve those. Therefore count those "in words"
- // in order to modify the selection accordingly.
+ // make sure the selection build later from the data below does
+ // not include "in word" character to the left and right in
+ // order to preserve those. Therefore count those "in words" in
+ // order to modify the selection accordingly.
const sal_Unicode* pChar = aText.GetBuffer();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 85336a8..0f24ecf 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1377,7 +1377,7 @@ void lcl_CopyHint( const sal_uInt16 nWhich, const SwTxtAttr * const pHt,
case RES_TXTATR_META:
case RES_TXTATR_METAFIELD:
OSL_ENSURE(pNewHt, "copying Meta should not fail!");
- OSL_ENSURE(pDest && (CH_TXTATR_INWORD ==
+ OSL_ENSURE(pDest && (CH_TXTATR_BREAKWORD ==
pDest->GetTxt().GetChar(*pNewHt->GetStart())),
"missing CH_TXTATR?");
break;
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index fd419ef..a1afcde 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -3013,16 +3013,16 @@ sal_Unicode GetCharOfTxtAttr( const SwTxtAttr& rAttr )
sal_Unicode cRet = CH_TXTATR_BREAKWORD;
switch ( rAttr.Which() )
{
- case RES_TXTATR_FTN:
case RES_TXTATR_REFMARK:
case RES_TXTATR_TOXMARK:
- case RES_TXTATR_META:
- case RES_TXTATR_METAFIELD:
cRet = CH_TXTATR_INWORD;
break;
case RES_TXTATR_FIELD:
case RES_TXTATR_FLYCNT:
+ case RES_TXTATR_FTN:
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
{
cRet = CH_TXTATR_BREAKWORD;
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 26716a7..7da33e9 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -942,11 +942,11 @@ sal_uInt16 SwTxtNode::Spell(SwSpellArgs* pArgs)
}
else
{
- // make sure the selection build later from the
- // data below does not include footnotes and other
- // "in word" character to the left and right in order
- // to preserve those. Therefore count those "in words"
- // in order to modify the selection accordingly.
+ // make sure the selection build later from the data
+ // below does not include "in word" character to the
+ // left and right in order to preserve those. Therefore
+ // count those "in words" in order to modify the
+ // selection accordingly.
const sal_Unicode* pChar = rWord.GetBuffer();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index a7ca886..8b53d6d 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -3566,7 +3566,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
pPam->GetPoint()->nContent--;
nPos--;
aFtnNote.SetNumStr(rtl::OUString(pTxtNd->GetTxt().GetChar(nPos)));
- ((String&)pTxtNd->GetTxt()).SetChar( nPos, CH_TXTATR_INWORD );
+ ((String&)pTxtNd->GetTxt()).SetChar( nPos, CH_TXTATR_BREAKWORD );
bDelFirstChar = sal_True;
}
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 9920890..6acf843 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3159,7 +3159,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
break;
case 0x2: // Auto-Footnote-Number, should be replaced by SwWW8ImplReader::End_Ftn later
if (!maFtnStack.empty())
- cInsert = CH_TXTATR_INWORD;
+ cInsert = 0x2;
break;
#if OSL_DEBUG_LEVEL > 1
default:
diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx
index 1722998..ae8c234 100644
--- a/sw/source/ui/uiview/viewling.cxx
+++ b/sw/source/ui/uiview/viewling.cxx
@@ -533,11 +533,10 @@ void SwView::InsertThesaurusSynonym( const String &rSynonmText, const String &rL
pWrtShell->SelWrd();
- // make sure the selection build later from the
- // data below does not include footnotes and other
- // "in word" character to the left and right in order
- // to preserve those. Therefore count those "in words"
- // in order to modify the selection accordingly.
+ // make sure the selection build later from the data below does not
+ // include "in word" character to the left and right in order to
+ // preserve those. Therefore count those "in words" in order to modify
+ // the selection accordingly.
const sal_Unicode* pChar = rLookUpText.GetBuffer();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
commit 165640076df65971eb01f887a3c285cd6eb61d94
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jul 18 10:20:32 2012 +0100
Related: fdo#38244 include ODF_COMMENTRANGE in annotation undo/redo
make sure that insert->comment and undo/redo includes the insertion
of the dummy odfcomment from fdo#38244
Change-Id: Ib46afb194462a3bbfbe3b8e228ad04e522e64535
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
index e465e9f..ed483c1 100644
--- a/sw/source/ui/fldui/fldmgr.cxx
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -59,7 +59,6 @@
#include <svl/zforlist.hxx>
#include <svl/zformat.hxx>
#include <vcl/mnemonic.hxx>
-#include <xmloff/odffields.hxx>
#include <view.hxx>
#include <wrtsh.hxx> // active window
#include <doc.hxx> // active window
@@ -1379,14 +1378,14 @@ sal_Bool SwFldMgr::InsertFld( const SwInsertFld_Data& rData, SwPaM *pPam )
// insert
pCurShell->StartAllAction();
+ SwPaM *pCommentRange = NULL;
if (pPam && *pPam->GetPoint() != *pPam->GetMark() && rData.nTypeId == TYP_POSTITFLD)
{
- // If an annotation field is inserted, take care of the relevant fieldmark.
- IDocumentMarkAccess* pMarksAccess = pCurShell->GetDoc()->getIDocumentMarkAccess();
- pMarksAccess->makeFieldBookmark(*pPam, OUString(), ODF_COMMENTRANGE);
+ // If an annotation field will be inserted, pass through the affected range
+ pCommentRange = pPam;
}
- pCurShell->Insert(*pFld);
+ pCurShell->Insert(*pFld, pCommentRange);
if(bExp && bEvalExp)
pCurShell->UpdateExpFlds(sal_True);
diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
index 59431b4..f2e1e3c 100644
--- a/sw/source/ui/inc/wrtsh.hxx
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -296,7 +296,7 @@ typedef sal_Bool (SwWrtShell:: *FNSimpleMove)();
int IntelligentCut(int nSelectionType, sal_Bool bCut = sal_True);
// edit
- void Insert(SwField &);
+ void Insert(SwField &, SwPaM *pCommentRange = NULL);
void Insert(const String &);
// graphic
void Insert( const String &rPath, const String &rFilter,
diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx
index 16196cc..f6dda8c 100644
--- a/sw/source/ui/wrtsh/wrtsh2.cxx
+++ b/sw/source/ui/wrtsh/wrtsh2.cxx
@@ -72,7 +72,9 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-void SwWrtShell::Insert(SwField &rFld)
+#include <xmloff/odffields.hxx>
+
+void SwWrtShell::Insert(SwField &rFld, SwPaM *pCommentRange)
{
ResetCursorStack();
if(!CanInsert())
@@ -84,6 +86,13 @@ void SwWrtShell::Insert(SwField &rFld)
StartUndo(UNDO_INSERT, &aRewriter);
+ if (pCommentRange && GetDoc())
+ {
+ // If an annotation field is inserted, take care of the relevant fieldmark.
+ IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess();
+ pMarksAccess->makeFieldBookmark(*pCommentRange, OUString(), ODF_COMMENTRANGE);
+ }
+
bool bDeleted = false;
if( HasSelection() )
{
commit 8a9244afe9954e0f8e801a41d83e3c2084c620de
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jul 18 08:49:33 2012 +0100
expand cInsert to unicode at compile time
Change-Id: I74a7f905c69912d527dafc2212bf37f97bb78dc4
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 246d151..9920890 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3019,7 +3019,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
nWCharVal = nBCode;
}
- sal_Char cInsert = '\x0';
+ sal_Unicode cInsert = '\x0';
bool bRet = false;
//xushanchuan add for issue106569
if ( 0xc != nWCharVal )
@@ -3170,7 +3170,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
if( '\x0' != cInsert )
{
- rtl::OUString sInsert(&cInsert, 1, RTL_TEXTENCODING_MS_1252);
+ rtl::OUString sInsert(cInsert);
emulateMSWordAddTextToParagraph(sInsert);
}
if (!maApos.back()) //a para end in apo doesn't count
commit 1a0d0762ea6d89ee8138b536140b84d65603d04f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jul 17 22:36:36 2012 +0100
beef up the join and break tests
Change-Id: Ia34c2f18cfa84447578604ff27a9145d17bf354a
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index 28f46b1..56f117e 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -222,16 +222,14 @@ void TestBreakIterator::testWordBoundaries()
}
//See https://bugs.freedesktop.org/show_bug.cgi?id=49629
+ sal_Unicode aBreakTests[] = { ' ', 1, 2, 3, 4, 5, 6, 7, 0x91, 0x92, 0x200B, 0xE8FF, 0xF8FF };
for (int mode = i18n::WordType::ANY_WORD; mode <= i18n::WordType::WORD_COUNT; ++mode)
{
//make sure that in all cases isBeginWord and isEndWord matches getWordBoundary
- //
- //test "Word", then "Word\x01" then "Word\x02"
- for (sal_Unicode i = 0; i < 3; ++i)
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aBreakTests); ++i)
{
::rtl::OUString aTest("Word");
- if (i > 0)
- aTest += rtl::OUString(i) + rtl::OUString("Word");
+ aTest += rtl::OUString(aBreakTests[i]) + rtl::OUString("Word");
aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale, mode, true);
switch (mode)
{
@@ -254,6 +252,35 @@ void TestBreakIterator::testWordBoundaries()
}
}
+ sal_Unicode aJoinTests[] = { 'X', 0x200C, 0x200D, 0x2060, 0xFEFF, 0xFFF9 };
+ for (int mode = i18n::WordType::ANY_WORD; mode <= i18n::WordType::WORD_COUNT; ++mode)
+ {
+ //make sure that in all cases isBeginWord and isEndWord matches getWordBoundary
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aJoinTests); ++i)
+ {
+ ::rtl::OUString aTest("Word");
+ aTest += rtl::OUString(aJoinTests[i]) + rtl::OUString("Word");
+ aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale, mode, true);
+ switch (mode)
+ {
+ case i18n::WordType::ANY_WORD:
+ CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 9);
+ break;
+ case i18n::WordType::ANYWORD_IGNOREWHITESPACES:
+ CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 9);
+ break;
+ case i18n::WordType::DICTIONARY_WORD:
+ CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 9);
+ break;
+ case i18n::WordType::WORD_COUNT:
+ CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 9);
+ break;
+ }
+
+ CPPUNIT_ASSERT(m_xBreak->isBeginWord(aTest, aBounds.startPos, aLocale, mode));
+ CPPUNIT_ASSERT(m_xBreak->isEndWord(aTest, aBounds.endPos, aLocale, mode));
+ }
+ }
}
//See http://qa.openoffice.org/issues/show_bug.cgi?id=111152
commit b4f077af546e5e54ed6f12edaae88b69ac052bdf
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jul 17 21:26:56 2012 +0100
move test to right category
Change-Id: If2cb8da2a24331cc01fed85750747fff3d2fc8e0
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index 3ed44fc..28f46b1 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -125,39 +125,6 @@ void TestBreakIterator::testLineBreaking()
CPPUNIT_ASSERT_MESSAGE("Expected a break at the the start of the word", aResult.breakIndex == aWord.getLength()+1);
}
}
-
- //See https://bugs.freedesktop.org/show_bug.cgi?id=49629
- for (int mode = i18n::WordType::ANY_WORD; mode <= i18n::WordType::WORD_COUNT; ++mode)
- {
- //make sure that in all cases isBeginWord and isEndWord matches getWordBoundary
- //
- //test "Word", then "Word\x01" then "Word\x02"
- for (sal_Unicode i = 0; i < 3; ++i)
- {
- ::rtl::OUString aTest("Word");
- if (i > 0)
- aTest += rtl::OUString(i) + rtl::OUString("Word");
- i18n::Boundary aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale, mode, true);
- switch (mode)
- {
- case i18n::WordType::ANY_WORD:
- CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 4);
- break;
- case i18n::WordType::ANYWORD_IGNOREWHITESPACES:
- CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 4);
- break;
- case i18n::WordType::DICTIONARY_WORD:
- CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 4);
- break;
- case i18n::WordType::WORD_COUNT:
- CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 4);
- break;
- }
-
- CPPUNIT_ASSERT(m_xBreak->isBeginWord(aTest, aBounds.startPos, aLocale, mode));
- CPPUNIT_ASSERT(m_xBreak->isEndWord(aTest, aBounds.endPos, aLocale, mode));
- }
- }
}
//See https://bugs.freedesktop.org/show_bug.cgi?id=49629
@@ -253,6 +220,40 @@ void TestBreakIterator::testWordBoundaries()
aBounds = m_xBreak->getWordBoundary(aTest, 90, aLocale, i18n::WordType::DICTIONARY_WORD, false);
CPPUNIT_ASSERT(aBounds.startPos == 88 && aBounds.endPos == 92);
}
+
+ //See https://bugs.freedesktop.org/show_bug.cgi?id=49629
+ for (int mode = i18n::WordType::ANY_WORD; mode <= i18n::WordType::WORD_COUNT; ++mode)
+ {
+ //make sure that in all cases isBeginWord and isEndWord matches getWordBoundary
+ //
+ //test "Word", then "Word\x01" then "Word\x02"
+ for (sal_Unicode i = 0; i < 3; ++i)
+ {
+ ::rtl::OUString aTest("Word");
+ if (i > 0)
+ aTest += rtl::OUString(i) + rtl::OUString("Word");
+ aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale, mode, true);
+ switch (mode)
+ {
+ case i18n::WordType::ANY_WORD:
+ CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 4);
+ break;
+ case i18n::WordType::ANYWORD_IGNOREWHITESPACES:
+ CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 4);
+ break;
+ case i18n::WordType::DICTIONARY_WORD:
+ CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 4);
+ break;
+ case i18n::WordType::WORD_COUNT:
+ CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 4);
+ break;
+ }
+
+ CPPUNIT_ASSERT(m_xBreak->isBeginWord(aTest, aBounds.startPos, aLocale, mode));
+ CPPUNIT_ASSERT(m_xBreak->isEndWord(aTest, aBounds.endPos, aLocale, mode));
+ }
+ }
+
}
//See http://qa.openoffice.org/issues/show_bug.cgi?id=111152
commit f1eab266dc8036267e163cd897df95dfd4d20df5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jul 17 20:48:39 2012 +0100
translate comment, use CH_TXTATR_INWORD
Change-Id: I68943de82574897ae787035f35439747510bf88d
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index a710f7a..246d151 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3157,10 +3157,10 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
case 0x5: // Annotation reference
case 0x13:
break;
- case 0x2:
+ case 0x2: // Auto-Footnote-Number, should be replaced by SwWW8ImplReader::End_Ftn later
if (!maFtnStack.empty())
- cInsert = 0x2;
- break; // Auto-Fussnoten-Nummer
+ cInsert = CH_TXTATR_INWORD;
+ break;
#if OSL_DEBUG_LEVEL > 1
default:
::std::clog << "<unknownValue val=\"" << nWCharVal << "\">" << ::std::endl;
More information about the Libreoffice-commits
mailing list