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