1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
|
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sfx2.hxx"
#include <vcl/wrkwin.hxx>
#include <vcl/msgbox.hxx>
#include <tools/urlobj.hxx>
#include <tools/stream.hxx>
#include <sot/formats.hxx>
#include <svtools/filter.hxx>
#include <sfx2/lnkbase.hxx>
#include <sfx2/app.hxx>
#include <sfx2/progress.hxx>
#include <sfx2/docfilt.hxx>
#include <sfx2/filedlghelper.hxx>
#include <sot/exchange.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <sfx2/docfac.hxx>
#include <com/sun/star/document/XTypeDetection.hpp>
#include <comphelper/mediadescriptor.hxx>
#include <comphelper/processfactory.hxx>
#include <sfx2/linkmgr.hxx>
#include <sfx2/opengrf.hxx>
#include "sfx2/sfxresid.hxx"
#include "fileobj.hxx"
#include "app.hrc"
namespace css = ::com::sun::star;
#define FILETYPE_TEXT 1
#define FILETYPE_GRF 2
#define FILETYPE_OBJECT 3
struct Impl_DownLoadData
{
Graphic aGrf;
Timer aTimer;
Impl_DownLoadData( const Link& rLink )
{
aTimer.SetTimeout( 100 );
aTimer.SetTimeoutHdl( rLink );
aGrf.SetDefaultType();
}
~Impl_DownLoadData()
{
aTimer.Stop();
}
};
// --------------------------------------------------------------------------
SvFileObject::SvFileObject() :
pDownLoadData( NULL ), pOldParent( NULL ), nType( FILETYPE_TEXT )
{
bLoadAgain = TRUE;
bSynchron = bLoadError = bWaitForData = bDataReady = bNativFormat =
bClearMedium = bStateChangeCalled = bInCallDownLoad = FALSE;
}
SvFileObject::~SvFileObject()
{
if ( xMed.Is() )
{
xMed->SetDataAvailableLink( Link() );
xMed->SetDoneLink( Link() );
xMed.Clear();
}
delete pDownLoadData;
}
BOOL SvFileObject::GetData( ::com::sun::star::uno::Any & rData,
const String & rMimeType,
BOOL bGetSynchron )
{
ULONG nFmt = SotExchange::GetFormatStringId( rMimeType );
switch( nType )
{
case FILETYPE_TEXT:
if( FORMAT_FILE == nFmt )
{
// das Medium muss in der Applikation geoffnet werden, um die
// relativen Datei Links aufzuloesen!!!! Wird ueber den
// LinkManager und damit von dessen Storage erledigt.
rData <<= rtl::OUString( sFileNm );
}
break;
case FILETYPE_GRF:
if( !bLoadError )
{
SfxMediumRef xTmpMed;
if( FORMAT_GDIMETAFILE == nFmt || FORMAT_BITMAP == nFmt ||
SOT_FORMATSTR_ID_SVXB == nFmt )
{
Graphic aGrf;
//JP 15.07.98: Bug 52959
// falls das Nativformat doch erwuenscht ist, muss am
// Ende das Flag zurueckgesetzt werden.
// wird einzig und allein im sw/ndgrf.cxx benutzt, wenn der Link vom
// GraphicNode entfernt wird.
BOOL bOldNativFormat = bNativFormat;
//!!?? bNativFormat = 0 != (ASPECT_ICON & pSvData->GetAspect());
// falls gedruckt werden soll, warten wir bis die
// Daten vorhanden sind
if( bGetSynchron )
{
// testhalber mal ein LoadFile rufen um das nach-
// laden ueberahaupt anzustossen
if( !xMed.Is() )
LoadFile_Impl();
if( !bInCallDownLoad )
{
xTmpMed = xMed;
while( bWaitForData )
Application::Reschedule();
xMed = xTmpMed;
bClearMedium = TRUE;
}
}
if( pDownLoadData ||
( !bWaitForData && ( xMed.Is() || // wurde als URL geladen
( bSynchron && LoadFile_Impl() && xMed.Is() ) )) )
{
// falls
// falls es uebers Internet gesogen wurde, nicht
// wieder versuchen
if( !bGetSynchron )
bLoadAgain = !xMed->IsRemote();
bLoadError = !GetGraphic_Impl( aGrf, xMed->GetInStream() );
}
else if( !LoadFile_Impl() ||
!GetGraphic_Impl( aGrf, xMed.Is() ? xMed->GetInStream() : 0 ))
{
if( !xMed.Is() )
break;
aGrf.SetDefaultType();
}
if( SOT_FORMATSTR_ID_SVXB != nFmt )
nFmt = (bLoadError || GRAPHIC_BITMAP == aGrf.GetType())
? FORMAT_BITMAP
: FORMAT_GDIMETAFILE;
SvMemoryStream aMemStm( 0, 65535 );
switch ( nFmt )
{
case SOT_FORMATSTR_ID_SVXB:
if( GRAPHIC_NONE != aGrf.GetType() )
{
aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 );
aMemStm << aGrf;
}
break;
case FORMAT_BITMAP:
if( !aGrf.GetBitmap().IsEmpty())
aMemStm << aGrf.GetBitmap();
break;
default:
if( aGrf.GetGDIMetaFile().GetActionCount() )
{
GDIMetaFile aMeta( aGrf.GetGDIMetaFile() );
aMeta.Write( aMemStm );
}
}
rData <<= css::uno::Sequence< sal_Int8 >( (sal_Int8*) aMemStm.GetData(),
aMemStm.Seek( STREAM_SEEK_TO_END ) );
bNativFormat = bOldNativFormat;
// alles fertig?
if( xMed.Is() && !bSynchron && bClearMedium )
{
xMed.Clear();
bClearMedium = FALSE;
}
}
}
break;
case FILETYPE_OBJECT:
// TODO/LATER: possibility to insert a new object
rData <<= rtl::OUString( sFileNm );
break;
}
return sal_True/*0 != aTypeList.Count()*/;
}
BOOL SvFileObject::Connect( sfx2::SvBaseLink* pLink )
{
if( !pLink || !pLink->GetLinkManager() )
return FALSE;
// teste doch mal, ob nicht ein anderer Link mit der gleichen
// Verbindung schon existiert
pLink->GetLinkManager()->GetDisplayNames( pLink, 0, &sFileNm, 0, &sFilter );
if( OBJECT_CLIENT_GRF == pLink->GetObjType() )
{
SfxObjectShellRef pShell = pLink->GetLinkManager()->GetPersist();
if( pShell.Is() )
{
if( pShell->IsAbortingImport() )
return FALSE;
if( pShell->GetMedium() )
sReferer = pShell->GetMedium()->GetName();
}
}
switch( pLink->GetObjType() )
{
case OBJECT_CLIENT_GRF:
nType = FILETYPE_GRF;
bSynchron = pLink->IsSynchron();
break;
case OBJECT_CLIENT_FILE:
nType = FILETYPE_TEXT;
break;
case OBJECT_CLIENT_OLE:
nType = FILETYPE_OBJECT;
// TODO/LATER: introduce own type to be used for exchanging
break;
default:
return FALSE;
}
SetUpdateTimeout( 0 );
// und jetzt bei diesem oder gefundenem Pseudo-Object anmelden
AddDataAdvise( pLink, SotExchange::GetFormatMimeType( pLink->GetContentType()), 0 );
return TRUE;
}
BOOL SvFileObject::LoadFile_Impl()
{
// wir sind noch im Laden!!
if( bWaitForData || !bLoadAgain || xMed.Is() || pDownLoadData )
return FALSE;
// z.Z. nur auf die aktuelle DocShell
xMed = new SfxMedium( sFileNm, STREAM_STD_READ, TRUE );
SvLinkSource::StreamToLoadFrom aStreamToLoadFrom =
getStreamToLoadFrom();
xMed->setStreamToLoadFrom(
aStreamToLoadFrom.m_xInputStreamToLoadFrom,
aStreamToLoadFrom.m_bIsReadOnly);
// setStreamToLoadFrom(0,0);
if( sReferer.Len() )
xMed->SetReferer( sReferer );
if( !bSynchron )
{
bLoadAgain = bDataReady = bInNewData = FALSE;
bWaitForData = TRUE;
SfxMediumRef xTmpMed = xMed;
xMed->SetDataAvailableLink( STATIC_LINK( this, SvFileObject, LoadGrfNewData_Impl ) );
bInCallDownLoad = TRUE;
xMed->DownLoad( STATIC_LINK( this, SvFileObject, LoadGrfReady_Impl ) );
bInCallDownLoad = FALSE;
bClearMedium = !xMed.Is();
if( bClearMedium )
xMed = xTmpMed; // falls gleich im DownLoad schon schluss ist
return bDataReady;
}
bWaitForData = TRUE;
bDataReady = bInNewData = FALSE;
xMed->DownLoad();
bLoadAgain = !xMed->IsRemote();
bWaitForData = FALSE;
// Grafik ist fertig, also DataChanged von der Statusaederung schicken:
SendStateChg_Impl( xMed->GetInStream() && xMed->GetInStream()->GetError()
? sfx2::LinkManager::STATE_LOAD_ERROR : sfx2::LinkManager::STATE_LOAD_OK );
return TRUE;
}
BOOL SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream )
{
GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
const USHORT nFilter = sFilter.Len() && pGF->GetImportFormatCount()
? pGF->GetImportFormatNumber( sFilter )
: GRFILTER_FORMAT_DONTKNOW;
String aEmptyStr;
int nRes;
// vermeiden, dass ein native Link angelegt wird
if( ( !pStream || !pDownLoadData ) && !rGrf.IsLink() &&
!rGrf.GetContext() && !bNativFormat )
rGrf.SetLink( GfxLink() );
if( !pStream )
nRes = xMed.Is() ? GRFILTER_OPENERROR
: pGF->ImportGraphic( rGrf, INetURLObject(sFileNm),
nFilter );
else if( !pDownLoadData )
{
pStream->Seek( STREAM_SEEK_TO_BEGIN );
nRes = pGF->ImportGraphic( rGrf, aEmptyStr, *pStream, nFilter );
}
else
{
nRes = pGF->ImportGraphic( pDownLoadData->aGrf, aEmptyStr,
*pStream, nFilter );
if( pDownLoadData )
{
rGrf = pDownLoadData->aGrf;
if( GRAPHIC_NONE == rGrf.GetType() )
rGrf.SetDefaultType();
if( !pDownLoadData->aGrf.GetContext() )
{
xMed->SetDataAvailableLink( Link() );
// xMed->SetDoneLink( Link() );
delete pDownLoadData, pDownLoadData = 0;
bDataReady = TRUE;
bWaitForData = FALSE;
}
else if( FALSE )
{
// Timer aufsetzen, um zurueck zukehren
pDownLoadData->aTimer.Start();
}
}
}
if( pStream && ERRCODE_IO_PENDING == pStream->GetError() )
pStream->ResetError();
#ifdef DBG_UTIL
if( nRes )
{
if( xMed.Is() && !pStream )
{
DBG_WARNING3( "GrafikFehler [%d] - [%s] URL[%s]",
nRes,
xMed->GetPhysicalName().GetBuffer(),
sFileNm.GetBuffer() );
}
else
{
DBG_WARNING2( "GrafikFehler [%d] - [%s]",
nRes, sFileNm.GetBuffer() );
}
}
#endif
return GRFILTER_OK == nRes;
}
/** detect the filter of the given file
@param _rURL
specifies the URL of the file which filter is to detected.<br/>
If the URL doesn't denote a valid (existent and accessible) file, the
request is silently dropped.
*/
String impl_getFilter( const String& _rURL )
{
String sFilter;
if ( _rURL.Len() == 0 )
return sFilter;
try
{
css::uno::Reference< ::com::sun::star::document::XTypeDetection > xTypeDetection(
::comphelper::getProcessServiceFactory()->createInstance(
::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection") ),
css::uno::UNO_QUERY );
if ( xTypeDetection.is() )
{
::comphelper::MediaDescriptor aDescr;
aDescr[ ::comphelper::MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( _rURL );
css::uno::Sequence< css::beans::PropertyValue > aDescrList =
aDescr.getAsConstPropertyValueList();
::rtl::OUString sType = xTypeDetection->queryTypeByDescriptor( aDescrList, sal_True );
if ( sType.getLength() )
{
css::uno::Reference< css::container::XNameAccess > xTypeCont( xTypeDetection,
css::uno::UNO_QUERY );
if ( xTypeCont.is() )
{
::comphelper::SequenceAsHashMap lTypeProps( xTypeCont->getByName( sType ) );
sFilter = lTypeProps.getUnpackedValueOrDefault(
::rtl::OUString::createFromAscii("PreferredFilter"), ::rtl::OUString() );
}
}
}
}
catch( const css::uno::Exception& )
{
}
return sFilter;
}
void SvFileObject::Edit( Window* pParent, sfx2::SvBaseLink* pLink, const Link& rEndEditHdl )
{
aEndEditLink = rEndEditHdl;
String sFile, sRange, sTmpFilter;
if( pLink && pLink->GetLinkManager() )
{
pLink->GetLinkManager()->GetDisplayNames( pLink, 0, &sFile, &sRange, &sTmpFilter );
switch( pLink->GetObjType() )
{
case OBJECT_CLIENT_GRF:
{
nType = FILETYPE_GRF; // falls noch nicht gesetzt
SvxOpenGraphicDialog aDlg(SfxResId(RID_SVXSTR_EDITGRFLINK));
aDlg.EnableLink(sal_False);
aDlg.SetPath( sFile, sal_True );
aDlg.SetCurrentFilter( sTmpFilter );
if( !aDlg.Execute() )
{
sFile = aDlg.GetPath();
sFile += ::sfx2::cTokenSeperator;
sFile += ::sfx2::cTokenSeperator;
sFile += aDlg.GetCurrentFilter();
if ( aEndEditLink.IsSet() )
aEndEditLink.Call( &sFile );
}
else
sFile.Erase();
}
break;
case OBJECT_CLIENT_OLE:
{
nType = FILETYPE_OBJECT; // if not set already
pOldParent = Application::GetDefDialogParent();
Application::SetDefDialogParent( pParent );
::sfx2::FileDialogHelper* pFileDlg =
pLink->GetFileDialog( (SFXWB_INSERT | WB_3DLOOK), String() );
pFileDlg->StartExecuteModal( LINK( this, SvFileObject, DialogClosedHdl ) );
}
break;
case OBJECT_CLIENT_FILE:
{
nType = FILETYPE_TEXT; // if not set already
pOldParent = Application::GetDefDialogParent();
Application::SetDefDialogParent( pParent );
String sFactory;
SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist();
if ( pShell )
sFactory = pShell->GetFactory().GetFactoryName();
::sfx2::FileDialogHelper* pFileDlg =
pLink->GetFileDialog( (SFXWB_INSERT | WB_3DLOOK), sFactory );
pFileDlg->StartExecuteModal( LINK( this, SvFileObject, DialogClosedHdl ) );
}
break;
default:
sFile.Erase();
}
}
}
IMPL_STATIC_LINK( SvFileObject, LoadGrfReady_Impl, void*, EMPTYARG )
{
// wenn wir von hier kommen, kann es kein Fehler mehr sein
pThis->bLoadError = FALSE;
pThis->bWaitForData = FALSE;
pThis->bInCallDownLoad = FALSE;
if( !pThis->bInNewData && !pThis->bDataReady )
{
// Grafik ist fertig, also DataChanged von der Status-
// aederung schicken:
pThis->bDataReady = TRUE;
pThis->SendStateChg_Impl( sfx2::LinkManager::STATE_LOAD_OK );
// und dann nochmal die Daten senden
pThis->NotifyDataChanged();
}
if( pThis->bDataReady )
{
pThis->bLoadAgain = TRUE;
if( pThis->xMed.Is() )
{
pThis->xMed->SetDataAvailableLink( Link() );
pThis->xMed->SetDoneLink( Link() );
Application::PostUserEvent(
STATIC_LINK( pThis, SvFileObject, DelMedium_Impl ),
new SfxMediumRef( pThis->xMed ));
pThis->xMed.Clear();
}
if( pThis->pDownLoadData )
delete pThis->pDownLoadData, pThis->pDownLoadData = 0;
}
return 0;
}
IMPL_STATIC_LINK( SvFileObject, DelMedium_Impl, SfxMediumRef*, pDelMed )
{
(void)pThis;
delete pDelMed;
return 0;
}
IMPL_STATIC_LINK( SvFileObject, LoadGrfNewData_Impl, void*, EMPTYARG )
{
// wenn wir von hier kommen, kann es kein Fehler mehr sein
if( pThis->bInNewData )
return 0;
pThis->bInNewData = TRUE;
pThis->bLoadError = FALSE;
if( !pThis->pDownLoadData )
{
pThis->pDownLoadData = new Impl_DownLoadData(
STATIC_LINK( pThis, SvFileObject, LoadGrfNewData_Impl ) );
// Null-Link setzen, damit keine temporaeren Grafiken
// rausgeswapt werden; der Filter prueft, ob schon
// ein Link gesetzt ist => falls dies zutrifft, wird
// _kein_ neuer Link gesetzt; der Link muss hier gesetzt werden,
// (bevor das erste Mal gefiltert wird), um zu verhindern,
// dass der Kontext zurueckgesetzt wird (aynchrones Laden)
if( !pThis->bNativFormat )
{
static GfxLink aDummyLink;
pThis->pDownLoadData->aGrf.SetLink( aDummyLink );
}
}
pThis->NotifyDataChanged();
SvStream* pStrm = pThis->xMed.Is() ? pThis->xMed->GetInStream() : 0;
if( pStrm && pStrm->GetError() )
{
if( ERRCODE_IO_PENDING == pStrm->GetError() )
pStrm->ResetError();
// im DataChanged ein DataReady?
else if( pThis->bWaitForData && pThis->pDownLoadData )
{
pThis->bLoadError = TRUE;
}
}
if( pThis->bDataReady )
{
// Grafik ist fertig, also DataChanged von der Status-
// aederung schicken:
pThis->SendStateChg_Impl( pStrm->GetError() ? sfx2::LinkManager::STATE_LOAD_ERROR : sfx2::LinkManager::STATE_LOAD_OK );
}
pThis->bInNewData = FALSE;
return 0;
}
IMPL_LINK( SvFileObject, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg )
{
String sFile;
Application::SetDefDialogParent( pOldParent );
if ( FILETYPE_TEXT == nType || FILETYPE_OBJECT == nType )
{
if ( _pFileDlg && _pFileDlg->GetError() == ERRCODE_NONE )
{
String sURL( _pFileDlg->GetPath() );
sFile = sURL;
sFile += ::sfx2::cTokenSeperator;
sFile += ::sfx2::cTokenSeperator;
sFile += impl_getFilter( sURL );
}
}
else
{
DBG_ERRORFILE( "SvFileObject::DialogClosedHdl(): wrong file type" );
}
if ( aEndEditLink.IsSet() )
aEndEditLink.Call( &sFile );
return 0;
}
/* [Beschreibung]
Die Methode stellt fest, ob aus einem DDE-Object die Daten gelesen
werden kann.
Zurueckgegeben wird:
ERRCODE_NONE wenn sie komplett gelesen wurde
ERRCODE_SO_PENDING wenn sie noch nicht komplett gelesen wurde
ERRCODE_SO_FALSE sonst
*/
BOOL SvFileObject::IsPending() const
{
return FILETYPE_GRF == nType && !bLoadError &&
( pDownLoadData || bWaitForData );
}
BOOL SvFileObject::IsDataComplete() const
{
BOOL bRet = FALSE;
if( FILETYPE_GRF != nType )
bRet = TRUE;
else if( !bLoadError && ( !bWaitForData && !pDownLoadData ))
{
SvFileObject* pThis = (SvFileObject*)this;
if( bDataReady ||
( bSynchron && pThis->LoadFile_Impl() && xMed.Is() ) )
bRet = TRUE;
else
{
INetURLObject aUrl( sFileNm );
if( aUrl.HasError() ||
INET_PROT_NOT_VALID == aUrl.GetProtocol() )
bRet = TRUE;
}
}
return bRet;
}
void SvFileObject::CancelTransfers()
{
// und aus dem Cache austragen, wenn man mitten im Laden ist
if( !bDataReady )
{
// nicht noch mal aufsetzen
bLoadAgain = FALSE;
bDataReady = bLoadError = bWaitForData = TRUE;
SendStateChg_Impl( sfx2::LinkManager::STATE_LOAD_ABORT );
}
}
void SvFileObject::SendStateChg_Impl( sfx2::LinkManager::LinkState nState )
{
if( !bStateChangeCalled && HasDataLinks() )
{
css::uno::Any aAny;
aAny <<= rtl::OUString::valueOf( (sal_Int32)nState );
DataChanged( SotExchange::GetFormatName(
sfx2::LinkManager::RegisterStatusInfoId()), aAny );
bStateChangeCalled = TRUE;
}
}
|