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