tdf#137335 calculate paragraph height in RTF/DOCX
[LibreOffice.git] / sw / inc / IDocumentFieldsAccess.hxx
blob4ffe7779833fd091536bc665e189a20b6a49991f
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 .
20 #pragma once
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>
30 class SwFieldTypes;
31 class SwFieldType;
32 class SfxPoolItem;
33 struct SwPosition;
34 class SwDocUpdateField;
35 class SwCalc;
36 class SwTextField;
37 class SwField;
38 class SwMsgPoolItem;
39 class DateTime;
40 class SetGetExpField;
41 class SwNode;
42 class SwTable;
43 enum class SwFieldIds : sal_uInt16;
44 class SwRootFrame;
45 class IDocumentRedlineAccess;
47 namespace com::sun::star::uno { class Any; }
49 /** Document fields related interfaces
51 class IDocumentFieldsAccess
53 public:
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;
68 /**
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
74 @param rVal the value
75 @param nMId
77 @retval true putting of value was successful
78 @retval false else
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.
84 /** Updates a field.
86 @param rDstFormatField field to update
87 @param rSrcField field containing the new values
88 @param pMsgHint
89 @param bUpdateTableFields TRUE: update table fields, too.
91 @retval true update was successful
92 @retval false else
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;
140 protected:
141 virtual ~IDocumentFieldsAccess() {};
144 namespace sw {
145 bool IsFieldDeletedInModel(IDocumentRedlineAccess const& rIDRA,
146 SwTextField const& rTextField);
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */