11d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 31d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 41d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 51d2dbeb0SAndrew Rist * distributed with this work for additional information 61d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 71d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 81d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 91d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 101d2dbeb0SAndrew Rist * 111d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 121d2dbeb0SAndrew Rist * 131d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 141d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 151d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 161d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 171d2dbeb0SAndrew Rist * specific language governing permissions and limitations 181d2dbeb0SAndrew Rist * under the License. 191d2dbeb0SAndrew Rist * 201d2dbeb0SAndrew Rist *************************************************************/ 211d2dbeb0SAndrew Rist 221d2dbeb0SAndrew Rist 23cdf0e10cSrcweir #ifndef _FMTFLD_HXX 24cdf0e10cSrcweir #define _FMTFLD_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <list> 27cdf0e10cSrcweir #include <svl/poolitem.hxx> 28cdf0e10cSrcweir #include <svl/brdcst.hxx> 29cdf0e10cSrcweir #include <svl/smplhint.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "swdllapi.h" 32cdf0e10cSrcweir #include <calbck.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir class SwField; 35cdf0e10cSrcweir class SwTxtFld; 36cdf0e10cSrcweir class SwView; 37cdf0e10cSrcweir class SwFieldType; 38cdf0e10cSrcweir 39cdf0e10cSrcweir // ATT_FLD *********************************** 40cdf0e10cSrcweir class SW_DLLPUBLIC SwFmtFld : public SfxPoolItem, public SwClient, public SfxBroadcaster 41cdf0e10cSrcweir { 42*69a74367SOliver-Rainer Wittmann friend void _InitCore(); 43*69a74367SOliver-Rainer Wittmann SwFmtFld( sal_uInt16 nWhich ); // for default-Attibute 44cdf0e10cSrcweir 45*69a74367SOliver-Rainer Wittmann SwField* mpField; 46*69a74367SOliver-Rainer Wittmann SwTxtFld* mpTxtFld; // the TextAttribute 47cdf0e10cSrcweir 48cdf0e10cSrcweir 49*69a74367SOliver-Rainer Wittmann // @@@ copy construction allowed, but copy assignment is not? @@@ 50*69a74367SOliver-Rainer Wittmann SwFmtFld& operator=(const SwFmtFld& rFld); 51cdf0e10cSrcweir 52cdf0e10cSrcweir protected: 53cdf0e10cSrcweir virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew); 54cdf0e10cSrcweir virtual void SwClientNotify( const SwModify& rModify, const SfxHint& rHint ); 55cdf0e10cSrcweir 56cdf0e10cSrcweir public: 57cdf0e10cSrcweir TYPEINFO(); 58cdf0e10cSrcweir 59cdf0e10cSrcweir // single argument constructors shall be explicit. 60cdf0e10cSrcweir explicit SwFmtFld( const SwField &rFld ); 61cdf0e10cSrcweir 62cdf0e10cSrcweir // @@@ copy construction allowed, but copy assignment is not? @@@ 63cdf0e10cSrcweir SwFmtFld( const SwFmtFld& rAttr ); 64cdf0e10cSrcweir 65cdf0e10cSrcweir virtual ~SwFmtFld(); 66cdf0e10cSrcweir 67cdf0e10cSrcweir // "pure virtual Methoden" vom SfxPoolItem 68cdf0e10cSrcweir virtual int operator==( const SfxPoolItem& ) const; 69cdf0e10cSrcweir virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; 70cdf0e10cSrcweir 71cdf0e10cSrcweir virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const; 72cdf0e10cSrcweir GetField() const73c0286415SOliver-Rainer Wittmann const SwField* GetField() const 74c0286415SOliver-Rainer Wittmann { 75*69a74367SOliver-Rainer Wittmann return mpField; 76c0286415SOliver-Rainer Wittmann } GetField()77c0286415SOliver-Rainer Wittmann SwField* GetField() 78c0286415SOliver-Rainer Wittmann { 79*69a74367SOliver-Rainer Wittmann return mpField; 80c0286415SOliver-Rainer Wittmann } 81cdf0e10cSrcweir 82cdf0e10cSrcweir // #111840# 83cdf0e10cSrcweir /** 84cdf0e10cSrcweir Sets current field. 85cdf0e10cSrcweir 86cdf0e10cSrcweir @param pField new field 87cdf0e10cSrcweir 88cdf0e10cSrcweir @attention The current field will be destroyed before setting the new field. 89cdf0e10cSrcweir */ 90*69a74367SOliver-Rainer Wittmann void SetField( SwField * pField ); 91*69a74367SOliver-Rainer Wittmann 92*69a74367SOliver-Rainer Wittmann GetTxtFld() const93*69a74367SOliver-Rainer Wittmann const SwTxtFld* GetTxtFld() const 94*69a74367SOliver-Rainer Wittmann { 95*69a74367SOliver-Rainer Wittmann return mpTxtFld; 96*69a74367SOliver-Rainer Wittmann } GetTxtFld()97*69a74367SOliver-Rainer Wittmann SwTxtFld* GetTxtFld() 98*69a74367SOliver-Rainer Wittmann { 99*69a74367SOliver-Rainer Wittmann return mpTxtFld; 100*69a74367SOliver-Rainer Wittmann } 101*69a74367SOliver-Rainer Wittmann void SetTxtFld( SwTxtFld& rTxtFld ); 102*69a74367SOliver-Rainer Wittmann void ClearTxtFld(); 103cdf0e10cSrcweir 104cdf0e10cSrcweir 105cdf0e10cSrcweir void RegisterToFieldType( SwFieldType& ); 106*69a74367SOliver-Rainer Wittmann bool IsFldInDoc() const; 107*69a74367SOliver-Rainer Wittmann sal_Bool IsProtect() const; 108cdf0e10cSrcweir }; 109cdf0e10cSrcweir 110cdf0e10cSrcweir class SW_DLLPUBLIC SwFmtFldHint : public SfxHint 111cdf0e10cSrcweir { 112cdf0e10cSrcweir #define SWFMTFLD_INSERTED 1 113cdf0e10cSrcweir #define SWFMTFLD_REMOVED 2 114cdf0e10cSrcweir #define SWFMTFLD_FOCUS 3 115cdf0e10cSrcweir #define SWFMTFLD_CHANGED 4 116cdf0e10cSrcweir #define SWFMTFLD_LANGUAGE 5 117cdf0e10cSrcweir 118cdf0e10cSrcweir const SwFmtFld* pFld; 119cdf0e10cSrcweir sal_Int16 nWhich; 120cdf0e10cSrcweir const SwView* pView; 121cdf0e10cSrcweir 122cdf0e10cSrcweir public: SwFmtFldHint(const SwFmtFld * p,sal_Int16 n,const SwView * pV=0)123cdf0e10cSrcweir SwFmtFldHint( const SwFmtFld* p, sal_Int16 n, const SwView* pV = 0) 124cdf0e10cSrcweir : pFld(p) 125cdf0e10cSrcweir , nWhich(n) 126cdf0e10cSrcweir , pView(pV) 127cdf0e10cSrcweir {} 128cdf0e10cSrcweir 129cdf0e10cSrcweir TYPEINFO(); GetField() const130cdf0e10cSrcweir const SwFmtFld* GetField() const { return pFld; } Which() const131cdf0e10cSrcweir sal_Int16 Which() const { return nWhich; } GetView() const132cdf0e10cSrcweir const SwView* GetView() const { return pView; } 133cdf0e10cSrcweir }; 134cdf0e10cSrcweir 135cdf0e10cSrcweir #endif 136