Update ooo320-m1
[ooovba.git] / sw / source / core / text / portxt.hxx
blob240d40accad335f491119b90ff5b3c5f45db020a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: portxt.hxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _PORTXT_HXX
31 #define _PORTXT_HXX
32 #ifdef GCC
33 #include <sys/types.h>
34 #else
35 #include <new.h> //fuer size_t, FIXEDMEM aus tools
36 #endif
37 #include <tools/mempool.hxx>
39 #include "porlin.hxx"
41 class SwTxtGuess;
43 /*************************************************************************
44 * class SwTxtPortion
45 *************************************************************************/
47 class SwTxtPortion : public SwLinePortion
49 void BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess );
50 void BreakUnderflow( SwTxtFormatInfo &rInf );
51 sal_Bool _Format( SwTxtFormatInfo &rInf );
53 public:
54 inline SwTxtPortion(){ SetWhichPor( POR_TXT ); }
55 SwTxtPortion( const SwLinePortion &rPortion );
56 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
57 virtual sal_Bool Format( SwTxtFormatInfo &rInf );
58 virtual void FormatEOL( SwTxtFormatInfo &rInf );
59 virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
60 virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
61 virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
62 virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const;
64 // zaehlt die Spaces fuer Blocksatz
65 xub_StrLen GetSpaceCnt( const SwTxtSizeInfo &rInf, xub_StrLen& rCnt ) const;
67 sal_Bool CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess );
69 // Accessibility: pass information about this portion to the PortionHandler
70 virtual void HandlePortion( SwPortionHandler& rPH ) const;
72 OUTPUT_OPERATOR
73 DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion)
76 /*************************************************************************
77 * class SwHolePortion
78 *************************************************************************/
80 class SwHolePortion : public SwLinePortion
82 KSHORT nBlankWidth;
83 public:
84 SwHolePortion( const SwTxtPortion &rPor );
85 inline KSHORT GetBlankWidth( ) const { return nBlankWidth; }
86 inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; }
87 virtual SwLinePortion *Compress();
88 virtual sal_Bool Format( SwTxtFormatInfo &rInf );
89 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
91 // Accessibility: pass information about this portion to the PortionHandler
92 virtual void HandlePortion( SwPortionHandler& rPH ) const;
94 OUTPUT_OPERATOR
95 DECL_FIXEDMEMPOOL_NEWDEL(SwHolePortion)
98 class SwFieldMarkPortion : public SwTxtPortion
100 public:
101 inline SwFieldMarkPortion() : SwTxtPortion()
103 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
104 virtual sal_Bool Format( SwTxtFormatInfo &rInf );
107 class SwFieldFormPortion : public SwTxtPortion
109 public:
110 inline SwFieldFormPortion() : SwTxtPortion()
112 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
113 virtual sal_Bool Format( SwTxtFormatInfo &rInf );
117 CLASSIO( SwTxtPortion )
118 CLASSIO( SwHolePortion )
120 #endif