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 .
23 #include <svl/poolitem.hxx>
24 #include <svl/brdcst.hxx>
25 #include <svl/smplhint.hxx>
36 class SW_DLLPUBLIC SwFmtFld
: public SfxPoolItem
, public SwClient
, public SfxBroadcaster
38 friend class SwTxtFld
;
39 friend void _InitCore();
44 SwFmtFld(); ///< Default attibute.
46 /* Protected CopyCtor.
47 @@@ copy construction allowed, but copy assignment is not? @@@ */
48 SwFmtFld
& operator=(const SwFmtFld
& rFld
);
51 virtual void Modify( const SfxPoolItem
* pOld
, const SfxPoolItem
*pNew
);
52 virtual void SwClientNotify( const SwModify
& rModify
, const SfxHint
& rHint
);
57 /// Single argument constructors shall be explicit.
58 explicit SwFmtFld( const SwField
&rFld
);
60 /// @@@ copy construction allowed, but copy assignment is not? @@@
61 SwFmtFld( const SwFmtFld
& rAttr
);
65 /// "Pure virtual methods" of SfxPoolItem.
66 virtual int operator==( const SfxPoolItem
& ) const;
67 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= 0 ) const;
69 virtual bool GetInfo( SfxPoolItem
& rInfo
) const;
71 const SwField
*GetFld() const { return pField
; }
72 SwField
*GetFld() { return pField
; }
77 @param pField new field
79 @attention The current field will be destroyed before setting the new field.
81 void SetFld(SwField
* pField
);
83 const SwTxtFld
*GetTxtFld() const { return pTxtAttr
; }
84 SwTxtFld
*GetTxtFld() { return pTxtAttr
; }
86 void RegisterToFieldType( SwFieldType
& );
87 sal_Bool
IsFldInDoc() const;
88 sal_Bool
IsProtect() const;
91 class SW_DLLPUBLIC SwFmtFldHint
: public SfxHint
93 #define SWFMTFLD_INSERTED 1
94 #define SWFMTFLD_REMOVED 2
95 #define SWFMTFLD_FOCUS 3
96 #define SWFMTFLD_CHANGED 4
97 #define SWFMTFLD_LANGUAGE 5
104 SwFmtFldHint( const SwFmtFld
* p
, sal_Int16 n
, const SwView
* pV
= 0)
111 const SwFmtFld
* GetField() const { return pFld
; }
112 sal_Int16
Which() const { return nWhich
; }
113 const SwView
* GetView() const { return pView
; }
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */