diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2003-03-27 16:45:03 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2003-03-27 16:45:03 +0000 |
commit | 53d50f23228c3acfe75703b51c8832ac48f54270 (patch) | |
tree | 7096895bf857cb7cbf08067f96a60279225caa77 /unotools/source/ucbhelper | |
parent | 832f7b267bcc52af248a5e72e6ebda14d92a19ee (diff) |
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'unotools/source/ucbhelper')
-rw-r--r-- | unotools/source/ucbhelper/makefile.mk | 12 | ||||
-rw-r--r-- | unotools/source/ucbhelper/progresshandlerwrap.cxx | 132 | ||||
-rw-r--r-- | unotools/source/ucbhelper/ucbhelper.cxx | 33 | ||||
-rw-r--r-- | unotools/source/ucbhelper/ucblockbytes.cxx | 6 |
4 files changed, 154 insertions, 29 deletions
diff --git a/unotools/source/ucbhelper/makefile.mk b/unotools/source/ucbhelper/makefile.mk index 0ed474f7a3e4..868e99917577 100644 --- a/unotools/source/ucbhelper/makefile.mk +++ b/unotools/source/ucbhelper/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.10 $ +# $Revision: 1.11 $ # -# last change: $Author: mh $ $Date: 2001-11-06 21:09:39 $ +# last change: $Author: hr $ $Date: 2003-03-27 17:39:52 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -69,6 +69,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Settings common for the whole project ----- +#UNOTYPES= #.INCLUDE : $(PRJINC)$/unotools$/unotools.mk # --- Settings ---------------------------------- @@ -85,8 +86,8 @@ ENABLE_EXCEPTIONS=TRUE # --- Types ------------------------------------- -UNOTYPES+= \ - com.sun.star.sdbc.XRow +#UNOTYPES+= \ +# com.sun.star.container.XInputStream # --- Files ------------------------------------- @@ -97,7 +98,8 @@ SLOFILES=\ $(SLO)$/ucbhelper.obj \ $(SLO)$/ucbstreamhelper.obj \ $(SLO)$/tempfile.obj \ - $(SLO)$/xtempfile.obj + $(SLO)$/xtempfile.obj \ + $(SLO)$/progresshandlerwrap.obj # --- Targets ---------------------------------- diff --git a/unotools/source/ucbhelper/progresshandlerwrap.cxx b/unotools/source/ucbhelper/progresshandlerwrap.cxx new file mode 100644 index 000000000000..a1ecbb3d2d8f --- /dev/null +++ b/unotools/source/ucbhelper/progresshandlerwrap.cxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * $RCSfile: progresshandlerwrap.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: hr $ $Date: 2003-03-27 17:39:52 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _UTL_PROGRESSHANDLERWRAP_HXX_ +#include <unotools/progresshandlerwrap.hxx> +#endif + +namespace utl +{ + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::task; +using namespace ::com::sun::star::ucb; + +ProgressHandlerWrap::ProgressHandlerWrap( ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > xSI ) +: m_xStatusIndicator( xSI ) +{ +} + +sal_Bool getStatusFromAny_Impl( const Any& aAny, ::rtl::OUString& aText, sal_Int32& nNum ) +{ + sal_Bool bNumIsSet = sal_False; + + Sequence< Any > aSetList; + if( ( aAny >>= aSetList ) && aSetList.getLength() ) + for( int ind = 0; ind < aSetList.getLength(); ind++ ) + { + if( !bNumIsSet && ( aSetList[ind] >>= nNum ) ) + bNumIsSet = sal_True; + else + !aText.getLength() && ( aSetList[ind] >>= aText ); + } + + return bNumIsSet; +} + +void SAL_CALL ProgressHandlerWrap::push( const Any& Status ) + throw( RuntimeException ) +{ + if( !m_xStatusIndicator.is() ) + return; + + ::rtl::OUString aText; + sal_Int32 nRange; + + if( getStatusFromAny_Impl( Status, aText, nRange ) ) + m_xStatusIndicator->start( aText, nRange ); +} + +void SAL_CALL ProgressHandlerWrap::update( const Any& Status ) + throw( RuntimeException ) +{ + if( !m_xStatusIndicator.is() ) + return; + + ::rtl::OUString aText; + sal_Int32 nValue; + + if( getStatusFromAny_Impl( Status, aText, nValue ) ) + { + if( aText.getLength() ) m_xStatusIndicator->setText( aText ); + m_xStatusIndicator->setValue( nValue ); + } +} + +void SAL_CALL ProgressHandlerWrap::pop() + throw( RuntimeException ) +{ + if( m_xStatusIndicator.is() ) + m_xStatusIndicator->end(); +} + +} // namespace utl + diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index f508cd756a51..e53480ff3bc3 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ucbhelper.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: mav $ $Date: 2002-12-09 16:29:09 $ + * last change: $Author: hr $ $Date: 2003-03-27 17:39:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -588,7 +588,7 @@ sal_Bool UCBContentHelper::CanMakeFolder( const String& rFolder ) // ----------------------------------------------------------------------- -sal_Bool UCBContentHelper::MakeFolder( const String& rFolder ) +sal_Bool UCBContentHelper::MakeFolder( const String& rFolder, sal_Bool bNewOnly ) { INetURLObject aURL( rFolder ); DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" ); @@ -600,14 +600,14 @@ sal_Bool UCBContentHelper::MakeFolder( const String& rFolder ) Reference< XInteractionHandler > xInteractionHandler = Reference< XInteractionHandler > ( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), UNO_QUERY ); if ( Content::create( aURL.GetMainURL( INetURLObject::NO_DECODE ), new CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ), aCnt ) ) - return MakeFolder( aCnt, aTitle, aNew ); + return MakeFolder( aCnt, aTitle, aNew, bNewOnly ); else return sal_False; } -sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Content& rNew ) +sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Content& rNew, sal_Bool bNewOnly ) { - sal_Bool bRecover = sal_False; + sal_Bool bAlreadyExists = sal_False; try { @@ -653,12 +653,12 @@ sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Cont { if ( r.Code == IOErrorCode_ALREADY_EXISTING ) { - bRecover = sal_True; + bAlreadyExists = sal_True; } } catch ( NameClashException& ) { - bRecover = sal_True; + bAlreadyExists = sal_True; } catch( ::com::sun::star::ucb::CommandAbortedException& ) { @@ -670,7 +670,7 @@ sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Cont { } - if( bRecover ) + if( bAlreadyExists && !bNewOnly ) { INetURLObject aObj( aCnt.getURL() ); aObj.Append( aTitle ); @@ -806,19 +806,10 @@ sal_Bool UCBContentHelper::Exists( const String& rURL ) ::rtl::OUString sIn( sObjectPhysicalName ), sOut; if ( osl_File_E_None == osl_getFileURLFromSystemPath( sIn.pData, &sOut.pData ) ) { - ::osl::FileBase::RC eResult = FileBase::E_None; - + // #106526 osl_getDirectoryItem is an existence check + // no further osl_getFileStatus call necessary DirectoryItem aItem; - if ( FileBase::E_None == DirectoryItem::get( sOut, aItem ) ) - { - FileStatus aStatus( FileStatusMask_FileName ); - eResult = aItem.getFileStatus( aStatus ); - if ( FileBase::E_NOENT == eResult ) - { // there is no such entry - return sal_False; - } - return sal_True; - } + return (FileBase::E_None == DirectoryItem::get(sOut, aItem)); } return sal_False; } diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index 383cbea15dc2..c31df0407e5e 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ucblockbytes.cxx,v $ * - * $Revision: 1.41 $ + * $Revision: 1.42 $ * - * last change: $Author: mav $ $Date: 2002-08-15 15:34:27 $ + * last change: $Author: hr $ $Date: 2003-03-27 17:39:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -708,7 +708,7 @@ ErrCode UcbLockBytes::SetSize (ULONG nNewSize) ULONG nDiff = nNewSize-nSize, nCount=0; BYTE* pBuffer = new BYTE[ nDiff ]; WriteAt( nSize, pBuffer, nDiff, &nCount ); - delete pBuffer; + delete[] pBuffer; if ( nCount != nDiff ) return ERRCODE_IO_CANTWRITE; } |