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 : #ifndef _PORHYPH_HXX
20 : #define _PORHYPH_HXX
21 :
22 : #include "porexp.hxx"
23 :
24 : /*************************************************************************
25 : * class SwHyphPortion
26 : *************************************************************************/
27 :
28 2 : class SwHyphPortion : public SwExpandPortion
29 : {
30 : public:
31 2 : inline SwHyphPortion( ) { SetWhichPor( POR_HYPH ); }
32 : virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
33 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
34 :
35 : // Accessibility: pass information about this portion to the PortionHandler
36 : virtual void HandlePortion( SwPortionHandler& rPH ) const;
37 :
38 : OUTPUT_OPERATOR
39 : };
40 :
41 : /*************************************************************************
42 : * class SwHyphStrPortion
43 : *************************************************************************/
44 :
45 0 : class SwHyphStrPortion : public SwHyphPortion
46 : {
47 : XubString aExpand;
48 : public:
49 : inline SwHyphStrPortion( const XubString &rStr );
50 : virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
51 :
52 : // Accessibility: pass information about this portion to the PortionHandler
53 : virtual void HandlePortion( SwPortionHandler& rPH ) const;
54 :
55 : OUTPUT_OPERATOR
56 : };
57 :
58 : /*************************************************************************
59 : * class SwSoftHyphPortion
60 : *************************************************************************/
61 :
62 4 : class SwSoftHyphPortion : public SwHyphPortion
63 : {
64 : sal_Bool bExpand;
65 : KSHORT nViewWidth;
66 : KSHORT nHyphWidth;
67 :
68 : public:
69 : SwSoftHyphPortion();
70 : virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
71 : virtual SwLinePortion *Compress();
72 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
73 : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
74 : virtual void FormatEOL( SwTxtFormatInfo &rInf );
75 4 : inline void SetExpand( const sal_Bool bNew ) { bExpand = bNew; }
76 10 : sal_Bool IsExpand() const { return bExpand; }
77 :
78 : virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
79 :
80 : // Accessibility: pass information about this portion to the PortionHandler
81 : virtual void HandlePortion( SwPortionHandler& rPH ) const;
82 :
83 : OUTPUT_OPERATOR
84 : };
85 :
86 : /*************************************************************************
87 : * class SwSoftHyphStrPortion
88 : *************************************************************************/
89 :
90 0 : class SwSoftHyphStrPortion : public SwHyphStrPortion
91 : {
92 : public:
93 : SwSoftHyphStrPortion( const XubString &rStr );
94 : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
95 : OUTPUT_OPERATOR
96 : };
97 :
98 0 : inline SwHyphStrPortion::SwHyphStrPortion( const XubString &rStr )
99 0 : : aExpand( rStr )
100 : {
101 0 : aExpand += '-';
102 0 : SetWhichPor( POR_HYPHSTR );
103 0 : }
104 :
105 : CLASSIO( SwHyphPortion )
106 : CLASSIO( SwHyphStrPortion )
107 : CLASSIO( SwSoftHyphPortion )
108 : CLASSIO( SwSoftHyphStrPortion )
109 :
110 :
111 : #endif
112 :
113 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|