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 : :
29 : :
30 : : #include <hintids.hxx>
31 : : #include <vcl/svapp.hxx>
32 : : #include <vcl/outdev.hxx>
33 : :
34 : : #include <osl/thread.hxx>
35 : : #include <salhelper/condition.hxx>
36 : : #include <comphelper/mediadescriptor.hxx>
37 : : #include <sfx2/docfile.hxx>
38 : : #include <sfx2/lnkbase.hxx>
39 : : #include <sfx2/objsh.hxx>
40 : : #include <editeng/boxitem.hxx>
41 : : #include <svx/svxids.hrc> // fuer die EventIds
42 : : #include <sfx2/linkmgr.hxx>
43 : : #include <svtools/soerr.hxx>
44 : : #include <fmtfsize.hxx>
45 : : #include <fmtanchr.hxx>
46 : : #include <frmatr.hxx>
47 : : #include <frmfmt.hxx>
48 : : #include <doc.hxx>
49 : : #include <pam.hxx>
50 : : #include <editsh.hxx>
51 : : #include <swtable.hxx>
52 : : #include <docary.hxx>
53 : : #include <swevent.hxx>
54 : : #include <swbaslnk.hxx>
55 : : #include <swserv.hxx>
56 : : #include <ndgrf.hxx>
57 : : #include <ndole.hxx>
58 : : #include <hints.hxx>
59 : : #include <tabfrm.hxx>
60 : : #include <cntfrm.hxx>
61 : : #include <htmltbl.hxx>
62 : :
63 : : using namespace com::sun::star;
64 : :
65 : : sal_Bool SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd );
66 : :
67 [ + - ][ # # ]: 48 : TYPEINIT1( SwBaseLink, ::sfx2::SvBaseLink );
68 : :
69 [ # # ][ # # ]: 0 : SV_IMPL_REF( SwServerObject )
70 : :
71 : 12 : void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
72 : : {
73 : : //call fist all not SwNoTxtFrames, then the SwNoTxtFrames.
74 : : // The reason is, that in the SwNoTxtFrames the Graphic
75 : : // after a Paint will be swapped out! So all other "behind"
76 : : // them havent't a loaded Graphic.
77 : 12 : rGrfNd.LockModify();
78 : :
79 [ + - ]: 12 : SwClientIter aIter( rGrfNd ); // TODO
80 [ + + ]: 36 : for( int n = 0; n < 2; ++n )
81 : : {
82 [ + - ]: 24 : SwClient * pLast = aIter.GoStart();
83 [ + - ]: 24 : if( pLast ) // konnte zum Anfang gesprungen werden ??
84 : : {
85 [ + - ][ - + ]: 24 : do {
86 [ + - ][ + - ]: 24 : if( (0 == n) ^ ( 0 != pLast->ISA( SwCntntFrm )) )
[ + + ]
87 [ + - ]: 12 : pLast->ModifyNotification( &rItem, &rItem );
88 : : } while( 0 != ( pLast = aIter++ ));
89 : : }
90 : : }
91 [ + - ]: 12 : rGrfNd.UnlockModify();
92 : 12 : }
93 : :
94 : :
95 : 40 : ::sfx2::SvBaseLink::UpdateResult SwBaseLink::DataChanged(
96 : : const String& rMimeType, const uno::Any & rValue )
97 : : {
98 [ - + ]: 40 : if( !pCntntNode )
99 : : {
100 : : OSL_ENSURE(!this, "DataChanged ohne ContentNode" );
101 : 0 : return ERROR_GENERAL;
102 : : }
103 : :
104 : 40 : SwDoc* pDoc = pCntntNode->GetDoc();
105 [ + - ][ - + ]: 40 : if( pDoc->IsInDtor() || ChkNoDataFlag() || bIgnoreDataChanged )
[ - + ][ + - ]
106 : : {
107 : 0 : bIgnoreDataChanged = sal_False;
108 : 0 : return SUCCESS;
109 : : }
110 : :
111 [ + - ]: 40 : sal_uLong nFmt = SotExchange::GetFormatIdFromMimeType( rMimeType );
112 : :
113 [ + - ][ + + ]: 80 : if( pCntntNode->IsNoTxtNode() &&
[ + + ]
114 [ + - ]: 40 : nFmt == sfx2::LinkManager::RegisterStatusInfoId() )
115 : : {
116 : : // nur eine Statusaenderung - Events bedienen ?
117 : 12 : ::rtl::OUString sState;
118 [ + - ][ + - ]: 12 : if( rValue.hasValue() && ( rValue >>= sState ))
[ + - ]
119 : : {
120 : 12 : sal_uInt16 nEvent = 0;
121 [ + - - - ]: 12 : switch( sState.toInt32() )
122 : : {
123 : 12 : case sfx2::LinkManager::STATE_LOAD_OK: nEvent = SVX_EVENT_IMAGE_LOAD; break;
124 : 0 : case sfx2::LinkManager::STATE_LOAD_ERROR: nEvent = SVX_EVENT_IMAGE_ERROR; break;
125 : 0 : case sfx2::LinkManager::STATE_LOAD_ABORT: nEvent = SVX_EVENT_IMAGE_ABORT; break;
126 : : }
127 : :
128 : : SwFrmFmt* pFmt;
129 [ + - ][ + - ]: 12 : if( nEvent && 0 != ( pFmt = pCntntNode->GetFlyFmt() ))
[ + - ][ + - ]
130 : : {
131 : 12 : SwCallMouseEvent aCallEvent;
132 : 12 : aCallEvent.Set( EVENT_OBJECT_IMAGE, pFmt );
133 [ + - ]: 12 : pDoc->CallEvent( nEvent, aCallEvent );
134 : : }
135 : : }
136 : 12 : return SUCCESS; // das wars!
137 : : }
138 : :
139 : 28 : sal_Bool bUpdate = sal_False;
140 : 28 : sal_Bool bGraphicArrived = sal_False;
141 : 28 : sal_Bool bGraphicPieceArrived = sal_False;
142 : 28 : sal_Bool bDontNotify = sal_False;
143 : 28 : Size aGrfSz, aFrmFmtSz;
144 : :
145 [ + - ]: 28 : if( pCntntNode->IsGrfNode() )
146 : : {
147 : 28 : GraphicObject& rGrfObj = ((SwGrfNode*)pCntntNode)->GetGrfObj();
148 : :
149 : 28 : bDontNotify = ((SwGrfNode*)pCntntNode)->IsFrameInPaint();
150 : :
151 [ + - ]: 28 : bGraphicArrived = GetObj()->IsDataComplete();
152 [ + - ]: 28 : bGraphicPieceArrived = GetObj()->IsPending();
153 : 28 : ((SwGrfNode*)pCntntNode)->SetGrafikArrived( bGraphicArrived );
154 : :
155 [ + - ]: 28 : Graphic aGrf;
156 [ + - ][ + - ]: 56 : if( sfx2::LinkManager::GetGraphicFromAny( rMimeType, rValue, aGrf ) &&
[ - + # # ]
[ + - ]
157 [ + - ]: 28 : ( GRAPHIC_DEFAULT != aGrf.GetType() ||
158 : 0 : GRAPHIC_DEFAULT != rGrfObj.GetType() ) )
159 : : {
160 [ + - ]: 28 : aGrfSz = ::GetGraphicSizeTwip( aGrf, 0 );
161 [ - + ]: 28 : if( static_cast< const SwGrfNode * >( pCntntNode )->IsChgTwipSizeFromPixel() )
162 : : {
163 [ # # ]: 0 : const MapMode aMapTwip( MAP_TWIP );
164 : : aFrmFmtSz =
165 : : Application::GetDefaultDevice()->PixelToLogic(
166 [ # # ][ # # ]: 0 : aGrf.GetSizePixel(), aMapTwip );
[ # # ][ # # ]
167 : :
168 : : }
169 : : else
170 : : {
171 : 28 : aFrmFmtSz = aGrfSz;
172 : : }
173 [ + - ]: 28 : Size aSz( ((SwGrfNode*)pCntntNode)->GetTwipSize() );
174 : :
175 [ + + ][ + - ]: 40 : if( bGraphicPieceArrived && GRAPHIC_DEFAULT != aGrf.GetType() &&
[ + - - +
# # ][ + + ]
176 : 12 : ( !aSz.Width() || !aSz.Height() ) )
177 : : {
178 : : // wenn nur ein Teil ankommt, aber die Groesse nicht
179 : : // gesetzt ist, dann muss "unten" der Teil von
180 : : // bGraphicArrived durchlaufen werden!
181 : : // (ansonten wird die Grafik in deft. Size gepaintet)
182 : 12 : bGraphicArrived = sal_True;
183 : 12 : bGraphicPieceArrived = sal_False;
184 : : }
185 : :
186 [ + - ][ + - ]: 28 : rGrfObj.SetGraphic( aGrf, rGrfObj.GetLink() );
[ + - ]
187 : 28 : bUpdate = sal_True;
188 : :
189 : : // Bug 33999: damit der Node den Transparent-Status
190 : : // richtig gesetzt hat, ohne auf die Grafik
191 : : // zugreifen zu muessen (sonst erfolgt ein SwapIn!).
192 [ + + ]: 28 : if( bGraphicArrived )
193 : : {
194 : : // immer mit der korrekten Grafik-Size arbeiten
195 [ - + ][ # # : 12 : if( aGrfSz.Height() && aGrfSz.Width() &&
# # # # #
# ][ - + ]
196 : 0 : aSz.Height() && aSz.Width() &&
197 : 0 : aGrfSz != aSz )
198 [ # # ]: 28 : ((SwGrfNode*)pCntntNode)->SetTwipSize( aGrfSz );
199 : : }
200 : : }
201 [ + - ][ + + ]: 28 : if ( bUpdate && !bGraphicArrived && !bGraphicPieceArrived )
[ + - ]
202 [ + - ][ + - ]: 28 : ((SwGrfNode*)pCntntNode)->SetTwipSize( Size(0,0) );
203 : : }
204 [ # # ]: 0 : else if( pCntntNode->IsOLENode() )
205 : 0 : bUpdate = sal_True;
206 : :
207 : 28 : ViewShell *pSh = 0;
208 [ + - ]: 28 : SwEditShell* pESh = pDoc->GetEditShell( &pSh );
209 : :
210 [ + - ][ - + ]: 28 : if ( bUpdate && bGraphicPieceArrived && !(bSwapIn || bDontNotify) )
[ # # ][ # # ]
211 : : {
212 : : //Hint ohne Actions verschicken, loest direktes Paint aus.
213 [ # # ][ # # ]: 0 : if ( (!pSh || !pSh->ActionPend()) && (!pESh || !pESh->ActionPend()) )
[ # # ][ # # ]
[ # # ]
214 : : {
215 [ # # ]: 0 : SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED );
216 [ # # ]: 0 : pCntntNode->ModifyNotification( &aMsgHint, &aMsgHint );
217 [ # # ]: 0 : bUpdate = sal_False;
218 : : }
219 : : }
220 : :
221 : : static sal_Bool bInNotifyLinks = sal_False;
222 [ + - ][ + - ]: 28 : if( bUpdate && !bDontNotify && (!bSwapIn || bGraphicArrived) &&
[ + + ][ + + ]
[ + - ]
223 : 20 : !bInNotifyLinks)
224 : : {
225 : 20 : sal_Bool bLockView = sal_False;
226 [ + - ]: 20 : if( pSh )
227 : : {
228 : 20 : bLockView = pSh->IsViewLocked();
229 : 20 : pSh->LockView( sal_True );
230 : : }
231 : :
232 [ + - ]: 20 : if( pESh )
233 [ + - ]: 20 : pESh->StartAllAction();
234 [ # # ]: 0 : else if( pSh )
235 [ # # ]: 0 : pSh->StartAction();
236 : :
237 : : SwMsgPoolItem aMsgHint( static_cast<sal_uInt16>(
238 [ + + ][ + - ]: 20 : bGraphicArrived ? RES_GRAPHIC_ARRIVED : RES_UPDATE_ATTR ) );
239 : :
240 [ + + ]: 20 : if ( bGraphicArrived )
241 : : {
242 : : //Alle benachrichtigen, die am gleichen Link horchen.
243 : 12 : bInNotifyLinks = sal_True;
244 : :
245 [ + - ]: 12 : const ::sfx2::SvBaseLinks& rLnks = pDoc->GetLinkManager().GetLinks();
246 [ + + ]: 24 : for( sal_uInt16 n = rLnks.size(); n; )
247 : : {
248 : 12 : ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
249 [ + - ]: 36 : if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() &&
[ + - + - ]
[ + - ][ + - ]
250 [ + - ]: 24 : pLnk->ISA( SwBaseLink ) && pLnk->GetObj() == GetObj() )
251 : : {
252 : 12 : SwBaseLink* pBLink = (SwBaseLink*)pLnk;
253 : 12 : SwGrfNode* pGrfNd = (SwGrfNode*)pBLink->pCntntNode;
254 : :
255 [ - + ]: 12 : if( pBLink != this &&
[ # # # # ]
[ - + ]
256 : 0 : ( !bSwapIn ||
257 : 0 : GRAPHIC_DEFAULT == pGrfNd->GetGrfObj().GetType()))
258 : : {
259 : 0 : pBLink->bIgnoreDataChanged = sal_False;
260 [ # # ]: 0 : pBLink->DataChanged( rMimeType, rValue );
261 : 0 : pBLink->bIgnoreDataChanged = sal_True;
262 : :
263 : : pGrfNd->SetGrafikArrived( ((SwGrfNode*)pCntntNode)->
264 : 0 : IsGrafikArrived() );
265 : :
266 : : // Fly der Grafik anpassen !
267 [ # # ][ # # ]: 0 : if( !::SetGrfFlySize( aGrfSz, aFrmFmtSz, pGrfNd ) )
268 [ # # ]: 0 : ::lcl_CallModify( *pGrfNd, aMsgHint );
269 : : }
270 [ + - ][ + - ]: 24 : else if( pBLink == this &&
[ + - ]
271 [ + - ]: 12 : !::SetGrfFlySize( aGrfSz, aFrmFmtSz, pGrfNd ) )
272 : : // Fly der Grafik anpassen !
273 [ + - ]: 12 : ::lcl_CallModify( *pGrfNd, aMsgHint );
274 : : }
275 : : }
276 : :
277 : 12 : bInNotifyLinks = sal_False;
278 : : }
279 : : else
280 : : {
281 [ + - ]: 8 : pCntntNode->ModifyNotification( &aMsgHint, &aMsgHint );
282 : : }
283 : :
284 : :
285 [ + - ]: 20 : if( pESh )
286 : : {
287 : 20 : const sal_Bool bEndActionByVirDev = pESh->IsEndActionByVirDev();
288 : 20 : pESh->SetEndActionByVirDev( sal_True );
289 [ + - ]: 20 : pESh->EndAllAction();
290 : 20 : pESh->SetEndActionByVirDev( bEndActionByVirDev );
291 : : }
292 [ # # ]: 0 : else if( pSh )
293 [ # # ]: 0 : pSh->EndAction();
294 : :
295 [ + - ][ + - ]: 20 : if( pSh && !bLockView )
296 [ + - ]: 20 : pSh->LockView( sal_False );
297 : : }
298 : :
299 : 40 : return SUCCESS;
300 : : }
301 : :
302 : 12 : sal_Bool SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd )
303 : : {
304 : 12 : sal_Bool bRet = sal_False;
305 : : ViewShell *pSh;
306 : 12 : CurrShell *pCurr = 0;
307 [ + - ][ + - ]: 12 : if ( pGrfNd->GetDoc()->GetEditShell( &pSh ) )
308 [ + - ][ + - ]: 12 : pCurr = new CurrShell( pSh );
309 : :
310 [ + - ]: 12 : Size aSz = pGrfNd->GetTwipSize();
311 [ - + ][ # # : 24 : if ( !(aSz.Width() && aSz.Height()) &&
- + # # ]
[ - + ]
312 : 12 : rGrfSz.Width() && rGrfSz.Height() )
313 : : {
314 : : SwFrmFmt* pFmt;
315 [ # # ][ # # ]: 0 : if( pGrfNd->IsChgTwipSize() &&
[ # # ][ # # ]
316 : 0 : 0 != (pFmt = pGrfNd->GetFlyFmt()) )
317 : : {
318 : 0 : Size aCalcSz( aSz );
319 [ # # ][ # # ]: 0 : if ( !aSz.Height() && aSz.Width() )
[ # # ]
320 : : //passende Hoehe ausrechnen.
321 : 0 : aCalcSz.Height() = rFrmSz.Height() *
322 : 0 : aSz.Width() / rFrmSz.Width();
323 [ # # ][ # # ]: 0 : else if ( !aSz.Width() && aSz.Height() )
[ # # ]
324 : : //passende Breite ausrechnen
325 : 0 : aCalcSz.Width() = rFrmSz.Width() *
326 : 0 : aSz.Height() / rFrmSz.Height();
327 : : else
328 : : //Hoehe und Breite uebernehmen
329 : 0 : aCalcSz = rFrmSz;
330 : :
331 [ # # ]: 0 : const SvxBoxItem &rBox = pFmt->GetBox();
332 [ # # ]: 0 : aCalcSz.Width() += rBox.CalcLineSpace(BOX_LINE_LEFT) +
333 [ # # ]: 0 : rBox.CalcLineSpace(BOX_LINE_RIGHT);
334 [ # # ]: 0 : aCalcSz.Height()+= rBox.CalcLineSpace(BOX_LINE_TOP) +
335 [ # # ]: 0 : rBox.CalcLineSpace(BOX_LINE_BOTTOM);
336 [ # # ]: 0 : const SwFmtFrmSize& rOldAttr = pFmt->GetFrmSize();
337 [ # # ]: 0 : if( rOldAttr.GetSize() != aCalcSz )
338 : : {
339 [ # # ]: 0 : SwFmtFrmSize aAttr( rOldAttr );
340 : 0 : aAttr.SetSize( aCalcSz );
341 [ # # ]: 0 : pFmt->SetFmtAttr( aAttr );
342 [ # # ]: 0 : bRet = sal_True;
343 : : }
344 : :
345 [ # # ]: 0 : if( !aSz.Width() )
346 : : {
347 : : // Wenn die Grafik in einer Tabelle verankert ist, muess
348 : : // die Tabellen-Spalten neu berechnet werden
349 : 0 : const SwDoc *pDoc = pGrfNd->GetDoc();
350 [ # # ][ # # ]: 0 : const SwPosition* pAPos = pFmt->GetAnchor().GetCntntAnchor();
351 : : SwNode *pANd;
352 : : SwTableNode *pTblNd;
353 [ # # ][ # # ]: 0 : if( pAPos &&
[ # # ][ # # ]
[ # # ]
354 : 0 : 0 != (pANd = & pAPos->nNode.GetNode()) &&
355 : : 0 != (pTblNd = pANd->FindTableNode()) )
356 : : {
357 : 0 : const sal_Bool bLastGrf = !pTblNd->GetTable().DecGrfsThatResize();
358 : : SwHTMLTableLayout *pLayout =
359 : 0 : pTblNd->GetTable().GetHTMLTableLayout();
360 [ # # ]: 0 : if( pLayout )
361 : : {
362 : : const sal_uInt16 nBrowseWidth =
363 [ # # ]: 0 : pLayout->GetBrowseWidthByTable( *pDoc );
364 [ # # ]: 0 : if ( nBrowseWidth )
365 : : {
366 : : pLayout->Resize( nBrowseWidth, sal_True, sal_True,
367 : : bLastGrf ? HTMLTABLE_RESIZE_NOW
368 [ # # ][ # # ]: 0 : : 500 );
369 : : }
370 : : }
371 : : }
372 : : }
373 : : }
374 : :
375 : : // SetTwipSize skaliert ggf. eine ImageMap neu und
376 : : // braucht dazu das Frame-Format
377 [ # # ]: 0 : pGrfNd->SetTwipSize( rGrfSz );
378 : : }
379 : :
380 [ + - ][ + - ]: 12 : delete pCurr;
381 : :
382 : 12 : return bRet;
383 : : }
384 : :
385 : :
386 : 32 : sal_Bool SwBaseLink::SwapIn( sal_Bool bWaitForData, sal_Bool bNativFormat )
387 : : {
388 : 32 : bSwapIn = sal_True;
389 : :
390 : : sal_Bool bRes;
391 : :
392 [ + + ][ + - ]: 32 : if( !GetObj() && ( bNativFormat || ( !IsSynchron() && bWaitForData ) ))
[ + - ][ - + ]
[ - + ]
393 : : {
394 : 0 : AddNextRef();
395 : 0 : _GetRealObject();
396 : 0 : ReleaseRef();
397 : : }
398 : :
399 : : #if OSL_DEBUG_LEVEL > 1
400 : : {
401 : : String sGrfNm;
402 : : if(GetLinkManager())
403 : : GetLinkManager()->GetDisplayNames( this, 0, &sGrfNm, 0, 0 );
404 : : int x = 0;
405 : : ++x;
406 : : }
407 : : #endif
408 : :
409 [ + + ]: 32 : if( GetObj() )
410 : : {
411 [ + - ][ + - ]: 24 : String aMimeType( SotExchange::GetFormatMimeType( GetContentType() ));
412 : 24 : uno::Any aValue;
413 [ + + ][ + - ]: 24 : GetObj()->GetData( aValue, aMimeType, !IsSynchron() && bWaitForData );
[ + - ]
414 : :
415 [ + + ][ - + ]: 24 : if( bWaitForData && !GetObj() )
[ - + ]
416 : : {
417 : : OSL_ENSURE( !this, "das SvxFileObject wurde in einem GetData geloescht!" );
418 : 0 : bRes = sal_False;
419 : : }
420 [ + + ]: 24 : else if( 0 != ( bRes = aValue.hasValue() ) )
421 : : {
422 : : //JP 14.04.99: Bug 64820 - das Flag muss beim SwapIn natuerlich
423 : : // zurueckgesetzt werden. Die Daten sollen ja neu
424 : : // uebernommen werden
425 : 8 : bIgnoreDataChanged = sal_False;
426 [ + - ]: 8 : DataChanged( aMimeType, aValue );
427 [ + - ]: 24 : }
428 : : }
429 [ + - ][ - + ]: 8 : else if( !IsSynchron() && bWaitForData )
[ - + ]
430 : : {
431 : 0 : SetSynchron( sal_True );
432 : 0 : bRes = Update();
433 : 0 : SetSynchron( sal_False );
434 : : }
435 : : else
436 : 8 : bRes = Update();
437 : :
438 : 32 : bSwapIn = sal_False;
439 : 32 : return bRes;
440 : : }
441 : :
442 : 0 : void SwBaseLink::Closed()
443 : : {
444 [ # # ][ # # ]: 0 : if( pCntntNode && !pCntntNode->GetDoc()->IsInDtor() )
[ # # ]
445 : : {
446 : : // wir heben die Verbindung auf
447 [ # # ]: 0 : if( pCntntNode->IsGrfNode() )
448 : 0 : ((SwGrfNode*)pCntntNode)->ReleaseLink();
449 : : }
450 : 0 : SvBaseLink::Closed();
451 : 0 : }
452 : :
453 : 0 : const SwNode* SwBaseLink::GetAnchor() const
454 : : {
455 [ # # ]: 0 : if (pCntntNode)
456 : : {
457 : 0 : SwFrmFmt *const pFmt = pCntntNode->GetFlyFmt();
458 [ # # ]: 0 : if (pFmt)
459 : : {
460 : 0 : const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
461 : 0 : SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
462 [ # # ][ # # : 0 : if (pAPos &&
# # # # #
# # # ]
463 : 0 : ((FLY_AS_CHAR == rAnchor.GetAnchorId()) ||
464 : 0 : (FLY_AT_CHAR == rAnchor.GetAnchorId()) ||
465 : 0 : (FLY_AT_FLY == rAnchor.GetAnchorId()) ||
466 : 0 : (FLY_AT_PARA == rAnchor.GetAnchorId())))
467 : : {
468 : 0 : return &pAPos->nNode.GetNode();
469 : : }
470 : 0 : return 0;
471 : : }
472 : : }
473 : :
474 : : OSL_ENSURE( !this, "GetAnchor nicht ueberlagert" );
475 : 0 : return 0;
476 : : }
477 : :
478 : 0 : sal_Bool SwBaseLink::IsRecursion( const SwBaseLink* pChkLnk ) const
479 : : {
480 : 0 : SwServerObjectRef aRef( (SwServerObject*)GetObj() );
481 [ # # ]: 0 : if( aRef.Is() )
482 : : {
483 : : // es ist ein ServerObject, also frage nach allen darin
484 : : // befindlichen Links, ob wir darin enthalten sind. Ansonsten
485 : : // handelt es sich um eine Rekursion.
486 [ # # ]: 0 : return aRef->IsLinkInServer( pChkLnk );
487 : : }
488 [ # # ]: 0 : return sal_False;
489 : : }
490 : :
491 : 0 : sal_Bool SwBaseLink::IsInRange( sal_uLong, sal_uLong, xub_StrLen, xub_StrLen ) const
492 : : {
493 : : // Grafik oder OLE-Links nicht,
494 : : // Felder oder Sections haben eigene Ableitung!
495 : 0 : return sal_False;
496 : : }
497 : :
498 : 13 : SwBaseLink::~SwBaseLink()
499 : : {
500 [ - + ]: 24 : }
501 : :
502 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|