LibreOffice Module sw (master) 1
ddefld.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#ifndef INCLUDED_SW_INC_DDEFLD_HXX
20#define INCLUDED_SW_INC_DDEFLD_HXX
21
22#include <sfx2/lnkbase.hxx>
23#include <svl/hint.hxx>
24#include "swdllapi.h"
25#include "fldbas.hxx"
26
27class SwDoc;
28class SwNode;
29class SwNodes;
30
31namespace sw
32{
33 struct LinkAnchorSearchHint final : public SfxHint
34 {
37 LinkAnchorSearchHint(SwNodes& rNodes, const SwNode*& rpFoundNode) : m_rNodes(rNodes), m_rpFoundNode(rpFoundNode) {};
38 virtual ~LinkAnchorSearchHint() override;
39 };
40 struct InRangeSearchHint final : public SfxHint
41 {
44 InRangeSearchHint(const SwNodeOffset nSttNd, const SwNodeOffset nEndNd, bool& rIsInRange)
45 : m_nSttNd(nSttNd), m_nEndNd(nEndNd), m_rIsInRange(rIsInRange) {}
46 };
47}
48
49// FieldType for DDE
51{
52 OUString m_aName;
53 OUString m_aExpansion;
54
57
58 sal_uInt16 m_nRefCount;
59 bool m_bCRLFFlag : 1;
60 bool m_bDeleted : 1;
61
62 SAL_DLLPRIVATE void RefCntChgd();
63
64public:
65 SwDDEFieldType( OUString aName, const OUString& rCmd,
67 virtual ~SwDDEFieldType() override;
68
69 const OUString& GetExpansion() const { return m_aExpansion; }
70 void SetExpansion( const OUString& rStr ) { m_aExpansion = rStr;
71 m_bCRLFFlag = false; }
72
73 virtual std::unique_ptr<SwFieldType> Copy() const override;
74 virtual OUString GetName() const override;
75
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;
78
79 OUString const & GetCmd() const;
80 void SetCmd( const OUString& aStr );
81
82 SfxLinkUpdateMode GetType() const { return m_RefLink->GetUpdateMode(); }
83 void SetType( SfxLinkUpdateMode nType ) { m_RefLink->SetUpdateMode( nType ); }
84
85 bool IsDeleted() const { return m_bDeleted; }
86 void SetDeleted( bool b ) { m_bDeleted = b; }
87
88 void Disconnect() { m_RefLink->Disconnect(); }
89
90 const ::sfx2::SvBaseLink& GetBaseLink() const { return *m_RefLink; }
91 ::sfx2::SvBaseLink& GetBaseLink() { return *m_RefLink; }
92
93 const SwDoc* GetDoc() const { return m_pDoc; }
94 SwDoc* GetDoc() { return m_pDoc; }
95 void SetDoc( SwDoc* pDoc );
96
97 void IncRefCnt() { if( !m_nRefCount++ && m_pDoc ) RefCntChgd(); }
98 void DecRefCnt() { if( !--m_nRefCount && m_pDoc ) RefCntChgd(); }
99
100 void SetCRLFDelFlag( bool bFlag ) { m_bCRLFFlag = bFlag; }
101 virtual void UpdateFields() override
102 { UpdateDDE(false); };
103 void UpdateDDE(const bool bNotifyShells = true);
104};
105
106// DDE-field
107class SwDDEField final : public SwField
108{
109private:
110 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
111 virtual std::unique_ptr<SwField> Copy() const override;
112
113public:
115 virtual ~SwDDEField() override;
116
119 virtual OUString GetPar1() const override;
120
121 // Command
122 virtual OUString GetPar2() const override;
123 virtual void SetPar2(const OUString& rStr) override;
124};
125
126#endif // INCLUDED_SW_INC_DDEFLD_HXX
127
128/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void UpdateFields() override
Definition: ddefld.hxx:101
void SetDeleted(bool b)
Definition: ddefld.hxx:86
SfxLinkUpdateMode GetType() const
Definition: ddefld.hxx:82
OUString m_aName
Definition: ddefld.hxx:52
void SetExpansion(const OUString &rStr)
Definition: ddefld.hxx:70
bool IsDeleted() const
Definition: ddefld.hxx:85
void Disconnect()
Definition: ddefld.hxx:88
void SetCRLFDelFlag(bool bFlag)
Definition: ddefld.hxx:100
void IncRefCnt()
Definition: ddefld.hxx:97
OUString m_aExpansion
Definition: ddefld.hxx:53
sal_uInt16 m_nRefCount
Definition: ddefld.hxx:58
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: ddefld.hxx:90
bool m_bCRLFFlag
Definition: ddefld.hxx:59
SwDoc * GetDoc()
Definition: ddefld.hxx:94
const OUString & GetExpansion() const
Definition: ddefld.hxx:69
bool m_bDeleted
Definition: ddefld.hxx:60
::sfx2::SvBaseLink & GetBaseLink()
Definition: ddefld.hxx:91
tools::SvRef< sfx2::SvBaseLink > m_RefLink
Definition: ddefld.hxx:55
SwDoc * m_pDoc
Definition: ddefld.hxx:56
void SetType(SfxLinkUpdateMode nType)
Definition: ddefld.hxx:83
void DecRefCnt()
Definition: ddefld.hxx:98
const SwDoc * GetDoc() const
Definition: ddefld.hxx:93
virtual OUString GetPar1() const override
Get parameter via types.
Definition: ddefld.cxx:374
virtual ~SwDDEField() override
Definition: ddefld.cxx:349
virtual void SetPar2(const OUString &rStr) override
set field type command
Definition: ddefld.cxx:386
SwDDEField(SwDDEFieldType *)
Definition: ddefld.cxx:344
virtual std::unique_ptr< SwField > Copy() const override
Definition: ddefld.cxx:368
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: ddefld.cxx:355
virtual OUString GetPar2() const override
get field type command
Definition: ddefld.cxx:380
Definition: doc.hxx:194
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:242
virtual OUString GetName() const
Only in derived classes.
Definition: fldbas.cxx:137
virtual void QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const
Definition: fldbas.cxx:142
virtual void PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich)
Definition: fldbas.cxx:145
virtual std::unique_ptr< SwFieldType > Copy() const =0
Base class of all fields.
Definition: fldbas.hxx:292
Base class of the Writer document model elements.
Definition: node.hxx:98
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
SfxLinkUpdateMode
Dialog to specify the properties of date form field.
QPRO_FUNC_TYPE nType
InRangeSearchHint(const SwNodeOffset nSttNd, const SwNodeOffset nEndNd, bool &rIsInRange)
Definition: ddefld.hxx:44
const SwNodeOffset m_nSttNd
Definition: ddefld.hxx:42
const SwNodeOffset m_nEndNd
Definition: ddefld.hxx:42
const SwNode *& m_rpFoundNode
Definition: ddefld.hxx:36
virtual ~LinkAnchorSearchHint() override
Definition: ddefld.cxx:134
LinkAnchorSearchHint(SwNodes &rNodes, const SwNode *&rpFoundNode)
Definition: ddefld.hxx:37
#define SW_DLLPUBLIC
Definition: swdllapi.h:28