summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Martens <ama@openoffice.org>2001-02-20 08:54:07 +0000
committerAndreas Martens <ama@openoffice.org>2001-02-20 08:54:07 +0000
commit6f960e8526f071835dfb6bdcb226ac0efb807a91 (patch)
treedc291d647a6e1cc077b9628b1e53db88eaa211f8
parent79f996b0815cecc4cb315061deebda71aa64a580 (diff)
Opt.: ScriptInfo cached changes of script
-rw-r--r--sw/source/core/text/porlay.hxx70
-rw-r--r--sw/source/core/text/txtfrm.cxx12
-rw-r--r--sw/source/core/text/txtftn.cxx7
3 files changed, 80 insertions, 9 deletions
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index 2aa80f131761..b0db649c4bcc 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: porlay.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: ama $ $Date: 2000-12-21 09:04:26 $
+ * last change: $Author: ama $ $Date: 2001-02-20 09:54:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,6 +63,8 @@
#ifndef _SVSTDARR_HXX
#define _SVSTDARR_SHORTS
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_XUB_STRLEN
#include <svtools/svstdarr.hxx>
#endif
#ifndef _STRING_HXX //autogen
@@ -71,6 +73,7 @@
#include "swrect.hxx" // SwRepaint
#include "portxt.hxx"
+#include "swfont.hxx"
class SwMarginPortion;
class SwDropPortion;
@@ -128,6 +131,64 @@ public:
};
/*************************************************************************
+ * class SwScriptInfo
+ *
+ * encapsultes information about script changes
+ *************************************************************************/
+
+class SwScriptInfo
+{
+private:
+ SvXub_StrLens aScriptChg;
+ SvUShorts aScriptType;
+ xub_StrLen nInvalidityPos;
+
+ inline void InsertScriptChg( const xub_StrLen nChg, const USHORT nCnt );
+ inline void InsertScriptType( const USHORT nScript, const USHORT nCnt );
+
+public:
+ inline SwScriptInfo() : nInvalidityPos( 0 ) {};
+
+ // determines script changes
+ void InitScriptInfo( const String& rTxt );
+ // set/get position from which data is invalid
+ inline void SetInvalidity( const xub_StrLen nPos );
+ inline xub_StrLen GetInvalidity() { return nInvalidityPos; };
+
+ // array operations, nCnt refers to array position
+ inline USHORT CountScriptChg() const;
+ inline xub_StrLen GetScriptChg( const USHORT nCnt ) const;
+ inline USHORT GetScriptType( const USHORT nCnt ) const;
+
+ // "high" level operations, nPos refers to string position
+ xub_StrLen NextScriptChg( const xub_StrLen nPos ) const;
+ USHORT ScriptType( const xub_StrLen nPos ) const;
+};
+
+inline void SwScriptInfo::InsertScriptChg( const xub_StrLen nChg, const USHORT nCnt )
+{
+ aScriptChg.Insert( nChg, nCnt );
+}
+inline void SwScriptInfo::InsertScriptType( const USHORT nScript, const USHORT nCnt )
+{
+ aScriptType.Insert( nScript, nCnt );
+}
+inline void SwScriptInfo::SetInvalidity( const xub_StrLen nPos )
+{
+ if ( nPos < nInvalidityPos )
+ nInvalidityPos = nPos;
+};
+inline USHORT SwScriptInfo::CountScriptChg() const { return aScriptChg.Count(); }
+inline xub_StrLen SwScriptInfo::GetScriptChg( const USHORT nCnt ) const
+{
+ return aScriptChg[ nCnt ];
+}
+inline USHORT SwScriptInfo::GetScriptType( const xub_StrLen nCnt ) const
+{
+ return aScriptType[ nCnt ];
+}
+
+/*************************************************************************
* class SwLineLayout
*************************************************************************/
@@ -245,6 +306,7 @@ class SwParaPortion : public SwLineLayout
SwRepaint aRepaint;
// neu zu formatierender Bereich
SwCharRange aReformat;
+ SwScriptInfo aScriptInfo;
long nDelta;
// Wenn ein SwTxtFrm gelocked ist, werden keine Veraenderungen an den
@@ -269,7 +331,7 @@ class SwParaPortion : public SwLineLayout
sal_Bool bFlag16 : 1; //
public:
- SwParaPortion();
+ SwParaPortion();
// setzt alle Formatinformationen zurueck (ausser bFlys wg. 9916)
inline void FormatReset();
@@ -284,7 +346,7 @@ public:
inline const SwCharRange *GetReformat() const { return &aReformat; }
inline long *GetDelta() { return &nDelta; }
inline const long *GetDelta() const { return &nDelta; }
-
+ inline SwScriptInfo* GetScriptInfo() { return &aScriptInfo; }
// fuer SwTxtFrm::Format: liefert die aktuelle Laenge des Absatzes
xub_StrLen GetParLen() const;
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index cec4e5d4557e..369b88776486 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.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: ama $ $Date: 2000-10-13 09:05:02 $
+ * last change: $Author: ama $ $Date: 2001-02-20 09:52:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -530,6 +530,10 @@ void SwTxtFrm::CalcLineSpace()
pPage->InvalidateAutoCompleteWords(); \
}
+#define SET_SCRIPT_INVAL( nPos )\
+ if( GetPara() )\
+ GetPara()->GetScriptInfo()->SetInvalidity( nPos );
+
void lcl_ModifyOfst( SwTxtFrm* pFrm, xub_StrLen nPos, xub_StrLen nLen )
{
if( nLen < 0 )
@@ -585,6 +589,7 @@ void SwTxtFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
nPos = ((SwInsChr*)pNew)->nPos;
InvalidateRange( SwCharRange( nPos, 1 ), 1 );
SET_WRONG( nPos, 1, Move )
+ SET_SCRIPT_INVAL( nPos )
bSetFldsDirty = sal_True;
if( HasFollow() )
lcl_ModifyOfst( this, nPos, 1 );
@@ -608,6 +613,7 @@ void SwTxtFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
_InvalidateRange( SwCharRange( nPos, nLen ), nLen );
}
SET_WRONG( nPos, nLen, Move )
+ SET_SCRIPT_INVAL( nPos )
bSetFldsDirty = sal_True;
if( HasFollow() )
lcl_ModifyOfst( this, nPos, nLen );
@@ -618,6 +624,7 @@ void SwTxtFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
nPos = ((SwDelChr*)pNew)->nPos;
InvalidateRange( SwCharRange( nPos, 1 ), -1 );
SET_WRONG( nPos, -1, Move )
+ SET_SCRIPT_INVAL( nPos )
bSetFldsDirty = bRecalcFtnFlag = sal_True;
if( HasFollow() )
lcl_ModifyOfst( this, nPos, -1 );
@@ -637,6 +644,7 @@ void SwTxtFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
InvalidateRange( SwCharRange( nPos, 1 ), m );
}
SET_WRONG( nPos, m, Move )
+ SET_SCRIPT_INVAL( nPos )
bSetFldsDirty = bRecalcFtnFlag = sal_True;
if( HasFollow() )
lcl_ModifyOfst( this, nPos, nLen );
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index 4675a5a654af..839056c2bba9 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtftn.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: ama $ $Date: 2001-02-06 15:23:10 $
+ * last change: $Author: ama $ $Date: 2001-02-20 09:51:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -976,7 +976,8 @@ SwNumberPortion *SwTxtFormatter::NewFtnNumPortion( SwTxtFormatInfo &rInf ) const
SwTxtFtn* pTxtFtn = rFtn.GetTxtFtn();
if( pTxtFtn )
{
- SwAttrIter aIter( (SwTxtNode&)pTxtFtn->GetTxtNode() );
+ SwScriptInfo aScriptInfo;
+ SwAttrIter aIter( (SwTxtNode&)pTxtFtn->GetTxtNode(), &aScriptInfo );
aIter.Seek( *pTxtFtn->GetStart() );
// Achtung: Wenn die Kriterien, nach denen der FtnReferenz-Font
// auf den FtnNumerierungsfont wirkt, geaendert werden, muss die