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>
23 #include <svl/hint.hxx>
33 struct LinkAnchorSearchHint final
: public SfxHint
36 const SwNode
*& m_rpFoundNode
;
37 LinkAnchorSearchHint(SwNodes
& rNodes
, const SwNode
*& rpFoundNode
) : m_rNodes(rNodes
), m_rpFoundNode(rpFoundNode
) {};
38 virtual ~LinkAnchorSearchHint() override
;
40 struct InRangeSearchHint final
: public SfxHint
42 const SwNodeOffset m_nSttNd
, m_nEndNd
;
44 InRangeSearchHint(const SwNodeOffset nSttNd
, const SwNodeOffset nEndNd
, bool& rIsInRange
)
45 : m_nSttNd(nSttNd
), m_nEndNd(nEndNd
), m_rIsInRange(rIsInRange
) {}
50 class SW_DLLPUBLIC SwDDEFieldType final
: public SwFieldType
53 OUString m_aExpansion
;
55 tools::SvRef
<sfx2::SvBaseLink
> m_RefLink
;
58 sal_uInt16 m_nRefCount
;
62 SAL_DLLPRIVATE
void RefCntChgd();
65 SwDDEFieldType( OUString aName
, const OUString
& rCmd
,
67 virtual ~SwDDEFieldType() override
;
69 const OUString
& GetExpansion() const { return m_aExpansion
; }
70 void SetExpansion( const OUString
& rStr
) { m_aExpansion
= rStr
;
71 m_bCRLFFlag
= false; }
73 virtual std::unique_ptr
<SwFieldType
> Copy() const override
;
74 virtual OUString
GetName() const override
;
76 virtual void QueryValue( css::uno::Any
& rVal
, sal_uInt16 nWhich
) const override
;
77 virtual void PutValue( const css::uno::Any
& rVal
, sal_uInt16 nWhich
) override
;
79 OUString
const & GetCmd() const;
80 void SetCmd( const OUString
& aStr
);
82 SfxLinkUpdateMode
GetType() const { return m_RefLink
->GetUpdateMode(); }
83 void SetType( SfxLinkUpdateMode nType
) { m_RefLink
->SetUpdateMode( nType
); }
85 bool IsDeleted() const { return m_bDeleted
; }
86 void SetDeleted( bool b
) { m_bDeleted
= b
; }
88 void Disconnect() { m_RefLink
->Disconnect(); }
90 const ::sfx2::SvBaseLink
& GetBaseLink() const { return *m_RefLink
; }
91 ::sfx2::SvBaseLink
& GetBaseLink() { return *m_RefLink
; }
93 const SwDoc
* GetDoc() const { return m_pDoc
; }
94 SwDoc
* GetDoc() { return m_pDoc
; }
95 void SetDoc( SwDoc
* pDoc
);
97 void IncRefCnt() { if( !m_nRefCount
++ && m_pDoc
) RefCntChgd(); }
98 void DecRefCnt() { if( !--m_nRefCount
&& m_pDoc
) RefCntChgd(); }
100 void SetCRLFDelFlag( bool bFlag
) { m_bCRLFFlag
= bFlag
; }
101 virtual void UpdateFields() override
102 { UpdateDDE(false); };
103 void UpdateDDE(const bool bNotifyShells
= true);
107 class SwDDEField final
: public SwField
110 virtual OUString
ExpandImpl(SwRootFrame
const* pLayout
) const override
;
111 virtual std::unique_ptr
<SwField
> Copy() const override
;
114 SwDDEField(SwDDEFieldType
*);
115 virtual ~SwDDEField() override
;
117 /** Get parameter via types.
118 Name cannot be changed. */
119 virtual OUString
GetPar1() const override
;
122 virtual OUString
GetPar2() const override
;
123 virtual void SetPar2(const OUString
& rStr
) override
;
126 #endif // INCLUDED_SW_INC_DDEFLD_HXX
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */