summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/redline.hxx11
-rw-r--r--sw/source/core/doc/docredln.cxx43
-rw-r--r--sw/source/core/text/redlnitr.cxx45
-rw-r--r--sw/source/core/text/redlnitr.hxx5
-rw-r--r--sw/source/core/text/txtfrm.cxx6
-rw-r--r--sw/source/core/txtnode/txtedt.cxx80
6 files changed, 127 insertions, 63 deletions
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 51b54f0e1630..633c0ddbbbd0 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: redline.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:14:27 $
+ * last change: $Author: fme $ $Date: 2001-04-27 13:29:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -292,6 +292,9 @@ public:
void Hide( USHORT nLoop = 0 );
void ShowOriginal( USHORT nLoop = 0 );
+ // calculates the intersection with text node number nNdIdx
+ void CalcStartEnd( USHORT nNdIdx, USHORT& nStart, USHORT& nEnd ) const;
+
void InvalidateRange(); // das Layout anstossen
BOOL IsOwnRedline( const SwRedline& rRedl ) const
@@ -305,8 +308,4 @@ public:
int operator<( const SwRedline& ) const;
};
-
-
-
-
#endif
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 8fdbf7bbc2c8..4bfe5507e590 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: docredln.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jp $ $Date: 2001-04-25 11:30:51 $
+ * last change: $Author: fme $ $Date: 2001-04-27 13:30:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -2786,6 +2786,45 @@ void SwRedline::InvalidateRange() // das Layout anstossen
}
}
+/*************************************************************************
+ * SwRedline::CalcStartEnd()
+ * Calculates the start and end position of the intersection rTmp and
+ * text node nNdIdx
+ *************************************************************************/
+
+void SwRedline::CalcStartEnd( USHORT nNdIdx, USHORT& nStart, USHORT& nEnd ) const
+{
+ const SwPosition *pRStt = Start(), *pREnd = End();
+ if( pRStt->nNode < nNdIdx )
+ {
+ if( pREnd->nNode > nNdIdx )
+ {
+ nStart = 0; // Absatz ist komplett enthalten
+ nEnd = STRING_LEN;
+ }
+ else
+ {
+ ASSERT( pREnd->nNode == nNdIdx,
+ "SwRedlineItr::Seek: GetRedlinePos Error" );
+ nStart = 0; // Absatz wird vorne ueberlappt
+ nEnd = pREnd->nContent.GetIndex();
+ }
+ }
+ else if( pRStt->nNode == nNdIdx )
+ {
+ nStart = pRStt->nContent.GetIndex();
+ if( pREnd->nNode == nNdIdx )
+ nEnd = pREnd->nContent.GetIndex(); // Innerhalb des Absatzes
+ else
+ nEnd = STRING_LEN; // Absatz wird hinten ueberlappt
+ }
+ else
+ {
+ nStart = STRING_LEN;
+ nEnd = STRING_LEN;
+ }
+}
+
void SwRedline::MoveToSection()
{
if( !pCntntSect )
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 77a11551ffc4..d576bfc9fe45 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: redlnitr.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: fme $ $Date: 2001-04-10 14:43:06 $
+ * last change: $Author: fme $ $Date: 2001-04-27 13:33:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -290,40 +290,6 @@ SwRedlineItr::~SwRedlineItr()
delete pExt;
}
-void SwRedlineItr::CalcStartEnd()
-{
- const SwRedline* pTmp = rDoc.GetRedlineTbl()[ nAct ];
- const SwPosition *pRStt = pTmp->Start(), *pREnd = pTmp->End();
- if( pRStt->nNode < nNdIdx )
- {
- if( pREnd->nNode > nNdIdx )
- {
- nStart = 0; // Absatz ist komplett enthalten
- nEnd = STRING_LEN;
- }
- else
- {
- ASSERT( pREnd->nNode == nNdIdx,
- "SwRedlineItr::Seek: GetRedlinePos Error" );
- nStart = 0; // Absatz wird vorne ueberlappt
- nEnd = pREnd->nContent.GetIndex();
- }
- }
- else if( pRStt->nNode == nNdIdx )
- {
- nStart = pRStt->nContent.GetIndex();
- if( pREnd->nNode == nNdIdx )
- nEnd = pREnd->nContent.GetIndex(); // Innerhalb des Absatzes
- else
- nEnd = STRING_LEN; // Absatz wird hinten ueberlappt
- }
- else
- {
- nStart = STRING_LEN;
- nEnd = STRING_LEN;
- }
-}
-
// Der Return-Wert von SwRedlineItr::Seek gibt an, ob der aktuelle Font
// veraendert wurde durch Verlassen (-1) oder Betreten eines Bereichs (+1)
@@ -363,7 +329,8 @@ short SwRedlineItr::_Seek( SwFont& rFnt, xub_StrLen nNew, xub_StrLen nOld )
for( ; nAct < rDoc.GetRedlineTbl().Count() ; ++nAct )
{
- CalcStartEnd();
+ rDoc.GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
+
if( nNew < nEnd )
{
if( nNew >= nStart ) // der einzig moegliche Kandidat
@@ -468,7 +435,7 @@ xub_StrLen SwRedlineItr::_GetNextRedln( xub_StrLen nNext )
if( MSHRT_MAX == nAct )
{
nAct = nFirst;
- CalcStartEnd();
+ rDoc.GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
}
if( bOn || !nStart )
{
@@ -509,7 +476,7 @@ sal_Bool SwRedlineItr::CheckLine( xub_StrLen nChkStart, xub_StrLen nChkEnd )
for( nAct = nFirst; nAct < rDoc.GetRedlineTbl().Count() ; ++nAct )
{
- CalcStartEnd();
+ rDoc.GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
if( nChkEnd < nStart )
break;
if( nChkStart <= nEnd && ( nChkEnd > nStart || STRING_LEN == nEnd ) )
diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx
index 2ccd0025b2c3..04aee7727f7c 100644
--- a/sw/source/core/text/redlnitr.hxx
+++ b/sw/source/core/text/redlnitr.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: redlnitr.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: ama $ $Date: 2001-03-15 15:54:04 $
+ * last change: $Author: fme $ $Date: 2001-04-27 13:33:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -114,7 +114,6 @@ class SwRedlineItr
sal_Bool bShow;
void _Clear( SwFont* pFnt );
- void CalcStartEnd();
sal_Bool _ChkSpecialUnderline() const;
void FillHints( MSHORT nAuthor, SwRedlineType eType );
short _Seek( SwFont& rFnt, xub_StrLen nNew, xub_StrLen nOld );
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 6c9c5c33a98c..aa5786bb0d0a 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtfrm.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: fme $ $Date: 2001-04-10 14:44:48 $
+ * last change: $Author: fme $ $Date: 2001-04-27 13:33:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -668,7 +668,7 @@ void SwTxtFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
_InvalidateRange( SwCharRange( nPos, nLen) );
MSHORT nTmp = ((SwUpdateAttr*)pNew)->nWhichAttr;
if( !nTmp || RES_CHRATR_LANGUAGE == nTmp ||
- RES_TXTATR_CHARFMT == nTmp )
+ RES_TXTATR_CHARFMT == nTmp || RES_FMT_CHG == nTmp )
SET_WRONG( nPos, nPos + nLen, Invalidate );
}
}
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 11190e70d84a..5a1c0774b55e 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtedt.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: ama $ $Date: 2001-03-14 10:09:29 $
+ * last change: $Author: fme $ $Date: 2001-04-27 13:32:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -167,6 +167,12 @@
#ifndef _TXATRITR_HXX
#include <txatritr.hxx>
#endif
+#ifndef _REDLINE_HXX
+#include <redline.hxx> // SwRedline
+#endif
+#ifndef _DOCARY_HXX
+#include <docary.hxx> // SwRedlineTbl
+#endif
using namespace ::com::sun::star;
using namespace ::com::sun::star::i18n;
@@ -181,13 +187,10 @@ using namespace ::com::sun::star::linguistic2;
extern const SwTxtNode *pLinguNode;
extern SwTxtFrm *pLinguFrm;
-
/*
* Ein Zeichen wurde eingefuegt.
*/
-
-
SwTxtNode& SwTxtNode::Insert( xub_Unicode c, const SwIndex &rIdx )
{
xub_StrLen nOrigLen = aText.Len();
@@ -602,6 +605,28 @@ USHORT SwTxtNode::Spell(SwSpellArgs* pArgs)
xub_StrLen nBegin, nEnd;
+ // modify string according to redline information
+ const SwDoc* pDoc = GetDoc();
+ USHORT nAct = pDoc->GetRedlinePos( *this );
+ const XubString rOldTxt( aText );
+
+ for ( ; nAct < pDoc->GetRedlineTbl().Count(); nAct++ )
+ {
+ const SwRedline* pRed = pDoc->GetRedlineTbl()[ nAct ];
+
+ if ( pRed->Start()->nNode > GetIndex() )
+ break;
+
+ if( REDLINE_DELETE == pRed->GetType() )
+ {
+ USHORT nStart, nEnd;
+ pRed->CalcStartEnd( GetIndex(), nStart, nEnd );
+
+ while ( nStart < nEnd && nStart < aText.Len() )
+ aText.SetChar( nStart++, CH_TXTATR_INWORD );
+ }
+ }
+
if ( pArgs->pStartNode != this )
nBegin = 0;
else
@@ -675,6 +700,9 @@ USHORT SwTxtNode::Spell(SwSpellArgs* pArgs)
}
}
+ // reset original text
+ aText = rOldTxt;
+
return pArgs->xSpellAlt.is() ? 1 : 0;
}
@@ -696,7 +724,30 @@ SwRect SwTxtFrm::_AutoSpell( SwCntntNode* pActNode, xub_StrLen nActPos )
LanguageType eFmtLang = pNode->GetSwAttrSet().GetLanguage().GetLanguage();
- const XubString& rTxt = pNode->aText;
+ // modify string according to redline information
+ const SwDoc* pDoc = pNode->GetDoc();
+ USHORT nAct = pDoc->GetRedlinePos( *pNode );
+ const XubString rOldTxt( pNode->aText );
+
+ for ( ; nAct < pDoc->GetRedlineTbl().Count(); nAct++ )
+ {
+ const SwRedline* pRed = pDoc->GetRedlineTbl()[ nAct ];
+
+ if ( pRed->Start()->nNode > pNode->GetIndex() )
+ break;
+
+ if( REDLINE_DELETE == pRed->GetType() )
+ {
+ USHORT nStart, nEnd;
+ pRed->CalcStartEnd( pNode->GetIndex(), nStart, nEnd );
+
+ while ( nStart < nEnd && nStart < pNode->aText.Len() )
+ pNode->aText.SetChar( nStart++, CH_TXTATR_INWORD );
+ }
+ }
+
+ // a change of data indicates that at least one word has been modified
+ sal_Bool bRedlineChg = ( pNode->aText.GetBuffer() != rOldTxt.GetBuffer() );
xub_StrLen nBegin;
xub_StrLen nEnd;
@@ -786,7 +837,16 @@ SwRect SwTxtFrm::_AutoSpell( SwCntntNode* pActNode, xub_StrLen nActPos )
}
}
else if( bAddAutoCmpl && rACW.GetMinWordLen() <= rWord.Len() )
- rACW.InsertWord( rWord );
+ {
+ if ( bRedlineChg )
+ {
+ XubString rNewWord( rWord );
+ rNewWord.EraseAllChars( CH_TXTATR_INWORD );
+ rACW.InsertWord( rNewWord );
+ }
+ else
+ rACW.InsertWord( rWord );
+ }
}
}
}
@@ -861,6 +921,9 @@ SwRect SwTxtFrm::_AutoSpell( SwCntntNode* pActNode, xub_StrLen nActPos )
else
pNode->SetWrongDirty( FALSE );
+ // reset original text
+ pNode->aText = rOldTxt;
+
if( bAddAutoCmpl )
pNode->SetAutoCompleteWordDirty( FALSE );
return aRect;
@@ -1135,6 +1198,3 @@ void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, const XubString& rText,
SwInsTxt aHint( nPos, nLen );
SwModify::Modify( 0, &aHint );
}
-
-
-