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