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