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 .
25 /// This portion represents a part of the paragraph string.
26 class SwTextPortion
: public SwLinePortion
28 void BreakCut( SwTextFormatInfo
&rInf
, const SwTextGuess
&rGuess
);
29 void BreakUnderflow( SwTextFormatInfo
&rInf
);
30 bool Format_( SwTextFormatInfo
&rInf
);
33 SwTextPortion(){ SetWhichPor( PortionType::Text
); }
34 static SwTextPortion
* CopyLinePortion(const SwLinePortion
&rPortion
);
35 virtual void Paint( const SwTextPaintInfo
&rInf
) const override
;
36 virtual bool Format( SwTextFormatInfo
&rInf
) override
;
37 virtual void FormatEOL( SwTextFormatInfo
&rInf
) override
;
38 virtual TextFrameIndex
GetModelPositionForViewPoint(sal_uInt16 nOfst
) const override
;
39 virtual SwPosSize
GetTextSize( const SwTextSizeInfo
&rInfo
) const override
;
40 virtual bool GetExpText( const SwTextSizeInfo
&rInf
, OUString
&rText
) const override
;
41 virtual tools::Long
CalcSpacing( tools::Long nSpaceAdd
, const SwTextSizeInfo
&rInf
) const override
;
43 // Counts the spaces for justified paragraph
44 TextFrameIndex
GetSpaceCnt(const SwTextSizeInfo
&rInf
, TextFrameIndex
& rCnt
) const;
46 bool CreateHyphen( SwTextFormatInfo
&rInf
, SwTextGuess
const &rGuess
);
48 // Accessibility: pass information about this portion to the PortionHandler
49 virtual void HandlePortion( SwPortionHandler
& rPH
) const override
;
52 class SwTextInputFieldPortion
: public SwTextPortion
55 SwTextInputFieldPortion();
57 virtual bool Format( SwTextFormatInfo
&rInf
) override
;
58 virtual void Paint( const SwTextPaintInfo
&rInf
) const override
;
59 virtual bool GetExpText( const SwTextSizeInfo
&rInf
, OUString
&rText
) const override
;
60 virtual SwPosSize
GetTextSize( const SwTextSizeInfo
&rInfo
) const override
;
63 class SwHolePortion
: public SwLinePortion
65 sal_uInt16 m_nBlankWidth
;
67 explicit SwHolePortion( const SwTextPortion
&rPor
);
68 sal_uInt16
GetBlankWidth( ) const { return m_nBlankWidth
; }
69 void SetBlankWidth( const sal_uInt16 nNew
) { m_nBlankWidth
= nNew
; }
70 virtual SwLinePortion
*Compress() override
;
71 virtual bool Format( SwTextFormatInfo
&rInf
) override
;
72 virtual SwPosSize
GetTextSize(const SwTextSizeInfo
& rInfo
) const override
;
73 virtual void Paint( const SwTextPaintInfo
&rInf
) const override
;
75 // Accessibility: pass information about this portion to the PortionHandler
76 virtual void HandlePortion( SwPortionHandler
& rPH
) const override
;
78 void dumpAsXml(xmlTextWriterPtr pWriter
, const OUString
& rText
,
79 TextFrameIndex
& nOffset
) const override
;
82 class SwFieldMarkPortion
: public SwTextPortion
85 SwFieldMarkPortion() : SwTextPortion()
87 SetWhichPor(PortionType::FieldMark
);
89 virtual void Paint( const SwTextPaintInfo
&rInf
) const override
;
90 virtual bool Format( SwTextFormatInfo
&rInf
) override
;
93 class SwFieldFormCheckboxPortion
: public SwTextPortion
96 SwFieldFormCheckboxPortion() : SwTextPortion()
98 SetWhichPor(PortionType::FieldFormCheckbox
);
100 virtual void Paint( const SwTextPaintInfo
&rInf
) const override
;
101 virtual bool Format( SwTextFormatInfo
&rInf
) override
;
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */