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 <tools/solar.h>
25 #include "swdllapi.h"
26 #include "fldbas.hxx"
27 
28 class SwDoc;
29 class SwNode;
30 class SwNodes;
31 
32 namespace sw
33 {
34  struct LinkAnchorSearchHint final : public SfxHint
35  {
38  LinkAnchorSearchHint(SwNodes& rNodes, const SwNode*& rpFoundNode) : m_rNodes(rNodes), m_rpFoundNode(rpFoundNode) {};
39  virtual ~LinkAnchorSearchHint() override;
40  };
41  struct InRangeSearchHint final : public SfxHint
42  {
44  bool& m_rIsInRange;
45  InRangeSearchHint(const sal_uLong nSttNd, const sal_uLong nEndNd, bool& rIsInRange)
46  : m_nSttNd(nSttNd), m_nEndNd(nEndNd), m_rIsInRange(rIsInRange) {}
47  };
48 }
49 
50 // FieldType for DDE
52 {
53  OUString const aName;
54  OUString aExpansion;
55 
58 
59  sal_uInt16 nRefCnt;
60  bool bCRLFFlag : 1;
61  bool bDeleted : 1;
62 
63  SAL_DLLPRIVATE void RefCntChgd();
64 
65 public:
66  SwDDEFieldType( const OUString& rName, const OUString& rCmd,
68  virtual ~SwDDEFieldType() override;
69 
70  const OUString& GetExpansion() const { return aExpansion; }
71  void SetExpansion( const OUString& rStr ) { aExpansion = rStr;
72  bCRLFFlag = false; }
73 
74  virtual std::unique_ptr<SwFieldType> Copy() const override;
75  virtual OUString GetName() const override;
76 
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;
79 
80  OUString const & GetCmd() const;
81  void SetCmd( const OUString& aStr );
82 
83  SfxLinkUpdateMode GetType() const { return refLink->GetUpdateMode(); }
84  void SetType( SfxLinkUpdateMode nType ) { refLink->SetUpdateMode( nType ); }
85 
86  bool IsDeleted() const { return bDeleted; }
87  void SetDeleted( bool b ) { bDeleted = b; }
88 
89  void Disconnect() { refLink->Disconnect(); }
90 
91  const ::sfx2::SvBaseLink& GetBaseLink() const { return *refLink; }
92  ::sfx2::SvBaseLink& GetBaseLink() { return *refLink; }
93 
94  const SwDoc* GetDoc() const { return pDoc; }
95  SwDoc* GetDoc() { return pDoc; }
96  void SetDoc( SwDoc* pDoc );
97 
98  void IncRefCnt() { if( !nRefCnt++ && pDoc ) RefCntChgd(); }
99  void DecRefCnt() { if( !--nRefCnt && pDoc ) RefCntChgd(); }
100 
101  void SetCRLFDelFlag( bool bFlag ) { bCRLFFlag = bFlag; }
102 };
103 
104 // DDE-field
105 class SwDDEField final : public SwField
106 {
107 private:
108  virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
109  virtual std::unique_ptr<SwField> Copy() const override;
110 
111 public:
113  virtual ~SwDDEField() override;
114 
117  virtual OUString GetPar1() const override;
118 
119  // Command
120  virtual OUString GetPar2() const override;
121  virtual void SetPar2(const OUString& rStr) override;
122 };
123 
124 #endif // INCLUDED_SW_INC_DDEFLD_HXX
125 
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:234
sal_uInt16 nRefCnt
Definition: ddefld.hxx:59
virtual void SetPar2(const OUString &rStr) override
set field type command
Definition: ddefld.cxx:374
virtual ~SwDDEField() override
Definition: ddefld.cxx:337
virtual std::unique_ptr< SwFieldType > Copy() const =0
sal_uIntPtr sal_uLong
bool IsDeleted() const
Definition: ddefld.hxx:86
void SetType(SfxLinkUpdateMode nType)
Definition: ddefld.hxx:84
Base class of all fields.
Definition: fldbas.hxx:280
SfxLinkUpdateMode GetType() const
Definition: ddefld.hxx:83
Definition: doc.hxx:185
void Disconnect()
Definition: ddefld.hxx:89
Dialog to specify the properties of date form field.
const sal_uLong m_nSttNd
Definition: ddefld.hxx:43
OUString const aName
Definition: ddefld.hxx:53
virtual ~LinkAnchorSearchHint() override
Definition: ddefld.cxx:172
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
const SwDoc * GetDoc() const
Definition: ddefld.hxx:94
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: ddefld.cxx:343
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: ddefld.hxx:91
void SetCRLFDelFlag(bool bFlag)
Definition: ddefld.hxx:101
SwDoc * GetDoc()
Definition: ddefld.hxx:95
const OUString & GetExpansion() const
Definition: ddefld.hxx:70
::sfx2::SvBaseLink & GetBaseLink()
Definition: ddefld.hxx:92
SwDoc * pDoc
Definition: ddefld.hxx:57
virtual OUString GetPar1() const override
Get parameter via types.
Definition: ddefld.cxx:362
virtual OUString GetPar2() const override
get field type command
Definition: ddefld.cxx:368
SwDDEField(SwDDEFieldType *)
Definition: ddefld.cxx:332
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
const sal_uLong m_nEndNd
Definition: ddefld.hxx:43
void DecRefCnt()
Definition: ddefld.hxx:99
virtual void QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const
Definition: fldbas.cxx:140
void SetExpansion(const OUString &rStr)
Definition: ddefld.hxx:71
OUString aExpansion
Definition: ddefld.hxx:54
LinkAnchorSearchHint(SwNodes &rNodes, const SwNode *&rpFoundNode)
Definition: ddefld.hxx:38
virtual OUString GetName() const
Only in derived classes.
Definition: fldbas.cxx:135
const SwNode *& m_rpFoundNode
Definition: ddefld.hxx:37
void SetDeleted(bool b)
Definition: ddefld.hxx:87
virtual void PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich)
Definition: fldbas.cxx:143
tools::SvRef< sfx2::SvBaseLink > refLink
Definition: ddefld.hxx:56
virtual std::unique_ptr< SwField > Copy() const override
Definition: ddefld.cxx:356
InRangeSearchHint(const sal_uLong nSttNd, const sal_uLong nEndNd, bool &rIsInRange)
Definition: ddefld.hxx:45
void IncRefCnt()
Definition: ddefld.hxx:98
SfxLinkUpdateMode
Base class of the Writer document model elements.
Definition: node.hxx:79