Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVX_LSPCITEM_HXX
29 : : #define _SVX_LSPCITEM_HXX
30 : :
31 : : #include <svl/eitem.hxx>
32 : : #include <editeng/svxenum.hxx>
33 : : #include <editeng/editengdllapi.h>
34 : :
35 : : class SvXMLUnitConverter;
36 : : namespace rtl
37 : : {
38 : : class OUString;
39 : : }
40 : :
41 : : // class SvxLineSpacingItem ----------------------------------------------
42 : :
43 : : /* [Description]
44 : : This item describes the distance between the lines.
45 : : */
46 : :
47 : : #define LINE_SPACE_DEFAULT_HEIGHT 200
48 [ - + ]: 5421 : class EDITENG_DLLPUBLIC SvxLineSpacingItem : public SfxEnumItemInterface
49 : : {
50 : : friend SvStream& operator<<( SvStream&, SvxLineSpacingItem& ); //$ ostream
51 : :
52 : : short nInterLineSpace;
53 : : sal_uInt16 nLineHeight;
54 : : sal_uInt8 nPropLineSpace;
55 : : SvxLineSpace eLineSpace;
56 : : SvxInterLineSpace eInterLineSpace;
57 : :
58 : : public:
59 : : TYPEINFO();
60 : :
61 : : // The writer relies on a default height of 200! Actually, I would
62 : : // initialize all values to 0, but who can ignore the consequences in
63 : : // writer? => Rather have a crooked vales as the default, but the
64 : : // programmer sees that there's something special happening.
65 : :
66 : : SvxLineSpacingItem( sal_uInt16 nHeight /*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId );
67 : :
68 : : // "pure virtual Methods" from SfxPoolItem
69 : : virtual int operator==( const SfxPoolItem& ) const;
70 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
71 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
72 : :
73 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
74 : : SfxMapUnit eCoreMetric,
75 : : SfxMapUnit ePresMetric,
76 : : String &rText, const IntlWrapper * = 0 ) const;
77 : :
78 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
79 : : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
80 : : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
81 : :
82 : : // Methods to query and edit. InterlineSpace is added to the height.
83 : 524 : inline short GetInterLineSpace() const { return nInterLineSpace; }
84 : 0 : inline void SetInterLineSpace( const short nSpace )
85 : : {
86 : 0 : nInterLineSpace = nSpace;
87 : 0 : eInterLineSpace = SVX_INTER_LINE_SPACE_FIX;
88 : 0 : }
89 : :
90 : : // Determines the absolute or minimum row height.
91 : 2901 : inline sal_uInt16 GetLineHeight() const { return nLineHeight; }
92 : 3 : inline void SetLineHeight( const sal_uInt16 nHeight )
93 : : {
94 : 3 : nLineHeight = nHeight;
95 : 3 : eLineSpace = SVX_LINE_SPACE_MIN;
96 : 3 : }
97 : :
98 : : // To increase or decrease the row height.
99 : 3813 : sal_uInt8 GetPropLineSpace() const { return nPropLineSpace; }
100 : 300 : inline void SetPropLineSpace( const sal_uInt8 nProp )
101 : : {
102 : 300 : nPropLineSpace = nProp;
103 : 300 : eInterLineSpace = SVX_INTER_LINE_SPACE_PROP;
104 : 300 : }
105 : :
106 : 15091 : inline SvxLineSpace &GetLineSpaceRule() { return eLineSpace; }
107 : 899675 : inline SvxLineSpace GetLineSpaceRule() const { return eLineSpace; }
108 : :
109 : 14836 : inline SvxInterLineSpace &GetInterLineSpaceRule() { return eInterLineSpace; }
110 : 1537179 : inline SvxInterLineSpace GetInterLineSpaceRule() const { return eInterLineSpace; }
111 : :
112 : : virtual sal_uInt16 GetValueCount() const;
113 : : virtual rtl::OUString GetValueTextByPos( sal_uInt16 nPos ) const;
114 : : virtual sal_uInt16 GetEnumValue() const;
115 : : virtual void SetEnumValue( sal_uInt16 nNewVal );
116 : : };
117 : :
118 : : #endif
119 : :
120 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|