1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
24 class SwExpandPortion
: public SwTextPortion
27 SwExpandPortion() { SetWhichPor( PortionType::Expand
); }
28 virtual bool Format( SwTextFormatInfo
&rInf
) override
;
29 virtual TextFrameIndex
GetModelPositionForViewPoint(sal_uInt16 nOfst
) const override
;
30 virtual bool GetExpText( const SwTextSizeInfo
&rInf
, OUString
&rText
) const override
;
31 virtual SwPosSize
GetTextSize( const SwTextSizeInfo
&rInfo
) const override
;
32 virtual void Paint( const SwTextPaintInfo
&rInf
) const override
;
34 // Accessibility: pass information about this portion to the PortionHandler
35 virtual void HandlePortion( SwPortionHandler
& rPH
) const override
;
37 void dumpAsXml(xmlTextWriterPtr pWriter
, const OUString
& rText
,
38 TextFrameIndex
& nOffset
) const override
;
41 /// Non-breaking space or non-breaking hyphen.
42 class SwBlankPortion
: public SwExpandPortion
45 bool m_bMulti
; // For multiportion brackets
47 SwBlankPortion( sal_Unicode cCh
, bool bMult
= false )
48 : m_cChar( cCh
), m_bMulti( bMult
)
49 { SetLen(TextFrameIndex(1)); SetWhichPor( PortionType::Blank
); }
51 virtual SwLinePortion
*Compress() override
;
52 virtual bool GetExpText( const SwTextSizeInfo
&rInf
, OUString
&rText
) const override
;
53 virtual void FormatEOL( SwTextFormatInfo
&rInf
) override
;
54 virtual bool Format( SwTextFormatInfo
&rInf
) override
;
55 virtual void Paint( const SwTextPaintInfo
&rInf
) const override
;
56 static sal_uInt16
MayUnderflow(const SwTextFormatInfo
&rInf
, TextFrameIndex nIdx
,
59 // Accessibility: pass information about this portion to the PortionHandler
60 virtual void HandlePortion( SwPortionHandler
& rPH
) const override
;
62 void dumpAsXml(xmlTextWriterPtr pWriter
, const OUString
& rText
,
63 TextFrameIndex
& nOffset
) const override
;
66 class SwPostItsPortion
: public SwExpandPortion
70 explicit SwPostItsPortion( bool bScrpt
);
71 virtual void Paint( const SwTextPaintInfo
&rInf
) const override
;
72 virtual bool Format( SwTextFormatInfo
&rInf
) override
;
73 virtual sal_uInt16
GetViewWidth( const SwTextSizeInfo
&rInf
) const override
;
74 virtual bool GetExpText( const SwTextSizeInfo
&rInf
, OUString
&rText
) const override
;
75 bool IsScript() const { return m_bScript
; }
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */