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 :
20 : #ifndef _POREXP_HXX
21 : #define _POREXP_HXX
22 :
23 : #include "portxt.hxx"
24 :
25 : /*************************************************************************
26 : * class SwExpandPortion
27 : *************************************************************************/
28 :
29 149 : class SwExpandPortion : public SwTxtPortion
30 : {
31 : public:
32 149 : inline SwExpandPortion() { SetWhichPor( POR_EXP ); }
33 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
34 : virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const;
35 : virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
36 : virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
37 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
38 :
39 : // Accessibility: pass information about this portion to the PortionHandler
40 : virtual void HandlePortion( SwPortionHandler& rPH ) const;
41 :
42 : OUTPUT_OPERATOR
43 : };
44 :
45 :
46 : /*************************************************************************
47 : * class SwBlankPortion
48 : *************************************************************************/
49 :
50 16 : class SwBlankPortion : public SwExpandPortion
51 : {
52 : sal_Unicode cChar;
53 : bool bMulti; // For multiportion brackets
54 : public:
55 8 : inline SwBlankPortion( sal_Unicode cCh, bool bMult = false )
56 8 : : cChar( cCh ), bMulti( bMult )
57 8 : { cChar = cCh; SetLen(1); SetWhichPor( POR_BLANK ); }
58 :
59 : bool IsMulti() const { return bMulti; }
60 : void SetMulti( bool bNew ) { bMulti = bNew; }
61 :
62 : virtual SwLinePortion *Compress();
63 : virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
64 : virtual void FormatEOL( SwTxtFormatInfo &rInf );
65 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
66 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
67 : MSHORT MayUnderFlow( const SwTxtFormatInfo &rInf, xub_StrLen nIdx,
68 : sal_Bool bUnderFlow ) const;
69 :
70 : // Accessibility: pass information about this portion to the PortionHandler
71 : virtual void HandlePortion( SwPortionHandler& rPH ) const;
72 :
73 : OUTPUT_OPERATOR
74 : };
75 :
76 : /*************************************************************************
77 : * class SwPostItsPortion
78 : *************************************************************************/
79 :
80 12 : class SwPostItsPortion : public SwExpandPortion
81 : {
82 : sal_Bool bScript;
83 : public:
84 : SwPostItsPortion( sal_Bool bScrpt );
85 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
86 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
87 : virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
88 : virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
89 3 : sal_Bool IsScript() const { return bScript; }
90 : OUTPUT_OPERATOR
91 : };
92 :
93 :
94 : CLASSIO( SwExpandPortion )
95 : CLASSIO( SwBlankPortion )
96 : CLASSIO( SwPostItsPortion )
97 :
98 :
99 : #endif
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|