summaryrefslogtreecommitdiff
path: root/sw/inc/IDocumentFieldsAccess.hxx
blob: 3d8f3e5db3248678dd6a7e456d0ca9d95b42487c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX
#define INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX

#include <sal/types.h>
#include <tools/solar.h>

class SwFieldTypes;
class SwFieldType;
class SfxPoolItem;
struct SwPosition;
class SwDocUpdateField;
class SwCalc;
class SwTextField;
class SwField;
class SwMsgPoolItem;
class DateTime;
class _SetGetExpField;
struct SwHash;
class SwNode;

namespace rtl { class OUString; }
using rtl::OUString;
namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }

 /** Document fields related interfaces
 */
 class IDocumentFieldsAccess
 {
 public:
    virtual const SwFieldTypes *GetFieldTypes() const = 0;

    virtual SwFieldType *InsertFieldType(const SwFieldType &) = 0;

    virtual SwFieldType *GetSysFieldType( const sal_uInt16 eWhich ) const = 0;

    virtual SwFieldType* GetFieldType(sal_uInt16 nResId, const OUString& rName, bool bDbFieldMatching) const = 0;

    virtual void RemoveFieldType(size_t nField) = 0;

    virtual void UpdateFields( SfxPoolItem* pNewHt, bool bCloseDB) = 0;

    virtual void InsDeletedFieldType(SwFieldType &) = 0;

    /**
       Puts a value into a field at a certain position.

       A missing field at the given position leads to a failure.

       @param rPosition        position of the field
       @param rVal             the value
       @param nMId

       @retval true            putting of value was successful
       @retval false           else
    */
    virtual bool PutValueToField(const SwPosition & rPos, const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich) = 0;

    // Call update of expression fields. All expressions are re-evaluated.

    /** Updates a field.

        @param rDstFormatField field to update
        @param rSrcField field containing the new values
        @param pMsgHint
        @param bUpdateTableFields TRUE: update table fields, too.

        @retval true             update was successful
        @retval false            else
    */
    virtual bool UpdateField(SwTextField * rDstFormatField, SwField & rSrcField, SwMsgPoolItem * pMsgHint, bool bUpdateTableFields) = 0;

    virtual void UpdateRefFields(SfxPoolItem* pHt) = 0;

    virtual void UpdateTableFields(SfxPoolItem* pHt) = 0;

    virtual void UpdateExpFields(SwTextField* pField, bool bUpdateRefFields) = 0;

    virtual void UpdateUsrFields() = 0;

    virtual void UpdatePageFields(SfxPoolItem*) = 0;

    virtual void LockExpFields() = 0;

    virtual void UnlockExpFields() = 0;

    virtual bool IsExpFieldsLocked() const = 0;

    virtual SwDocUpdateField& GetUpdateFields() const = 0;

    /*  @@@MAINTAINABILITY-HORROR@@@
        SwNode (see parameter pChk) is (?) part of the private
        data structure of SwDoc and should not be exposed
    */
    virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen) = 0;

    virtual void SetFixFields(bool bOnlyTimeDate, const DateTime* pNewDateTime) = 0;

    // In Calculator set all SetExpression fields that are valid up to the indicated position
    // (Node [ + ::com::sun::star::ucb::Content]).
    // A generated list of all fields may be passed along too
    // (if the addreess != 0 and the pointer == 0 a new list will be returned).
    virtual void FieldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt) = 0;

    virtual void FieldsToCalc(SwCalc& rCalc, const _SetGetExpField& rToThisField) = 0;

    virtual void FieldsToExpand(SwHash**& ppTable, sal_uInt16& rTableSize, const _SetGetExpField& rToThisField) = 0;

    virtual bool IsNewFieldLst() const = 0;

    virtual void SetNewFieldLst( bool bFlag) = 0;

    virtual void InsDelFieldInFieldLst(bool bIns, const SwTextField& rField) = 0;

protected:
    virtual ~IDocumentFieldsAccess() {};
 };

#endif // INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */