Teach symstore more duplicated DLLs
[LibreOffice.git] / sw / inc / usrfld.hxx
blobc297ef01340981704ae2e704142cdf388caf0749
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 INCLUDED_SW_INC_USRFLD_HXX
20 #define INCLUDED_SW_INC_USRFLD_HXX
22 #include "swdllapi.h"
23 #include "fldbas.hxx"
25 class SfxPoolItem;
26 class SwCalc;
27 class SwDoc;
29 /**
30 * The shared part of a user field.
32 * Tracks the value, but conversion between the float and string representation
33 * always happens with the system locale.
35 class SW_DLLPUBLIC SwUserFieldType final : public SwValueFieldType
37 bool m_bValidValue : 1;
38 bool m_bDeleted : 1;
39 /// Float value type.
40 double m_nValue;
41 OUString m_aName;
42 /// String value type.
43 OUString m_aContent;
44 sal_uInt16 m_nType;
46 public:
47 SwUserFieldType( SwDoc* pDocPtr, const OUString& );
49 virtual OUString GetName() const override;
50 virtual std::unique_ptr<SwFieldType> Copy() const override;
52 OUString Expand(sal_uInt32 nFormat, sal_uInt16 nSubType, LanguageType nLng);
54 OUString GetContent( sal_uInt32 nFormat = 0 );
55 void SetContent( const OUString& rStr, sal_uInt32 nFormat = 0 );
57 inline bool IsValid() const;
59 double GetValue(SwCalc& rCalc); // Recalculate member nValue.
60 inline double GetValue() const;
61 inline void SetValue(const double nVal);
63 inline sal_uInt16 GetType() const;
64 inline void SetType(sal_uInt16);
66 bool IsDeleted() const { return m_bDeleted; }
67 void SetDeleted( bool b ) { m_bDeleted = b; }
69 virtual void QueryValue( css::uno::Any& rVal, sal_uInt16 nMId ) const override;
70 virtual void PutValue( const css::uno::Any& rVal, sal_uInt16 nMId ) override;
71 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
73 private:
74 virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) override;
77 inline bool SwUserFieldType::IsValid() const
78 { return m_bValidValue; }
80 inline double SwUserFieldType::GetValue() const
81 { return m_nValue; }
83 inline void SwUserFieldType::SetValue(const double nVal)
84 { m_nValue = nVal; }
86 inline sal_uInt16 SwUserFieldType::GetType() const
87 { return m_nType; }
89 inline void SwUserFieldType::SetType(sal_uInt16 nSub)
91 m_nType = nSub;
92 EnableFormat(!(nSub & nsSwGetSetExpType::GSE_STRING));
95 /**
96 * The non-shared part of a user field.
98 * Tracks the number format and the language, conversion between the float and
99 * string representation is independent from the system locale.
101 class SwUserField final : public SwValueField
103 sal_uInt16 m_nSubType;
105 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
106 virtual std::unique_ptr<SwField> Copy() const override;
108 public:
109 SwUserField(SwUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFormat);
111 virtual sal_uInt16 GetSubType() const override;
112 virtual void SetSubType(sal_uInt16 nSub) override;
114 virtual double GetValue() const override;
115 virtual void SetValue( const double& rVal ) override;
117 virtual OUString GetFieldName() const override;
119 // Name cannot be changed.
120 virtual OUString GetPar1() const override;
122 // Content.
123 virtual OUString GetPar2() const override;
124 virtual void SetPar2(const OUString& rStr) override;
125 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhichId ) const override;
126 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhichId ) override;
127 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
130 #endif // INCLUDED_SW_INC_USRFLD_HXX
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */