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 20 #ifndef INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX 21 #define INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX 22 23 #include <sal/types.h> 24 #include <tools/solar.h> 25 26 class SwFieldTypes; 27 class SwFieldType; 28 class SfxPoolItem; 29 struct SwPosition; 30 class SwDocUpdateField; 31 class SwCalc; 32 class SwTextField; 33 class SwField; 34 class SwMsgPoolItem; 35 class DateTime; 36 class SetGetExpField; 37 class SwNode; 38 enum class SwFieldIds : sal_uInt16; 39 template <class T> class SwHashTable; 40 struct HashStr; 41 class SwRootFrame; 42 class IDocumentRedlineAccess; 43 44 namespace rtl { class OUString; } 45 using rtl::OUString; 46 namespace com { namespace sun { namespace star { namespace uno { class Any; } } } } 47 48 /** Document fields related interfaces 49 */ 50 class IDocumentFieldsAccess 51 { 52 public: 53 virtual const SwFieldTypes *GetFieldTypes() const = 0; 54 55 virtual SwFieldType *InsertFieldType(const SwFieldType &) = 0; 56 57 virtual SwFieldType *GetSysFieldType( const SwFieldIds eWhich ) const = 0; 58 59 virtual SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName, bool bDbFieldMatching) const = 0; 60 61 virtual void RemoveFieldType(size_t nField) = 0; 62 63 virtual void UpdateFields(bool bCloseDB) = 0; 64 65 virtual void InsDeletedFieldType(SwFieldType &) = 0; 66 67 /** 68 Puts a value into a field at a certain position. 69 70 A missing field at the given position leads to a failure. 71 72 @param rPosition position of the field 73 @param rVal the value 74 @param nMId 75 76 @retval true putting of value was successful 77 @retval false else 78 */ 79 virtual void PutValueToField(const SwPosition & rPos, const css::uno::Any& rVal, sal_uInt16 nWhich) = 0; 80 81 // Call update of expression fields. All expressions are re-evaluated. 82 83 /** Updates a field. 84 85 @param rDstFormatField field to update 86 @param rSrcField field containing the new values 87 @param pMsgHint 88 @param bUpdateTableFields TRUE: update table fields, too. 89 90 @retval true update was successful 91 @retval false else 92 */ 93 virtual bool UpdateField(SwTextField * rDstFormatField, SwField & rSrcField, SwMsgPoolItem * pMsgHint, bool bUpdateTableFields) = 0; 94 95 virtual void UpdateRefFields() = 0; 96 97 virtual void UpdateTableFields(SfxPoolItem* pHt) = 0; 98 99 virtual void UpdateExpFields(SwTextField* pField, bool bUpdateRefFields) = 0; 100 101 virtual void UpdateUsrFields() = 0; 102 103 virtual void UpdatePageFields(SfxPoolItem*) = 0; 104 105 virtual void LockExpFields() = 0; 106 107 virtual void UnlockExpFields() = 0; 108 109 virtual bool IsExpFieldsLocked() const = 0; 110 111 virtual SwDocUpdateField& GetUpdateFields() const = 0; 112 113 /* @@@MAINTAINABILITY-HORROR@@@ 114 SwNode (see parameter pChk) is (?) part of the private 115 data structure of SwDoc and should not be exposed 116 */ 117 virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen) = 0; 118 119 virtual void SetFixFields(const DateTime* pNewDateTime) = 0; 120 121 // In Calculator set all SetExpression fields that are valid up to the indicated position 122 // (Node [ + css::ucb::Content]). 123 // A generated list of all fields may be passed along too 124 // (if the address != 0 and the pointer == 0 a new list will be returned). 125 virtual void FieldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt) = 0; 126 127 virtual void FieldsToCalc(SwCalc& rCalc, const SetGetExpField& rToThisField, SwRootFrame const* pLayout) = 0; 128 129 virtual void FieldsToExpand(SwHashTable<HashStr> & rTable, const SetGetExpField& rToThisField, SwRootFrame const& rLayout) = 0; 130 131 virtual bool IsNewFieldLst() const = 0; 132 133 virtual void SetNewFieldLst( bool bFlag) = 0; 134 135 virtual void InsDelFieldInFieldLst(bool bIns, const SwTextField& rField) = 0; 136 137 virtual sal_Int32 GetRecordsPerDocument() const = 0; 138 139 protected: ~IDocumentFieldsAccess()140 virtual ~IDocumentFieldsAccess() {}; 141 }; 142 143 namespace sw { 144 bool IsFieldDeletedInModel(IDocumentRedlineAccess const& rIDRA, 145 SwTextField const& rTextField); 146 } 147 148 #endif // INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX 149 150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 151