1 |
From ec7ff475f480619787131d0a193d7786c30dac10 Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> |
3 |
Date: Fri, 28 Jan 2011 21:16:36 +0000 |
4 |
Subject: [PATCH] Resolves: fdo#33509, #i62414# out-by-one breaks CTL spell-checking popup |
5 |
|
6 |
ABCD |
7 |
0123 |
8 |
^ |
9 |
|
10 |
Currently calls GetCharRect for position "0" and position "4". It should be |
11 |
"3". We were placing the cursor *after* the final character. We really need to |
12 |
place it *before* the final character and get the bounding box of the last char |
13 |
to union it with the first char's bounding box. It works out ok for western |
14 |
text, but you get a far different value for CTL text. |
15 |
--- |
16 |
sw/source/core/crsr/crsrsh.cxx | 4 ++-- |
17 |
sw/source/core/edit/edlingu.cxx | 14 +++++--------- |
18 |
2 files changed, 7 insertions(+), 11 deletions(-) |
19 |
|
20 |
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx |
21 |
index ed8d37b..a6db747 100644 |
22 |
--- a/sw/source/core/crsr/crsrsh.cxx |
23 |
+++ b/sw/source/core/crsr/crsrsh.cxx |
24 |
@@ -3419,7 +3419,7 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect, |
25 |
//no determine the rectangle in the current line |
26 |
xub_StrLen nWordStart = (nBegin + nLeft) < nLineStart ? nLineStart : nBegin + nLeft; |
27 |
//take one less than the line end - otherwise the next line would be calculated |
28 |
- xub_StrLen nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd ? nLineEnd - 1: (nBegin + nLen - nLeft - nRight); |
29 |
+ xub_StrLen nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd ? nLineEnd : (nBegin + nLen - nLeft - nRight); |
30 |
Push(); |
31 |
pCrsr->DeleteMark(); |
32 |
SwIndex& rContent = GetCrsr()->GetPoint()->nContent; |
33 |
@@ -3431,7 +3431,7 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect, |
34 |
SwCntntFrm *pCntntFrame = pCntntNode->GetFrm( &rPt, pCrsr->GetPoint(), FALSE); |
35 |
|
36 |
pCntntFrame->GetCharRect( aStartRect, *pCrsr->GetPoint(), &aState ); |
37 |
- rContent = nWordEnd; |
38 |
+ rContent = nWordEnd - 1; |
39 |
SwRect aEndRect; |
40 |
pCntntFrame->GetCharRect( aEndRect, *pCrsr->GetPoint(),&aState ); |
41 |
rSelectRect = aStartRect.Union( aEndRect ); |
42 |
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx |
43 |
index 7e186f9..a3d1572 100644 |
44 |
--- a/sw/source/core/edit/edlingu.cxx |
45 |
+++ b/sw/source/core/edit/edlingu.cxx |
46 |
@@ -550,7 +550,6 @@ uno::Any SwHyphIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) |
47 |
|
48 |
const sal_Bool bAuto = IsAuto(); |
49 |
uno::Reference< XHyphenatedWord > xHyphWord; |
50 |
- sal_uInt16 nRet; |
51 |
sal_Bool bGoOn = sal_False; |
52 |
do { |
53 |
SwPaM *pCrsr; |
54 |
@@ -565,10 +564,7 @@ uno::Any SwHyphIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) |
55 |
pCrsr->SetMark(); |
56 |
} |
57 |
|
58 |
- // geraten BUG: |
59 |
- if ( *pCrsr->End() > *GetEnd() ) |
60 |
- nRet = 0; |
61 |
- else |
62 |
+ if ( *pCrsr->End() <= *GetEnd() ) |
63 |
{ |
64 |
*pCrsr->GetMark() = *GetEnd(); |
65 |
|
66 |
@@ -1076,7 +1072,7 @@ uno::Reference< XSpellAlternatives > |
67 |
//no determine the rectangle in the current line |
68 |
xub_StrLen nWordStart = (nBegin + nLeft) < nLineStart ? nLineStart : nBegin + nLeft; |
69 |
//take one less than the line end - otherwise the next line would be calculated |
70 |
- xub_StrLen nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd ? nLineEnd - 1: (nBegin + nLen - nLeft - nRight); |
71 |
+ xub_StrLen nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd ? nLineEnd: (nBegin + nLen - nLeft - nRight); |
72 |
Push(); |
73 |
pCrsr->DeleteMark(); |
74 |
SwIndex& rContent = GetCrsr()->GetPoint()->nContent; |
75 |
@@ -1088,7 +1084,7 @@ uno::Reference< XSpellAlternatives > |
76 |
SwCntntFrm *pCntntFrame = pCntntNode->GetFrm(pPt, pCrsr->GetPoint(), FALSE); |
77 |
|
78 |
pCntntFrame->GetCharRect( aStartRect, *pCrsr->GetPoint(), &aState ); |
79 |
- rContent = nWordEnd; |
80 |
+ rContent = nWordEnd - 1; |
81 |
SwRect aEndRect; |
82 |
pCntntFrame->GetCharRect( aEndRect, *pCrsr->GetPoint(),&aState ); |
83 |
rSelectRect = aStartRect.Union( aEndRect ); |
84 |
@@ -1210,7 +1206,7 @@ bool SwEditShell::GetGrammarCorrection( |
85 |
//no determine the rectangle in the current line |
86 |
xub_StrLen nWordStart = (nBegin + nLeft) < nLineStart ? nLineStart : nBegin + nLeft; |
87 |
//take one less than the line end - otherwise the next line would be calculated |
88 |
- xub_StrLen nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd ? nLineEnd - 1: (nBegin + nLen - nLeft - nRight); |
89 |
+ xub_StrLen nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd ? nLineEnd: (nBegin + nLen - nLeft - nRight); |
90 |
Push(); |
91 |
pCrsr->DeleteMark(); |
92 |
SwIndex& rContent = GetCrsr()->GetPoint()->nContent; |
93 |
@@ -1222,7 +1218,7 @@ bool SwEditShell::GetGrammarCorrection( |
94 |
SwCntntFrm *pCntntFrame = pCntntNode->GetFrm(pPt, pCrsr->GetPoint(), FALSE); |
95 |
|
96 |
pCntntFrame->GetCharRect( aStartRect, *pCrsr->GetPoint(), &aState ); |
97 |
- rContent = nWordEnd; |
98 |
+ rContent = nWordEnd - 1; |
99 |
SwRect aEndRect; |
100 |
pCntntFrame->GetCharRect( aEndRect, *pCrsr->GetPoint(),&aState ); |
101 |
rSelectRect = aStartRect.Union( aEndRect ); |
102 |
-- |
103 |
1.7.3.5 |
104 |
|