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 .
20 #ifndef INCLUDED_SW_INC_FMTFLD_HXX
21 #define INCLUDED_SW_INC_FMTFLD_HXX
23 #include <com/sun/star/text/XTextField.hpp>
25 #include <cppuhelper/weakref.hxx>
26 #include <svl/poolitem.hxx>
27 #include <svl/SfxBroadcaster.hxx>
28 #include <svl/smplhint.hxx>
39 class SW_DLLPUBLIC SwFormatField
42 , public SfxBroadcaster
44 friend void _InitCore();
45 SwFormatField( sal_uInt16 nWhich
); // for default-Attibute
47 ::com::sun::star::uno::WeakReference
<
48 ::com::sun::star::text::XTextField
> m_wXTextField
;
51 SwTextField
* mpTextField
; // the TextAttribute
53 // @@@ copy construction allowed, but copy assignment is not? @@@
54 SwFormatField
& operator=(const SwFormatField
& rField
) SAL_DELETED_FUNCTION
;
57 virtual void Modify( const SfxPoolItem
* pOld
, const SfxPoolItem
*pNew
) SAL_OVERRIDE
;
58 virtual void SwClientNotify( const SwModify
& rModify
, const SfxHint
& rHint
) SAL_OVERRIDE
;
63 /// Single argument constructors shall be explicit.
64 explicit SwFormatField( const SwField
&rField
);
66 /// @@@ copy construction allowed, but copy assignment is not? @@@
67 SwFormatField( const SwFormatField
& rAttr
);
69 virtual ~SwFormatField();
71 /// "Pure virtual methods" of SfxPoolItem.
72 virtual bool operator==( const SfxPoolItem
& ) const SAL_OVERRIDE
;
73 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= 0 ) const SAL_OVERRIDE
;
75 virtual bool GetInfo( SfxPoolItem
& rInfo
) const SAL_OVERRIDE
;
77 void InvalidateField();
79 const SwField
* GetField() const
91 @param pField new field
93 @attention The current field will be destroyed before setting the new field.
95 void SetField( SwField
* pField
);
97 const SwTextField
* GetTextField() const
101 SwTextField
* GetTextField()
105 void SetTextField( SwTextField
& rTextField
);
106 void ClearTextField();
108 void RegisterToFieldType( SwFieldType
& );
109 bool IsFieldInDoc() const;
110 bool IsProtect() const;
112 SAL_DLLPRIVATE ::com::sun::star::uno::WeakReference
<
113 ::com::sun::star::text::XTextField
> const& GetXTextField() const
114 { return m_wXTextField
; }
115 SAL_DLLPRIVATE
void SetXTextField(::com::sun::star::uno::Reference
<
116 ::com::sun::star::text::XTextField
> const& xTextField
)
117 { m_wXTextField
= xTextField
; }
120 enum class SwFormatFieldHintWhich
129 class SW_DLLPUBLIC SwFormatFieldHint
: public SfxHint
131 const SwFormatField
* pField
;
132 SwFormatFieldHintWhich nWhich
;
136 SwFormatFieldHint( const SwFormatField
* p
, SwFormatFieldHintWhich n
, const SwView
* pV
= 0)
142 const SwFormatField
* GetField() const { return pField
; }
143 SwFormatFieldHintWhich
Which() const { return nWhich
; }
144 const SwView
* GetView() const { return pView
; }
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */