Update ooo320-m1
[ooovba.git] / sw / inc / fmtfld.hxx
blob7edbb77a0fbfb50405fd6ab00e52379b513cd1d3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fmtfld.hxx,v $
10 * $Revision: 1.9.118.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _FMTFLD_HXX
31 #define _FMTFLD_HXX
33 #include <svtools/poolitem.hxx>
34 #include <svtools/brdcst.hxx>
35 #include <svtools/smplhint.hxx>
37 #include "swdllapi.h"
38 #include <calbck.hxx>
40 class SwField;
41 class SwTxtFld;
42 class SwView;
44 // ATT_FLD ***********************************
45 class SW_DLLPUBLIC SwFmtFld : public SfxPoolItem, public SwClient, public SfxBroadcaster
47 friend class SwTxtFld;
48 friend void _InitCore();
50 SwField *pField;
51 SwTxtFld* pTxtAttr; // mein TextAttribut
53 SwFmtFld(); // das default-Attibut
55 // geschuetzter CopyCtor
56 // @@@ copy construction allowed, but copy assignment is not? @@@
57 SwFmtFld& operator=(const SwFmtFld& rFld);
59 public:
60 TYPEINFO();
62 // single argument constructors shall be explicit.
63 explicit SwFmtFld( const SwField &rFld );
65 // @@@ copy construction allowed, but copy assignment is not? @@@
66 SwFmtFld( const SwFmtFld& rAttr );
68 virtual ~SwFmtFld();
70 // "pure virtual Methoden" vom SfxPoolItem
71 virtual int operator==( const SfxPoolItem& ) const;
72 virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
74 virtual void Modify( SfxPoolItem* pOld, SfxPoolItem* pNew );
75 virtual BOOL GetInfo( SfxPoolItem& rInfo ) const;
77 const SwField *GetFld() const { return pField; }
78 SwField *GetFld() { return pField; }
80 // #111840#
81 /**
82 Sets current field.
84 @param pField new field
86 @attention The current field will be destroyed before setting the new field.
88 void SetFld(SwField * pField);
90 const SwTxtFld *GetTxtFld() const { return pTxtAttr; }
91 SwTxtFld *GetTxtFld() { return pTxtAttr; }
93 BOOL IsFldInDoc() const;
94 BOOL IsProtect() const;
97 class SW_DLLPUBLIC SwFmtFldHint : public SfxHint
99 #define SWFMTFLD_INSERTED 1
100 #define SWFMTFLD_REMOVED 2
101 #define SWFMTFLD_FOCUS 3
102 #define SWFMTFLD_CHANGED 4
103 #define SWFMTFLD_LANGUAGE 5
105 const SwFmtFld* pFld;
106 sal_Int16 nWhich;
107 const SwView* pView;
109 public:
110 SwFmtFldHint( const SwFmtFld* p, sal_Int16 n, const SwView* pV = 0)
111 : pFld(p)
112 , nWhich(n)
113 , pView(pV)
116 TYPEINFO();
117 const SwFmtFld* GetField() const { return pFld; }
118 sal_Int16 Which() const { return nWhich; }
119 const SwView* GetView() const { return pView; }
122 #endif