merge the formfield patch from ooo-build
[ooovba.git] / sw / inc / usrfld.hxx
blobe2695c40c51efc7fa594673e27d225213eacdcbd
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: usrfld.hxx,v $
10 * $Revision: 1.8 $
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 _USRFLD_HXX
31 #define _USRFLD_HXX
33 #include "swdllapi.h"
34 #include "fldbas.hxx"
36 class SfxPoolItem;
37 class SwCalc;
38 class SwDoc;
40 /*--------------------------------------------------------------------
41 Beschreibung: Benutzerfelder
42 --------------------------------------------------------------------*/
44 class SW_DLLPUBLIC SwUserFieldType : public SwValueFieldType
46 BOOL bValidValue : 1;
47 BOOL bDeleted : 1;
48 double nValue;
49 String aName;
50 String aContent;
51 USHORT nType;
53 public:
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
90 { return nValue; }
92 inline void SwUserFieldType::SetValue(const double nVal)
93 { nValue = nVal; }
95 inline USHORT SwUserFieldType::GetType() const
96 { return nType; }
98 inline void SwUserFieldType::SetType(USHORT nSub)
100 nType = nSub;
101 EnableFormat(!(nSub & nsSwGetSetExpType::GSE_STRING));
104 /*--------------------------------------------------------------------
105 Beschreibung: Benutzerfelder
106 --------------------------------------------------------------------*/
108 class SW_DLLPUBLIC SwUserField : public SwValueField
110 USHORT nSubType;
112 public:
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;
128 // Inhalt
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