bump product version to 4.1.6.2
[LibreOffice.git] / sw / inc / usrfld.hxx
blob85fe469775a787d3e2b10007b2df0bd0e0404106
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 SW_USRFLD_HXX
20 #define SW_USRFLD_HXX
22 #include "swdllapi.h"
23 #include "fldbas.hxx"
25 class SfxPoolItem;
26 class SwCalc;
27 class SwDoc;
30 class SW_DLLPUBLIC SwUserFieldType : public SwValueFieldType
32 bool bValidValue : 1;
33 bool bDeleted : 1;
34 double nValue;
35 OUString aName;
36 String aContent;
37 sal_uInt16 nType;
39 public:
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 );
66 protected:
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
77 { return nValue; }
79 inline void SwUserFieldType::SetValue(const double nVal)
80 { nValue = nVal; }
82 inline sal_uInt16 SwUserFieldType::GetType() const
83 { return nType; }
85 inline void SwUserFieldType::SetType(sal_uInt16 nSub)
87 nType = nSub;
88 EnableFormat(!(nSub & nsSwGetSetExpType::GSE_STRING));
92 class SW_DLLPUBLIC SwUserField : public SwValueField
94 sal_uInt16 nSubType;
96 virtual String Expand() const;
97 virtual SwField* Copy() const;
99 public:
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;
113 // Content.
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: */