xref: /AOO41X/main/sw/inc/ndole.hxx (revision 5ff14ef2c455a7c2a39819566d74aed4bcc9528e)
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();
68     const String& GetCurrentPersistName() const { return aName; }
69 	//IAccessibility2 Implementation 2009-----
70 	String GetStyleString();
71 	//-----IAccessibility2 Implementation 2009
72 	sal_Bool IsOleRef() const;	//Damit das Objekt nicht unnoetig geladen werden muss.
73 #endif
74 };
75 
76 
77 // --------------------
78 // SwOLENode
79 // --------------------
80 
81 class SW_DLLPUBLIC SwOLENode: public SwNoTxtNode
82 {
83 	friend class SwNodes;
84 	mutable SwOLEObj aOLEObj;
85     Graphic*    pGraphic;
86 	String sChartTblName;		// bei Chart Objecten: Name der ref. Tabelle
87 	sal_Bool   bOLESizeInvalid;		//Soll beim SwDoc::PrtOLENotify beruecksichtig
88 								//werden (zum Beispiel kopiert). Ist nicht
89 								//Persistent.
90 
91 	SwEmbedObjectLink*	mpObjectLink;
92 	String maLinkURL;
93 
94 	SwOLENode(	const SwNodeIndex &rWhere,
95                 const svt::EmbeddedObjectRef&,
96 				SwGrfFmtColl *pGrfColl,
97 				SwAttrSet* pAutoAttr = 0 );
98 
99 	SwOLENode(	const SwNodeIndex &rWhere,
100 				const String &rName,
101 				sal_Int64 nAspect,
102 				SwGrfFmtColl *pGrfColl,
103 				SwAttrSet* pAutoAttr = 0 );
104 
105 	// aOLEObj besitzt einen privaten Copy-CTOR, wir brauchen auch einen:
106 	SwOLENode( const SwOLENode & );
107 
108     using SwNoTxtNode::GetGraphic;
109 
110 public:
111 	const SwOLEObj& GetOLEObj() const { return aOLEObj; }
112 		  SwOLEObj& GetOLEObj()		  { return aOLEObj; }
113     ~SwOLENode();
114 
115     virtual SwCntntNode *SplitCntntNode( const SwPosition & );
116 		// steht in ndcopy.cxx
117 	virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
118 
119 	virtual Size GetTwipSize() const;
120 
121     Graphic* GetGraphic();
122 
123 	Graphic* GetHCGraphic(); // tries to retrieve HighContrast representation if possible
124     void GetNewReplacement();
125 
126 	virtual sal_Bool SavePersistentData();
127 	virtual sal_Bool RestorePersistentData();
128 
129 	sal_Bool IsInGlobalDocSection() const;
130 	sal_Bool IsOLEObjectDeleted() const;
131 
132 	sal_Bool IsOLESizeInvalid() const	{ return bOLESizeInvalid; }
133 	void SetOLESizeInvalid( sal_Bool b ){ bOLESizeInvalid = b; }
134 
135     sal_Int64 GetAspect() const { return aOLEObj.GetObject().GetViewAspect(); }
136     void SetAspect( sal_Int64 nAspect) { aOLEObj.GetObject().SetViewAspect( nAspect ); }
137 
138 	// OLE-Object aus dem "Speicher" entfernen
139 	// inline void Unload() { aOLEObj.Unload(); }
140     String GetDescription() const { return aOLEObj.GetDescription(); }
141 
142 	sal_Bool UpdateLinkURL_Impl();
143 	void BreakFileLink_Impl();
144 	void DisconnectFileLink_Impl();
145 
146 	void CheckFileLink_Impl();
147 
148     // --> OD 2009-03-05 #i99665#
149     bool IsChart() const;
150     // <--
151 
152 #ifndef _FESHVIEW_ONLY_INLINE_NEEDED
153 	const String& GetChartTblName() const 		{ return sChartTblName; }
154 	void SetChartTblName( const String& rNm ) 	{ sChartTblName = rNm; }
155 #endif
156 };
157 
158 
159 // Inline Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
160 inline SwOLENode *SwNode::GetOLENode()
161 {
162 	 return ND_OLENODE == nNodeType ? (SwOLENode*)this : 0;
163 }
164 inline const SwOLENode *SwNode::GetOLENode() const
165 {
166 	 return ND_OLENODE == nNodeType ? (const SwOLENode*)this : 0;
167 }
168 
169 #endif	// _NDOLE_HXX
170