Kaydet (Commit) 46a3d058 authored tarafından Andreas Martens's avatar Andreas Martens

New: Rotated text with frame as character inside

üst a436f17f
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: porfly.cxx,v $ * $RCSfile: porfly.cxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: aw $ $Date: 2000-11-25 18:12:16 $ * last change: $Author: ama $ $Date: 2001-02-01 14:41:17 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -341,7 +341,7 @@ void SwFlyCntPortion::Paint( const SwTxtPaintInfo &rInf ) const ...@@ -341,7 +341,7 @@ void SwFlyCntPortion::Paint( const SwTxtPaintInfo &rInf ) const
* Es erfolgt ein SetBase() ! * Es erfolgt ein SetBase() !
*************************************************************************/ *************************************************************************/
SwFlyCntPortion::SwFlyCntPortion( SwFlyInCntFrm *pFly, const Point &rBase, SwFlyCntPortion::SwFlyCntPortion( SwFlyInCntFrm *pFly, const Point &rBase,
long nLnAscent, long nLnDescent, long nFlyAsc, long nFlyDesc, sal_Bool bQuick ) : long nLnAscent, long nLnDescent, long nFlyAsc, long nFlyDesc, sal_uInt8 nFlags ) :
pContact( pFly ), pContact( pFly ),
bDraw( sal_False ), bDraw( sal_False ),
bMax( sal_False ), bMax( sal_False ),
...@@ -349,15 +349,13 @@ SwFlyCntPortion::SwFlyCntPortion( SwFlyInCntFrm *pFly, const Point &rBase, ...@@ -349,15 +349,13 @@ SwFlyCntPortion::SwFlyCntPortion( SwFlyInCntFrm *pFly, const Point &rBase,
{ {
ASSERT( pFly, "SwFlyCntPortion::SwFlyCntPortion: no SwFlyInCntFrm!" ); ASSERT( pFly, "SwFlyCntPortion::SwFlyCntPortion: no SwFlyInCntFrm!" );
nLineLength = 1; nLineLength = 1;
sal_uInt8 nFlags = SETBASE_ULSPACE | SETBASE_INIT; nFlags |= SETBASE_ULSPACE | SETBASE_INIT;
if( bQuick )
nFlags |= SETBASE_QUICK;
SetBase( rBase, nLnAscent, nLnDescent, nFlyAsc, nFlyDesc, nFlags ); SetBase( rBase, nLnAscent, nLnDescent, nFlyAsc, nFlyDesc, nFlags );
SetWhichPor( POR_FLYCNT ); SetWhichPor( POR_FLYCNT );
} }
SwFlyCntPortion::SwFlyCntPortion( SwDrawContact *pDrawContact, SwFlyCntPortion::SwFlyCntPortion( SwDrawContact *pDrawContact,
const Point &rBase, long nLnAscent, long nLnDescent, const Point &rBase, long nLnAscent, long nLnDescent,
long nFlyAsc, long nFlyDesc, sal_Bool bQuick ) : long nFlyAsc, long nFlyDesc, sal_uInt8 nFlags ) :
pContact( pDrawContact ), pContact( pDrawContact ),
bDraw( sal_True ), bDraw( sal_True ),
bMax( sal_False ), bMax( sal_False ),
...@@ -366,7 +364,7 @@ SwFlyCntPortion::SwFlyCntPortion( SwDrawContact *pDrawContact, ...@@ -366,7 +364,7 @@ SwFlyCntPortion::SwFlyCntPortion( SwDrawContact *pDrawContact,
ASSERT( pDrawContact, "SwFlyCntPortion::SwFlyCntPortion: no SwDrawContact!" ); ASSERT( pDrawContact, "SwFlyCntPortion::SwFlyCntPortion: no SwDrawContact!" );
if( !pDrawContact->GetAnchor() ) if( !pDrawContact->GetAnchor() )
{ {
if( bQuick ) if( nFlags & SETBASE_QUICK )
{ {
Point aAnchorPos = pDrawContact->GetMaster()->GetAnchorPos(); Point aAnchorPos = pDrawContact->GetMaster()->GetAnchorPos();
pDrawContact->ConnectToLayout(); pDrawContact->ConnectToLayout();
...@@ -376,9 +374,7 @@ SwFlyCntPortion::SwFlyCntPortion( SwDrawContact *pDrawContact, ...@@ -376,9 +374,7 @@ SwFlyCntPortion::SwFlyCntPortion( SwDrawContact *pDrawContact,
pDrawContact->ConnectToLayout(); pDrawContact->ConnectToLayout();
} }
nLineLength = 1; nLineLength = 1;
sal_uInt8 nFlags = SETBASE_ULSPACE | SETBASE_INIT; nFlags |= SETBASE_ULSPACE | SETBASE_INIT;
if( bQuick )
nFlags |= SETBASE_QUICK;
SetBase( rBase, nLnAscent, nLnDescent, nFlyAsc, nFlyDesc, nFlags ); SetBase( rBase, nLnAscent, nLnDescent, nFlyAsc, nFlyDesc, nFlags );
SetWhichPor( POR_FLYCNT ); SetWhichPor( POR_FLYCNT );
} }
...@@ -413,7 +409,6 @@ void SwFlyCntPortion::SetBase( const Point &rBase, long nLnAscent, ...@@ -413,7 +409,6 @@ void SwFlyCntPortion::SetBase( const Point &rBase, long nLnAscent,
//Die vertikale Position wird berechnet, die relative horizontale //Die vertikale Position wird berechnet, die relative horizontale
//Position ist stets 0. //Position ist stets 0.
Point aRelPos;
SdrObject *pSdrObj; SdrObject *pSdrObj;
SwRect aBoundRect; SwRect aBoundRect;
long nOldWidth; long nOldWidth;
...@@ -441,32 +436,34 @@ void SwFlyCntPortion::SetBase( const Point &rBase, long nLnAscent, ...@@ -441,32 +436,34 @@ void SwFlyCntPortion::SetBase( const Point &rBase, long nLnAscent,
aBoundRect.Width( aBoundRect.Width() + rLRSpace.GetRight() ); aBoundRect.Width( aBoundRect.Width() + rLRSpace.GetRight() );
aBoundRect.Top( aBoundRect.Top() - rULSpace.GetUpper() ); aBoundRect.Top( aBoundRect.Top() - rULSpace.GetUpper() );
aBoundRect.Height( aBoundRect.Height() + rULSpace.GetLower() ); aBoundRect.Height( aBoundRect.Height() + rULSpace.GetLower() );
SwTwips nBoundHeight = ( nFlags & SETBASE_ROTATE ) ?
aBoundRect.Width() : aBoundRect.Height();
SwTwips nRelPos = 0;
if ( eOri == VERT_NONE ) if ( eOri == VERT_NONE )
aRelPos.Y() = rVert.GetPos(); nRelPos = rVert.GetPos();
else else
{ {
aRelPos.Y() = 0; nRelPos = 0;
if ( eOri == VERT_CENTER ) if ( eOri == VERT_CENTER )
aRelPos.Y() -= aBoundRect.Height() / 2; nRelPos -= nBoundHeight / 2;
else if ( eOri == VERT_TOP ) else if ( eOri == VERT_TOP )
aRelPos.Y() -= aBoundRect.Height(); nRelPos -= nBoundHeight;
else if ( eOri == VERT_BOTTOM ) else if ( eOri == VERT_BOTTOM )
; ;
else if ( eOri == VERT_CHAR_CENTER ) else if ( eOri == VERT_CHAR_CENTER )
aRelPos.Y() -= ( aBoundRect.Height() + nLnAscent - nLnDescent ) / 2; nRelPos -= ( nBoundHeight + nLnAscent - nLnDescent ) / 2;
else if ( eOri == VERT_CHAR_TOP ) else if ( eOri == VERT_CHAR_TOP )
aRelPos.Y() -= nLnAscent; nRelPos -= nLnAscent;
else if ( eOri == VERT_CHAR_BOTTOM ) else if ( eOri == VERT_CHAR_BOTTOM )
aRelPos.Y() += nLnDescent - aBoundRect.Height(); nRelPos += nLnDescent - nBoundHeight;
else else
{ {
if( aBoundRect.Height() >= nFlyAsc + nFlyDesc ) if( nBoundHeight >= nFlyAsc + nFlyDesc )
{ {
// wenn ich genauso gross bin wie die Zeile, brauche ich mich // wenn ich genauso gross bin wie die Zeile, brauche ich mich
// nicht an der Zeile nicht weiter ausrichten, ich lasse // nicht an der Zeile nicht weiter ausrichten, ich lasse
// dann auch den max. Ascent der Zeile zunaechst unveraendert // dann auch den max. Ascent der Zeile zunaechst unveraendert
aRelPos.Y() -= nFlyAsc; nRelPos -= nFlyAsc;
if ( eOri == VERT_LINE_CENTER ) if ( eOri == VERT_LINE_CENTER )
SetAlign( 2 ); SetAlign( 2 );
else if ( eOri == VERT_LINE_TOP ) else if ( eOri == VERT_LINE_TOP )
...@@ -476,35 +473,53 @@ void SwFlyCntPortion::SetBase( const Point &rBase, long nLnAscent, ...@@ -476,35 +473,53 @@ void SwFlyCntPortion::SetBase( const Point &rBase, long nLnAscent,
} }
else if ( eOri == VERT_LINE_CENTER ) else if ( eOri == VERT_LINE_CENTER )
{ {
aRelPos.Y() -= ( aBoundRect.Height() +nFlyAsc -nFlyDesc ) / 2; nRelPos -= ( nBoundHeight +nFlyAsc -nFlyDesc ) / 2;
SetAlign( 2 ); SetAlign( 2 );
} }
else if ( eOri == VERT_LINE_TOP ) else if ( eOri == VERT_LINE_TOP )
{ {
aRelPos.Y() -= nFlyAsc; nRelPos -= nFlyAsc;
SetAlign( 1 ); SetAlign( 1 );
} }
else if ( eOri == VERT_LINE_BOTTOM ) else if ( eOri == VERT_LINE_BOTTOM )
{ {
aRelPos.Y() += nFlyDesc - aBoundRect.Height(); nRelPos += nFlyDesc - nBoundHeight;
SetAlign( 3 ); SetAlign( 3 );
} }
} }
} }
if( nFlags & SETBASE_INIT && aRelPos.Y() < 0 && nFlyAsc < -aRelPos.Y() ) if( nFlags & SETBASE_INIT && nRelPos < 0 && nFlyAsc < -nRelPos )
aBase.Y() -= nFlyAsc + aRelPos.Y(); {
if( nFlags & SETBASE_ROTATE )
aBase.X() -= nFlyAsc + nRelPos;
else
aBase.Y() -= nFlyAsc + nRelPos;
}
Point aRelPos;
if( nFlags & SETBASE_ROTATE )
{
if( nFlags & SETBASE_REVERSE )
aRelPos.X() = -nRelPos;
else
{
aRelPos.X() = nRelPos;
aRelPos.Y() = -aBoundRect.Height();
}
}
else
aRelPos.Y() = nRelPos;
if( bDraw ) if( bDraw )
{ {
if( !( nFlags & SETBASE_QUICK ) ) if( !( nFlags & SETBASE_QUICK ) )
{ {
if( rVert.GetPos() != aRelPos.Y() && eOri != VERT_NONE ) if( rVert.GetPos() != nRelPos && eOri != VERT_NONE )
{ {
// Das aRelPos wird gepflegt, weil sonst SwDrawContact::_Changed // Das aRelPos wird gepflegt, weil sonst SwDrawContact::_Changed
// auf die Idee kommen koennte, auf VERT_NONE umzuschalten. // auf die Idee kommen koennte, auf VERT_NONE umzuschalten.
SwFmtVertOrient aVert( rVert ); SwFmtVertOrient aVert( rVert );
aVert.SetPos( aRelPos.Y() ); aVert.SetPos( nRelPos );
((SwFrmFmt*)pFmt)->LockModify(); ((SwFrmFmt*)pFmt)->LockModify();
((SwFrmFmt*)pFmt)->SetAttr( aVert ); ((SwFrmFmt*)pFmt)->SetAttr( aVert );
((SwFrmFmt*)pFmt)->UnlockModify(); ((SwFrmFmt*)pFmt)->UnlockModify();
...@@ -517,10 +532,11 @@ void SwFlyCntPortion::SetBase( const Point &rBase, long nLnAscent, ...@@ -517,10 +532,11 @@ void SwFlyCntPortion::SetBase( const Point &rBase, long nLnAscent,
} }
else else
{ {
Point aRelAttr( 0, nRelPos );
if ( !(nFlags & SETBASE_QUICK) && (aBase != GetFlyFrm()->GetRefPoint() || if ( !(nFlags & SETBASE_QUICK) && (aBase != GetFlyFrm()->GetRefPoint() ||
aRelPos != GetFlyFrm()->GetCurRelPos()) ) aRelAttr != GetFlyFrm()->GetCurRelPos()) )
{ {
GetFlyFrm()->SetRefPoint( aBase, aRelPos ); GetFlyFrm()->SetRefPoint( aBase, aRelAttr, aRelPos );
if( nOldWidth != GetFlyFrm()->Frm().Width() ) if( nOldWidth != GetFlyFrm()->Frm().Width() )
{ {
aBoundRect = GetFlyFrm()->Frm(); aBoundRect = GetFlyFrm()->Frm();
...@@ -534,19 +550,22 @@ void SwFlyCntPortion::SetBase( const Point &rBase, long nLnAscent, ...@@ -534,19 +550,22 @@ void SwFlyCntPortion::SetBase( const Point &rBase, long nLnAscent,
"SwFlyCntPortion::SetBase: flyfrm has an invalid height" ); "SwFlyCntPortion::SetBase: flyfrm has an invalid height" );
} }
aRef = aBase; aRef = aBase;
SvLSize( aBoundRect.SSize() ); if( nFlags & SETBASE_ROTATE )
SvXSize( aBoundRect.SSize() );
else
SvLSize( aBoundRect.SSize() );
if( Height() ) if( Height() )
{ {
if ( aRelPos.Y() < 0 ) if ( nRelPos < 0 )
{ {
nAscent = Abs( int( aRelPos.Y() ) ); nAscent = Abs( int( nRelPos ) );
if( nAscent > Height() ) if( nAscent > Height() )
Height( nAscent ); Height( nAscent );
} }
else else
{ {
nAscent = 0; nAscent = 0;
Height( Height() + int( aRelPos.Y() ) ); Height( Height() + int( nRelPos ) );
} }
} }
else else
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: pormulti.cxx,v $ * $RCSfile: pormulti.cxx,v $
* *
* $Revision: 1.17 $ * $Revision: 1.18 $
* *
* last change: $Author: ama $ $Date: 2001-01-19 15:27:04 $ * last change: $Author: ama $ $Date: 2001-02-01 14:43:04 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -153,10 +153,13 @@ void SwMultiPortion::CalcSize( SwTxtFormatter& rLine, SwTxtFormatInfo &rInf ) ...@@ -153,10 +153,13 @@ void SwMultiPortion::CalcSize( SwTxtFormatter& rLine, SwTxtFormatInfo &rInf )
Width( 0 ); Width( 0 );
Height( 0 ); Height( 0 );
SetAscent( 0 ); SetAscent( 0 );
SetFlyInCntnt( sal_False );
SwLineLayout *pLay = &GetRoot(); SwLineLayout *pLay = &GetRoot();
do do
{ {
pLay->CalcLine( rLine, rInf ); pLay->CalcLine( rLine, rInf );
if( rLine.IsFlyInCntBase() )
SetFlyInCntnt( sal_True );
if( IsRuby() && ( OnTop() == ( pLay == &GetRoot() ) ) ) if( IsRuby() && ( OnTop() == ( pLay == &GetRoot() ) ) )
{ {
// An empty phonetic line don't need an ascent or a height. // An empty phonetic line don't need an ascent or a height.
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: pormulti.hxx,v $ * $RCSfile: pormulti.hxx,v $
* *
* $Revision: 1.11 $ * $Revision: 1.12 $
* *
* last change: $Author: ama $ $Date: 2001-01-19 15:26:26 $ * last change: $Author: ama $ $Date: 2001-02-01 14:42:39 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -111,10 +111,12 @@ class SwMultiPortion : public SwLinePortion ...@@ -111,10 +111,12 @@ class SwMultiPortion : public SwLinePortion
sal_Bool bFormatted :1; // Already formatted sal_Bool bFormatted :1; // Already formatted
sal_Bool bFollowFld :1; // Field follow inside sal_Bool bFollowFld :1; // Field follow inside
sal_uInt8 nDirection:2; // Direction (0/90/180/270 degrees) sal_uInt8 nDirection:2; // Direction (0/90/180/270 degrees)
sal_Bool bFlyInCntnt:1; // Fly as character inside
protected: protected:
SwMultiPortion( xub_StrLen nEnd ) : pFldRest( 0 ), bTab1( sal_False ), SwMultiPortion( xub_StrLen nEnd ) : pFldRest( 0 ), bTab1( sal_False ),
bTab2( sal_False ), bDouble( sal_False ), bRuby( sal_False ), bTab2( sal_False ), bDouble( sal_False ), bRuby( sal_False ),
bFormatted( sal_False ), bFollowFld( sal_False ), nDirection( 0 ) bFormatted( sal_False ), bFollowFld( sal_False ), nDirection( 0 ),
bFlyInCntnt( sal_False )
{ SetWhichPor( POR_MULTI ); SetLen( nEnd ); } { SetWhichPor( POR_MULTI ); SetLen( nEnd ); }
inline void SetDouble() { bDouble = sal_True; } inline void SetDouble() { bDouble = sal_True; }
inline void SetRuby() { bRuby = sal_True; } inline void SetRuby() { bRuby = sal_True; }
...@@ -136,6 +138,8 @@ public: ...@@ -136,6 +138,8 @@ public:
inline void SetFormatted() { bFormatted = sal_True; } inline void SetFormatted() { bFormatted = sal_True; }
inline sal_Bool IsFollowFld() const { return bFollowFld; } inline sal_Bool IsFollowFld() const { return bFollowFld; }
inline void SetFollowFld() { bFollowFld = sal_True; } inline void SetFollowFld() { bFollowFld = sal_True; }
inline sal_Bool HasFlyInCntnt() const { return bFlyInCntnt; }
inline void SetFlyInCntnt( sal_Bool bNew ) { bFlyInCntnt = bNew; }
inline sal_Bool IsDouble() const { return bDouble; } inline sal_Bool IsDouble() const { return bDouble; }
inline sal_Bool IsRuby() const { return bRuby; } inline sal_Bool IsRuby() const { return bRuby; }
inline sal_Bool OnTop() const { return bTop; } inline sal_Bool OnTop() const { return bTop; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment