summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorFrank Meies <fme@openoffice.org>2002-01-21 07:30:44 +0000
committerFrank Meies <fme@openoffice.org>2002-01-21 07:30:44 +0000
commit7b1a08e38656f37a98b52f97a51909568010b19a (patch)
tree1bc4861121019335f7eeea16f45cb08be8d0724e /sw
parentbe6eb3761d24f9aa0016d4350c2d01d7d55f68be (diff)
Chg: Vertical Formatting - Self painted portions
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/inftxt.cxx86
-rw-r--r--sw/source/core/text/inftxt.hxx7
-rw-r--r--sw/source/core/text/itrpaint.cxx8
-rw-r--r--sw/source/core/text/porrst.cxx22
-rw-r--r--sw/source/core/text/porrst.hxx8
5 files changed, 83 insertions, 48 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 8c4354342bc6..749da804e8a0 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.55 $
+ * $Revision: 1.56 $
*
- * last change: $Author: fme $ $Date: 2002-01-17 15:44:53 $
+ * last change: $Author: fme $ $Date: 2002-01-21 08:30:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -184,6 +184,13 @@ using namespace ::com::sun::star::beans;
#define DARK_COLOR 154
#define CHAR_UNDERSCORE ((sal_Unicode)0x005F)
+#ifdef VERTICAL_LAYOUT
+#define CHAR_LEFT_ARROW ((sal_Unicode)0x25C0)
+#define CHAR_RIGHT_ARROW ((sal_Unicode)0x25B6)
+#define CHAR_TAB ((sal_Unicode)0x2192)
+#define CHAR_LINEBREAK ((sal_Unicode)0x21B5)
+#endif
+
// steht im number.cxx
extern const sal_Char __FAR_DATA sBulletFntName[];
@@ -812,15 +819,14 @@ void lcl_CalcRect( const SwTxtPaintInfo* pInf, const SwLinePortion& rPor,
/*************************************************************************
* lcl_DrawSpecial
*
- * Draws a special portion, e.g., line break portion, tab portion
- * rPor provides values about the portion (Ascent and height),
- * rRect is the
+ * Draws a special portion, e.g., line break portion, tab portion.
+ * The special character is positioned inside the rectangle
*************************************************************************/
void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rPor,
- SwRect& rRect, sal_Unicode cChar )
+ SwRect& rRect, const Color* pCol, sal_Unicode cChar )
{
- // pRect is given in absolute coordinates
+ // rRect is given in absolute coordinates
if ( rInf.GetTxtFrm()->IsVertical() )
rInf.GetTxtFrm()->SwitchVerticalToHorizontal( rRect );
@@ -835,6 +841,8 @@ void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rPor,
pFnt->SetStyleName( aEmptyStr, pOldFnt->GetActual() );
pFnt->SetCharSet( RTL_TEXTENCODING_SYMBOL, pOldFnt->GetActual() );
pFnt->SetFixKerning( 0 );
+ if ( pCol )
+ pFnt->SetColor( *pCol );
const XubString aTmp( cChar );
@@ -877,7 +885,6 @@ void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rPor,
break;
}
- const Point& rPos = rInf.GetPos();
const Point aOldPos( rInf.GetPos() );
// adjust values so that tab is vertically centered
@@ -886,19 +893,19 @@ void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rPor,
switch ( nDir )
{
case 0 :
- nX = rPos.X() + ( rRect.Width() - aFontSize.Width() ) / 2;
- nY = rPos.Y() - rPor.GetAscent() + rInf.GetAscent() +
- ( rPor.Height() - aFontSize.Height() ) / 2;
+ nX = rRect.Left() + ( rRect.Width() - aFontSize.Width() ) / 2;
+ nY = rRect.Top() + ( rRect.Height() - aFontSize.Height() ) / 2 +
+ rInf.GetAscent();
break;
case 900 :
- nX = rPos.X() - rPor.GetAscent() + rInf.GetAscent() +
- ( rPor.Height() - aFontSize.Height() ) / 2;
- nY = rPos.Y() - ( rRect.Height() - aFontSize.Width() ) / 2;
+ nX = rRect.Left() + ( rRect.Width() - aFontSize.Height() ) / 2 +
+ rInf.GetAscent();
+ nY = rRect.Top() + ( rRect.Height() + aFontSize.Width() ) / 2;
break;
case 2700 :
- nX = rPos.X() + rPor.GetAscent() - rInf.GetAscent() -
- ( rPor.Height() - aFontSize.Height() ) / 2;
- nY = rPos.Y() + ( rRect.Height() - aFontSize.Width() ) / 2;
+ nX = rRect.Left() + ( rRect.Width() + aFontSize.Height() ) / 2 -
+ rInf.GetAscent();
+ nY = rRect.Top() + ( rRect.Height() - aFontSize.Width() ) / 2;
break;
}
@@ -958,7 +965,7 @@ void SwTxtPaintInfo::DrawTab( const SwLinePortion &rPor ) const
#endif
#ifdef VERTICAL_LAYOUT
- lcl_DrawSpecial( *this, rPor, aRect, 0x2192 );
+ lcl_DrawSpecial( *this, rPor, aRect, 0, CHAR_TAB );
#else
pOpt->PaintTab( pWin, aRect );
#endif
@@ -982,7 +989,7 @@ void SwTxtPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const
#ifdef VERTICAL_LAYOUT
if( aRect.HasArea() )
- lcl_DrawSpecial( *this, rPor, aRect, 0x21B5 );
+ lcl_DrawSpecial( *this, rPor, aRect, 0, CHAR_LINEBREAK );
((SwLinePortion&)rPor).Width( nOldWidth );
#else
@@ -993,6 +1000,47 @@ void SwTxtPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const
}
}
+#ifdef VERTICAL_LAYOUT
+
+/*************************************************************************
+ * SwTxtPaintInfo::DrawRedArrow()
+ *************************************************************************/
+
+void SwTxtPaintInfo::DrawRedArrow( const SwLinePortion &rPor ) const
+{
+// Size aSize( 6, 12 );
+// aSize = GetOut()->PixelToLogic( aSize );
+ Size aSize( 240, 240 );
+ SwRect aRect( ((SwArrowPortion&)rPor).GetPos(), aSize );
+ sal_Unicode cChar;
+ if( ((SwArrowPortion&)rPor).IsLeft() )
+ {
+ aRect.Pos().Y() += 20 - GetAscent();
+ aRect.Pos().X() += 20;
+ if( aSize.Height() > rPor.Height() )
+ aRect.Height( rPor.Height() );
+ cChar = CHAR_LEFT_ARROW;
+ }
+ else
+ {
+ if( aSize.Height() > rPor.Height() )
+ aRect.Height( rPor.Height() );
+ aRect.Pos().Y() -= aRect.Height() + 20;
+ aRect.Pos().X() -= aRect.Width() + 20;
+ cChar = CHAR_RIGHT_ARROW;
+ }
+
+ if ( GetTxtFrm()->IsVertical() )
+ GetTxtFrm()->SwitchHorizontalToVertical( aRect );
+
+ Color aCol( COL_LIGHTRED );
+
+ if( aRect.HasArea() )
+ lcl_DrawSpecial( *this, rPor, aRect, &aCol, cChar );
+}
+
+#endif
+
/*************************************************************************
* SwTxtPaintInfo::DrawPostIts()
*************************************************************************/
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 2ed6128e0636..0c807b083f25 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.30 $
+ * $Revision: 1.31 $
*
- * last change: $Author: fme $ $Date: 2001-11-15 16:38:23 $
+ * last change: $Author: fme $ $Date: 2002-01-21 08:30:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -478,6 +478,9 @@ public:
sal_Bool bRetouche = sal_True ) const;
void DrawTab( const SwLinePortion &rPor ) const;
void DrawLineBreak( const SwLinePortion &rPor ) const;
+#ifdef VERTICAL_LAYOUT
+ void DrawRedArrow( const SwLinePortion &rPor ) const;
+#endif
void DrawPostIts( const SwLinePortion &rPor, sal_Bool bScript ) const;
void DrawBackground( const SwLinePortion &rPor ) const;
void DrawViewOpt( const SwLinePortion &rPor, const MSHORT nWhich ) const;
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 4ed7b2d2dbf4..cdb61c29c7f3 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: itrpaint.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: fme $ $Date: 2002-01-17 15:40:38 $
+ * last change: $Author: fme $ $Date: 2002-01-21 08:30:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -523,7 +523,7 @@ void SwTxtPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
{
if( pArrow )
#ifdef VERTICAL_LAYOUT
- pArrow->PaintIt( pOut, GetTxtFrm() );
+ GetInfo().DrawRedArrow( *pArrow );
#else
pArrow->PaintIt( pOut );
#endif
@@ -535,7 +535,7 @@ void SwTxtPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
{
SwArrowPortion aArrow( GetInfo() );
#ifdef VERTICAL_LAYOUT
- aArrow.PaintIt( pOut, GetTxtFrm() );
+ GetInfo().DrawRedArrow( aArrow );
#else
aArrow.PaintIt( pOut );
#endif
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index 1628a27d1992..a0862295b0fb 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: porrst.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: fme $ $Date: 2002-01-17 15:49:58 $
+ * last change: $Author: fme $ $Date: 2002-01-21 08:30:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -343,11 +343,8 @@ void SwArrowPortion::Paint( const SwTxtPaintInfo &rInf ) const
((SwArrowPortion*)this)->aPos = rInf.GetPos();
}
-#ifdef VERTICAL_LAYOUT
-void SwArrowPortion::PaintIt( OutputDevice *pOut, SwTxtFrm* pFrm ) const
-#else
+#ifndef VERTICAL_LAYOUT
void SwArrowPortion::PaintIt( OutputDevice *pOut ) const
-#endif
{
Size aSize( 6, 12 );
aSize = pOut->PixelToLogic( aSize );
@@ -367,20 +364,9 @@ void SwArrowPortion::PaintIt( OutputDevice *pOut ) const
aRect.Pos().X() -= aRect.Width() + 20;
}
- Color aCol( COL_LIGHTRED );
-
-#ifdef VERTICAL_LAYOUT
- if ( pFrm->IsVertical() )
- {
- pFrm->SwitchHorizontalToVertical( aRect );
- SvxFont::DrawArrow( *pOut, aRect.SVRect(), aSize, aCol, ! bLeft );
- }
- else
- SvxFont::DrawArrow( *pOut, aRect.SVRect(), aSize, aCol, bLeft );
-#else
SvxFont::DrawArrow( *pOut, aRect.SVRect(), aSize, aCol, bLeft );
-#endif
}
+#endif
SwLinePortion *SwArrowPortion::Compress() { return this; }
diff --git a/sw/source/core/text/porrst.hxx b/sw/source/core/text/porrst.hxx
index 8932c8f9a307..aa399536acec 100644
--- a/sw/source/core/text/porrst.hxx
+++ b/sw/source/core/text/porrst.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: porrst.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: fme $ $Date: 2002-01-17 15:41:23 $
+ * last change: $Author: fme $ $Date: 2002-01-21 08:30:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -153,9 +153,7 @@ public:
SwArrowPortion( const SwTxtPaintInfo &rInf );
virtual void Paint( const SwTxtPaintInfo &rInf ) const;
virtual SwLinePortion *Compress();
-#ifdef VERTICAL_LAYOUT
- void PaintIt( OutputDevice *pOut, SwTxtFrm* pFrm ) const;
-#else
+#ifndef VERTICAL_LAYOUT
void PaintIt( OutputDevice *pOut ) const;
#endif
inline sal_Bool IsLeft() const { return bLeft; }