diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-04-15 13:07:53 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-04-15 13:07:53 +0000 |
commit | 4c30788ec3b63d08cae203928f8637efca3c9d7f (patch) | |
tree | c94585448db8e7488a22cbc3c9625430bdc74b74 /svtools/inc | |
parent | 94f9a81f005a3d8d290a21f22c0814811f96644f (diff) |
INTEGRATION: CWS calcshare2 (1.1.2); FILE ADDED
2008/04/15 07:08:51 rt 1.1.2.4: Udate license header
2008/03/31 13:09:34 mav 1.1.2.3: #i85794# workaround for automated testing
2008/03/29 14:50:28 mav 1.1.2.2: #i86677# fix recovery of shared documents
2008/03/14 20:25:29 mav 1.1.2.1: #i85794# new file locking prototype
Diffstat (limited to 'svtools/inc')
-rw-r--r-- | svtools/inc/svtools/documentlockfile.hxx | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/svtools/inc/svtools/documentlockfile.hxx b/svtools/inc/svtools/documentlockfile.hxx new file mode 100644 index 000000000000..7b8de8994a3f --- /dev/null +++ b/svtools/inc/svtools/documentlockfile.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: documentlockfile.hxx,v $ + * + * $Revision: 1.2 $ + * + * 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. + * + ************************************************************************/ + +#ifndef _SVT_SHARECONTROLFILE_HXX +#define _SVT_SHARECONTROLFILE_HXX + +#include <svtools/svtdllapi.h> + +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/io/XTruncate.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <osl/mutex.hxx> + +// TODO/LATER: should be combined with sharecontrolfile +#define LOCKFILE_OOOUSERNAME_ID 0 +#define LOCKFILE_SYSUSERNAME_ID 1 +#define LOCKFILE_LOCALHOST_ID 2 +#define LOCKFILE_EDITTIME_ID 3 +#define LOCKFILE_USERURL_ID 4 +#define LOCKFILE_ENTRYSIZE 5 + +namespace svt { + +class SVT_DLLPUBLIC DocumentLockFile +{ + // the workaround for automated testing! + static sal_Bool m_bAllowInteraction; + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + ::rtl::OUString m_aURL; + + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > OpenStream(); + + void WriteEntryToStream( ::com::sun::star::uno::Sequence< ::rtl::OUString > aEntry, ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream ); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > ParseEntry( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer ); + ::rtl::OUString ParseName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos ); + ::rtl::OUString EscapeCharacters( const ::rtl::OUString& aSource ); + ::rtl::OUString GetOOOUserName(); + ::rtl::OUString GetCurrentLocalTime(); + +public: + DocumentLockFile( const ::rtl::OUString& aOrigURL, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ); + ~DocumentLockFile(); + + sal_Bool CreateOwnLockFile(); + ::com::sun::star::uno::Sequence< ::rtl::OUString > GetLockData(); + ::com::sun::star::uno::Sequence< ::rtl::OUString > GenerateOwnEntry(); + void RemoveFile(); + + // the methods allow to control whether UI interaction regarding the locked document file is allowed + // this is a workaround for automated tests + static void AllowInteraction( sal_Bool bAllow ) { m_bAllowInteraction = bAllow; } + static sal_Bool IsInteractionAllowed() { return m_bAllowInteraction; } +}; + +} + +#endif + |