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 public:
56  SwOLEObj( const svt::EmbeddedObjectRef& pObj );
57  SwOLEObj( const OUString &rName, sal_Int64 nAspect );
58  ~SwOLEObj() COVERITY_NOEXCEPT_FALSE;
59 
60  bool UnloadObject();
61  static bool UnloadObject( css::uno::Reference< css::embed::XEmbeddedObject > const & xObj,
62  const SwDoc* pDoc,
63  sal_Int64 nAspect );
64 
65  OUString GetDescription();
66 
67  css::uno::Reference < css::embed::XEmbeddedObject > const & GetOleRef();
68  svt::EmbeddedObjectRef& GetObject();
69  const OUString& GetCurrentPersistName() const { return m_aName; }
70  OUString GetStyleString();
71  bool IsOleRef() const;
72 
73  // try to get OLE visualization in form of a Primitive2DSequence
74  // and the corresponding B2DRange. This data may be locally buffered
75  drawinglayer::primitive2d::Primitive2DContainer const & tryToGetChartContentAsPrimitive2DSequence(
76  basegfx::B2DRange& rRange,
77  bool bSynchron);
78  void resetBufferedData();
79 };
80 
81 // SwOLENode
82 
84 {
85  friend class SwNodes;
86  mutable SwOLEObj maOLEObj;
87  OUString msChartTableName;
92  OUString maLinkURL;
93 
94  SwOLENode( const SwNodeIndex &rWhere,
96  SwGrfFormatColl *pGrfColl,
97  SwAttrSet const * pAutoAttr );
98 
99  SwOLENode( const SwNodeIndex &rWhere,
100  const OUString &rName,
101  sal_Int64 nAspect,
102  SwGrfFormatColl *pGrfColl,
103  SwAttrSet const * pAutoAttr );
104 
105  SwOLENode( const SwOLENode & ) = delete;
106 
108 
109 public:
110  const SwOLEObj& GetOLEObj() const { return maOLEObj; }
111  SwOLEObj& GetOLEObj() { return maOLEObj; }
112  virtual ~SwOLENode() override;
113 
115  virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const override;
116 
117  virtual Size GetTwipSize() const override;
118 
119  const Graphic* GetGraphic();
120 
121  void GetNewReplacement();
122 
123  virtual bool SavePersistentData() override;
124  virtual bool RestorePersistentData() override;
125 
126  bool IsInGlobalDocSection() const;
127  bool IsOLEObjectDeleted() const;
128 
129  bool IsOLESizeInvalid() const { return mbOLESizeInvalid; }
130  void SetOLESizeInvalid( bool b ){ mbOLESizeInvalid = b; }
131 
132  sal_Int64 GetAspect() const { return maOLEObj.GetObject().GetViewAspect(); }
133  void SetAspect( sal_Int64 nAspect) { maOLEObj.GetObject().SetViewAspect( nAspect ); }
134 
137  OUString GetDescription() const { return maOLEObj.GetDescription(); }
138 
139  bool UpdateLinkURL_Impl();
140  void BreakFileLink_Impl();
141  void DisconnectFileLink_Impl();
142 
143  void CheckFileLink_Impl();
144 
145  // #i99665#
146  bool IsChart() const;
147 
148  const OUString& GetChartTableName() const { return msChartTableName; }
149  void SetChartTableName( const OUString& rNm ) { msChartTableName = rNm; }
150 
151 
152  // react on visual change (invalidate)
153  void SetChanged();
154 };
155 
158 {
159  return SwNodeType::Ole == m_nNodeType ? static_cast<SwOLENode*>(this) : nullptr;
160 }
161 
162 inline const SwOLENode *SwNode::GetOLENode() const
163 {
164  return SwNodeType::Ole == m_nNodeType ? static_cast<const SwOLENode*>(this) : nullptr;
165 }
166 
167 #endif // _ INCLUDED_SW_INC_NDOLE_HXX
168 
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetAspect(sal_Int64 nAspect)
Definition: ndole.hxx:133
Graphic GetGraphic() const
Definition: ndnotxt.cxx:231
sal_Int64 GetAspect() const
Definition: ndole.hxx:132
SwOLEObj maOLEObj
Definition: ndole.hxx:86
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:157
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:110
OUString msChartTableName
with chart objects: name of referenced table.
Definition: ndole.hxx:87
OUString GetDescription()
Definition: ndole.cxx:1015
virtual Size GetTwipSize() const =0
const OUString & GetChartTableName() const
Definition: ndole.hxx:148
std::unique_ptr< DeflateData > m_pDeflateData
Definition: ndole.hxx:49
rtl::Reference< SwOLEListener_Impl > m_xListener
Definition: ndole.hxx:39
Definition: doc.hxx:185
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:952
drawinglayer::primitive2d::Primitive2DContainer m_aPrimitive2DSequence
Definition: ndole.hxx:47
const SwOLENode * m_pOLENode
Definition: ndole.hxx:38
Holder for local data for a parallel-executed task to load a chart model.
Definition: ndole.cxx:665
OUString m_aName
Definition: ndole.hxx:44
OUString maLinkURL
Definition: ndole.hxx:92
virtual SwContentNode * MakeCopy(SwDoc *, const SwNodeIndex &, bool bNewFrames) const =0
Marks a node in the document model.
Definition: ndindex.hxx:31
SwEmbedObjectLink * mpObjectLink
Definition: ndole.hxx:91
#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:77
virtual bool SavePersistentData()
Definition: ndnotxt.cxx:82
void SetChartTableName(const OUString &rNm)
Definition: ndole.hxx:149
void SetViewAspect(sal_Int64 nAspect)
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:88
void SetOLESizeInvalid(bool b)
Definition: ndole.hxx:130
bool IsOLESizeInvalid() const
Definition: ndole.hxx:129
SwOLEObj & GetOLEObj()
Definition: ndole.hxx:111
SwNodeType const m_nNodeType
Definition: node.hxx:84
basegfx::B2DRange m_aRange
Definition: ndole.hxx:48
sal_Int64 GetViewAspect() const
OUString GetDescription() const
Remove OLE-object from "memory".
Definition: ndole.hxx:137