summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-12-14 11:44:06 +0000
committerOliver Bolte <obo@openoffice.org>2009-12-14 11:44:06 +0000
commit9b579030e34e57c9a66369cac7be44fd60454733 (patch)
tree293defba130b3668cb20716109bb836f060ecbda
parent59c70a59d7a0ad11c00554d00a9c2ec57489b8b0 (diff)
CWS-TOOLING: integrate CWS jl146
2009-12-11 15:27:57 +0100 jsk r277793 : jl146: #i107038 - The page is now centered so the workarounds for UNIX(like) OS are no longer required. Fixed one timing issue in a tools library 2009-12-11 14:51:36 +0100 mav r277792 : #i107525# use the system file locking after storing process is over 2009-12-11 08:01:14 +0100 hde r277783 : reverted previous changes 2009-12-11 07:57:16 +0100 hde r277782 : Introduce new sub to change default page layout 2009-12-11 07:54:40 +0100 hde r277781 : Introduce new sub to change default page layout 2009-12-10 14:12:21 +0100 hde r277779 : FIX: initial dialog closed that opened after loading document, close all documents at end of testcase 2009-12-10 13:21:20 +0100 jsk r277778 : jl146: #i107038 - Added call to ViewZoom at the end of hNewDocument() for Writer documents 2009-12-10 13:19:53 +0100 mav r277777 : #i10000# adopt for unix 2009-12-10 11:58:47 +0100 hde r277774 : FIX: selection of tabpage failed 2009-12-10 11:58:16 +0100 mav r277773 : #i107512# let the singleton be registered 2009-12-10 11:28:23 +0100 jsk r277771 : jl146: #i107038 - Reverting changes made for the given issue as it is no longer reproducible in a m7. 2009-12-10 09:43:31 +0100 hde r277770 : FIX: document must'nt be read only, export Filter fixed 2009-12-09 21:51:15 +0100 mav r277769 : #i107525# let the original file be locked with the system file locking 2009-12-09 12:10:48 +0100 er r277763 : #i107501# #i107518# ScRange::Parse_XL_Header: reset external doc name if it was none 2009-12-09 11:54:32 +0100 jsk r277762 : jl149: #i107548 - e_extensions.bas was unable to handle root-installations. Now we identify the installation target directory messagebox (which only pops up if the user has the rights to install into shared layer). Otherwise we skip. 2009-12-09 08:56:16 +0100 jsk r277756 : sb146: #i107548 - Replacing publisher.inc with the version from cws sb111 (which brings dynamic waiting plus extra time for unopkg add to complete) 2009-12-08 15:11:19 +0100 jl r277751 : #i107528# incorrect string conversion of the path of the berkeley db causes the Extension Manager to abort
-rw-r--r--desktop/source/deployment/dp_persmap.cxx2
-rw-r--r--sfx2/inc/sfx2/docfile.hxx3
-rw-r--r--sfx2/source/doc/docfile.cxx132
-rw-r--r--sfx2/source/doc/objmisc.cxx16
4 files changed, 121 insertions, 32 deletions
diff --git a/desktop/source/deployment/dp_persmap.cxx b/desktop/source/deployment/dp_persmap.cxx
index 43fe8b87f3..04f3f19d2e 100644
--- a/desktop/source/deployment/dp_persmap.cxx
+++ b/desktop/source/deployment/dp_persmap.cxx
@@ -104,7 +104,7 @@ PersistentMap::PersistentMap( OUString const & url_, bool readOnly )
OSL_ASSERT( false );
}
OString cstr_sysPath(
- OUStringToOString( m_sysPath, osl_getThreadTextEncoding() ) );
+ OUStringToOString( m_sysPath, RTL_TEXTENCODING_UTF8 ) );
char const * pcstr_sysPath = cstr_sysPath.getStr();
u_int32_t flags = DB_CREATE;
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index ad63ad325c..ad9e4e06b7 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -229,7 +229,7 @@ public:
sal_Int8 ShowLockedDocumentDialog( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aData, sal_Bool bIsLoading, sal_Bool bOwnLock );
sal_Bool LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI );
- void UnlockFile();
+ void UnlockFile( sal_Bool bReleaseLockStream );
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage( sal_Bool bCreateTempIfNo = sal_True );
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetOutputStorage();
@@ -290,6 +290,7 @@ public:
SAL_DLLPRIVATE void Init_Impl();
SAL_DLLPRIVATE void ForceSynchronStream_Impl( sal_Bool bSynchron );
+ SAL_DLLPRIVATE void GetLockingStream_Impl();
SAL_DLLPRIVATE void GetMedium_Impl();
SAL_DLLPRIVATE sal_Bool TryDirectTransfer( const ::rtl::OUString& aURL, SfxItemSet& aTargetSet );
SAL_DLLPRIVATE void Transfer_Impl();
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 5ac85abdc8..00117a17a4 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -383,6 +383,8 @@ public:
Reference < XInputStream > xInputStream;
Reference < XStream > xStream;
+ uno::Reference< io::XStream > m_xLockingStream;
+
sal_uInt32 nLastStorageError;
::rtl::OUString aCharset;
@@ -1114,6 +1116,13 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
// otherwise the document should be opened readonly
// if user cancel the loading the ERROR_ABORT is set
+ if ( pImp->m_bLocked && bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
+ {
+ // if the document is already locked the system locking might be temporarely off after storing
+ // check whether the system file locking should be taken again
+ GetLockingStream_Impl();
+ }
+
sal_Bool bResult = pImp->m_bLocked;
if ( !bResult )
@@ -1125,21 +1134,18 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
if ( !bResult && !IsReadOnly() )
{
- // check whether the file is readonly in fs
- // the check is only necessary if
- // do it only for loading, some contents still might have problems with this property, let them not affect the saving
sal_Bool bContentReadonly = sal_False;
- if ( bLoading && ::utl::LocalFileHelper::IsLocalFile( aLogicName ) )
+ if ( bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
{
- // let the stream be opened to check the possibility to open it for editing
- GetMedium_Impl();
+ // let the original document be opened to check the possibility to open it for editing
+ // and to let the writable stream stay open to hold the lock on the document
+ GetLockingStream_Impl();
}
// "IsReadOnly" property does not allow to detect whether the file is readonly always
// so we try always to open the file for editing
// the file is readonly only in case the read-write stream can not be opened
- SFX_ITEMSET_ARG( pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM, sal_False);
- if ( bLoading && !pWriteStreamItem )
+ if ( bLoading && !pImp->m_xLockingStream.is() )
{
try
{
@@ -2270,6 +2276,45 @@ void SfxMedium::ClearBackup_Impl()
}
//----------------------------------------------------------------
+void SfxMedium::GetLockingStream_Impl()
+{
+ if ( ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) )
+ && !pImp->m_xLockingStream.is() )
+ {
+ SFX_ITEMSET_ARG( pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM, sal_False);
+ if ( pWriteStreamItem )
+ pWriteStreamItem->GetValue() >>= pImp->m_xLockingStream;
+
+ if ( !pImp->m_xLockingStream.is() )
+ {
+ // open the original document
+ uno::Sequence< beans::PropertyValue > xProps;
+ TransformItems( SID_OPENDOC, *GetItemSet(), xProps );
+ comphelper::MediaDescriptor aMedium( xProps );
+
+ aMedium.addInputStreamOwnLock();
+
+ uno::Reference< io::XInputStream > xInputStream;
+ aMedium[comphelper::MediaDescriptor::PROP_STREAM()] >>= pImp->m_xLockingStream;
+ aMedium[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
+
+ if ( !pImp->pTempFile && !aName.Len() )
+ {
+ // the medium is still based on the original file, it makes sence to initialize the streams
+ if ( pImp->m_xLockingStream.is() )
+ pImp->xStream = pImp->m_xLockingStream;
+
+ if ( xInputStream.is() )
+ pImp->xInputStream = xInputStream;
+
+ if ( !pImp->xInputStream.is() && pImp->xStream.is() )
+ pImp->xInputStream = pImp->xStream->getInputStream();
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------
void SfxMedium::GetMedium_Impl()
{
if ( !pInStream )
@@ -2335,27 +2380,36 @@ void SfxMedium::GetMedium_Impl()
TransformItems( SID_OPENDOC, *GetItemSet(), xProps );
comphelper::MediaDescriptor aMedium( xProps );
- if ( bFromTempFile )
+ if ( pImp->m_xLockingStream.is() && !bFromTempFile )
{
- aMedium[comphelper::MediaDescriptor::PROP_URL()] <<= ::rtl::OUString( aFileName );
- aMedium.erase( comphelper::MediaDescriptor::PROP_READONLY() );
- aMedium.addInputStream();
- }
- else if ( ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
- {
- // use the special locking approach only for file URLs
- aMedium.addInputStreamOwnLock();
+ // the medium is not based on the temporary file, so the original stream can be used
+ pImp->xStream = pImp->m_xLockingStream;
}
else
- aMedium.addInputStream();
+ {
+ if ( bFromTempFile )
+ {
+ aMedium[comphelper::MediaDescriptor::PROP_URL()] <<= ::rtl::OUString( aFileName );
+ aMedium.erase( comphelper::MediaDescriptor::PROP_READONLY() );
+ aMedium.addInputStream();
+ }
+ else if ( ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
+ {
+ // use the special locking approach only for file URLs
+ aMedium.addInputStreamOwnLock();
+ }
+ else
+ aMedium.addInputStream();
+
+ // the ReadOnly property set in aMedium is ignored
+ // the check is done in LockOrigFileOnDemand() for file and non-file URLs
- // the ReadOnly property set in aMedium is ignored
- // the check is done in LockOrigFileOnDemand() for file and non-file URLs
+ //TODO/MBA: what happens if property is not there?!
+ aMedium[comphelper::MediaDescriptor::PROP_STREAM()] >>= pImp->xStream;
+ aMedium[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= pImp->xInputStream;
+ }
- //TODO/MBA: what happens if property is not there?!
GetContent();
- aMedium[comphelper::MediaDescriptor::PROP_STREAM()] >>= pImp->xStream;
- aMedium[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= pImp->xInputStream;
if ( !pImp->xInputStream.is() && pImp->xStream.is() )
pImp->xInputStream = pImp->xStream->getInputStream();
}
@@ -2664,7 +2718,7 @@ void SfxMedium::Close()
CloseStreams_Impl();
- UnlockFile();
+ UnlockFile( sal_False );
}
void SfxMedium::CloseAndRelease()
@@ -2697,11 +2751,31 @@ void SfxMedium::CloseAndRelease()
CloseAndReleaseStreams_Impl();
- UnlockFile();
+ UnlockFile( sal_True );
}
-void SfxMedium::UnlockFile()
+void SfxMedium::UnlockFile( sal_Bool bReleaseLockStream )
{
+ if ( pImp->m_xLockingStream.is() )
+ {
+ if ( bReleaseLockStream )
+ {
+ try
+ {
+ uno::Reference< io::XInputStream > xInStream = pImp->m_xLockingStream->getInputStream();
+ uno::Reference< io::XOutputStream > xOutStream = pImp->m_xLockingStream->getOutputStream();
+ if ( xInStream.is() )
+ xInStream->closeInput();
+ if ( xOutStream.is() )
+ xOutStream->closeOutput();
+ }
+ catch( uno::Exception& )
+ {}
+ }
+
+ pImp->m_xLockingStream = uno::Reference< io::XStream >();
+ }
+
if ( pImp->m_bLocked )
{
try
@@ -2723,8 +2797,14 @@ void SfxMedium::CloseAndReleaseStreams_Impl()
uno::Reference< io::XInputStream > xInToClose = pImp->xInputStream;
uno::Reference< io::XOutputStream > xOutToClose;
if ( pImp->xStream.is() )
+ {
xOutToClose = pImp->xStream->getOutputStream();
+ // if the locking stream is closed here the related member should be cleaned
+ if ( pImp->xStream == pImp->m_xLockingStream )
+ pImp->m_xLockingStream = uno::Reference< io::XStream >();
+ }
+
// The probably exsisting SvStream wrappers should be closed first
CloseStreams_Impl();
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index ff4ed98058..8fb219d7fa 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -2531,12 +2531,20 @@ void SfxObjectShell::StoreLog()
if ( pImp->m_xLogRing.is() )
{
- ::rtl::OUString aFileURL =
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}" ) );
+#ifdef WNT
+ ::rtl::OUString aFileURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}" ) );
+#else
+ ::rtl::OUString aFileURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}" ) );
+#endif
+
::rtl::Bootstrap::expandMacros( aFileURL );
- ::rtl::OUString aBuildID =
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/setup.ini:buildid}" ) );
+#ifdef WNT
+ ::rtl::OUString aBuildID = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/setup.ini:buildid}" ) );
+#else
+ ::rtl::OUString aBuildID = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/setuprc:buildid}" ) );
+#endif
+
::rtl::Bootstrap::expandMacros( aBuildID );
if ( aFileURL.getLength() )