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 SW_DDEFLD_HXX 24 #define SW_DDEFLD_HXX 25 26 #include <sfx2/lnkbase.hxx> 27 #include "swdllapi.h" 28 #include "fldbas.hxx" 29 30 class SwDoc; 31 32 /*-------------------------------------------------------------------- 33 Beschreibung: FieldType fuer DDE 34 --------------------------------------------------------------------*/ 35 36 class SW_DLLPUBLIC SwDDEFieldType : public SwFieldType 37 { 38 String aName; 39 String aExpansion; 40 41 ::sfx2::SvBaseLinkRef refLink; 42 SwDoc* pDoc; 43 44 sal_uInt16 nRefCnt; 45 sal_Bool bCRLFFlag : 1; 46 sal_Bool bDeleted : 1; 47 48 SW_DLLPRIVATE void _RefCntChgd(); 49 50 public: 51 SwDDEFieldType( const String& rName, const String& rCmd, 52 sal_uInt16 = sfx2::LINKUPDATE_ONCALL ); 53 ~SwDDEFieldType(); 54 GetExpansion() const55 const String& GetExpansion() const { return aExpansion; } SetExpansion(const String & rStr)56 void SetExpansion( const String& rStr ) { aExpansion = rStr, 57 bCRLFFlag = sal_False; } 58 59 virtual SwFieldType* Copy() const; 60 virtual const String& GetName() const; 61 62 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const; 63 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ); 64 65 String GetCmd() const; 66 void SetCmd( const String& rStr ); 67 GetType() const68 sal_uInt16 GetType() const { return refLink->GetUpdateMode(); } SetType(sal_uInt16 nType)69 void SetType( sal_uInt16 nType ) { refLink->SetUpdateMode( nType ); } 70 IsDeleted() const71 sal_Bool IsDeleted() const { return bDeleted; } SetDeleted(sal_Bool b)72 void SetDeleted( sal_Bool b ) { bDeleted = b; } 73 UpdateNow()74 void UpdateNow() { refLink->Update(); } Disconnect()75 void Disconnect() { refLink->Disconnect(); } 76 GetBaseLink() const77 const ::sfx2::SvBaseLink& GetBaseLink() const { return *refLink; } GetBaseLink()78 ::sfx2::SvBaseLink& GetBaseLink() { return *refLink; } 79 GetDoc() const80 const SwDoc* GetDoc() const { return pDoc; } GetDoc()81 SwDoc* GetDoc() { return pDoc; } 82 void SetDoc( SwDoc* pDoc ); 83 IncRefCnt()84 void IncRefCnt() { if( !nRefCnt++ && pDoc ) _RefCntChgd(); } DecRefCnt()85 void DecRefCnt() { if( !--nRefCnt && pDoc ) _RefCntChgd(); } 86 SetCRLFDelFlag(sal_Bool bFlag=sal_True)87 void SetCRLFDelFlag( sal_Bool bFlag = sal_True ) { bCRLFFlag = bFlag; } 88 }; 89 90 /*-------------------------------------------------------------------- 91 Beschreibung: DDE-Feld 92 --------------------------------------------------------------------*/ 93 94 class SwDDEField : public SwField 95 { 96 private: 97 virtual String Expand() const; 98 virtual SwField* Copy() const; 99 100 public: 101 SwDDEField(SwDDEFieldType*); 102 ~SwDDEField(); 103 104 // ueber Typen Parameter ermitteln 105 // Name kann nicht geaendert werden 106 virtual const String& GetPar1() const; 107 108 // Commando 109 virtual String GetPar2() const; 110 virtual void SetPar2(const String& rStr); 111 }; 112 113 114 #endif // SW_DDEFLD_HXX 115