LibreOffice Module sw (master) 1
DocumentFieldsManager.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#ifndef INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTFIELDSMANAGER_HXX
20#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTFIELDSMANAGER_HXX
21
23#include <sal/types.h>
24#include <memory>
25
26class SwDoc;
28
29namespace sw {
30
32{
33
34public:
35
36 DocumentFieldsManager( SwDoc& i_rSwdoc );
37
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, SwMsgPoolItem * pMsgHint, bool bUpdateTableFields) override;
47 virtual void UpdateRefFields() override;
48 virtual void UpdateTableFields(SfxPoolItem* pHt) override;
49 virtual void UpdateExpFields(SwTextField* pField, bool bUpdateRefFields) override;
50 virtual void UpdateUsrFields() override;
51 virtual void UpdatePageFields(SfxPoolItem*) 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;
65
66 //Non Interface methods
67
72 static SwField* GetFieldAtPos(const SwPosition& rPos);
73
78 static SwTextField* GetTextFieldAtPos(const SwPosition& rPos);
79
81
82 // Delete all unreferenced field types.
83 void GCFieldTypes();
84
85 void InitFieldTypes();
86
87 void ClearFieldTypes();
88
89 void UpdateDBNumFields( SwDBNameInfField& rDBField, SwCalc& rCalc );
90
91 virtual ~DocumentFieldsManager() override;
92
93private:
94
97
98 void UpdateExpFieldsImpl(SwTextField* pField, SwRootFrame const* pLayout);
99
101
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!
106};
107
108}
109#endif
110
111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Document fields related interfaces.
Definition: calc.hxx:195
Definition: doc.hxx:192
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:242
Base class of all fields.
Definition: fldbas.hxx:292
T should be a subclass of SwHash.
Definition: calc.hxx:154
Base class of the Writer document model elements.
Definition: node.hxx:84
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
virtual bool UpdateField(SwTextField *rDstFormatField, SwField &rSrcField, SwMsgPoolItem *pMsgHint, bool bUpdateTableFields) override
Updates a field.
virtual void UnlockExpFields() override
virtual bool IsNewFieldLst() const override
virtual void UpdateUsrFields() override
Insert field type that was marked as deleted.
void UpdateDBNumFields(SwDBNameInfField &rDBField, SwCalc &rCalc)
virtual bool IsExpFieldsLocked() const override
virtual void UpdateRefFields() override
Update reference and table fields.
virtual void SetFixFields(const DateTime *pNewDateTime) override
virtual SwDocUpdateField & GetUpdateFields() const override
virtual void InsDeletedFieldType(SwFieldType &) override
virtual void FieldsToExpand(SwHashTable< HashStr > &rTable, const SetGetExpField &rToThisField, SwRootFrame const &rLayout) override
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const override
Find first type with ResId and name.
virtual void UpdateTableFields(SfxPoolItem *pHt) override
virtual void InsDelFieldInFieldLst(bool bIns, const SwTextField &rField) override
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const override
std::unique_ptr< SwFieldTypes > mpFieldTypes
DocumentFieldsManager & operator=(DocumentFieldsManager const &)=delete
virtual void PutValueToField(const SwPosition &rPos, const css::uno::Any &rVal, sal_uInt16 nWhich) override
Puts a value into a field at a certain position.
virtual void UpdateFields(bool bCloseDB) override
virtual ~DocumentFieldsManager() override
virtual const SwFieldTypes * GetFieldTypes() const override
virtual bool SetFieldsDirty(bool b, const SwNode *pChk, SwNodeOffset nLen) override
virtual sal_Int32 GetRecordsPerDocument() const override
std::unique_ptr< SwDocUpdateField > mpUpdateFields
virtual void UpdateExpFields(SwTextField *pField, bool bUpdateRefFields) override
virtual void FieldsToCalc(SwCalc &rCalc, SwNodeOffset nLastNd, sal_Int32 nLastCnt) override
DocumentFieldsManager(DocumentFieldsManager const &)=delete
void UpdateExpFieldsImpl(SwTextField *pField, SwRootFrame const *pLayout)
static SwTextField * GetTextFieldAtPos(const SwPosition &rPos)
Returns the field at a certain position.
virtual void RemoveFieldType(size_t nField) override
Remove field type.
void GCFieldTypes()
Remove all unreferenced field types of a document.
virtual void LockExpFields() override
virtual void UpdatePageFields(SfxPoolItem *) override
virtual SwFieldType * InsertFieldType(const SwFieldType &) override
Insert field types.
virtual void SetNewFieldLst(bool bFlag) override
static SwField * GetFieldAtPos(const SwPosition &rPos)
Returns the field at a certain position.
SwFieldIds
Definition: fldbas.hxx:45
Dialog to specify the properties of date form field.
Marks a position in the document model.
Definition: pam.hxx:37
signed char sal_Int8