1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <sal/config.h>
24 #include <rtl/ustring.hxx>
25 #include <sal/types.h>
26 #include "swtypes.hxx"
27 #include "nodeoffset.hxx"
28 #include <unordered_map>
34 class SwDocUpdateField
;
43 enum class SwFieldIds
: sal_uInt16
;
45 class IDocumentRedlineAccess
;
47 namespace com::sun::star::uno
{ class Any
; }
49 /** Document fields related interfaces
51 class IDocumentFieldsAccess
54 virtual const SwFieldTypes
*GetFieldTypes() const = 0;
56 virtual SwFieldType
*InsertFieldType(const SwFieldType
&) = 0;
58 virtual SwFieldType
*GetSysFieldType( const SwFieldIds eWhich
) const = 0;
60 virtual SwFieldType
* GetFieldType(SwFieldIds nResId
, const OUString
& rName
, bool bDbFieldMatching
) const = 0;
62 virtual void RemoveFieldType(size_t nField
) = 0;
64 virtual void UpdateFields(bool bCloseDB
) = 0;
66 virtual void InsDeletedFieldType(SwFieldType
&) = 0;
69 Puts a value into a field at a certain position.
71 A missing field at the given position leads to a failure.
73 @param rPosition position of the field
77 @retval true putting of value was successful
80 virtual void PutValueToField(const SwPosition
& rPos
, const css::uno::Any
& rVal
, sal_uInt16 nWhich
) = 0;
82 // Call update of expression fields. All expressions are re-evaluated.
86 @param rDstFormatField field to update
87 @param rSrcField field containing the new values
89 @param bUpdateTableFields TRUE: update table fields, too.
91 @retval true update was successful
94 virtual bool UpdateField(SwTextField
* rDstFormatField
, SwField
& rSrcField
, bool bUpdateTableFields
) = 0;
96 virtual void UpdateRefFields() = 0;
98 virtual void UpdateTableFields(const SwTable
* pTable
) = 0;
100 virtual void UpdateExpFields(SwTextField
* pField
, bool bUpdateRefFields
) = 0;
102 virtual void UpdateUsrFields() = 0;
104 virtual void UpdatePageFields(const SwTwips
) = 0;
106 virtual void LockExpFields() = 0;
108 virtual void UnlockExpFields() = 0;
110 virtual bool IsExpFieldsLocked() const = 0;
112 virtual SwDocUpdateField
& GetUpdateFields() const = 0;
114 /* @@@MAINTAINABILITY-HORROR@@@
115 SwNode (see parameter pChk) is (?) part of the private
116 data structure of SwDoc and should not be exposed
118 virtual bool SetFieldsDirty(bool b
, const SwNode
* pChk
, SwNodeOffset nLen
) = 0;
120 virtual void SetFixFields(const DateTime
* pNewDateTime
) = 0;
122 // In Calculator set all SetExpression fields that are valid up to the indicated position
123 // (Node [ + css::ucb::Content]).
124 // A generated list of all fields may be passed along too
125 // (if the address != 0 and the pointer == 0 a new list will be returned).
126 virtual void FieldsToCalc(SwCalc
& rCalc
, SwNodeOffset nLastNd
, sal_Int32 nLastCnt
) = 0;
128 virtual void FieldsToCalc(SwCalc
& rCalc
, const SetGetExpField
& rToThisField
, SwRootFrame
const* pLayout
) = 0;
130 virtual void FieldsToExpand(std::unordered_map
<OUString
,OUString
> & rTable
, const SetGetExpField
& rToThisField
, SwRootFrame
const& rLayout
) = 0;
132 virtual bool IsNewFieldLst() const = 0;
134 virtual void SetNewFieldLst( bool bFlag
) = 0;
136 virtual void InsDelFieldInFieldLst(bool bIns
, const SwTextField
& rField
) = 0;
138 virtual sal_Int32
GetRecordsPerDocument() const = 0;
141 virtual ~IDocumentFieldsAccess() {};
145 bool IsFieldDeletedInModel(IDocumentRedlineAccess
const& rIDRA
,
146 SwTextField
const& rTextField
);
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */