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 SwTextGuess;
27 :
28 : /// This portion represents a part of the paragraph string.
29 161467 : class SwTextPortion : public SwLinePortion
30 : {
31 : void BreakCut( SwTextFormatInfo &rInf, const SwTextGuess &rGuess );
32 : void BreakUnderflow( SwTextFormatInfo &rInf );
33 : bool _Format( SwTextFormatInfo &rInf );
34 :
35 : public:
36 121312 : inline SwTextPortion(){ SetWhichPor( POR_TXT ); }
37 : static SwTextPortion * CopyLinePortion(const SwLinePortion &rPortion);
38 : virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
39 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
40 : virtual void FormatEOL( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
41 : virtual sal_Int32 GetCrsrOfst( const sal_uInt16 nOfst ) const SAL_OVERRIDE;
42 : virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const SAL_OVERRIDE;
43 : virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const SAL_OVERRIDE;
44 : virtual long CalcSpacing( long nSpaceAdd, const SwTextSizeInfo &rInf ) const SAL_OVERRIDE;
45 :
46 : // Counts the spaces for justified paragraph
47 : sal_Int32 GetSpaceCnt( const SwTextSizeInfo &rInf, sal_Int32& rCnt ) const;
48 :
49 : bool CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess &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 125312 : DECL_FIXEDMEMPOOL_NEWDEL(SwTextPortion)
56 : };
57 :
58 50 : class SwTextInputFieldPortion : public SwTextPortion
59 : {
60 : public:
61 : SwTextInputFieldPortion();
62 :
63 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
64 : virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
65 : virtual sal_uInt16 GetViewWidth( const SwTextSizeInfo &rInf ) const SAL_OVERRIDE;
66 : virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const SAL_OVERRIDE;
67 : virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const SAL_OVERRIDE;
68 :
69 : private:
70 : bool mbContainsInputFieldStart;
71 : bool mbContainsInputFieldEnd;
72 : bool ContainsOnlyDummyChars() const;
73 : };
74 :
75 7560 : class SwHolePortion : public SwLinePortion
76 : {
77 : sal_uInt16 nBlankWidth;
78 : public:
79 : explicit SwHolePortion( const SwTextPortion &rPor );
80 0 : sal_uInt16 GetBlankWidth( ) const { return nBlankWidth; }
81 84 : void SetBlankWidth( const sal_uInt16 nNew ) { nBlankWidth = nNew; }
82 : virtual SwLinePortion *Compress() SAL_OVERRIDE;
83 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
84 : virtual void Paint( const SwTextPaintInfo &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 7560 : DECL_FIXEDMEMPOOL_NEWDEL(SwHolePortion)
91 : };
92 :
93 444 : class SwFieldMarkPortion : public SwTextPortion
94 : {
95 : public:
96 222 : inline SwFieldMarkPortion() : SwTextPortion()
97 222 : { }
98 : virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
99 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
100 : };
101 :
102 18 : class SwFieldFormCheckboxPortion : public SwTextPortion
103 : {
104 : public:
105 9 : SwFieldFormCheckboxPortion() : SwTextPortion()
106 : {
107 9 : }
108 : virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
109 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
110 : };
111 :
112 : #endif
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|