1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <ndnotxt.hxx>
24 #include <svtools/embedhlp.hxx>
30 class SwOLEListener_Impl
;
31 class SwEmbedObjectLink
;
32 class SW_DLLPUBLIC SwOLEObj
34 friend class SwOLENode
;
36 const SwOLENode
* pOLENd
;
37 SwOLEListener_Impl
* pListener
;
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
;
44 SwOLEObj( const SwOLEObj
& rObj
); /// Not allowed.
47 void SetNode( SwOLENode
* pNode
);
50 SwOLEObj( const svt::EmbeddedObjectRef
& pObj
);
51 SwOLEObj( const String
&rName
, sal_Int64 nAspect
);
54 sal_Bool
UnloadObject();
55 static sal_Bool
UnloadObject( ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedObject
> xObj
,
59 String
GetDescription();
61 #ifndef _FESHVIEW_ONLY_INLINE_NEEDED
62 const com::sun::star::uno::Reference
< com::sun::star::embed::XEmbeddedObject
> GetOleRef();
63 svt::EmbeddedObjectRef
& GetObject();
64 const String
& GetCurrentPersistName() const { return aName
; }
65 sal_Bool
IsOleRef() const; ///< To avoid unneccessary loading of object.
73 class SW_DLLPUBLIC SwOLENode
: public SwNoTxtNode
76 mutable SwOLEObj aOLEObj
;
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. */
82 SwEmbedObjectLink
* mpObjectLink
;
85 SwOLENode( const SwNodeIndex
&rWhere
,
86 const svt::EmbeddedObjectRef
&,
87 SwGrfFmtColl
*pGrfColl
,
88 SwAttrSet
* pAutoAttr
= 0 );
90 SwOLENode( const SwNodeIndex
&rWhere
,
93 SwGrfFmtColl
*pGrfColl
,
94 SwAttrSet
* pAutoAttr
= 0 );
96 /// aOLEObj has a private Copy-Ctor. We need one too:
97 SwOLENode( const SwOLENode
& );
99 using SwNoTxtNode::GetGraphic
;
102 const SwOLEObj
& GetOLEObj() const { return aOLEObj
; }
103 SwOLEObj
& GetOLEObj() { return aOLEObj
; }
106 virtual SwCntntNode
*SplitCntntNode( const SwPosition
& );
108 /// Is in ndcopy.cxx.
109 virtual SwCntntNode
* MakeCopy( SwDoc
*, const SwNodeIndex
& ) const;
111 virtual Size
GetTwipSize() const;
113 const Graphic
* GetGraphic();
115 void GetNewReplacement();
117 virtual sal_Bool
SavePersistentData();
118 virtual sal_Bool
RestorePersistentData();
120 sal_Bool
IsInGlobalDocSection() const;
121 sal_Bool
IsOLEObjectDeleted() const;
123 sal_Bool
IsOLESizeInvalid() const { return bOLESizeInvalid
; }
124 void SetOLESizeInvalid( sal_Bool b
){ bOLESizeInvalid
= b
; }
126 sal_Int64
GetAspect() const { return aOLEObj
.GetObject().GetViewAspect(); }
127 void SetAspect( sal_Int64 nAspect
) { aOLEObj
.GetObject().SetViewAspect( nAspect
); }
129 /** Remove OLE-object from "memory".
130 inline void Unload() { aOLEObj.Unload(); } */
131 String
GetDescription() const { return aOLEObj
.GetDescription(); }
133 sal_Bool
UpdateLinkURL_Impl();
134 void BreakFileLink_Impl();
135 void DisconnectFileLink_Impl();
137 void CheckFileLink_Impl();
140 bool IsChart() const;
143 #ifndef _FESHVIEW_ONLY_INLINE_NEEDED
144 const String
& GetChartTblName() const { return sChartTblName
; }
145 void SetChartTblName( const String
& rNm
) { sChartTblName
= rNm
; }
150 /// Inline methods from Node.hxx
151 inline SwOLENode
*SwNode::GetOLENode()
153 return ND_OLENODE
== nNodeType
? (SwOLENode
*)this : 0;
156 inline const SwOLENode
*SwNode::GetOLENode() const
158 return ND_OLENODE
== nNodeType
? (const SwOLENode
*)this : 0;
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */