1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <sfx2/lnkbase.hxx>
28 /*--------------------------------------------------------------------
30 --------------------------------------------------------------------*/
32 class SW_DLLPUBLIC SwDDEFieldType
: public SwFieldType
37 ::sfx2::SvBaseLinkRef refLink
;
41 sal_Bool bCRLFFlag
: 1;
42 sal_Bool bDeleted
: 1;
44 SW_DLLPRIVATE
void _RefCntChgd();
47 SwDDEFieldType( const String
& rName
, const String
& rCmd
,
48 sal_uInt16
= sfx2::LINKUPDATE_ONCALL
);
51 const String
& GetExpansion() const { return aExpansion
; }
52 void SetExpansion( const String
& rStr
) { aExpansion
= rStr
,
53 bCRLFFlag
= sal_False
; }
55 virtual SwFieldType
* Copy() const;
56 virtual const OUString
& GetName() const;
58 virtual bool QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt16 nWhich
) const;
59 virtual bool PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt16 nWhich
);
61 String
GetCmd() const;
62 void SetCmd( const String
& rStr
);
64 sal_uInt16
GetType() const { return refLink
->GetUpdateMode(); }
65 void SetType( sal_uInt16 nType
) { refLink
->SetUpdateMode( nType
); }
67 sal_Bool
IsDeleted() const { return bDeleted
; }
68 void SetDeleted( sal_Bool b
) { bDeleted
= b
; }
70 void UpdateNow() { refLink
->Update(); }
71 void Disconnect() { refLink
->Disconnect(); }
73 const ::sfx2::SvBaseLink
& GetBaseLink() const { return *refLink
; }
74 ::sfx2::SvBaseLink
& GetBaseLink() { return *refLink
; }
76 const SwDoc
* GetDoc() const { return pDoc
; }
77 SwDoc
* GetDoc() { return pDoc
; }
78 void SetDoc( SwDoc
* pDoc
);
80 void IncRefCnt() { if( !nRefCnt
++ && pDoc
) _RefCntChgd(); }
81 void DecRefCnt() { if( !--nRefCnt
&& pDoc
) _RefCntChgd(); }
83 void SetCRLFDelFlag( sal_Bool bFlag
= sal_True
) { bCRLFFlag
= bFlag
; }
86 /*--------------------------------------------------------------------
88 --------------------------------------------------------------------*/
90 class SwDDEField
: public SwField
93 virtual String
Expand() const;
94 virtual SwField
* Copy() const;
97 SwDDEField(SwDDEFieldType
*);
100 /** Get parameter via types.
101 Name cannot be changed. */
102 virtual const OUString
& GetPar1() const;
105 virtual OUString
GetPar2() const;
106 virtual void SetPar2(const OUString
& rStr
);
110 #endif // SW_DDEFLD_HXX
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */