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 INCLUDED_SW_SOURCE_CORE_TEXT_PORHYPH_HXX
20 : #define INCLUDED_SW_SOURCE_CORE_TEXT_PORHYPH_HXX
21 :
22 : #include "porexp.hxx"
23 :
24 37 : class SwHyphPortion : public SwExpandPortion
25 : {
26 : public:
27 37 : SwHyphPortion()
28 37 : {
29 37 : SetWhichPor( POR_HYPH );
30 37 : }
31 : virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const SAL_OVERRIDE;
32 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
33 :
34 : // Accessibility: pass information about this portion to the PortionHandler
35 : virtual void HandlePortion( SwPortionHandler& rPH ) const SAL_OVERRIDE;
36 :
37 : OUTPUT_OPERATOR_OVERRIDE
38 : };
39 :
40 0 : class SwHyphStrPortion : public SwHyphPortion
41 : {
42 : OUString aExpand;
43 : public:
44 0 : explicit SwHyphStrPortion(const OUString &rStr)
45 0 : : aExpand(rStr + "-")
46 : {
47 0 : SetWhichPor( POR_HYPHSTR );
48 0 : }
49 :
50 : virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const SAL_OVERRIDE;
51 :
52 : // Accessibility: pass information about this portion to the PortionHandler
53 : virtual void HandlePortion( SwPortionHandler& rPH ) const SAL_OVERRIDE;
54 :
55 : OUTPUT_OPERATOR_OVERRIDE
56 : };
57 :
58 74 : class SwSoftHyphPortion : public SwHyphPortion
59 : {
60 : bool bExpand;
61 : sal_uInt16 nViewWidth;
62 : sal_uInt16 nHyphWidth;
63 :
64 : public:
65 : SwSoftHyphPortion();
66 : virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const SAL_OVERRIDE;
67 : virtual SwLinePortion *Compress() SAL_OVERRIDE;
68 : virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
69 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
70 : virtual void FormatEOL( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
71 74 : inline void SetExpand( const bool bNew ) { bExpand = bNew; }
72 37 : bool IsExpand() const { return bExpand; }
73 :
74 : virtual sal_uInt16 GetViewWidth( const SwTextSizeInfo &rInf ) const SAL_OVERRIDE;
75 :
76 : // Accessibility: pass information about this portion to the PortionHandler
77 : virtual void HandlePortion( SwPortionHandler& rPH ) const SAL_OVERRIDE;
78 :
79 : OUTPUT_OPERATOR_OVERRIDE
80 : };
81 :
82 0 : class SwSoftHyphStrPortion : public SwHyphStrPortion
83 : {
84 : public:
85 : explicit SwSoftHyphStrPortion( const OUString &rStr );
86 : virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
87 : OUTPUT_OPERATOR_OVERRIDE
88 : };
89 :
90 : #endif
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|