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 .
19 #ifndef INCLUDED_SW_INC_USRFLD_HXX
20 #define INCLUDED_SW_INC_USRFLD_HXX
29 class SW_DLLPUBLIC SwUserFieldType
: public SwValueFieldType
39 SwUserFieldType( SwDoc
* pDocPtr
, const OUString
& );
41 virtual OUString
GetName() const SAL_OVERRIDE
;
42 virtual SwFieldType
* Copy() const SAL_OVERRIDE
;
44 OUString
Expand(sal_uInt32 nFormat
, sal_uInt16 nSubType
, sal_uInt16 nLng
);
46 OUString
GetContent( sal_uInt32 nFormat
= 0 );
47 void SetContent( const OUString
& rStr
, sal_uInt32 nFormat
= 0 );
49 inline bool IsValid() const;
50 inline void ChgValid( bool bNew
);
52 double GetValue(SwCalc
& rCalc
); // Recalculate member nValue.
53 inline double GetValue() const;
54 inline void SetValue(const double nVal
);
56 inline sal_uInt16
GetType() const;
57 inline void SetType(sal_uInt16
);
59 bool IsDeleted() const { return bDeleted
; }
60 void SetDeleted( bool b
) { bDeleted
= b
; }
62 virtual bool QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt16 nMId
) const SAL_OVERRIDE
;
63 virtual bool PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt16 nMId
) SAL_OVERRIDE
;
66 virtual void Modify( const SfxPoolItem
* pOld
, const SfxPoolItem
* pNew
) SAL_OVERRIDE
;
69 inline bool SwUserFieldType::IsValid() const
70 { return bValidValue
; }
72 inline void SwUserFieldType::ChgValid( bool bNew
)
73 { bValidValue
= bNew
; }
75 inline double SwUserFieldType::GetValue() const
78 inline void SwUserFieldType::SetValue(const double nVal
)
81 inline sal_uInt16
SwUserFieldType::GetType() const
84 inline void SwUserFieldType::SetType(sal_uInt16 nSub
)
87 EnableFormat(!(nSub
& nsSwGetSetExpType::GSE_STRING
));
90 class SW_DLLPUBLIC SwUserField
: public SwValueField
94 virtual OUString
Expand() const SAL_OVERRIDE
;
95 virtual SwField
* Copy() const SAL_OVERRIDE
;
98 SwUserField(SwUserFieldType
*, sal_uInt16 nSub
= 0, sal_uInt32 nFormat
= 0);
100 virtual sal_uInt16
GetSubType() const SAL_OVERRIDE
;
101 virtual void SetSubType(sal_uInt16 nSub
) SAL_OVERRIDE
;
103 virtual double GetValue() const SAL_OVERRIDE
;
104 virtual void SetValue( const double& rVal
) SAL_OVERRIDE
;
106 virtual OUString
GetFieldName() const SAL_OVERRIDE
;
108 // Name cannot be changed.
109 virtual OUString
GetPar1() const SAL_OVERRIDE
;
112 virtual OUString
GetPar2() const SAL_OVERRIDE
;
113 virtual void SetPar2(const OUString
& rStr
) SAL_OVERRIDE
;
114 virtual bool QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt16 nWhichId
) const SAL_OVERRIDE
;
115 virtual bool PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt16 nWhichId
) SAL_OVERRIDE
;
118 #endif // INCLUDED_SW_INC_USRFLD_HXX
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */