LibreOffice Module sw (master)  1
ndole.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_NDOLE_HXX
20 #define INCLUDED_SW_INC_NDOLE_HXX
21 
22 #include "ndnotxt.hxx"
23 #include <svtools/embedhlp.hxx>
25 #include <rtl/ref.hxx>
26 
27 class SwGrfFormatColl;
28 class SwDoc;
29 class SwOLENode;
30 class SwOLEListener_Impl;
31 class SwEmbedObjectLink;
32 class DeflateData;
33 
35 {
36  friend class SwOLENode;
37 
40 
44  OUString m_aName;
45 
46  // eventually buffered data if it is a chart OLE
49  std::unique_ptr<DeflateData> m_pDeflateData;
50 
51  SwOLEObj( const SwOLEObj& rObj ) = delete;
52 
53  void SetNode( SwOLENode* pNode );
54 
55  DECL_LINK(IsProtectedHdl, LinkParamNone*, bool);
56 
57 public:
58  SwOLEObj( const svt::EmbeddedObjectRef& pObj );
59  SwOLEObj( const OUString &rName, sal_Int64 nAspect );
60  ~SwOLEObj() COVERITY_NOEXCEPT_FALSE;
61 
62  bool UnloadObject();
63  static bool UnloadObject( css::uno::Reference< css::embed::XEmbeddedObject > const & xObj,
64  const SwDoc* pDoc,
65  sal_Int64 nAspect );
66 
67  OUString GetDescription();
68 
69  css::uno::Reference < css::embed::XEmbeddedObject > const & GetOleRef();
70  svt::EmbeddedObjectRef& GetObject();
71  const OUString& GetCurrentPersistName() const { return m_aName; }
72  OUString GetStyleString();
73  bool IsOleRef() const;
74  bool IsProtected() const;
75 
76  // try to get OLE visualization in form of a Primitive2DSequence
77  // and the corresponding B2DRange. This data may be locally buffered
78  drawinglayer::primitive2d::Primitive2DContainer const & tryToGetChartContentAsPrimitive2DSequence(
79  basegfx::B2DRange& rRange,
80  bool bSynchron);
81  void resetBufferedData();
82 
83  void dumpAsXml(xmlTextWriterPtr pWriter) const;
84 };
85 
86 // SwOLENode
87 
88 class SW_DLLPUBLIC SwOLENode final: public SwNoTextNode
89 {
90  friend class SwNodes;
91  mutable SwOLEObj maOLEObj;
92  OUString msChartTableName;
97  OUString maLinkURL;
98 
99  SwOLENode( const SwNodeIndex &rWhere,
100  const svt::EmbeddedObjectRef&,
101  SwGrfFormatColl *pGrfColl,
102  SwAttrSet const * pAutoAttr );
103 
104  SwOLENode( const SwNodeIndex &rWhere,
105  const OUString &rName,
106  sal_Int64 nAspect,
107  SwGrfFormatColl *pGrfColl,
108  SwAttrSet const * pAutoAttr );
109 
110  SwOLENode( const SwOLENode & ) = delete;
111 
113 
114 public:
115  const SwOLEObj& GetOLEObj() const { return maOLEObj; }
116  SwOLEObj& GetOLEObj() { return maOLEObj; }
117  virtual ~SwOLENode() override;
118 
120  virtual SwContentNode* MakeCopy(SwDoc&, const SwNodeIndex&, bool bNewFrames) const override;
121 
122  virtual Size GetTwipSize() const override;
123 
124  const Graphic* GetGraphic();
125 
126  void GetNewReplacement();
127 
128  virtual bool SavePersistentData() override;
129  virtual bool RestorePersistentData() override;
130 
131  virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
132 
133  bool IsInGlobalDocSection() const;
134  bool IsOLEObjectDeleted() const;
135 
136  bool IsOLESizeInvalid() const { return mbOLESizeInvalid; }
137  void SetOLESizeInvalid( bool b ){ mbOLESizeInvalid = b; }
138 
139  sal_Int64 GetAspect() const { return maOLEObj.GetObject().GetViewAspect(); }
140  void SetAspect( sal_Int64 nAspect) { maOLEObj.GetObject().SetViewAspect( nAspect ); }
141 
144  OUString GetDescription() const { return maOLEObj.GetDescription(); }
145 
146  bool UpdateLinkURL_Impl();
147  void BreakFileLink_Impl();
148  void DisconnectFileLink_Impl();
149 
150  void CheckFileLink_Impl();
151 
152  // #i99665#
153  bool IsChart() const;
154 
155  const OUString& GetChartTableName() const { return msChartTableName; }
156  void SetChartTableName( const OUString& rNm ) { msChartTableName = rNm; }
157 
158 
159  // react on visual change (invalidate)
160  void SetChanged();
161 };
162 
165 {
166  return SwNodeType::Ole == m_nNodeType ? static_cast<SwOLENode*>(this) : nullptr;
167 }
168 
169 inline const SwOLENode *SwNode::GetOLENode() const
170 {
171  return SwNodeType::Ole == m_nNodeType ? static_cast<const SwOLENode*>(this) : nullptr;
172 }
173 
174 namespace sw
175 {
176  class DocumentSettingManager;
177 }
178 
180 {
181 private:
184 public:
185  PurgeGuard(const SwDoc& rDoc);
186  ~PurgeGuard() COVERITY_NOEXCEPT_FALSE;
187 };
188 
189 #endif // _ INCLUDED_SW_INC_NDOLE_HXX
190 
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetAspect(sal_Int64 nAspect)
Definition: ndole.hxx:140
Graphic GetGraphic() const
Definition: ndnotxt.cxx:229
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
sal_Int64 GetAspect() const
Definition: ndole.hxx:139
~PurgeGuard() COVERITY_NOEXCEPT_FALSE
Definition: ndole.cxx:1015
SwOLEObj maOLEObj
Definition: ndole.hxx:91
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:164
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:115
OUString msChartTableName
with chart objects: name of referenced table.
Definition: ndole.hxx:92
OUString GetDescription()
Definition: ndole.cxx:1067
virtual Size GetTwipSize() const =0
const OUString & GetChartTableName() const
Definition: ndole.hxx:155
std::unique_ptr< DeflateData > m_pDeflateData
Definition: ndole.hxx:49
rtl::Reference< SwOLEListener_Impl > m_xListener
Definition: ndole.hxx:39
Definition: doc.hxx:187
Dialog to specify the properties of date form field.
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Dumps the node structure to the given destination (file nodes.xml in the current directory by default...
Definition: ndole.cxx:294
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Dumps the node structure to the given destination (file nodes.xml in the current directory by default...
Definition: node.cxx:881
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:990
drawinglayer::primitive2d::Primitive2DContainer m_aPrimitive2DSequence
Definition: ndole.hxx:47
const SwOLENode * m_pOLENode
Definition: ndole.hxx:38
::sw::DocumentSettingManager & m_rManager
Definition: ndole.hxx:182
Holder for local data for a parallel-executed task to load a chart model.
Definition: ndole.cxx:680
OUString m_aName
Definition: ndole.hxx:44
OUString maLinkURL
Definition: ndole.hxx:97
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Definition: ndnotxt.hxx:29
Marks a node in the document model.
Definition: ndindex.hxx:30
SwEmbedObjectLink * mpObjectLink
Definition: ndole.hxx:96
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
virtual bool RestorePersistentData()
Dummies for loading/saving of persistent data when working with graphics and OLE objects.
Definition: ndnotxt.cxx:75
SwNodeType m_nNodeType
Definition: node.hxx:86
virtual bool SavePersistentData()
Definition: ndnotxt.cxx:80
void SetChartTableName(const OUString &rNm)
Definition: ndole.hxx:156
virtual SwContentNode * MakeCopy(SwDoc &, const SwNodeIndex &, bool bNewFrames) const =0
void SetViewAspect(sal_Int64 nAspect)
bool m_bOrigPurgeOle
Definition: ndole.hxx:183
PurgeGuard(const SwDoc &rDoc)
Definition: ndole.cxx:1008
svt::EmbeddedObjectRef m_xOLERef
Either ref or name are known.
Definition: ndole.hxx:43
bool mbOLESizeInvalid
Should be considered at SwDoc::PrtOLENotify (e.g.
Definition: ndole.hxx:93
void SetOLESizeInvalid(bool b)
Definition: ndole.hxx:137
bool IsOLESizeInvalid() const
Definition: ndole.hxx:136
SwOLEObj & GetOLEObj()
Definition: ndole.hxx:116
struct _xmlTextWriter * xmlTextWriterPtr
basegfx::B2DRange m_aRange
Definition: ndole.hxx:48
sal_Int64 GetViewAspect() const
OUString GetDescription() const
Remove OLE-object from "memory".
Definition: ndole.hxx:144