summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorAndreas Martens <ama@openoffice.org>2000-12-11 10:05:15 +0000
committerAndreas Martens <ama@openoffice.org>2000-12-11 10:05:15 +0000
commiteced5faac874a15fc4f461f2b8b8a94fee3a2fc3 (patch)
tree5e5a784ef863bd78ec260cb6e8d7f7866c226737 /sw
parent0a63a8934d0d5ca51a4da619034264da147b8c7a (diff)
#81704#: Selection/travelling in doubleline portions
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/inftxt.cxx38
-rw-r--r--sw/source/core/text/inftxt.hxx10
-rw-r--r--sw/source/core/text/itratr.cxx14
-rw-r--r--sw/source/core/text/itratr.hxx20
-rw-r--r--sw/source/core/text/pormulti.cxx66
-rw-r--r--sw/source/core/text/pormulti.hxx15
-rw-r--r--sw/source/core/text/redlnitr.cxx5
7 files changed, 118 insertions, 50 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index c02238981946..adbfce2a6747 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: inftxt.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: ama $ $Date: 2000-11-30 11:37:32 $
+ * last change: $Author: ama $ $Date: 2000-12-11 11:00:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -166,6 +166,9 @@
#ifndef _FRMSH_HXX
#include <frmsh.hxx>
#endif
+#ifndef _ITRATR_HXX
+#include <itratr.hxx>
+#endif
using namespace ::com::sun::star;
using namespace ::com::sun::star::linguistic2;
@@ -1156,23 +1159,31 @@ SwTxtSlotLen::~SwTxtSlotLen()
* SwFontSave::SwFontSave()
*************************************************************************/
-SwFontSave::SwFontSave( const SwTxtSizeInfo &rInf, SwFont *pNewFnt )
- : pFnt( pNewFnt ? ((SwTxtSizeInfo&)rInf).GetFont() : 0 )
+SwFontSave::SwFontSave( const SwTxtSizeInfo &rInf, SwFont *pNew,
+ SwAttrIter* pItr )
+ : pFnt( pNew ? ((SwTxtSizeInfo&)rInf).GetFont() : 0 )
{
if( pFnt )
{
pInf = &((SwTxtSizeInfo&)rInf);
- if( pFnt->DifferentMagic( pNewFnt, pFnt->GetActual() ) ||
- pNewFnt->GetActual() != pFnt->GetActual() )
+ if( pFnt->DifferentMagic( pNew, pFnt->GetActual() ) ||
+ pNew->GetActual() != pFnt->GetActual() )
{
- pNewFnt->SetTransparent( sal_True );
- pNewFnt->SetAlign( ALIGN_BASELINE );
- pInf->SetFont( pNewFnt );
+ pNew->SetTransparent( sal_True );
+ pNew->SetAlign( ALIGN_BASELINE );
+ pInf->SetFont( pNew );
}
else
pFnt = 0;
- pNewFnt->Invalidate();
- pNewFnt->ChgPhysFnt( pInf->GetVsh(), pInf->GetOut() );
+ pNew->Invalidate();
+ pNew->ChgPhysFnt( pInf->GetVsh(), pInf->GetOut() );
+ if( pItr && pItr->GetFnt() == pFnt )
+ {
+ pIter = pItr;
+ pIter->SetFnt( pNew );
+ }
+ else
+ pIter = NULL;
}
}
@@ -1187,6 +1198,11 @@ SwFontSave::~SwFontSave()
// SwFont zurueckstellen
pFnt->Invalidate();
pInf->SetFont( pFnt );
+ if( pIter )
+ {
+ pIter->SetFnt( pFnt );
+ pIter->nPos = STRING_LEN;
+ }
}
}
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 04ed62e4f629..c510c6d43078 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: inftxt.hxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: ama $ $Date: 2000-11-30 15:13:45 $
+ * last change: $Author: ama $ $Date: 2000-12-11 11:00:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -97,6 +97,7 @@ class SwTxtSizeInfo;
class SwViewOption;
class ViewShell;
class SwTxtFtn;
+class SwAttrIter;
/* Minimum: Prozentwert fuers kernen */
#define MINKERNPERCENT 5
@@ -677,9 +678,10 @@ class SwFontSave
{
SwTxtSizeInfo *pInf;
SwFont *pFnt;
- SwFont *pNewFnt;
+ SwAttrIter *pIter;
public:
- SwFontSave( const SwTxtSizeInfo &rInf, SwFont *pFnt );
+ SwFontSave( const SwTxtSizeInfo &rInf, SwFont *pFnt,
+ SwAttrIter* pItr = NULL );
~SwFontSave();
};
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 1a1650743877..4280b59800e6 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: itratr.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: ama $ $Date: 2000-11-30 11:41:22 $
+ * last change: $Author: ama $ $Date: 2000-12-11 11:03:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -248,7 +248,7 @@ sal_Bool SwAttrIter::SeekAndChg( const xub_StrLen nNewPos, OutputDevice *pOut )
{
// wenn der Aenderungszaehler auf Null ist, kennen wir die MagicNo
// des gewuenschten Fonts ...
- if ( !nChgCnt )
+ if ( !nChgCnt && !nPropFont )
pFnt->SetMagic( aMagicNo[ pFnt->GetActual() ],
aFntIdx[ pFnt->GetActual() ], pFnt->GetActual() );
pFnt->ChgPhysFnt( pShell, pOut );
@@ -259,7 +259,7 @@ sal_Bool SwAttrIter::SeekAndChg( const xub_StrLen nNewPos, OutputDevice *pOut )
sal_Bool SwAttrIter::IsSymbol( const xub_StrLen nNewPos )
{
Seek( nNewPos );
- if ( !nChgCnt )
+ if ( !nChgCnt && !nPropFont )
pFnt->SetMagic( aMagicNo[ pFnt->GetActual() ],
aFntIdx[ pFnt->GetActual() ], pFnt->GetActual() );
return pFnt->IsSymbol( pShell );
@@ -308,6 +308,8 @@ sal_Bool SwAttrIter::SeekStartAndChg( OutputDevice *pOut, const sal_Bool bParaFo
pFnt->GetTox() = 0;
pFnt->GetRef() = 0;
nStartIndex = nEndIndex = nPos = nChgCnt = 0;
+ if( nPropFont )
+ pFnt->SetProportion( nPropFont );
if( pRedln )
{
pRedln->Clear( pFnt );
@@ -342,7 +344,7 @@ sal_Bool SwAttrIter::SeekStartAndChg( OutputDevice *pOut, const sal_Bool bParaFo
{
// wenn der Aenderungszaehler auf Null ist, kennen wir die MagicNo
// des gewuenschten Fonts ...
- if ( !nChgCnt )
+ if ( !nChgCnt && !nPropFont )
pFnt->SetMagic( aMagicNo[ pFnt->GetActual() ],
aFntIdx[ pFnt->GetActual() ], pFnt->GetActual() );
pFnt->ChgPhysFnt( pShell, pOut );
@@ -411,6 +413,8 @@ sal_Bool SwAttrIter::Seek( const xub_StrLen nNewPos )
pFnt->SetFnt( pAttrSet );
pFnt->GetTox() = 0;
pFnt->GetRef() = 0;
+ if( nPropFont )
+ pFnt->SetProportion( nPropFont );
nStartIndex = nEndIndex = nPos = 0;
nChgCnt = 0;
}
diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx
index 375ed557bf1e..ee653a10e6c1 100644
--- a/sw/source/core/text/itratr.hxx
+++ b/sw/source/core/text/itratr.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: itratr.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: ama $ $Date: 2000-09-29 13:53:38 $
+ * last change: $Author: ama $ $Date: 2000-12-11 11:04:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,6 +87,7 @@ class ViewShell;
class SwAttrIter
{
+ friend class SwFontSave;
protected:
ViewShell *pShell;
SwFont *pFnt;
@@ -102,23 +103,25 @@ private:
SwRedlineItr *pRedln;
xub_StrLen nStartIndex, nEndIndex, nPos;
MSHORT nChgCnt;
+ BYTE nPropFont;
void SeekFwd( const xub_StrLen nPos );
+ inline SetFnt( SwFont* pNew ) { pFnt = pNew; }
protected:
void Chg( SwTxtAttr *pHt );
void Rst( SwTxtAttr *pHt );
void CtorInit( SwTxtNode& rTxtNode );
- inline SwAttrIter() : pFnt(0), pLastOut(0), nChgCnt(0), pShell(0), pRedln(0)
- { aMagicNo[0] = aMagicNo[1] = aMagicNo[2] = 0;
+ inline SwAttrIter() : pFnt(0), pLastOut(0), nChgCnt(0), nPropFont(0),
+ pShell(0), pRedln(0) { aMagicNo[0] = aMagicNo[1] = aMagicNo[2] = 0;
aFntIdx[0] = aFntIdx[1] = aFntIdx[2] = 0; }
USHORT ScriptType( const xub_StrLen nPos );
public:
// Konstruktor, Destruktor
inline SwAttrIter( SwTxtNode& rTxtNode )
- : pFnt(0), pLastOut(0), nChgCnt(0), pRedln(0)
- { aMagicNo[0] = aMagicNo[1] = aMagicNo[2] = 0;
- aFntIdx[0] = aFntIdx[1] = aFntIdx[2] = 0; CtorInit( rTxtNode ); }
+ : pFnt(0), pLastOut(0), nChgCnt(0), nPropFont(0), pShell(0), pRedln(0)
+ { aMagicNo[0] = aMagicNo[1] = aMagicNo[2] = 0;
+ aFntIdx[0] = aFntIdx[1] = aFntIdx[2] = 0; CtorInit( rTxtNode ); }
virtual ~SwAttrIter();
@@ -152,6 +155,9 @@ public:
inline SwFont *GetFnt() { return pFnt; }
inline const SwFont *GetFnt() const { return pFnt; }
+
+ inline const BYTE GetPropFont() const { return nPropFont; }
+ inline void SetPropFont( const BYTE nNew ) { nPropFont = nNew; }
#ifdef DEBUG
void Dump( SvStream &rOS ) const;
#endif
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 7c709caa93f8..afc0f3ab8f33 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pormulti.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: ama $ $Date: 2000-12-01 12:55:48 $
+ * last change: $Author: ama $ $Date: 2000-12-11 11:04:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -234,6 +234,9 @@ SwDoubleLinePortion::SwDoubleLinePortion( const SwTxtAttr& rAttr,
xub_StrLen nEnd ) : SwMultiPortion( nEnd ), pBracket( new SwBracket() )
{
SetDouble();
+
+ pBracket->nStart = *rAttr.GetStart();
+
if( RES_CHRATR_TWO_LINES == rAttr.Which() )
{
pBracket->cPre = rAttr.Get2Lines().GetStartBracket();
@@ -262,6 +265,11 @@ SwDoubleLinePortion::SwDoubleLinePortion( const SwTxtAttr& rAttr,
pBracket->cPost = 0;
}
}
+ if( !pBracket->cPre && !pBracket->cPost )
+ {
+ delete pBracket;
+ pBracket = 0;
+ }
}
@@ -306,13 +314,14 @@ void SwDoubleLinePortion::PaintBracket( SwTxtPaintInfo &rInf,
* and fills it, if not both characters are 0x00.
* --------------------------------------------------*/
-void SwDoubleLinePortion::SetBrackets( sal_Unicode cPre, sal_Unicode cPost )
+void SwDoubleLinePortion::SetBrackets( const SwDoubleLinePortion& rDouble )
{
- if( cPre || cPost )
+ if( rDouble.pBracket )
{
pBracket = new SwBracket;
- pBracket->cPre = cPre;
- pBracket->cPost = cPost;
+ pBracket->cPre = rDouble.pBracket->cPre;
+ pBracket->cPost = rDouble.pBracket->cPost;
+ pBracket->nStart = rDouble.pBracket->nStart;
}
}
@@ -927,19 +936,28 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint,
SwSpaceManipulator aManip( GetInfo(), rMulti );
SwFontSave *pFontSave;
+ SwFont* pTmpFnt;
+
if( rMulti.IsDouble() )
{
- SwFont* pTmpFnt = new SwFont( *GetInfo().GetFont() );
- pTmpFnt->SetProportion( 50 );
- pFontSave = new SwFontSave( GetInfo(), pTmpFnt );
+ pTmpFnt = new SwFont( *GetInfo().GetFont() );
+ SetPropFont( 50 );
+ pTmpFnt->SetProportion( GetPropFont() );
+ pFontSave = new SwFontSave( GetInfo(), pTmpFnt, this );
}
else
+ {
pFontSave = NULL;
+ pTmpFnt = NULL;
+ }
if( rMulti.HasBrackets() )
{
+ xub_StrLen nOldIdx = GetInfo().GetIdx();
+ GetInfo().SetIdx(((SwDoubleLinePortion&)rMulti).GetBrackets()->nStart);
SeekAndChg( GetInfo() );
((SwDoubleLinePortion&)rMulti).PaintBracket( GetInfo(), 0, sal_True );
+ GetInfo().SetIdx( nOldIdx );
}
KSHORT nTmpX = GetInfo().X();
@@ -1004,8 +1022,8 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint,
pLay = pLay->GetNext();
pPor = pLay->GetFirstPortion();
bRest = pLay->IsRest();
- GetInfo().X( nTmpX );
aManip.SecondLine();
+ GetInfo().X( nTmpX );
// We switch to the baseline of the next inner line
GetInfo().Y( GetInfo().Y() + rMulti.GetRoot().Height()
- rMulti.GetRoot().GetAscent() + pLay->GetAscent() );
@@ -1017,15 +1035,20 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint,
if( rMulti.HasBrackets() )
{
+ xub_StrLen nOldIdx = GetInfo().GetIdx();
+ GetInfo().SetIdx(((SwDoubleLinePortion&)rMulti).GetBrackets()->nStart);
SeekAndChg( GetInfo() );
GetInfo().X( nOldX );
((SwDoubleLinePortion&)rMulti).PaintBracket( GetInfo(),
aManip.GetSpaceAdd(), sal_False );
+ GetInfo().SetIdx( nOldIdx );
}
// Restore the saved values
GetInfo().X( nOldX );
GetInfo().SetLen( nOldLen );
delete pFontSave;
+ delete pTmpFnt;
+ SetPropFont( 0 );
}
/*-----------------13.10.00 16:46-------------------
@@ -1062,20 +1085,28 @@ BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf,
SwMultiPortion& rMulti )
{
SwTwips nMaxWidth = rInf.Width();
+
+ if( rMulti.HasBrackets() )
+ {
+ xub_StrLen nOldIdx = rInf.GetIdx();
+ rInf.SetIdx( ((SwDoubleLinePortion&)rMulti).GetBrackets()->nStart );
+ SeekAndChg( rInf );
+ ((SwDoubleLinePortion&)rMulti).FormatBrackets( rInf, nMaxWidth );
+ rInf.SetIdx( nOldIdx );
+ }
+
SeekAndChg( rInf );
SwFontSave *pFontSave;
if( rMulti.IsDouble() )
{
SwFont* pTmpFnt = new SwFont( *rInf.GetFont() );
- pTmpFnt->SetProportion( 50 );
- pFontSave = new SwFontSave( rInf, pTmpFnt );
+ SetPropFont( 50 );
+ pTmpFnt->SetProportion( GetPropFont() );
+ pFontSave = new SwFontSave( rInf, pTmpFnt, this );
}
else
pFontSave = NULL;
- if( rMulti.HasBrackets() )
- ((SwDoubleLinePortion&)rMulti).FormatBrackets( rInf, nMaxWidth );
-
SwTwips nTmpX = rInf.X();
pMulti = &rMulti;
@@ -1273,9 +1304,11 @@ BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf,
rInf.SetRest( pTmp );
}
rInf.SetTxt( *pOldTxt );
+ SeekAndChg( rInf );
delete pFirstRest;
delete pSecondRest;
delete pFontSave;
+ SetPropFont( 0 );
return bRet;
}
@@ -1428,8 +1461,10 @@ SwTxtCursorSave::SwTxtCursorSave( SwTxtCursor* pTxtCursor,
pTxtCursor->Next() )
; // nothing
nWidth = pTxtCursor->pCurr->Width();
+ nOldProp = pTxtCursor->GetPropFont();
if( pMulti->IsDouble() )
{
+ pTxtCursor->SetPropFont( 50 );
bSpaceChg = pMulti->ChgSpaceAdd( pTxtCursor->pCurr, nSpaceAdd );
if( nSpaceAdd > 0 && !pMulti->HasTabulator() )
pTxtCursor->pCurr->Width( nWidth + nSpaceAdd *
@@ -1446,5 +1481,6 @@ SwTxtCursorSave::~SwTxtCursorSave()
pTxtCrsr->pCurr->Width( nWidth );
pTxtCrsr->pCurr = pCurr;
pTxtCrsr->nStart = nStart;
+ pTxtCrsr->SetPropFont( nOldProp );
}
diff --git a/sw/source/core/text/pormulti.hxx b/sw/source/core/text/pormulti.hxx
index 1462d28f7d9f..6fe24bcfdf27 100644
--- a/sw/source/core/text/pormulti.hxx
+++ b/sw/source/core/text/pormulti.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pormulti.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: ama $ $Date: 2000-11-14 11:38:37 $
+ * last change: $Author: ama $ $Date: 2000-12-11 11:05:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,6 +79,7 @@ class SwTxtPaintInfo;
struct SwBracket
{
+ xub_StrLen nStart; // Start of text attribute determins the font
KSHORT nAscent; // Ascent of the brackets
KSHORT nHeight; // Height of them
KSHORT nPreWidth; // Width of the opening bracket
@@ -107,16 +108,18 @@ class SwMultiPortion : public SwLinePortion
sal_Bool bTop :1; // Phonetic position
sal_Bool bFormatted :1; // Already formatted
sal_Bool bFollowFld :1; // Field follow inside
+ sal_Bool bRotation :1; // Rotation (horizontal <-> vertical)
protected:
SwMultiPortion( xub_StrLen nEnd ) : pFldRest( 0 ), bTab1( sal_False ),
bTab2( sal_False ), bDouble( sal_False ), bRuby( sal_False ),
- bFormatted( sal_False ), bFollowFld( sal_False )
+ bFormatted( sal_False ), bFollowFld( sal_False ), bRotation( sal_False )
{ SetWhichPor( POR_MULTI ); SetLen( nEnd ); }
inline void SetDouble() { bDouble = sal_True; }
inline void SetRuby() { bRuby = sal_True; }
inline void SetTop( sal_Bool bNew ) { bTop = bNew; }
inline void SetTab1( sal_Bool bNew ) { bTab1 = bNew; }
inline void SetTab2( sal_Bool bNew ) { bTab2 = bNew; }
+ inline void SetRotation( sal_Bool bNew ) { bRotation = bNew; }
inline sal_Bool GetTab1() const { return bTab1; }
inline sal_Bool GetTab2() const { return bTab2; }
public:
@@ -144,6 +147,7 @@ public:
inline sal_Bool ChgSpaceAdd( SwLineLayout* pCurr, short nSpaceAdd );
inline sal_Bool HasBrackets() const;
+ inline sal_Bool GetRotation() const { return bRotation; }
OUTPUT_OPERATOR
};
@@ -159,9 +163,7 @@ public:
~SwDoubleLinePortion();
inline SwBracket* GetBrackets() const { return pBracket; }
- void SetBrackets( sal_Unicode cPre, sal_Unicode cPost );
- inline void SetBrackets( const SwDoubleLinePortion& rDouble )
- { SetBrackets( rDouble.pBracket->cPre, rDouble.pBracket->cPost ); }
+ void SetBrackets( const SwDoubleLinePortion& rDouble );
void PaintBracket( SwTxtPaintInfo& rInf, short nSpc, sal_Bool bOpen ) const;
void FormatBrackets( SwTxtFormatInfo &rInf, SwTwips& nMaxWidth );
inline KSHORT PreWidth() const { return pBracket->nPreWidth; };
@@ -211,6 +213,7 @@ class SwTxtCursorSave
SwLineLayout* pCurr;
SwTwips nWidth;
xub_StrLen nStart;
+ BYTE nOldProp;
sal_Bool bSpaceChg;
public:
SwTxtCursorSave( SwTxtCursor* pTxtCursor, SwMultiPortion* pMulti,
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 7358bb152b3a..d32ec53f95c7 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.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: ama $ $Date: 2000-11-30 11:40:40 $
+ * last change: $Author: ama $ $Date: 2000-12-11 11:02:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -218,6 +218,7 @@ void SwAttrIter::CtorInit( SwTxtNode& rTxtNode )
}
nStartIndex = nEndIndex = nPos = nChgCnt = 0;
+ nPropFont = 0;
SwDoc* pDoc = rTxtNode.GetDoc();
const SwExtTextInput* pExtInp = pDoc->GetExtTextInput( rTxtNode );