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 _SVX_LSPCITEM_HXX
20 : #define _SVX_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 7668 : class EDITENG_DLLPUBLIC SvxLineSpacingItem : public SfxEnumItemInterface
36 : {
37 : friend SvStream& operator<<( SvStream&, SvxLineSpacingItem& ); //$ ostream
38 :
39 : short nInterLineSpace;
40 : sal_uInt16 nLineHeight;
41 : sal_uInt8 nPropLineSpace;
42 : SvxLineSpace eLineSpace;
43 : SvxInterLineSpace eInterLineSpace;
44 :
45 : public:
46 : TYPEINFO();
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 int operator==( const SfxPoolItem& ) const;
57 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
58 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
59 :
60 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
61 : SfxMapUnit eCoreMetric,
62 : SfxMapUnit ePresMetric,
63 : OUString &rText, const IntlWrapper * = 0 ) const;
64 :
65 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
66 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
67 : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
68 :
69 : // Methods to query and edit. InterlineSpace is added to the height.
70 1549 : 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 2181 : inline sal_uInt16 GetLineHeight() const { return nLineHeight; }
79 1 : inline void SetLineHeight( const sal_uInt16 nHeight )
80 : {
81 1 : nLineHeight = nHeight;
82 1 : eLineSpace = SVX_LINE_SPACE_MIN;
83 1 : }
84 :
85 : // To increase or decrease the row height.
86 444442 : sal_uInt8 GetPropLineSpace() const { return nPropLineSpace; }
87 842 : inline void SetPropLineSpace( const sal_uInt8 nProp )
88 : {
89 842 : nPropLineSpace = nProp;
90 842 : eInterLineSpace = SVX_INTER_LINE_SPACE_PROP;
91 842 : }
92 :
93 8019 : inline SvxLineSpace &GetLineSpaceRule() { return eLineSpace; }
94 1026050 : inline SvxLineSpace GetLineSpaceRule() const { return eLineSpace; }
95 :
96 7277 : inline SvxInterLineSpace &GetInterLineSpaceRule() { return eInterLineSpace; }
97 1922399 : inline SvxInterLineSpace GetInterLineSpaceRule() const { return eInterLineSpace; }
98 :
99 : virtual sal_uInt16 GetValueCount() const;
100 : virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
101 : virtual sal_uInt16 GetEnumValue() const;
102 : virtual void SetEnumValue( sal_uInt16 nNewVal );
103 : };
104 :
105 : #endif
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|