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: usrfld.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 ************************************************************************/
40 /*--------------------------------------------------------------------
41 Beschreibung: Benutzerfelder
42 --------------------------------------------------------------------*/
44 class SW_DLLPUBLIC SwUserFieldType
: public SwValueFieldType
54 SwUserFieldType( SwDoc
* pDocPtr
, const String
& );
56 virtual const String
& GetName() const;
57 virtual SwFieldType
* Copy() const;
59 String
Expand(sal_uInt32 nFmt
, USHORT nSubType
, USHORT nLng
);
61 String
GetContent( sal_uInt32 nFmt
= 0 );
62 void SetContent( const String
& rStr
, sal_uInt32 nFmt
= 0 );
64 inline BOOL
IsValid() const;
65 inline void ChgValid( BOOL bNew
);
67 virtual void Modify( SfxPoolItem
* pOld
, SfxPoolItem
* pNew
);
69 double GetValue(SwCalc
& rCalc
); // Member nValue neu berrechnen
70 inline double GetValue() const;
71 inline void SetValue(const double nVal
);
73 inline USHORT
GetType() const;
74 inline void SetType(USHORT
);
76 BOOL
IsDeleted() const { return bDeleted
; }
77 void SetDeleted( BOOL b
) { bDeleted
= b
; }
79 virtual BOOL
QueryValue( com::sun::star::uno::Any
& rVal
, USHORT nMId
) const;
80 virtual BOOL
PutValue( const com::sun::star::uno::Any
& rVal
, USHORT nMId
);
83 inline BOOL
SwUserFieldType::IsValid() const
84 { return bValidValue
; }
86 inline void SwUserFieldType::ChgValid( BOOL bNew
)
87 { bValidValue
= bNew
; }
89 inline double SwUserFieldType::GetValue() const
92 inline void SwUserFieldType::SetValue(const double nVal
)
95 inline USHORT
SwUserFieldType::GetType() const
98 inline void SwUserFieldType::SetType(USHORT nSub
)
101 EnableFormat(!(nSub
& nsSwGetSetExpType::GSE_STRING
));
104 /*--------------------------------------------------------------------
105 Beschreibung: Benutzerfelder
106 --------------------------------------------------------------------*/
108 class SW_DLLPUBLIC SwUserField
: public SwValueField
113 SwUserField(SwUserFieldType
*, USHORT nSub
= 0, sal_uInt32 nFmt
= 0);
115 virtual USHORT
GetSubType() const;
116 virtual void SetSubType(USHORT nSub
);
118 virtual double GetValue() const;
119 virtual void SetValue( const double& rVal
);
121 virtual String
Expand() const;
122 virtual SwField
* Copy() const;
123 virtual String
GetCntnt(BOOL bName
= FALSE
) const;
125 // Name kann nicht geaendert werden
126 virtual const String
& GetPar1() const;
129 virtual String
GetPar2() const;
130 virtual void SetPar2(const String
& rStr
);
131 virtual BOOL
QueryValue( com::sun::star::uno::Any
& rVal
, USHORT nWhichId
) const;
132 virtual BOOL
PutValue( const com::sun::star::uno::Any
& rVal
, USHORT nWhichId
);
135 #endif // _USRFLD_HXX