xref: /AOO41X/main/sw/source/core/text/porhyph.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _PORHYPH_HXX
24 #define _PORHYPH_HXX
25 
26 #include "porexp.hxx"
27 
28 /*************************************************************************
29  *                      class SwHyphPortion
30  *************************************************************************/
31 
32 class SwHyphPortion : public SwExpandPortion
33 {
34 public:
SwHyphPortion()35     inline  SwHyphPortion( ) { SetWhichPor( POR_HYPH ); }
36     virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
37     virtual sal_Bool Format( SwTxtFormatInfo &rInf );
38 
39     // Accessibility: pass information about this portion to the PortionHandler
40     virtual void HandlePortion( SwPortionHandler& rPH ) const;
41 
42     OUTPUT_OPERATOR
43 };
44 
45 /*************************************************************************
46  *                      class SwHyphStrPortion
47  *************************************************************************/
48 
49 class SwHyphStrPortion : public SwHyphPortion
50 {
51     XubString aExpand;
52 public:
53     inline  SwHyphStrPortion( const XubString &rStr );
54     virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
55 
56     // Accessibility: pass information about this portion to the PortionHandler
57     virtual void HandlePortion( SwPortionHandler& rPH ) const;
58 
59     OUTPUT_OPERATOR
60 };
61 
62 /*************************************************************************
63  *                      class SwSoftHyphPortion
64  *************************************************************************/
65 
66 class SwSoftHyphPortion : public SwHyphPortion
67 {
68     sal_Bool    bExpand;
69     KSHORT  nViewWidth;
70     KSHORT  nHyphWidth;
71 
72 public:
73     SwSoftHyphPortion();
74     virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
75     virtual SwLinePortion *Compress();
76     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
77     virtual sal_Bool Format( SwTxtFormatInfo &rInf );
78     virtual void FormatEOL( SwTxtFormatInfo &rInf );
SetExpand(const sal_Bool bNew)79     inline void SetExpand( const sal_Bool bNew ) { bExpand = bNew; }
IsExpand() const80     sal_Bool IsExpand() const { return bExpand; }
81 
82     virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
83 
84     // Accessibility: pass information about this portion to the PortionHandler
85     virtual void HandlePortion( SwPortionHandler& rPH ) const;
86 
87     OUTPUT_OPERATOR
88 };
89 
90 /*************************************************************************
91  *                      class SwSoftHyphStrPortion
92  *************************************************************************/
93 
94 class SwSoftHyphStrPortion : public SwHyphStrPortion
95 {
96 public:
97     SwSoftHyphStrPortion( const XubString &rStr );
98     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
99     OUTPUT_OPERATOR
100 };
101 
SwHyphStrPortion(const XubString & rStr)102 inline  SwHyphStrPortion::SwHyphStrPortion( const XubString &rStr )
103         : aExpand( rStr )
104 {
105     aExpand += '-';
106     SetWhichPor( POR_HYPHSTR );
107 }
108 
109 CLASSIO( SwHyphPortion )
110 CLASSIO( SwHyphStrPortion )
111 CLASSIO( SwSoftHyphPortion )
112 CLASSIO( SwSoftHyphStrPortion )
113 
114 
115 #endif
116