Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _PORTXT_HXX
29 : : #define _PORTXT_HXX
30 : : #ifdef GCC
31 : : #include <sys/types.h>
32 : : #else
33 : : #include <new.h> // for size_t, FIXEDMEM from tools
34 : : #endif
35 : : #include <tools/mempool.hxx>
36 : :
37 : : #include "porlin.hxx"
38 : :
39 : : class SwTxtGuess;
40 : :
41 : : /*************************************************************************
42 : : * class SwTxtPortion
43 : : *************************************************************************/
44 : :
45 : : /// This portion represents a part of the paragraph string.
46 [ - + ][ # # ]: 24389 : class SwTxtPortion : public SwLinePortion
47 : : {
48 : : void BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess );
49 : : void BreakUnderflow( SwTxtFormatInfo &rInf );
50 : : sal_Bool _Format( SwTxtFormatInfo &rInf );
51 : :
52 : : public:
53 : 17269 : inline SwTxtPortion(){ SetWhichPor( POR_TXT ); }
54 : : SwTxtPortion( const SwLinePortion &rPortion );
55 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
56 : : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
57 : : virtual void FormatEOL( SwTxtFormatInfo &rInf );
58 : : virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
59 : : virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
60 : : virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
61 : : virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const;
62 : :
63 : : // Counts the spaces for justified paragraph
64 : : xub_StrLen GetSpaceCnt( const SwTxtSizeInfo &rInf, xub_StrLen& rCnt ) const;
65 : :
66 : : sal_Bool CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess );
67 : :
68 : : // Accessibility: pass information about this portion to the PortionHandler
69 : : virtual void HandlePortion( SwPortionHandler& rPH ) const;
70 : :
71 : : OUTPUT_OPERATOR
72 [ + + ][ + + ]: 14610 : DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion)
73 : : };
74 : :
75 : : /*************************************************************************
76 : : * class SwHolePortion
77 : : *************************************************************************/
78 : :
79 [ - + ]: 2696 : class SwHolePortion : public SwLinePortion
80 : : {
81 : : KSHORT nBlankWidth;
82 : : public:
83 : : SwHolePortion( const SwTxtPortion &rPor );
84 : 0 : inline KSHORT GetBlankWidth( ) const { return nBlankWidth; }
85 : 70 : inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; }
86 : : virtual SwLinePortion *Compress();
87 : : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
88 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
89 : :
90 : : // Accessibility: pass information about this portion to the PortionHandler
91 : : virtual void HandlePortion( SwPortionHandler& rPH ) const;
92 : :
93 : : OUTPUT_OPERATOR
94 [ + - ][ + - ]: 2696 : DECL_FIXEDMEMPOOL_NEWDEL(SwHolePortion)
95 : : };
96 : :
97 [ - + ]: 72 : class SwFieldMarkPortion : public SwTxtPortion
98 : : {
99 : : public:
100 : 36 : inline SwFieldMarkPortion() : SwTxtPortion()
101 : 36 : { }
102 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
103 : : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
104 : : };
105 : :
106 [ - + ]: 6 : class SwFieldFormPortion : public SwTxtPortion
107 : : {
108 : : public:
109 : 3 : inline SwFieldFormPortion() : SwTxtPortion()
110 : 3 : { }
111 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
112 : : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
113 : : };
114 : :
115 : :
116 : : CLASSIO( SwTxtPortion )
117 : : CLASSIO( SwHolePortion )
118 : :
119 : : #endif
120 : :
121 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|