Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / IDocumentFieldsAccess.hxx
blob3d8f3e5db3248678dd6a7e456d0ca9d95b42487c
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 #ifndef INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX
21 #define INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX
23 #include <sal/types.h>
24 #include <tools/solar.h>
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 struct SwHash;
38 class SwNode;
40 namespace rtl { class OUString; }
41 using rtl::OUString;
42 namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
44 /** Document fields related interfaces
46 class IDocumentFieldsAccess
48 public:
49 virtual const SwFieldTypes *GetFieldTypes() const = 0;
51 virtual SwFieldType *InsertFieldType(const SwFieldType &) = 0;
53 virtual SwFieldType *GetSysFieldType( const sal_uInt16 eWhich ) const = 0;
55 virtual SwFieldType* GetFieldType(sal_uInt16 nResId, const OUString& rName, bool bDbFieldMatching) const = 0;
57 virtual void RemoveFieldType(size_t nField) = 0;
59 virtual void UpdateFields( SfxPoolItem* pNewHt, bool bCloseDB) = 0;
61 virtual void InsDeletedFieldType(SwFieldType &) = 0;
63 /**
64 Puts a value into a field at a certain position.
66 A missing field at the given position leads to a failure.
68 @param rPosition position of the field
69 @param rVal the value
70 @param nMId
72 @retval true putting of value was successful
73 @retval false else
75 virtual bool PutValueToField(const SwPosition & rPos, const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich) = 0;
77 // Call update of expression fields. All expressions are re-evaluated.
79 /** Updates a field.
81 @param rDstFormatField field to update
82 @param rSrcField field containing the new values
83 @param pMsgHint
84 @param bUpdateTableFields TRUE: update table fields, too.
86 @retval true update was successful
87 @retval false else
89 virtual bool UpdateField(SwTextField * rDstFormatField, SwField & rSrcField, SwMsgPoolItem * pMsgHint, bool bUpdateTableFields) = 0;
91 virtual void UpdateRefFields(SfxPoolItem* pHt) = 0;
93 virtual void UpdateTableFields(SfxPoolItem* pHt) = 0;
95 virtual void UpdateExpFields(SwTextField* pField, bool bUpdateRefFields) = 0;
97 virtual void UpdateUsrFields() = 0;
99 virtual void UpdatePageFields(SfxPoolItem*) = 0;
101 virtual void LockExpFields() = 0;
103 virtual void UnlockExpFields() = 0;
105 virtual bool IsExpFieldsLocked() const = 0;
107 virtual SwDocUpdateField& GetUpdateFields() const = 0;
109 /* @@@MAINTAINABILITY-HORROR@@@
110 SwNode (see parameter pChk) is (?) part of the private
111 data structure of SwDoc and should not be exposed
113 virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen) = 0;
115 virtual void SetFixFields(bool bOnlyTimeDate, const DateTime* pNewDateTime) = 0;
117 // In Calculator set all SetExpression fields that are valid up to the indicated position
118 // (Node [ + ::com::sun::star::ucb::Content]).
119 // A generated list of all fields may be passed along too
120 // (if the addreess != 0 and the pointer == 0 a new list will be returned).
121 virtual void FieldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt) = 0;
123 virtual void FieldsToCalc(SwCalc& rCalc, const _SetGetExpField& rToThisField) = 0;
125 virtual void FieldsToExpand(SwHash**& ppTable, sal_uInt16& rTableSize, const _SetGetExpField& rToThisField) = 0;
127 virtual bool IsNewFieldLst() const = 0;
129 virtual void SetNewFieldLst( bool bFlag) = 0;
131 virtual void InsDelFieldInFieldLst(bool bIns, const SwTextField& rField) = 0;
133 protected:
134 virtual ~IDocumentFieldsAccess() {};
137 #endif // INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */