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>
24 #include <tools/solar.h>
34 struct LinkAnchorSearchHint final
: public SfxHint
37 const SwNode
*& m_rpFoundNode
;
38 LinkAnchorSearchHint(SwNodes
& rNodes
, const SwNode
*& rpFoundNode
) : m_rNodes(rNodes
), m_rpFoundNode(rpFoundNode
) {};
39 virtual ~LinkAnchorSearchHint() override
;
41 struct InRangeSearchHint final
: public SfxHint
43 const sal_uLong m_nSttNd
, m_nEndNd
;
45 InRangeSearchHint(const sal_uLong nSttNd
, const sal_uLong nEndNd
, bool& rIsInRange
)
46 : m_nSttNd(nSttNd
), m_nEndNd(nEndNd
), m_rIsInRange(rIsInRange
) {}
51 class SW_DLLPUBLIC SwDDEFieldType final
: public SwFieldType
54 OUString m_aExpansion
;
56 tools::SvRef
<sfx2::SvBaseLink
> m_RefLink
;
59 sal_uInt16 m_nRefCount
;
63 SAL_DLLPRIVATE
void RefCntChgd();
66 SwDDEFieldType( const OUString
& rName
, const OUString
& rCmd
,
68 virtual ~SwDDEFieldType() override
;
70 const OUString
& GetExpansion() const { return m_aExpansion
; }
71 void SetExpansion( const OUString
& rStr
) { m_aExpansion
= rStr
;
72 m_bCRLFFlag
= false; }
74 virtual std::unique_ptr
<SwFieldType
> Copy() const override
;
75 virtual OUString
GetName() const override
;
77 virtual void QueryValue( css::uno::Any
& rVal
, sal_uInt16 nWhich
) const override
;
78 virtual void PutValue( const css::uno::Any
& rVal
, sal_uInt16 nWhich
) override
;
80 OUString
const & GetCmd() const;
81 void SetCmd( const OUString
& aStr
);
83 SfxLinkUpdateMode
GetType() const { return m_RefLink
->GetUpdateMode(); }
84 void SetType( SfxLinkUpdateMode nType
) { m_RefLink
->SetUpdateMode( nType
); }
86 bool IsDeleted() const { return m_bDeleted
; }
87 void SetDeleted( bool b
) { m_bDeleted
= b
; }
89 void Disconnect() { m_RefLink
->Disconnect(); }
91 const ::sfx2::SvBaseLink
& GetBaseLink() const { return *m_RefLink
; }
92 ::sfx2::SvBaseLink
& GetBaseLink() { return *m_RefLink
; }
94 const SwDoc
* GetDoc() const { return m_pDoc
; }
95 SwDoc
* GetDoc() { return m_pDoc
; }
96 void SetDoc( SwDoc
* pDoc
);
98 void IncRefCnt() { if( !m_nRefCount
++ && m_pDoc
) RefCntChgd(); }
99 void DecRefCnt() { if( !--m_nRefCount
&& m_pDoc
) RefCntChgd(); }
101 void SetCRLFDelFlag( bool bFlag
) { m_bCRLFFlag
= bFlag
; }
105 class SwDDEField final
: public SwField
108 virtual OUString
ExpandImpl(SwRootFrame
const* pLayout
) const override
;
109 virtual std::unique_ptr
<SwField
> Copy() const override
;
112 SwDDEField(SwDDEFieldType
*);
113 virtual ~SwDDEField() override
;
115 /** Get parameter via types.
116 Name cannot be changed. */
117 virtual OUString
GetPar1() const override
;
120 virtual OUString
GetPar2() const override
;
121 virtual void SetPar2(const OUString
& rStr
) override
;
124 #endif // INCLUDED_SW_INC_DDEFLD_HXX
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */