xref: /AOO41X/main/sw/inc/ndole.hxx (revision ca62e2c2083b5d0995f1245bad6c2edfb455fbec)
11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew 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; }
69*ca62e2c2SSteve Yin 	//IAccessibility2 Implementation 2009-----
70*ca62e2c2SSteve Yin 	String GetStyleString();
71*ca62e2c2SSteve Yin 	//-----IAccessibility2 Implementation 2009
72cdf0e10cSrcweir 	sal_Bool IsOleRef() const;	//Damit das Objekt nicht unnoetig geladen werden muss.
73cdf0e10cSrcweir #endif
74cdf0e10cSrcweir };
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 
77cdf0e10cSrcweir // --------------------
78cdf0e10cSrcweir // SwOLENode
79cdf0e10cSrcweir // --------------------
80cdf0e10cSrcweir 
81cdf0e10cSrcweir class SW_DLLPUBLIC SwOLENode: public SwNoTxtNode
82cdf0e10cSrcweir {
83cdf0e10cSrcweir 	friend class SwNodes;
84cdf0e10cSrcweir 	mutable SwOLEObj aOLEObj;
85cdf0e10cSrcweir     Graphic*    pGraphic;
86cdf0e10cSrcweir 	String sChartTblName;		// bei Chart Objecten: Name der ref. Tabelle
87cdf0e10cSrcweir 	sal_Bool   bOLESizeInvalid;		//Soll beim SwDoc::PrtOLENotify beruecksichtig
88cdf0e10cSrcweir 								//werden (zum Beispiel kopiert). Ist nicht
89cdf0e10cSrcweir 								//Persistent.
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	SwEmbedObjectLink*	mpObjectLink;
92cdf0e10cSrcweir 	String maLinkURL;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	SwOLENode(	const SwNodeIndex &rWhere,
95cdf0e10cSrcweir                 const svt::EmbeddedObjectRef&,
96cdf0e10cSrcweir 				SwGrfFmtColl *pGrfColl,
97cdf0e10cSrcweir 				SwAttrSet* pAutoAttr = 0 );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	SwOLENode(	const SwNodeIndex &rWhere,
100cdf0e10cSrcweir 				const String &rName,
101cdf0e10cSrcweir 				sal_Int64 nAspect,
102cdf0e10cSrcweir 				SwGrfFmtColl *pGrfColl,
103cdf0e10cSrcweir 				SwAttrSet* pAutoAttr = 0 );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	// aOLEObj besitzt einen privaten Copy-CTOR, wir brauchen auch einen:
106cdf0e10cSrcweir 	SwOLENode( const SwOLENode & );
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     using SwNoTxtNode::GetGraphic;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir public:
111cdf0e10cSrcweir 	const SwOLEObj& GetOLEObj() const { return aOLEObj; }
112cdf0e10cSrcweir 		  SwOLEObj& GetOLEObj()		  { return aOLEObj; }
113cdf0e10cSrcweir     ~SwOLENode();
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     virtual SwCntntNode *SplitCntntNode( const SwPosition & );
116cdf0e10cSrcweir 		// steht in ndcopy.cxx
117cdf0e10cSrcweir 	virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	virtual Size GetTwipSize() const;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     Graphic* GetGraphic();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	Graphic* GetHCGraphic(); // tries to retrieve HighContrast representation if possible
124cdf0e10cSrcweir     void GetNewReplacement();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	virtual sal_Bool SavePersistentData();
127cdf0e10cSrcweir 	virtual sal_Bool RestorePersistentData();
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	sal_Bool IsInGlobalDocSection() const;
130cdf0e10cSrcweir 	sal_Bool IsOLEObjectDeleted() const;
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	sal_Bool IsOLESizeInvalid() const	{ return bOLESizeInvalid; }
133cdf0e10cSrcweir 	void SetOLESizeInvalid( sal_Bool b ){ bOLESizeInvalid = b; }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     sal_Int64 GetAspect() const { return aOLEObj.GetObject().GetViewAspect(); }
136cdf0e10cSrcweir     void SetAspect( sal_Int64 nAspect) { aOLEObj.GetObject().SetViewAspect( nAspect ); }
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 	// OLE-Object aus dem "Speicher" entfernen
139cdf0e10cSrcweir 	// inline void Unload() { aOLEObj.Unload(); }
140cdf0e10cSrcweir     String GetDescription() const { return aOLEObj.GetDescription(); }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	sal_Bool UpdateLinkURL_Impl();
143cdf0e10cSrcweir 	void BreakFileLink_Impl();
144cdf0e10cSrcweir 	void DisconnectFileLink_Impl();
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 	void CheckFileLink_Impl();
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     // --> OD 2009-03-05 #i99665#
149cdf0e10cSrcweir     bool IsChart() const;
150cdf0e10cSrcweir     // <--
151cdf0e10cSrcweir 
152cdf0e10cSrcweir #ifndef _FESHVIEW_ONLY_INLINE_NEEDED
153cdf0e10cSrcweir 	const String& GetChartTblName() const 		{ return sChartTblName; }
154cdf0e10cSrcweir 	void SetChartTblName( const String& rNm ) 	{ sChartTblName = rNm; }
155cdf0e10cSrcweir #endif
156cdf0e10cSrcweir };
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 
159cdf0e10cSrcweir // Inline Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
160cdf0e10cSrcweir inline SwOLENode *SwNode::GetOLENode()
161cdf0e10cSrcweir {
162cdf0e10cSrcweir 	 return ND_OLENODE == nNodeType ? (SwOLENode*)this : 0;
163cdf0e10cSrcweir }
164cdf0e10cSrcweir inline const SwOLENode *SwNode::GetOLENode() const
165cdf0e10cSrcweir {
166cdf0e10cSrcweir 	 return ND_OLENODE == nNodeType ? (const SwOLENode*)this : 0;
167cdf0e10cSrcweir }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir #endif	// _NDOLE_HXX
170