xref: /AOO41X/main/sw/inc/ndole.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _NDOLE_HXX
24cdf0e10cSrcweir #define _NDOLE_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <ndnotxt.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <svtools/embedhlp.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir class SwGrfFmtColl;
31cdf0e10cSrcweir class SwDoc;
32cdf0e10cSrcweir class SwOLENode;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class SwOLEListener_Impl;
35cdf0e10cSrcweir class SwEmbedObjectLink;
36cdf0e10cSrcweir class SW_DLLPUBLIC SwOLEObj
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 	friend class SwOLENode;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 	const SwOLENode* pOLENd;
41cdf0e10cSrcweir     SwOLEListener_Impl* pListener;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 	//Entweder Ref oder Name sind bekannt, wenn nur der Name bekannt ist, wird
44cdf0e10cSrcweir 	//dir Ref bei Anforderung durch GetOleRef() vom Sfx besorgt.
45cdf0e10cSrcweir     svt::EmbeddedObjectRef xOLERef;
46cdf0e10cSrcweir 	String aName;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	SwOLEObj( const SwOLEObj& rObj );	//nicht erlaubt.
49cdf0e10cSrcweir 	SwOLEObj();
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	void SetNode( SwOLENode* pNode );
52cdf0e10cSrcweir 
53cdf0e10cSrcweir public:
54cdf0e10cSrcweir     SwOLEObj( const svt::EmbeddedObjectRef& pObj );
55cdf0e10cSrcweir 	SwOLEObj( const String &rName, sal_Int64 nAspect );
56cdf0e10cSrcweir 	~SwOLEObj();
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     sal_Bool UnloadObject();
59cdf0e10cSrcweir 	static sal_Bool UnloadObject( ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject > xObj,
60cdf0e10cSrcweir 								const SwDoc* pDoc,
61cdf0e10cSrcweir 								sal_Int64 nAspect );
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     String GetDescription();
64cdf0e10cSrcweir 
65cdf0e10cSrcweir #ifndef _FESHVIEW_ONLY_INLINE_NEEDED
66cdf0e10cSrcweir     const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef();
67cdf0e10cSrcweir     svt::EmbeddedObjectRef& GetObject();
68cdf0e10cSrcweir     const String& GetCurrentPersistName() const { return aName; }
69cdf0e10cSrcweir 	sal_Bool IsOleRef() const;	//Damit das Objekt nicht unnoetig geladen werden muss.
70cdf0e10cSrcweir #endif
71cdf0e10cSrcweir };
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 
74cdf0e10cSrcweir // --------------------
75cdf0e10cSrcweir // SwOLENode
76cdf0e10cSrcweir // --------------------
77cdf0e10cSrcweir 
78cdf0e10cSrcweir class SW_DLLPUBLIC SwOLENode: public SwNoTxtNode
79cdf0e10cSrcweir {
80cdf0e10cSrcweir 	friend class SwNodes;
81cdf0e10cSrcweir 	mutable SwOLEObj aOLEObj;
82cdf0e10cSrcweir     Graphic*    pGraphic;
83cdf0e10cSrcweir 	String sChartTblName;		// bei Chart Objecten: Name der ref. Tabelle
84cdf0e10cSrcweir 	sal_Bool   bOLESizeInvalid;		//Soll beim SwDoc::PrtOLENotify beruecksichtig
85cdf0e10cSrcweir 								//werden (zum Beispiel kopiert). Ist nicht
86cdf0e10cSrcweir 								//Persistent.
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	SwEmbedObjectLink*	mpObjectLink;
89cdf0e10cSrcweir 	String maLinkURL;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	SwOLENode(	const SwNodeIndex &rWhere,
92cdf0e10cSrcweir                 const svt::EmbeddedObjectRef&,
93cdf0e10cSrcweir 				SwGrfFmtColl *pGrfColl,
94cdf0e10cSrcweir 				SwAttrSet* pAutoAttr = 0 );
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	SwOLENode(	const SwNodeIndex &rWhere,
97cdf0e10cSrcweir 				const String &rName,
98cdf0e10cSrcweir 				sal_Int64 nAspect,
99cdf0e10cSrcweir 				SwGrfFmtColl *pGrfColl,
100cdf0e10cSrcweir 				SwAttrSet* pAutoAttr = 0 );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	// aOLEObj besitzt einen privaten Copy-CTOR, wir brauchen auch einen:
103cdf0e10cSrcweir 	SwOLENode( const SwOLENode & );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     using SwNoTxtNode::GetGraphic;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir public:
108cdf0e10cSrcweir 	const SwOLEObj& GetOLEObj() const { return aOLEObj; }
109cdf0e10cSrcweir 		  SwOLEObj& GetOLEObj()		  { return aOLEObj; }
110cdf0e10cSrcweir     ~SwOLENode();
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     virtual SwCntntNode *SplitCntntNode( const SwPosition & );
113cdf0e10cSrcweir 		// steht in ndcopy.cxx
114cdf0e10cSrcweir 	virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	virtual Size GetTwipSize() const;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     Graphic* GetGraphic();
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	Graphic* GetHCGraphic(); // tries to retrieve HighContrast representation if possible
121cdf0e10cSrcweir     void GetNewReplacement();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	virtual sal_Bool SavePersistentData();
124cdf0e10cSrcweir 	virtual sal_Bool RestorePersistentData();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	sal_Bool IsInGlobalDocSection() const;
127cdf0e10cSrcweir 	sal_Bool IsOLEObjectDeleted() const;
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	sal_Bool IsOLESizeInvalid() const	{ return bOLESizeInvalid; }
130cdf0e10cSrcweir 	void SetOLESizeInvalid( sal_Bool b ){ bOLESizeInvalid = b; }
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     sal_Int64 GetAspect() const { return aOLEObj.GetObject().GetViewAspect(); }
133cdf0e10cSrcweir     void SetAspect( sal_Int64 nAspect) { aOLEObj.GetObject().SetViewAspect( nAspect ); }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 	// OLE-Object aus dem "Speicher" entfernen
136cdf0e10cSrcweir 	// inline void Unload() { aOLEObj.Unload(); }
137cdf0e10cSrcweir     String GetDescription() const { return aOLEObj.GetDescription(); }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	sal_Bool UpdateLinkURL_Impl();
140cdf0e10cSrcweir 	void BreakFileLink_Impl();
141cdf0e10cSrcweir 	void DisconnectFileLink_Impl();
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 	void CheckFileLink_Impl();
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     // --> OD 2009-03-05 #i99665#
146cdf0e10cSrcweir     bool IsChart() const;
147cdf0e10cSrcweir     // <--
148cdf0e10cSrcweir 
149cdf0e10cSrcweir #ifndef _FESHVIEW_ONLY_INLINE_NEEDED
150cdf0e10cSrcweir 	const String& GetChartTblName() const 		{ return sChartTblName; }
151cdf0e10cSrcweir 	void SetChartTblName( const String& rNm ) 	{ sChartTblName = rNm; }
152cdf0e10cSrcweir #endif
153cdf0e10cSrcweir };
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 
156cdf0e10cSrcweir // Inline Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
157cdf0e10cSrcweir inline SwOLENode *SwNode::GetOLENode()
158cdf0e10cSrcweir {
159cdf0e10cSrcweir 	 return ND_OLENODE == nNodeType ? (SwOLENode*)this : 0;
160cdf0e10cSrcweir }
161cdf0e10cSrcweir inline const SwOLENode *SwNode::GetOLENode() const
162cdf0e10cSrcweir {
163cdf0e10cSrcweir 	 return ND_OLENODE == nNodeType ? (const SwOLENode*)this : 0;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir 
166cdf0e10cSrcweir #endif	// _NDOLE_HXX
167