LibreOffice Module sw (master) 1
fmtfld.hxx
Go to the documentation of this file.
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_FMTFLD_HXX
21#define INCLUDED_SW_INC_FMTFLD_HXX
22
24#include <svl/poolitem.hxx>
26#include <com/sun/star/text/XTextField.hpp>
27
28#include "swdllapi.h"
29#include "calbck.hxx"
30#include "reffld.hxx"
31#include "nodeoffset.hxx"
32
33class SwField;
34class SwTextField;
35class SwView;
36class SwFieldType;
37class SwDDETable;
38class SwFormatField;
40
41namespace sw {
45 FindFormatForFieldHint(const SwField* pField, SwFormatField*& rpFormat) : m_pField(pField), m_rpFormat(rpFormat) {};
46 };
48 const sal_uInt32 m_nPostItId;
50 FindFormatForPostItIdHint(const sal_uInt32 nPostItId, SwFormatField*& rpFormat) : m_nPostItId(nPostItId), m_rpFormat(rpFormat) {};
51 };
52 struct CollectPostItsHint final : SfxHint {
53 std::vector<SwFormatField*>& m_rvFormatFields;
55 const bool m_bHideRedlines;
56 CollectPostItsHint(std::vector<SwFormatField*>& rvFormatFields, IDocumentRedlineAccess const& rIDRA, bool bHideRedlines) : m_rvFormatFields(rvFormatFields), m_rIDRA(rIDRA), m_bHideRedlines(bHideRedlines) {};
57 };
60 HasHiddenInformationNotesHint(bool& rbHasHiddenInformationNotes) : m_rbHasHiddenInformationNotes(rbHasHiddenInformationNotes) {};
61 };
63 std::vector<SwNodeOffset>& m_rvNodeIndex;
64 GatherNodeIndexHint(std::vector<SwNodeOffset>& rvNodeIndex) : m_rvNodeIndex(rvNodeIndex) {};
65 };
67 std::vector<SwGetRefField*>& m_rvRFields;
68 const sal_uInt16 m_nType;
69 GatherRefFieldsHint(std::vector<SwGetRefField*>& rvRFields, const sal_uInt16 nType) : m_rvRFields(rvRFields), m_nType(nType) {};
70 };
71 struct GatherFieldsHint final : SfxHint {
73 std::vector<SwFormatField*>& m_rvFields;
74 GatherFieldsHint(std::vector<SwFormatField*>& rvFields, bool bCollectOnlyInDocNodes = true) : m_bCollectOnlyInDocNodes(bCollectOnlyInDocNodes), m_rvFields(rvFields) {};
75 };
77 std::vector<SwDDETable*>& m_rvTables;
78 GatherDdeTablesHint(std::vector<SwDDETable*>& rvTables) : m_rvTables(rvTables) {};
79 };
80}
81
82
83// ATT_FLD
85 : public SfxPoolItem
87 , public SfxBroadcaster
88{
89 friend void InitCore();
90 SwFormatField( sal_uInt16 nWhich ); // for default-Attribute
91
92 css::uno::WeakReference<css::text::XTextField> m_wXTextField;
93
94 std::unique_ptr<SwField> mpField;
95 SwTextField* mpTextField; // the TextAttribute
96
97 virtual void SwClientNotify( const SwModify& rModify, const SfxHint& rHint ) override;
98
99public:
100
102 explicit SwFormatField( const SwField &rField );
103
104 SwFormatField( const SwFormatField& rAttr );
105
106 virtual ~SwFormatField() override;
107
109 virtual bool operator==( const SfxPoolItem& ) const override;
110 virtual SwFormatField* Clone( SfxItemPool* pPool = nullptr ) const override;
111
112 virtual bool GetInfo( SfxPoolItem& rInfo ) const override;
113
114 void InvalidateField();
115
116 const SwField* GetField() const
117 {
118 return mpField.get();
119 }
121 {
122 return mpField.get();
123 }
124
132 void SetField( std::unique_ptr<SwField> pField );
133
135 {
136 return mpTextField;
137 }
139 {
140 return mpTextField;
141 }
142 void SetTextField( SwTextField& rTextField );
143 void ClearTextField();
144
145 void RegisterToFieldType( SwFieldType& );
146 bool IsFieldInDoc() const;
147 bool IsProtect() const;
148
149 SAL_DLLPRIVATE css::uno::WeakReference<css::text::XTextField> const& GetXTextField() const
150 { return m_wXTextField; }
151 SAL_DLLPRIVATE void SetXTextField(css::uno::Reference<css::text::XTextField> const& xTextField)
152 { m_wXTextField = xTextField; }
153 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
154
155 void UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* pNew);
156};
157
159{
160 INSERTED = 1,
161 REMOVED = 2,
162 FOCUS = 3,
163 CHANGED = 4,
164 LANGUAGE = 5,
165 RESOLVED = 6
166};
167
169{
173
174public:
175 SwFormatFieldHint( const SwFormatField* pField, SwFormatFieldHintWhich nWhich, const SwView* pView = nullptr)
176 : m_pField(pField)
177 , m_nWhich(nWhich)
178 , m_pView(pView)
179 {}
180
181 const SwFormatField* GetField() const { return m_pField; }
183 const SwView* GetView() const { return m_pView; }
184};
185
186#endif
187
188/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _xmlTextWriter * xmlTextWriterPtr
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
virtual bool operator==(const SfxPoolItem &) const=0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
sal_uInt16 m_nWhich
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:242
Base class of all fields.
Definition: fldbas.hxx:292
const SwView * GetView() const
Definition: fmtfld.hxx:183
const SwView * m_pView
Definition: fmtfld.hxx:172
SwFormatFieldHintWhich Which() const
Definition: fmtfld.hxx:182
SwFormatFieldHintWhich m_nWhich
Definition: fmtfld.hxx:171
const SwFormatField * m_pField
Definition: fmtfld.hxx:170
const SwFormatField * GetField() const
Definition: fmtfld.hxx:181
SwFormatFieldHint(const SwFormatField *pField, SwFormatFieldHintWhich nWhich, const SwView *pView=nullptr)
Definition: fmtfld.hxx:175
css::uno::WeakReference< css::text::XTextField > m_wXTextField
Definition: fmtfld.hxx:92
SAL_DLLPRIVATE void SetXTextField(css::uno::Reference< css::text::XTextField > const &xTextField)
Definition: fmtfld.hxx:151
const SwField * GetField() const
Definition: fmtfld.hxx:116
std::unique_ptr< SwField > mpField
Definition: fmtfld.hxx:94
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:134
SwField * GetField()
Definition: fmtfld.hxx:120
SwTextField * GetTextField()
Definition: fmtfld.hxx:138
SAL_DLLPRIVATE css::uno::WeakReference< css::text::XTextField > const & GetXTextField() const
Definition: fmtfld.hxx:149
SwTextField * mpTextField
Definition: fmtfld.hxx:95
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: calbck.cxx:303
virtual bool GetInfo(SfxPoolItem &) const override
Definition: calbck.cxx:161
Definition: view.hxx:145
SwFormatFieldHintWhich
Definition: fmtfld.hxx:159
void InitCore()
Definition: init.cxx:449
Dialog to specify the properties of date form field.
QPRO_FUNC_TYPE nType
const bool m_bHideRedlines
Definition: fmtfld.hxx:55
CollectPostItsHint(std::vector< SwFormatField * > &rvFormatFields, IDocumentRedlineAccess const &rIDRA, bool bHideRedlines)
Definition: fmtfld.hxx:56
IDocumentRedlineAccess const & m_rIDRA
Definition: fmtfld.hxx:54
std::vector< SwFormatField * > & m_rvFormatFields
Definition: fmtfld.hxx:53
SwFormatField *& m_rpFormat
Definition: fmtfld.hxx:44
const SwField * m_pField
Definition: fmtfld.hxx:43
FindFormatForFieldHint(const SwField *pField, SwFormatField *&rpFormat)
Definition: fmtfld.hxx:45
SwFormatField *& m_rpFormat
Definition: fmtfld.hxx:49
FindFormatForPostItIdHint(const sal_uInt32 nPostItId, SwFormatField *&rpFormat)
Definition: fmtfld.hxx:50
const sal_uInt32 m_nPostItId
Definition: fmtfld.hxx:48
std::vector< SwDDETable * > & m_rvTables
Definition: fmtfld.hxx:77
GatherDdeTablesHint(std::vector< SwDDETable * > &rvTables)
Definition: fmtfld.hxx:78
GatherFieldsHint(std::vector< SwFormatField * > &rvFields, bool bCollectOnlyInDocNodes=true)
Definition: fmtfld.hxx:74
const bool m_bCollectOnlyInDocNodes
Definition: fmtfld.hxx:72
std::vector< SwFormatField * > & m_rvFields
Definition: fmtfld.hxx:73
GatherNodeIndexHint(std::vector< SwNodeOffset > &rvNodeIndex)
Definition: fmtfld.hxx:64
std::vector< SwNodeOffset > & m_rvNodeIndex
Definition: fmtfld.hxx:63
const sal_uInt16 m_nType
Definition: fmtfld.hxx:68
GatherRefFieldsHint(std::vector< SwGetRefField * > &rvRFields, const sal_uInt16 nType)
Definition: fmtfld.hxx:69
std::vector< SwGetRefField * > & m_rvRFields
Definition: fmtfld.hxx:67
HasHiddenInformationNotesHint(bool &rbHasHiddenInformationNotes)
Definition: fmtfld.hxx:60
#define SW_DLLPUBLIC
Definition: swdllapi.h:28