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