diff options
author | Christian Lippka <cl@openoffice.org> | 2001-07-24 09:09:53 +0000 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2001-07-24 09:09:53 +0000 |
commit | cf48740231668d9ef3a7091c9a1dd0ad5c0afff4 (patch) | |
tree | 20a4f6bf7d811fba6f142d43cffa35cfb5b214d9 /svx/source/xoutdev/xtablend.cxx | |
parent | ced1e6986c3002c2a838ee0df2f612d58e430633 (diff) |
#89680# check for existing file before using SfxMedium to avoid error boxes during load
Diffstat (limited to 'svx/source/xoutdev/xtablend.cxx')
-rw-r--r-- | svx/source/xoutdev/xtablend.cxx | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx index 1580512f5cfd..569ad60208ec 100644 --- a/svx/source/xoutdev/xtablend.cxx +++ b/svx/source/xoutdev/xtablend.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xtablend.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: cl $ $Date: 2001-02-23 21:37:11 $ + * last change: $Author: cl $ $Date: 2001-07-24 10:09:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -69,6 +69,9 @@ #ifndef _SVX_XPROPERTYTABLE_HXX #include "XPropertyTable.hxx" #endif +#ifndef _UNTOOLS_UCBSTREAMHELPER_HXX +#include <unotools/ucbstreamhelper.hxx> +#endif #include "xmlxtexp.hxx" #include "xmlxtimp.hxx" @@ -415,6 +418,20 @@ BOOL XLineEndList::Load() if( !aURL.getExtension().Len() ) aURL.setExtension( String( pszExtLineEnd, 3 ) ); + // check if file exists, SfxMedium shows an errorbox else + { + com::sun::star::uno::Reference < com::sun::star::task::XInteractionHandler > xHandler; + SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL(), STREAM_READ, xHandler ); + + sal_Bool bOk = pIStm && ( pIStm->GetError() == 0); + + if( pIStm ) + delete pIStm; + + if( !bOk ) + return sal_False; + } + { SfxMedium aMedium( aURL.GetMainURL(), STREAM_READ | STREAM_NOCREATE, TRUE ); SvStream* pStream = aMedium.GetInStream(); |