1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef _NDOLE_HXX 28*cdf0e10cSrcweir #define _NDOLE_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include <ndnotxt.hxx> 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <svtools/embedhlp.hxx> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir class SwGrfFmtColl; 35*cdf0e10cSrcweir class SwDoc; 36*cdf0e10cSrcweir class SwOLENode; 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir class SwOLEListener_Impl; 39*cdf0e10cSrcweir class SwEmbedObjectLink; 40*cdf0e10cSrcweir class SW_DLLPUBLIC SwOLEObj 41*cdf0e10cSrcweir { 42*cdf0e10cSrcweir friend class SwOLENode; 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir const SwOLENode* pOLENd; 45*cdf0e10cSrcweir SwOLEListener_Impl* pListener; 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir //Entweder Ref oder Name sind bekannt, wenn nur der Name bekannt ist, wird 48*cdf0e10cSrcweir //dir Ref bei Anforderung durch GetOleRef() vom Sfx besorgt. 49*cdf0e10cSrcweir svt::EmbeddedObjectRef xOLERef; 50*cdf0e10cSrcweir String aName; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir SwOLEObj( const SwOLEObj& rObj ); //nicht erlaubt. 53*cdf0e10cSrcweir SwOLEObj(); 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir void SetNode( SwOLENode* pNode ); 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir public: 58*cdf0e10cSrcweir SwOLEObj( const svt::EmbeddedObjectRef& pObj ); 59*cdf0e10cSrcweir SwOLEObj( const String &rName, sal_Int64 nAspect ); 60*cdf0e10cSrcweir ~SwOLEObj(); 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir sal_Bool UnloadObject(); 63*cdf0e10cSrcweir static sal_Bool UnloadObject( ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject > xObj, 64*cdf0e10cSrcweir const SwDoc* pDoc, 65*cdf0e10cSrcweir sal_Int64 nAspect ); 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir String GetDescription(); 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir #ifndef _FESHVIEW_ONLY_INLINE_NEEDED 70*cdf0e10cSrcweir const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef(); 71*cdf0e10cSrcweir svt::EmbeddedObjectRef& GetObject(); 72*cdf0e10cSrcweir const String& GetCurrentPersistName() const { return aName; } 73*cdf0e10cSrcweir sal_Bool IsOleRef() const; //Damit das Objekt nicht unnoetig geladen werden muss. 74*cdf0e10cSrcweir #endif 75*cdf0e10cSrcweir }; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir // -------------------- 79*cdf0e10cSrcweir // SwOLENode 80*cdf0e10cSrcweir // -------------------- 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir class SW_DLLPUBLIC SwOLENode: public SwNoTxtNode 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir friend class SwNodes; 85*cdf0e10cSrcweir mutable SwOLEObj aOLEObj; 86*cdf0e10cSrcweir Graphic* pGraphic; 87*cdf0e10cSrcweir String sChartTblName; // bei Chart Objecten: Name der ref. Tabelle 88*cdf0e10cSrcweir sal_Bool bOLESizeInvalid; //Soll beim SwDoc::PrtOLENotify beruecksichtig 89*cdf0e10cSrcweir //werden (zum Beispiel kopiert). Ist nicht 90*cdf0e10cSrcweir //Persistent. 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir SwEmbedObjectLink* mpObjectLink; 93*cdf0e10cSrcweir String maLinkURL; 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir SwOLENode( const SwNodeIndex &rWhere, 96*cdf0e10cSrcweir const svt::EmbeddedObjectRef&, 97*cdf0e10cSrcweir SwGrfFmtColl *pGrfColl, 98*cdf0e10cSrcweir SwAttrSet* pAutoAttr = 0 ); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir SwOLENode( const SwNodeIndex &rWhere, 101*cdf0e10cSrcweir const String &rName, 102*cdf0e10cSrcweir sal_Int64 nAspect, 103*cdf0e10cSrcweir SwGrfFmtColl *pGrfColl, 104*cdf0e10cSrcweir SwAttrSet* pAutoAttr = 0 ); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir // aOLEObj besitzt einen privaten Copy-CTOR, wir brauchen auch einen: 107*cdf0e10cSrcweir SwOLENode( const SwOLENode & ); 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir using SwNoTxtNode::GetGraphic; 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir public: 112*cdf0e10cSrcweir const SwOLEObj& GetOLEObj() const { return aOLEObj; } 113*cdf0e10cSrcweir SwOLEObj& GetOLEObj() { return aOLEObj; } 114*cdf0e10cSrcweir ~SwOLENode(); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir virtual SwCntntNode *SplitCntntNode( const SwPosition & ); 117*cdf0e10cSrcweir // steht in ndcopy.cxx 118*cdf0e10cSrcweir virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const; 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir virtual Size GetTwipSize() const; 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir Graphic* GetGraphic(); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir Graphic* GetHCGraphic(); // tries to retrieve HighContrast representation if possible 125*cdf0e10cSrcweir void GetNewReplacement(); 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir virtual sal_Bool SavePersistentData(); 128*cdf0e10cSrcweir virtual sal_Bool RestorePersistentData(); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir sal_Bool IsInGlobalDocSection() const; 131*cdf0e10cSrcweir sal_Bool IsOLEObjectDeleted() const; 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir sal_Bool IsOLESizeInvalid() const { return bOLESizeInvalid; } 134*cdf0e10cSrcweir void SetOLESizeInvalid( sal_Bool b ){ bOLESizeInvalid = b; } 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir sal_Int64 GetAspect() const { return aOLEObj.GetObject().GetViewAspect(); } 137*cdf0e10cSrcweir void SetAspect( sal_Int64 nAspect) { aOLEObj.GetObject().SetViewAspect( nAspect ); } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir // OLE-Object aus dem "Speicher" entfernen 140*cdf0e10cSrcweir // inline void Unload() { aOLEObj.Unload(); } 141*cdf0e10cSrcweir String GetDescription() const { return aOLEObj.GetDescription(); } 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir sal_Bool UpdateLinkURL_Impl(); 144*cdf0e10cSrcweir void BreakFileLink_Impl(); 145*cdf0e10cSrcweir void DisconnectFileLink_Impl(); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir void CheckFileLink_Impl(); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir // --> OD 2009-03-05 #i99665# 150*cdf0e10cSrcweir bool IsChart() const; 151*cdf0e10cSrcweir // <-- 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir #ifndef _FESHVIEW_ONLY_INLINE_NEEDED 154*cdf0e10cSrcweir const String& GetChartTblName() const { return sChartTblName; } 155*cdf0e10cSrcweir void SetChartTblName( const String& rNm ) { sChartTblName = rNm; } 156*cdf0e10cSrcweir #endif 157*cdf0e10cSrcweir }; 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir // Inline Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !! 161*cdf0e10cSrcweir inline SwOLENode *SwNode::GetOLENode() 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir return ND_OLENODE == nNodeType ? (SwOLENode*)this : 0; 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir inline const SwOLENode *SwNode::GetOLENode() const 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir return ND_OLENODE == nNodeType ? (const SwOLENode*)this : 0; 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir #endif // _NDOLE_HXX 171