1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: lrspitem.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SVX_LRSPITEM_HXX
31 #define _SVX_LRSPITEM_HXX
33 // include ---------------------------------------------------------------
35 #ifndef _SFXPOOLITEM_HXX //autogen
36 #include <bf_svtools/poolitem.hxx>
38 #ifndef _SVX_SVXIDS_HRC
39 #include <bf_svx/svxids.hrc>
48 // class SvxLRSpaceItem --------------------------------------------------
52 Linker/Rechter Rand sowie Erstzeileneinzug
54 SvxLRSpaceItem bietet zwei Schnittstellen zur Befragung des linken
55 Randes und des Erstzeileneinzuges an. Die Get-Methoden liefern
56 die Member zurueck, wie sie das Layout bisher auch erwartete:
57 Der linke Rand verschiebt sich beim negativem Erstzeileneinzug
58 nach links. Die SetTxt/GetTxt-Methoden setzen voraus, dass der
59 linke Rand der 0-Punkt des Erstzeileneinzugs darstellt:
61 UI UI LAYOUT UI/TEXT UI/TEXT (Wo?)
62 SetTxtLeft SetTxtFirst GetLeft GetTxtLeft GetTxtFirst (Was?)
63 500 -500 0 500 -500 (Wieviel?)
69 #define LRSPACE_16_VERSION ((USHORT)0x0001)
70 #define LRSPACE_TXTLEFT_VERSION ((USHORT)0x0002)
71 #define LRSPACE_AUTOFIRST_VERSION ((USHORT)0x0003)
72 #define LRSPACE_NEGATIVE_VERSION ((USHORT)0x0004)
74 class SvxLRSpaceItem
: public SfxPoolItem
76 short nFirstLineOfst
; // Erstzeileneinzug _immer_ relativ zu nTxtLeft
77 long nTxtLeft
; // wir spendieren einen USHORT
78 long nLeftMargin
; // nLeft oder der neg. Erstzeileneinzug
79 long nRightMargin
; // der unproblematische rechte Rand
81 USHORT nPropFirstLineOfst
, nPropLeftMargin
, nPropRightMargin
;
82 BOOL bAutoFirst
: 1; // Automatische Berechnung der Erstzeileneinzugs
83 BOOL bBulletFI
: 1; // FI = Bullet...
85 void AdjustLeft(); // nLeftMargin und nTxtLeft werden angepasst.
90 SvxLRSpaceItem( const USHORT nId
= ITEMID_LRSPACE
);
91 SvxLRSpaceItem( const long nLeft
, const long nRight
,
92 const long nTLeft
= 0, const short nOfset
= 0,
93 const USHORT nId
= ITEMID_LRSPACE
);
94 inline SvxLRSpaceItem
& operator=( const SvxLRSpaceItem
&rCpy
);
96 // "pure virtual Methoden" vom SfxPoolItem
97 virtual int operator==( const SfxPoolItem
& ) const;
99 virtual sal_Bool
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 ) const;
100 virtual sal_Bool
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 );
103 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
104 virtual SfxPoolItem
* Create(SvStream
&, USHORT
) const;
105 virtual SvStream
& Store(SvStream
&, USHORT nItemVersion
) const;
106 virtual USHORT
GetVersion( USHORT nFileVersion
) const;
108 // Die "Layout-Schnittstelle":
109 inline void SetLeft ( const long nL
, const USHORT nProp
= 100 );
110 inline void SetRight( const long nR
, const USHORT nProp
= 100 );
112 // abfragen / direktes setzen der absoluten Werte
113 inline long GetLeft() const { return nLeftMargin
; }
114 inline long GetRight() const { return nRightMargin
;}
115 inline void SetLeftValue( const long nL
) { nTxtLeft
= nLeftMargin
= nL
; }
116 inline void SetRightValue( const long nR
) { nRightMargin
= nR
; }
117 inline BOOL
IsAutoFirst() const { return bAutoFirst
; }
118 inline void SetAutoFirst( const BOOL bNew
) { bAutoFirst
= bNew
; }
120 // abfragen / setzen der Prozent-Werte
121 inline void SetPropLeft( const USHORT nProp
= 100 )
122 { nPropLeftMargin
= nProp
; }
123 inline void SetPropRight( const USHORT nProp
= 100 )
124 { nPropRightMargin
= nProp
;}
125 inline USHORT
GetPropLeft() const { return nPropLeftMargin
; }
126 inline USHORT
GetPropRight() const { return nPropRightMargin
;}
128 // Die "UI/Text-Schnittstelle":
129 inline void SetTxtLeft( const long nL
, const USHORT nProp
= 100 );
130 inline long GetTxtLeft() const { return nTxtLeft
; }
132 inline void SetTxtFirstLineOfst( const short nF
, const USHORT nProp
= 100 );
133 inline short GetTxtFirstLineOfst() const { return nFirstLineOfst
; }
134 inline void SetPropTxtFirstLineOfst( const USHORT nProp
= 100 )
135 { nPropFirstLineOfst
= nProp
; }
136 inline USHORT
GetPropTxtFirstLineOfst() const
137 { return nPropFirstLineOfst
; }
138 inline void SetTxtFirstLineOfstValue( const short nValue
)
139 { nFirstLineOfst
= nValue
; }
141 // Outliner-Umstellung...
142 void SetBulletFI( BOOL b
) { bBulletFI
= b
; }
143 BOOL
IsBulletFI() const { return bBulletFI
; }
146 inline SvxLRSpaceItem
&SvxLRSpaceItem::operator=( const SvxLRSpaceItem
&rCpy
)
148 nFirstLineOfst
= rCpy
.nFirstLineOfst
;
149 nTxtLeft
= rCpy
.nTxtLeft
;
150 nLeftMargin
= rCpy
.nLeftMargin
;
151 nRightMargin
= rCpy
.nRightMargin
;
152 nPropFirstLineOfst
= rCpy
.nPropFirstLineOfst
;
153 nPropLeftMargin
= rCpy
.nPropLeftMargin
;
154 nPropRightMargin
= rCpy
.nPropRightMargin
;
155 bBulletFI
= rCpy
.bBulletFI
;
156 bAutoFirst
= rCpy
.bAutoFirst
;
160 inline void SvxLRSpaceItem::SetLeft( const long nL
, const USHORT nProp
)
162 nLeftMargin
= (nL
* nProp
) / 100;
163 nTxtLeft
= nLeftMargin
;
164 nPropLeftMargin
= nProp
;
166 inline void SvxLRSpaceItem::SetRight( const long nR
, const USHORT nProp
)
168 nRightMargin
= (nR
* nProp
) / 100;
169 nPropRightMargin
= nProp
;
171 inline void SvxLRSpaceItem::SetTxtFirstLineOfst( const short nF
,
174 nFirstLineOfst
= short((long(nF
) * nProp
) / 100);
175 nPropFirstLineOfst
= nProp
;
179 inline void SvxLRSpaceItem::SetTxtLeft( const long nL
, const USHORT nProp
)
181 nTxtLeft
= (nL
* nProp
) / 100;
182 nPropLeftMargin
= nProp
;
186 }//end of namespace binfilter