Line data Source code
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 _NDOLE_HXX
20 : #define _NDOLE_HXX
21 :
22 : #include <ndnotxt.hxx>
23 :
24 : #include <svtools/embedhlp.hxx>
25 :
26 : class SwGrfFmtColl;
27 : class SwDoc;
28 : class SwOLENode;
29 :
30 : class SwOLEListener_Impl;
31 : class SwEmbedObjectLink;
32 : class SW_DLLPUBLIC SwOLEObj
33 : {
34 : friend class SwOLENode;
35 :
36 : const SwOLENode* pOLENd;
37 : SwOLEListener_Impl* pListener;
38 :
39 : /** Either ref or name are known. If only name is known, ref is obtained
40 : on demand by GetOleRef() from Sfx. */
41 : svt::EmbeddedObjectRef xOLERef;
42 : String aName;
43 :
44 : SwOLEObj( const SwOLEObj& rObj ); /// Not allowed.
45 : SwOLEObj();
46 :
47 : void SetNode( SwOLENode* pNode );
48 :
49 : public:
50 : SwOLEObj( const svt::EmbeddedObjectRef& pObj );
51 : SwOLEObj( const String &rName, sal_Int64 nAspect );
52 : ~SwOLEObj();
53 :
54 : sal_Bool UnloadObject();
55 : static sal_Bool UnloadObject( ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject > xObj,
56 : const SwDoc* pDoc,
57 : sal_Int64 nAspect );
58 :
59 : String GetDescription();
60 :
61 : #ifndef _FESHVIEW_ONLY_INLINE_NEEDED
62 : const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef();
63 : svt::EmbeddedObjectRef& GetObject();
64 0 : const String& GetCurrentPersistName() const { return aName; }
65 : sal_Bool IsOleRef() const; ///< To avoid unneccessary loading of object.
66 : #endif
67 : };
68 :
69 :
70 :
71 : // SwOLENode
72 :
73 : class SW_DLLPUBLIC SwOLENode: public SwNoTxtNode
74 : {
75 : friend class SwNodes;
76 : mutable SwOLEObj aOLEObj;
77 : Graphic* pGraphic;
78 : String sChartTblName; ///< with chart objects: name of referenced table.
79 : sal_Bool bOLESizeInvalid; /**< Should be considered at SwDoc::PrtOLENotify
80 : (e.g. copied). Is not persistent. */
81 :
82 : SwEmbedObjectLink* mpObjectLink;
83 : String maLinkURL;
84 :
85 : SwOLENode( const SwNodeIndex &rWhere,
86 : const svt::EmbeddedObjectRef&,
87 : SwGrfFmtColl *pGrfColl,
88 : SwAttrSet* pAutoAttr = 0 );
89 :
90 : SwOLENode( const SwNodeIndex &rWhere,
91 : const String &rName,
92 : sal_Int64 nAspect,
93 : SwGrfFmtColl *pGrfColl,
94 : SwAttrSet* pAutoAttr = 0 );
95 :
96 : /// aOLEObj has a private Copy-Ctor. We need one too:
97 : SwOLENode( const SwOLENode & );
98 :
99 : using SwNoTxtNode::GetGraphic;
100 :
101 : public:
102 138 : const SwOLEObj& GetOLEObj() const { return aOLEObj; }
103 1542 : SwOLEObj& GetOLEObj() { return aOLEObj; }
104 : ~SwOLENode();
105 :
106 : virtual SwCntntNode *SplitCntntNode( const SwPosition & );
107 :
108 : /// Is in ndcopy.cxx.
109 : virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
110 :
111 : virtual Size GetTwipSize() const;
112 :
113 : Graphic* GetGraphic();
114 :
115 : void GetNewReplacement();
116 :
117 : virtual sal_Bool SavePersistentData();
118 : virtual sal_Bool RestorePersistentData();
119 :
120 : sal_Bool IsInGlobalDocSection() const;
121 : sal_Bool IsOLEObjectDeleted() const;
122 :
123 576 : sal_Bool IsOLESizeInvalid() const { return bOLESizeInvalid; }
124 0 : void SetOLESizeInvalid( sal_Bool b ){ bOLESizeInvalid = b; }
125 :
126 210 : sal_Int64 GetAspect() const { return aOLEObj.GetObject().GetViewAspect(); }
127 0 : void SetAspect( sal_Int64 nAspect) { aOLEObj.GetObject().SetViewAspect( nAspect ); }
128 :
129 : /** Remove OLE-object from "memory".
130 : inline void Unload() { aOLEObj.Unload(); } */
131 0 : String GetDescription() const { return aOLEObj.GetDescription(); }
132 :
133 : sal_Bool UpdateLinkURL_Impl();
134 : void BreakFileLink_Impl();
135 : void DisconnectFileLink_Impl();
136 :
137 : void CheckFileLink_Impl();
138 :
139 : // #i99665#
140 : bool IsChart() const;
141 :
142 :
143 : #ifndef _FESHVIEW_ONLY_INLINE_NEEDED
144 0 : const String& GetChartTblName() const { return sChartTblName; }
145 0 : void SetChartTblName( const String& rNm ) { sChartTblName = rNm; }
146 : #endif
147 : };
148 :
149 :
150 : /// Inline methods from Node.hxx
151 815 : inline SwOLENode *SwNode::GetOLENode()
152 : {
153 815 : return ND_OLENODE == nNodeType ? (SwOLENode*)this : 0;
154 : }
155 :
156 154 : inline const SwOLENode *SwNode::GetOLENode() const
157 : {
158 154 : return ND_OLENODE == nNodeType ? (const SwOLENode*)this : 0;
159 : }
160 :
161 : #endif // _NDOLE_HXX
162 :
163 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|