Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / inc / DocumentFieldsManager.hxx
blob75f2926474c8ff9832eb814af868c591ef0c58aa
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_SOURCE_CORE_INC_DOCUMENTFIELDSMANAGER_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTFIELDSMANAGER_HXX
22 #include <IDocumentFieldsAccess.hxx>
23 #include <sal/types.h>
24 #include <memory>
26 class SwDoc;
27 class SwDBNameInfField;
29 namespace sw {
31 class DocumentFieldsManager final : public IDocumentFieldsAccess
34 public:
36 DocumentFieldsManager( SwDoc& i_rSwdoc );
38 virtual const SwFieldTypes *GetFieldTypes() const override;
39 virtual SwFieldType *InsertFieldType(const SwFieldType &) override;
40 virtual SwFieldType *GetSysFieldType( const SwFieldIds eWhich ) const override;
41 virtual SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName, bool bDbFieldMatching) const override;
42 virtual void RemoveFieldType(size_t nField) override;
43 virtual void UpdateFields(bool bCloseDB) override;
44 virtual void InsDeletedFieldType(SwFieldType &) override;
45 virtual void PutValueToField(const SwPosition & rPos, const css::uno::Any& rVal, sal_uInt16 nWhich) override;
46 virtual bool UpdateField(SwTextField* rDstFormatField, SwField& rSrcField, bool bUpdateTableFields) override;
47 virtual void UpdateRefFields() override;
48 virtual void UpdateTableFields(const SwTable* pTable) override;
49 virtual void UpdateExpFields(SwTextField* pField, bool bUpdateRefFields) override;
50 virtual void UpdateUsrFields() override;
51 virtual void UpdatePageFields(const SwTwips) override;
52 virtual void LockExpFields() override;
53 virtual void UnlockExpFields() override;
54 virtual bool IsExpFieldsLocked() const override;
55 virtual SwDocUpdateField& GetUpdateFields() const override;
56 virtual bool SetFieldsDirty(bool b, const SwNode* pChk, SwNodeOffset nLen) override;
57 virtual void SetFixFields(const DateTime* pNewDateTime) override;
58 virtual void FieldsToCalc(SwCalc& rCalc, SwNodeOffset nLastNd, sal_Int32 nLastCnt) override;
59 virtual void FieldsToCalc(SwCalc& rCalc, const SetGetExpField& rToThisField, SwRootFrame const* pLayout) override;
60 virtual void FieldsToExpand(SwHashTable<HashStr>& rTable, const SetGetExpField& rToThisField, SwRootFrame const& rLayout) override;
61 virtual bool IsNewFieldLst() const override;
62 virtual void SetNewFieldLst( bool bFlag) override;
63 virtual void InsDelFieldInFieldLst(bool bIns, const SwTextField& rField) override;
64 virtual sal_Int32 GetRecordsPerDocument() const override;
66 //Non Interface methods
68 /** Returns the field at a certain position.
69 @param rPos position to search at
70 @return pointer to field at the given position or NULL in case no field is found
72 static SwField* GetFieldAtPos(const SwPosition& rPos);
74 /** Returns the field at a certain position.
75 @param rPos position to search at
76 @return pointer to field at the given position or NULL in case no field is found
78 static SwTextField* GetTextFieldAtPos(const SwPosition& rPos);
80 bool containsUpdatableFields();
82 // Delete all unreferenced field types.
83 void GCFieldTypes();
85 void InitFieldTypes();
87 void ClearFieldTypes();
89 void UpdateDBNumFields( SwDBNameInfField& rDBField, SwCalc& rCalc );
91 virtual ~DocumentFieldsManager() override;
93 private:
95 DocumentFieldsManager(DocumentFieldsManager const&) = delete;
96 DocumentFieldsManager& operator=(DocumentFieldsManager const&) = delete;
98 void UpdateExpFieldsImpl(SwTextField* pField, SwRootFrame const* pLayout);
100 SwDoc& m_rDoc;
102 bool mbNewFieldLst; //< TRUE: Rebuild field-list.
103 std::unique_ptr<SwDocUpdateField> mpUpdateFields; //< Struct for updating fields
104 std::unique_ptr<SwFieldTypes> mpFieldTypes;
105 sal_Int8 mnLockExpField; //< If != 0 UpdateExpFields() has no effect!
109 #endif
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */