LibreOffice Module sw (master)  1
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
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 .
18  */
23 #include <sal/types.h>
24 #include <memory>
26 class SwDoc;
27 class SwDBNameInfField;
29 namespace sw {
32 {
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, 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, sal_uLong nLen) override;
57  virtual void SetFixFields(const DateTime* pNewDateTime) override;
58  virtual void FieldsToCalc(SwCalc& rCalc, sal_uLong 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
72  static SwField* GetFieldAtPos(const SwPosition& rPos);
78  static SwTextField* GetTextFieldAtPos(const SwPosition& rPos);
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:
98  void UpdateExpFieldsImpl(SwTextField* pField, SwRootFrame const* pLayout);
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 };
108 }
109 #endif
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool UpdateField(SwTextField *rDstFormatField, SwField &rSrcField, SwMsgPoolItem *pMsgHint, bool bUpdateTableFields) override
Updates a field.
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:240
std::unique_ptr< SwFieldTypes > mpFieldTypes
Definition: calc.hxx:184
virtual void UpdateExpFields(SwTextField *pField, bool bUpdateRefFields) override
Marks a position in the document model.
Definition: pam.hxx:35
virtual bool IsNewFieldLst() const override
virtual void UpdateRefFields() override
Update reference and table fields.
virtual void LockExpFields() override
DocumentFieldsManager & operator=(DocumentFieldsManager const &)=delete
virtual void SetNewFieldLst(bool bFlag) override
virtual SwFieldType * InsertFieldType(const SwFieldType &) override
Insert field types.
signed char sal_Int8
sal_uIntPtr sal_uLong
Base class of all fields.
Definition: fldbas.hxx:293
virtual void SetFixFields(const DateTime *pNewDateTime) override
Definition: doc.hxx:184
static SwField * GetFieldAtPos(const SwPosition &rPos)
Returns the field at a certain position.
Dialog to specify the properties of date form field.
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
virtual void UpdatePageFields(SfxPoolItem *) override
void UpdateExpFieldsImpl(SwTextField *pField, SwRootFrame const *pLayout)
virtual void UpdateFields(bool bCloseDB) override
virtual void UpdateTableFields(SfxPoolItem *pHt) override
virtual bool IsExpFieldsLocked() const override
virtual SwDocUpdateField & GetUpdateFields() const override
static SwTextField * GetTextFieldAtPos(const SwPosition &rPos)
Returns the field at a certain position.
virtual void RemoveFieldType(size_t nField) override
Remove field type.
virtual bool SetFieldsDirty(bool b, const SwNode *pChk, sal_uLong nLen) override
virtual ~DocumentFieldsManager() override
Document fields related interfaces.
Definition: fldbas.hxx:44
virtual void FieldsToExpand(SwHashTable< HashStr > &rTable, const SetGetExpField &rToThisField, SwRootFrame const &rLayout) override
virtual void FieldsToCalc(SwCalc &rCalc, sal_uLong nLastNd, sal_Int32 nLastCnt) override
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const override
Find first type with ResId and name.
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const override
virtual void UnlockExpFields() override
void UpdateDBNumFields(SwDBNameInfField &rDBField, SwCalc &rCalc)
virtual const SwFieldTypes * GetFieldTypes() const override
virtual sal_Int32 GetRecordsPerDocument() const override
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.
std::unique_ptr< SwDocUpdateField > mpUpdateFields
void GCFieldTypes()
Remove all unreferenced field types of a document.
virtual void InsDeletedFieldType(SwFieldType &) override
T should be a subclass of SwHash.
Definition: calc.hxx:143
virtual void InsDelFieldInFieldLst(bool bIns, const SwTextField &rField) override
virtual void UpdateUsrFields() override
Insert field type that was marked as deleted.
Base class of the Writer document model elements.
Definition: node.hxx:79