Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _PORTXT_HXX
20 : #define _PORTXT_HXX
21 :
22 : #include <tools/mempool.hxx>
23 :
24 : #include "porlin.hxx"
25 :
26 : class SwTxtGuess;
27 :
28 : /*************************************************************************
29 : * class SwTxtPortion
30 : *************************************************************************/
31 :
32 : /// This portion represents a part of the paragraph string.
33 14298 : class SwTxtPortion : public SwLinePortion
34 : {
35 : void BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess );
36 : void BreakUnderflow( SwTxtFormatInfo &rInf );
37 : sal_Bool _Format( SwTxtFormatInfo &rInf );
38 :
39 : public:
40 10616 : inline SwTxtPortion(){ SetWhichPor( POR_TXT ); }
41 : SwTxtPortion( const SwLinePortion &rPortion );
42 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
43 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
44 : virtual void FormatEOL( SwTxtFormatInfo &rInf );
45 : virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
46 : virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
47 : virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const;
48 : virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const;
49 :
50 : // Counts the spaces for justified paragraph
51 : sal_Int32 GetSpaceCnt( const SwTxtSizeInfo &rInf, sal_Int32& rCnt ) const;
52 :
53 : sal_Bool CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess );
54 :
55 : // Accessibility: pass information about this portion to the PortionHandler
56 : virtual void HandlePortion( SwPortionHandler& rPH ) const;
57 :
58 : OUTPUT_OPERATOR
59 8128 : DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion)
60 : };
61 :
62 : /*************************************************************************
63 : * class SwHolePortion
64 : *************************************************************************/
65 :
66 706 : class SwHolePortion : public SwLinePortion
67 : {
68 : KSHORT nBlankWidth;
69 : public:
70 : SwHolePortion( const SwTxtPortion &rPor );
71 0 : inline KSHORT GetBlankWidth( ) const { return nBlankWidth; }
72 56 : inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; }
73 : virtual SwLinePortion *Compress();
74 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
75 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
76 :
77 : // Accessibility: pass information about this portion to the PortionHandler
78 : virtual void HandlePortion( SwPortionHandler& rPH ) const;
79 :
80 : OUTPUT_OPERATOR
81 706 : DECL_FIXEDMEMPOOL_NEWDEL(SwHolePortion)
82 : };
83 :
84 40 : class SwFieldMarkPortion : public SwTxtPortion
85 : {
86 : public:
87 20 : inline SwFieldMarkPortion() : SwTxtPortion()
88 20 : { }
89 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
90 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
91 : };
92 :
93 8 : class SwFieldFormPortion : public SwTxtPortion
94 : {
95 : public:
96 4 : inline SwFieldFormPortion() : SwTxtPortion()
97 4 : { }
98 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
99 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
100 : };
101 :
102 :
103 : CLASSIO( SwTxtPortion )
104 : CLASSIO( SwHolePortion )
105 :
106 : #endif
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|