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