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 .
19 #ifndef INCLUDED_SW_INC_DDEFLD_HXX
20 #define INCLUDED_SW_INC_DDEFLD_HXX
22 #include <sfx2/lnkbase.hxx>
29 class SW_DLLPUBLIC SwDDEFieldType
: public SwFieldType
34 tools::SvRef
<sfx2::SvBaseLink
> refLink
;
41 SAL_DLLPRIVATE
void _RefCntChgd();
44 SwDDEFieldType( const OUString
& rName
, const OUString
& rCmd
,
45 SfxLinkUpdateMode
= SfxLinkUpdateMode::ONCALL
);
46 virtual ~SwDDEFieldType();
48 OUString
GetExpansion() const { return aExpansion
; }
49 void SetExpansion( const OUString
& rStr
) { aExpansion
= rStr
;
52 virtual SwFieldType
* Copy() const override
;
53 virtual OUString
GetName() const override
;
55 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt16 nWhich
) const override
;
56 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt16 nWhich
) override
;
58 OUString
GetCmd() const;
59 void SetCmd( const OUString
& aStr
);
61 SfxLinkUpdateMode
GetType() const { return refLink
->GetUpdateMode(); }
62 void SetType( SfxLinkUpdateMode nType
) { refLink
->SetUpdateMode( nType
); }
64 bool IsDeleted() const { return bDeleted
; }
65 void SetDeleted( bool b
) { bDeleted
= b
; }
67 void UpdateNow() { refLink
->Update(); }
68 void Disconnect() { refLink
->Disconnect(); }
70 const ::sfx2::SvBaseLink
& GetBaseLink() const { return *refLink
; }
71 ::sfx2::SvBaseLink
& GetBaseLink() { return *refLink
; }
73 const SwDoc
* GetDoc() const { return pDoc
; }
74 SwDoc
* GetDoc() { return pDoc
; }
75 void SetDoc( SwDoc
* pDoc
);
77 void IncRefCnt() { if( !nRefCnt
++ && pDoc
) _RefCntChgd(); }
78 void DecRefCnt() { if( !--nRefCnt
&& pDoc
) _RefCntChgd(); }
80 void SetCRLFDelFlag( bool bFlag
= true ) { bCRLFFlag
= bFlag
; }
84 class SwDDEField
: public SwField
87 virtual OUString
Expand() const override
;
88 virtual SwField
* Copy() const override
;
91 SwDDEField(SwDDEFieldType
*);
92 virtual ~SwDDEField();
94 /** Get parameter via types.
95 Name cannot be changed. */
96 virtual OUString
GetPar1() const override
;
99 virtual OUString
GetPar2() const override
;
100 virtual void SetPar2(const OUString
& rStr
) override
;
103 #endif // INCLUDED_SW_INC_DDEFLD_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */