xref: /AOO41X/main/sw/source/core/text/porhyph.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _PORHYPH_HXX
28 #define _PORHYPH_HXX
29 
30 #include "porexp.hxx"
31 
32 /*************************************************************************
33  *                      class SwHyphPortion
34  *************************************************************************/
35 
36 class SwHyphPortion : public SwExpandPortion
37 {
38 public:
39 	inline	SwHyphPortion( ) { SetWhichPor( POR_HYPH ); }
40 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
41 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
42 
43     // Accessibility: pass information about this portion to the PortionHandler
44     virtual void HandlePortion( SwPortionHandler& rPH ) const;
45 
46 	OUTPUT_OPERATOR
47 };
48 
49 /*************************************************************************
50  *                      class SwHyphStrPortion
51  *************************************************************************/
52 
53 class SwHyphStrPortion : public SwHyphPortion
54 {
55 	XubString aExpand;
56 public:
57 	inline  SwHyphStrPortion( const XubString &rStr );
58 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
59 
60     // Accessibility: pass information about this portion to the PortionHandler
61     virtual void HandlePortion( SwPortionHandler& rPH ) const;
62 
63     OUTPUT_OPERATOR
64 };
65 
66 /*************************************************************************
67  *                      class SwSoftHyphPortion
68  *************************************************************************/
69 
70 class SwSoftHyphPortion : public SwHyphPortion
71 {
72 	sal_Bool    bExpand;
73 	KSHORT  nViewWidth;
74 	KSHORT	nHyphWidth;
75 
76 public:
77 	SwSoftHyphPortion();
78 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
79 	virtual SwLinePortion *Compress();
80 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
81 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
82 	virtual void FormatEOL( SwTxtFormatInfo &rInf );
83 	inline void SetExpand( const sal_Bool bNew ) { bExpand = bNew; }
84 	sal_Bool IsExpand() const { return bExpand; }
85 
86 	virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
87 
88     // Accessibility: pass information about this portion to the PortionHandler
89     virtual void HandlePortion( SwPortionHandler& rPH ) const;
90 
91 	OUTPUT_OPERATOR
92 };
93 
94 /*************************************************************************
95  *						class SwSoftHyphStrPortion
96  *************************************************************************/
97 
98 class SwSoftHyphStrPortion : public SwHyphStrPortion
99 {
100 public:
101 	SwSoftHyphStrPortion( const XubString &rStr );
102 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
103 	OUTPUT_OPERATOR
104 };
105 
106 inline  SwHyphStrPortion::SwHyphStrPortion( const XubString &rStr )
107 		: aExpand( rStr )
108 {
109 	aExpand += '-';
110 	SetWhichPor( POR_HYPHSTR );
111 }
112 
113 CLASSIO( SwHyphPortion )
114 CLASSIO( SwHyphStrPortion )
115 CLASSIO( SwSoftHyphPortion )
116 CLASSIO( SwSoftHyphStrPortion )
117 
118 
119 #endif
120