1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
30 class SW_DLLPUBLIC SwUserFieldType
: public SwValueFieldType
40 SwUserFieldType( SwDoc
* pDocPtr
, const String
& );
42 virtual const OUString
& GetName() const;
43 virtual SwFieldType
* Copy() const;
45 String
Expand(sal_uInt32 nFmt
, sal_uInt16 nSubType
, sal_uInt16 nLng
);
47 String
GetContent( sal_uInt32 nFmt
= 0 );
48 void SetContent( const String
& rStr
, sal_uInt32 nFmt
= 0 );
50 inline bool IsValid() const;
51 inline void ChgValid( bool bNew
);
53 double GetValue(SwCalc
& rCalc
); // Recalculate member nValue.
54 inline double GetValue() const;
55 inline void SetValue(const double nVal
);
57 inline sal_uInt16
GetType() const;
58 inline void SetType(sal_uInt16
);
60 bool IsDeleted() const { return bDeleted
; }
61 void SetDeleted( bool b
) { bDeleted
= b
; }
63 virtual bool QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt16 nMId
) const;
64 virtual bool PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt16 nMId
);
67 virtual void Modify( const SfxPoolItem
* pOld
, const SfxPoolItem
* pNew
);
70 inline bool SwUserFieldType::IsValid() const
71 { return bValidValue
; }
73 inline void SwUserFieldType::ChgValid( bool bNew
)
74 { bValidValue
= bNew
; }
76 inline double SwUserFieldType::GetValue() const
79 inline void SwUserFieldType::SetValue(const double nVal
)
82 inline sal_uInt16
SwUserFieldType::GetType() const
85 inline void SwUserFieldType::SetType(sal_uInt16 nSub
)
88 EnableFormat(!(nSub
& nsSwGetSetExpType::GSE_STRING
));
92 class SW_DLLPUBLIC SwUserField
: public SwValueField
96 virtual String
Expand() const;
97 virtual SwField
* Copy() const;
100 SwUserField(SwUserFieldType
*, sal_uInt16 nSub
= 0, sal_uInt32 nFmt
= 0);
102 virtual sal_uInt16
GetSubType() const;
103 virtual void SetSubType(sal_uInt16 nSub
);
105 virtual double GetValue() const;
106 virtual void SetValue( const double& rVal
);
108 virtual String
GetFieldName() const;
110 // Name cannot be changed.
111 virtual const OUString
& GetPar1() const;
114 virtual OUString
GetPar2() const;
115 virtual void SetPar2(const OUString
& rStr
);
116 virtual bool QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt16 nWhichId
) const;
117 virtual bool PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt16 nWhichId
);
120 #endif // SW_USRFLD_HXX
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */