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