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 INCLUDED_SW_SOURCE_CORE_TEXT_PORTXT_HXX
20 : #define INCLUDED_SW_SOURCE_CORE_TEXT_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 0 : class SwTxtPortion : public SwLinePortion
34 : {
35 : void BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess );
36 : void BreakUnderflow( SwTxtFormatInfo &rInf );
37 : bool _Format( SwTxtFormatInfo &rInf );
38 :
39 : public:
40 0 : inline SwTxtPortion(){ SetWhichPor( POR_TXT ); }
41 : SwTxtPortion( const SwLinePortion &rPortion );
42 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
43 : virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
44 : virtual void FormatEOL( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
45 : virtual sal_Int32 GetCrsrOfst( const KSHORT nOfst ) const SAL_OVERRIDE;
46 : virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const SAL_OVERRIDE;
47 : virtual bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const SAL_OVERRIDE;
48 : virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const SAL_OVERRIDE;
49 :
50 : // Counts the spaces for justified paragraph
51 : sal_Int32 GetSpaceCnt( const SwTxtSizeInfo &rInf, sal_Int32& rCnt ) const;
52 :
53 : bool CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess );
54 :
55 : // Accessibility: pass information about this portion to the PortionHandler
56 : virtual void HandlePortion( SwPortionHandler& rPH ) const SAL_OVERRIDE;
57 :
58 : OUTPUT_OPERATOR_OVERRIDE
59 0 : DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion)
60 : };
61 :
62 0 : class SwTxtInputFldPortion : public SwTxtPortion
63 : {
64 : public:
65 : SwTxtInputFldPortion();
66 :
67 : virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
68 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
69 : virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const SAL_OVERRIDE;
70 : virtual bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const SAL_OVERRIDE;
71 : virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const SAL_OVERRIDE;
72 :
73 : private:
74 : bool mbContainsInputFieldStart;
75 : bool mbContainsInputFieldEnd;
76 : bool ContainsOnlyDummyChars() const;
77 : };
78 :
79 : /*************************************************************************
80 : * class SwHolePortion
81 : *************************************************************************/
82 :
83 0 : class SwHolePortion : public SwLinePortion
84 : {
85 : KSHORT nBlankWidth;
86 : public:
87 : SwHolePortion( const SwTxtPortion &rPor );
88 0 : inline KSHORT GetBlankWidth( ) const { return nBlankWidth; }
89 0 : inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; }
90 : virtual SwLinePortion *Compress() SAL_OVERRIDE;
91 : virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
92 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
93 :
94 : // Accessibility: pass information about this portion to the PortionHandler
95 : virtual void HandlePortion( SwPortionHandler& rPH ) const SAL_OVERRIDE;
96 :
97 : OUTPUT_OPERATOR_OVERRIDE
98 0 : DECL_FIXEDMEMPOOL_NEWDEL(SwHolePortion)
99 : };
100 :
101 0 : class SwFieldMarkPortion : public SwTxtPortion
102 : {
103 : public:
104 0 : inline SwFieldMarkPortion() : SwTxtPortion()
105 0 : { }
106 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
107 : virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
108 : };
109 :
110 0 : class SwFieldFormCheckboxPortion : public SwTxtPortion
111 : {
112 : public:
113 0 : SwFieldFormCheckboxPortion() : SwTxtPortion()
114 : {
115 0 : }
116 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
117 : virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
118 : };
119 :
120 : #endif
121 :
122 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|