1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef SW_DDEFLD_HXX 28 #define SW_DDEFLD_HXX 29 30 #include <sfx2/lnkbase.hxx> 31 #include "swdllapi.h" 32 #include "fldbas.hxx" 33 34 class SwDoc; 35 36 /*-------------------------------------------------------------------- 37 Beschreibung: FieldType fuer DDE 38 --------------------------------------------------------------------*/ 39 40 class SW_DLLPUBLIC SwDDEFieldType : public SwFieldType 41 { 42 String aName; 43 String aExpansion; 44 45 ::sfx2::SvBaseLinkRef refLink; 46 SwDoc* pDoc; 47 48 sal_uInt16 nRefCnt; 49 sal_Bool bCRLFFlag : 1; 50 sal_Bool bDeleted : 1; 51 52 SW_DLLPRIVATE void _RefCntChgd(); 53 54 public: 55 SwDDEFieldType( const String& rName, const String& rCmd, 56 sal_uInt16 = sfx2::LINKUPDATE_ONCALL ); 57 ~SwDDEFieldType(); 58 59 const String& GetExpansion() const { return aExpansion; } 60 void SetExpansion( const String& rStr ) { aExpansion = rStr, 61 bCRLFFlag = sal_False; } 62 63 virtual SwFieldType* Copy() const; 64 virtual const String& GetName() const; 65 66 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const; 67 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ); 68 69 String GetCmd() const; 70 void SetCmd( const String& rStr ); 71 72 sal_uInt16 GetType() const { return refLink->GetUpdateMode(); } 73 void SetType( sal_uInt16 nType ) { refLink->SetUpdateMode( nType ); } 74 75 sal_Bool IsDeleted() const { return bDeleted; } 76 void SetDeleted( sal_Bool b ) { bDeleted = b; } 77 78 void UpdateNow() { refLink->Update(); } 79 void Disconnect() { refLink->Disconnect(); } 80 81 const ::sfx2::SvBaseLink& GetBaseLink() const { return *refLink; } 82 ::sfx2::SvBaseLink& GetBaseLink() { return *refLink; } 83 84 const SwDoc* GetDoc() const { return pDoc; } 85 SwDoc* GetDoc() { return pDoc; } 86 void SetDoc( SwDoc* pDoc ); 87 88 void IncRefCnt() { if( !nRefCnt++ && pDoc ) _RefCntChgd(); } 89 void DecRefCnt() { if( !--nRefCnt && pDoc ) _RefCntChgd(); } 90 91 void SetCRLFDelFlag( sal_Bool bFlag = sal_True ) { bCRLFFlag = bFlag; } 92 }; 93 94 /*-------------------------------------------------------------------- 95 Beschreibung: DDE-Feld 96 --------------------------------------------------------------------*/ 97 98 class SwDDEField : public SwField 99 { 100 private: 101 virtual String Expand() const; 102 virtual SwField* Copy() const; 103 104 public: 105 SwDDEField(SwDDEFieldType*); 106 ~SwDDEField(); 107 108 // ueber Typen Parameter ermitteln 109 // Name kann nicht geaendert werden 110 virtual const String& GetPar1() const; 111 112 // Commando 113 virtual String GetPar2() const; 114 virtual void SetPar2(const String& rStr); 115 }; 116 117 118 #endif // SW_DDEFLD_HXX 119