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 class SwExpandPortion : public SwTextPortion
26 {
27 public:
SwExpandPortion()28     SwExpandPortion() { SetWhichPor( PortionType::Expand ); }
29     virtual bool Format( SwTextFormatInfo &rInf ) override;
30     virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const override;
31     virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const override;
32     virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const override;
33     virtual void Paint( const SwTextPaintInfo &rInf ) const override;
34 
35     // Accessibility: pass information about this portion to the PortionHandler
36     virtual void HandlePortion( SwPortionHandler& rPH ) const override;
37 };
38 
39 class SwBlankPortion : public SwExpandPortion
40 {
41     sal_Unicode m_cChar;
42     bool const m_bMulti;        // For multiportion brackets
43 public:
SwBlankPortion(sal_Unicode cCh,bool bMult=false)44     SwBlankPortion( sal_Unicode cCh, bool bMult = false )
45         : m_cChar( cCh ), m_bMulti( bMult )
46         { m_cChar = cCh; SetLen(TextFrameIndex(1)); SetWhichPor( PortionType::Blank ); }
47 
48     virtual SwLinePortion *Compress() override;
49     virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const override;
50     virtual void FormatEOL( SwTextFormatInfo &rInf ) override;
51     virtual bool Format( SwTextFormatInfo &rInf ) override;
52     virtual void Paint( const SwTextPaintInfo &rInf ) const override;
53     static sal_uInt16 MayUnderflow(const SwTextFormatInfo &rInf, TextFrameIndex nIdx,
54         bool bUnderflow );
55 
56     // Accessibility: pass information about this portion to the PortionHandler
57     virtual void HandlePortion( SwPortionHandler& rPH ) const override;
58 };
59 
60 class SwPostItsPortion : public SwExpandPortion
61 {
62     bool const    bScript;
63 public:
64     explicit SwPostItsPortion( bool bScrpt );
65     virtual void Paint( const SwTextPaintInfo &rInf ) const override;
66     virtual bool Format( SwTextFormatInfo &rInf ) override;
67     virtual sal_uInt16 GetViewWidth( const SwTextSizeInfo &rInf ) const override;
68     virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const override;
IsScript() const69     bool IsScript() const { return bScript; }
70 };
71 
72 #endif
73 
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
75