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 
27 class SwDoc;
28 class SwNode;
29 class SwNodes;
30 
31 namespace 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  {
43  bool& m_rIsInRange;
44  InRangeSearchHint(const sal_uLong nSttNd, const sal_uLong nEndNd, bool& rIsInRange)
45  : m_nSttNd(nSttNd), m_nEndNd(nEndNd), m_rIsInRange(rIsInRange) {}
46  };
47 }
48 
49 // FieldType for DDE
51 {
52  OUString const aName;
53  OUString aExpansion;
54 
57 
58  sal_uInt16 nRefCnt;
59  bool bCRLFFlag : 1;
60  bool bDeleted : 1;
61 
62  SAL_DLLPRIVATE void RefCntChgd();
63 
64 public:
65  SwDDEFieldType( const OUString& rName, const OUString& rCmd,
67  virtual ~SwDDEFieldType() override;
68 
69  const OUString& GetExpansion() const { return aExpansion; }
70  void SetExpansion( const OUString& rStr ) { aExpansion = rStr;
71  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 refLink->GetUpdateMode(); }
83  void SetType( SfxLinkUpdateMode nType ) { refLink->SetUpdateMode( nType ); }
84 
85  bool IsDeleted() const { return bDeleted; }
86  void SetDeleted( bool b ) { bDeleted = b; }
87 
88  void Disconnect() { refLink->Disconnect(); }
89 
90  const ::sfx2::SvBaseLink& GetBaseLink() const { return *refLink; }
91  ::sfx2::SvBaseLink& GetBaseLink() { return *refLink; }
92 
93  const SwDoc* GetDoc() const { return pDoc; }
94  SwDoc* GetDoc() { return pDoc; }
95  void SetDoc( SwDoc* pDoc );
96 
97  void IncRefCnt() { if( !nRefCnt++ && pDoc ) RefCntChgd(); }
98  void DecRefCnt() { if( !--nRefCnt && pDoc ) RefCntChgd(); }
99 
100  void SetCRLFDelFlag( bool bFlag ) { bCRLFFlag = bFlag; }
101 };
102 
103 // DDE-field
104 class SwDDEField : public SwField
105 {
106 private:
107  virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
108  virtual std::unique_ptr<SwField> Copy() const override;
109 
110 public:
112  virtual ~SwDDEField() override;
113 
116  virtual OUString GetPar1() const override;
117 
118  // Command
119  virtual OUString GetPar2() const override;
120  virtual void SetPar2(const OUString& rStr) override;
121 };
122 
123 #endif // INCLUDED_SW_INC_DDEFLD_HXX
124 
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:233
sal_uInt16 nRefCnt
Definition: ddefld.hxx:58
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:85
void SetType(SfxLinkUpdateMode nType)
Definition: ddefld.hxx:83
Base class of all fields.
Definition: fldbas.hxx:279
SfxLinkUpdateMode GetType() const
Definition: ddefld.hxx:82
Definition: doc.hxx:185
void Disconnect()
Definition: ddefld.hxx:88
Dialog to specify the properties of drop-down form field.
Definition: accfrmobj.cxx:40
const sal_uLong m_nSttNd
Definition: ddefld.hxx:42
OUString const aName
Definition: ddefld.hxx:52
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:93
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: ddefld.cxx:343
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: ddefld.hxx:90
void SetCRLFDelFlag(bool bFlag)
Definition: ddefld.hxx:100
SwDoc * GetDoc()
Definition: ddefld.hxx:94
const OUString & GetExpansion() const
Definition: ddefld.hxx:69
::sfx2::SvBaseLink & GetBaseLink()
Definition: ddefld.hxx:91
SwDoc * pDoc
Definition: ddefld.hxx:56
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:42
void DecRefCnt()
Definition: ddefld.hxx:98
virtual void QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const
Definition: fldbas.cxx:150
void SetExpansion(const OUString &rStr)
Definition: ddefld.hxx:70
OUString aExpansion
Definition: ddefld.hxx:53
LinkAnchorSearchHint(SwNodes &rNodes, const SwNode *&rpFoundNode)
Definition: ddefld.hxx:37
virtual OUString GetName() const
Only in derived classes.
Definition: fldbas.cxx:145
const SwNode *& m_rpFoundNode
Definition: ddefld.hxx:36
void SetDeleted(bool b)
Definition: ddefld.hxx:86
virtual void PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich)
Definition: fldbas.cxx:153
tools::SvRef< sfx2::SvBaseLink > refLink
Definition: ddefld.hxx:55
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:44
void IncRefCnt()
Definition: ddefld.hxx:97
SfxLinkUpdateMode
Base class of the Writer document model elements.
Definition: node.hxx:79