Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _NDOLE_HXX
29 : : #define _NDOLE_HXX
30 : :
31 : : #include <ndnotxt.hxx>
32 : :
33 : : #include <svtools/embedhlp.hxx>
34 : :
35 : : class SwGrfFmtColl;
36 : : class SwDoc;
37 : : class SwOLENode;
38 : :
39 : : class SwOLEListener_Impl;
40 : : class SwEmbedObjectLink;
41 : : class SW_DLLPUBLIC SwOLEObj
42 : : {
43 : : friend class SwOLENode;
44 : :
45 : : const SwOLENode* pOLENd;
46 : : SwOLEListener_Impl* pListener;
47 : :
48 : : // Either ref or name are known. If only name is known, ref is obtained
49 : : // on demand by GetOleRef() from Sfx.
50 : : svt::EmbeddedObjectRef xOLERef;
51 : : String aName;
52 : :
53 : : SwOLEObj( const SwOLEObj& rObj ); // Not allowed.
54 : : SwOLEObj();
55 : :
56 : : void SetNode( SwOLENode* pNode );
57 : :
58 : : public:
59 : : SwOLEObj( const svt::EmbeddedObjectRef& pObj );
60 : : SwOLEObj( const String &rName, sal_Int64 nAspect );
61 : : ~SwOLEObj();
62 : :
63 : : sal_Bool UnloadObject();
64 : : static sal_Bool UnloadObject( ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject > xObj,
65 : : const SwDoc* pDoc,
66 : : sal_Int64 nAspect );
67 : :
68 : : String GetDescription();
69 : :
70 : : #ifndef _FESHVIEW_ONLY_INLINE_NEEDED
71 : : const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef();
72 : : svt::EmbeddedObjectRef& GetObject();
73 : 0 : const String& GetCurrentPersistName() const { return aName; }
74 : : sal_Bool IsOleRef() const; // To avoid unneccessary loading of object.
75 : : #endif
76 : : };
77 : :
78 : :
79 : :
80 : : // SwOLENode
81 : :
82 : : class SW_DLLPUBLIC SwOLENode: public SwNoTxtNode
83 : : {
84 : : friend class SwNodes;
85 : : mutable SwOLEObj aOLEObj;
86 : : Graphic* pGraphic;
87 : : String sChartTblName; // with chart objects: name of referenced table.
88 : : sal_Bool bOLESizeInvalid; // Should be considered at SwDoc::PrtOLENotify
89 : : // (e.g. copied). Is not 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 has a private Copy-Ctor. We need one too:
106 : : SwOLENode( const SwOLENode & );
107 : :
108 : : using SwNoTxtNode::GetGraphic;
109 : :
110 : : public:
111 : 0 : const SwOLEObj& GetOLEObj() const { return aOLEObj; }
112 : 3672 : SwOLEObj& GetOLEObj() { return aOLEObj; }
113 : : ~SwOLENode();
114 : :
115 : : virtual SwCntntNode *SplitCntntNode( const SwPosition & );
116 : :
117 : : // Is in ndcopy.cxx.
118 : : virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
119 : :
120 : : virtual Size GetTwipSize() const;
121 : :
122 : : Graphic* GetGraphic();
123 : :
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 : 1730 : sal_Bool IsOLESizeInvalid() const { return bOLESizeInvalid; }
133 : 0 : void SetOLESizeInvalid( sal_Bool b ){ bOLESizeInvalid = b; }
134 : :
135 : 416 : sal_Int64 GetAspect() const { return aOLEObj.GetObject().GetViewAspect(); }
136 : 0 : void SetAspect( sal_Int64 nAspect) { aOLEObj.GetObject().SetViewAspect( nAspect ); }
137 : :
138 : : // Remove OLE-object from "memory".
139 : : // inline void Unload() { aOLEObj.Unload(); }
140 : 2 : 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 : : // #i99665#
149 : : bool IsChart() const;
150 : :
151 : :
152 : : #ifndef _FESHVIEW_ONLY_INLINE_NEEDED
153 : 0 : const String& GetChartTblName() const { return sChartTblName; }
154 : 0 : void SetChartTblName( const String& rNm ) { sChartTblName = rNm; }
155 : : #endif
156 : : };
157 : :
158 : :
159 : : // Inline methods from Node.hxx
160 : 1847 : inline SwOLENode *SwNode::GetOLENode()
161 : : {
162 [ + + ]: 1847 : return ND_OLENODE == nNodeType ? (SwOLENode*)this : 0;
163 : : }
164 : :
165 : 263 : inline const SwOLENode *SwNode::GetOLENode() const
166 : : {
167 [ + + ]: 263 : return ND_OLENODE == nNodeType ? (const SwOLENode*)this : 0;
168 : : }
169 : :
170 : : #endif // _NDOLE_HXX
171 : :
172 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|