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 : #ifdef GCC
22 : #include <sys/types.h>
23 : #else
24 : #include <new.h> // for size_t, FIXEDMEM from tools
25 : #endif
26 : #include <tools/mempool.hxx>
27 :
28 : #include "porlin.hxx"
29 :
30 : class SwTxtGuess;
31 :
32 : /*************************************************************************
33 : * class SwTxtPortion
34 : *************************************************************************/
35 :
36 : /// This portion represents a part of the paragraph string.
37 1260 : class SwTxtPortion : public SwLinePortion
38 : {
39 : void BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess );
40 : void BreakUnderflow( SwTxtFormatInfo &rInf );
41 : sal_Bool _Format( SwTxtFormatInfo &rInf );
42 :
43 : public:
44 1023 : inline SwTxtPortion(){ SetWhichPor( POR_TXT ); }
45 : SwTxtPortion( const SwLinePortion &rPortion );
46 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
47 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
48 : virtual void FormatEOL( SwTxtFormatInfo &rInf );
49 : virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
50 : virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
51 : virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
52 : virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const;
53 :
54 : // Counts the spaces for justified paragraph
55 : xub_StrLen GetSpaceCnt( const SwTxtSizeInfo &rInf, xub_StrLen& rCnt ) const;
56 :
57 : sal_Bool CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess );
58 :
59 : // Accessibility: pass information about this portion to the PortionHandler
60 : virtual void HandlePortion( SwPortionHandler& rPH ) const;
61 :
62 : OUTPUT_OPERATOR
63 678 : DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion)
64 : };
65 :
66 : /*************************************************************************
67 : * class SwHolePortion
68 : *************************************************************************/
69 :
70 16 : class SwHolePortion : public SwLinePortion
71 : {
72 : KSHORT nBlankWidth;
73 : public:
74 : SwHolePortion( const SwTxtPortion &rPor );
75 0 : inline KSHORT GetBlankWidth( ) const { return nBlankWidth; }
76 0 : inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; }
77 : virtual SwLinePortion *Compress();
78 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
79 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
80 :
81 : // Accessibility: pass information about this portion to the PortionHandler
82 : virtual void HandlePortion( SwPortionHandler& rPH ) const;
83 :
84 : OUTPUT_OPERATOR
85 16 : DECL_FIXEDMEMPOOL_NEWDEL(SwHolePortion)
86 : };
87 :
88 24 : class SwFieldMarkPortion : public SwTxtPortion
89 : {
90 : public:
91 12 : inline SwFieldMarkPortion() : SwTxtPortion()
92 12 : { }
93 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
94 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
95 : };
96 :
97 2 : class SwFieldFormPortion : public SwTxtPortion
98 : {
99 : public:
100 1 : inline SwFieldFormPortion() : SwTxtPortion()
101 1 : { }
102 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
103 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
104 : };
105 :
106 :
107 : CLASSIO( SwTxtPortion )
108 : CLASSIO( SwHolePortion )
109 :
110 : #endif
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|