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 INCLUDED_SW_SOURCE_CORE_TEXT_POREXP_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_TEXT_POREXP_HXX
22 :
23 : #include "portxt.hxx"
24 :
25 21679 : class SwExpandPortion : public SwTextPortion
26 : {
27 : public:
28 21653 : inline SwExpandPortion() { SetWhichPor( POR_EXP ); }
29 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
30 : virtual sal_Int32 GetCrsrOfst( const sal_uInt16 nOfst ) const SAL_OVERRIDE;
31 : virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const SAL_OVERRIDE;
32 : virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const SAL_OVERRIDE;
33 : virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
34 :
35 : // Accessibility: pass information about this portion to the PortionHandler
36 : virtual void HandlePortion( SwPortionHandler& rPH ) const SAL_OVERRIDE;
37 :
38 : OUTPUT_OPERATOR_OVERRIDE
39 : };
40 :
41 1507 : class SwBlankPortion : public SwExpandPortion
42 : {
43 : sal_Unicode cChar;
44 : bool bMulti; // For multiportion brackets
45 : public:
46 757 : inline SwBlankPortion( sal_Unicode cCh, bool bMult = false )
47 757 : : cChar( cCh ), bMulti( bMult )
48 757 : { cChar = cCh; SetLen(1); SetWhichPor( POR_BLANK ); }
49 :
50 : bool IsMulti() const { return bMulti; }
51 : void SetMulti( bool bNew ) { bMulti = bNew; }
52 :
53 : virtual SwLinePortion *Compress() SAL_OVERRIDE;
54 : virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const SAL_OVERRIDE;
55 : virtual void FormatEOL( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
56 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
57 : virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
58 : static sal_uInt16 MayUnderflow( const SwTextFormatInfo &rInf, sal_Int32 nIdx,
59 : bool bUnderflow );
60 :
61 : // Accessibility: pass information about this portion to the PortionHandler
62 : virtual void HandlePortion( SwPortionHandler& rPH ) const SAL_OVERRIDE;
63 :
64 : OUTPUT_OPERATOR_OVERRIDE
65 : };
66 :
67 242 : class SwPostItsPortion : public SwExpandPortion
68 : {
69 : bool bScript;
70 : public:
71 : explicit SwPostItsPortion( bool bScrpt );
72 : virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
73 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
74 : virtual sal_uInt16 GetViewWidth( const SwTextSizeInfo &rInf ) const SAL_OVERRIDE;
75 : virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const SAL_OVERRIDE;
76 24 : bool IsScript() const { return bScript; }
77 : OUTPUT_OPERATOR_OVERRIDE
78 : };
79 :
80 : #endif
81 :
82 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|