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_EDITENG_LSPCITEM_HXX
20 : #define INCLUDED_EDITENG_LSPCITEM_HXX
21 :
22 : #include <svl/eitem.hxx>
23 : #include <editeng/svxenum.hxx>
24 : #include <editeng/editengdllapi.h>
25 :
26 : class SvXMLUnitConverter;
27 :
28 : // class SvxLineSpacingItem ----------------------------------------------
29 :
30 : /* [Description]
31 : This item describes the distance between the lines.
32 : */
33 :
34 : #define LINE_SPACE_DEFAULT_HEIGHT 200
35 217314 : class EDITENG_DLLPUBLIC SvxLineSpacingItem : public SfxEnumItemInterface
36 : {
37 : friend SvStream& WriteSvxLineSpacingItem( SvStream&, SvxLineSpacingItem& ); //$ ostream
38 :
39 : short nInterLineSpace;
40 : sal_uInt16 nLineHeight;
41 : sal_uInt16 nPropLineSpace;
42 : SvxLineSpace eLineSpace;
43 : SvxInterLineSpace eInterLineSpace;
44 :
45 : public:
46 : TYPEINFO_OVERRIDE();
47 :
48 : // The writer relies on a default height of 200! Actually, I would
49 : // initialize all values to 0, but who can ignore the consequences in
50 : // writer? => Rather have a crooked vales as the default, but the
51 : // programmer sees that there's something special happening.
52 :
53 : SvxLineSpacingItem( sal_uInt16 nHeight /*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId );
54 :
55 : // "pure virtual Methods" from SfxPoolItem
56 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
57 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
58 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
59 :
60 : virtual bool GetPresentation( SfxItemPresentation ePres,
61 : SfxMapUnit eCoreMetric,
62 : SfxMapUnit ePresMetric,
63 : OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE;
64 :
65 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
66 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const SAL_OVERRIDE;
67 : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const SAL_OVERRIDE;
68 :
69 : // Methods to query and edit. InterlineSpace is added to the height.
70 1214 : inline short GetInterLineSpace() const { return nInterLineSpace; }
71 0 : inline void SetInterLineSpace( const short nSpace )
72 : {
73 0 : nInterLineSpace = nSpace;
74 0 : eInterLineSpace = SVX_INTER_LINE_SPACE_FIX;
75 0 : }
76 :
77 : // Determines the absolute or minimum row height.
78 19956 : inline sal_uInt16 GetLineHeight() const { return nLineHeight; }
79 152 : inline void SetLineHeight( const sal_uInt16 nHeight )
80 : {
81 152 : nLineHeight = nHeight;
82 152 : eLineSpace = SVX_LINE_SPACE_MIN;
83 152 : }
84 :
85 : // To increase or decrease the row height.
86 112150 : sal_uInt16 GetPropLineSpace() const { return nPropLineSpace; }
87 7046 : inline void SetPropLineSpace( const sal_uInt8 nProp )
88 : {
89 7046 : nPropLineSpace = nProp;
90 7046 : eInterLineSpace = SVX_INTER_LINE_SPACE_PROP;
91 7046 : }
92 :
93 24899 : inline SvxLineSpace &GetLineSpaceRule() { return eLineSpace; }
94 1088725 : inline SvxLineSpace GetLineSpaceRule() const { return eLineSpace; }
95 :
96 23173 : inline SvxInterLineSpace &GetInterLineSpaceRule() { return eInterLineSpace; }
97 1920500 : inline SvxInterLineSpace GetInterLineSpaceRule() const { return eInterLineSpace; }
98 :
99 : virtual sal_uInt16 GetValueCount() const SAL_OVERRIDE;
100 : virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const SAL_OVERRIDE;
101 : virtual sal_uInt16 GetEnumValue() const SAL_OVERRIDE;
102 : virtual void SetEnumValue( sal_uInt16 nNewVal ) SAL_OVERRIDE;
103 : };
104 :
105 : #endif
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|