summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs8
-rw-r--r--sfx2/inc/sfx2/docfile.hxx8
-rw-r--r--sfx2/source/doc/docfile.cxx424
-rw-r--r--sfx2/source/doc/objstor.cxx23
-rw-r--r--sfx2/source/view/viewfrm.cxx5
-rw-r--r--svx/inc/optinet2.hrc45
-rw-r--r--svx/source/dialog/optinet2.cxx97
-rw-r--r--svx/source/dialog/optinet2.hxx6
-rw-r--r--svx/source/options/optinet2.src37
-rw-r--r--uui/source/alreadyopen.cxx63
-rw-r--r--uui/source/alreadyopen.hxx43
-rw-r--r--uui/source/alreadyopen.src65
-rw-r--r--uui/source/filechanged.cxx52
-rw-r--r--uui/source/filechanged.hxx43
-rw-r--r--uui/source/filechanged.src49
-rw-r--r--uui/source/iahndl.cxx186
-rw-r--r--uui/source/iahndl.hxx23
-rw-r--r--uui/source/ids.hrc27
-rw-r--r--uui/source/lockfailed.cxx53
-rw-r--r--uui/source/lockfailed.hxx45
-rw-r--r--uui/source/lockfailed.src49
-rw-r--r--uui/source/makefile.mk12
-rw-r--r--uui/source/masterpasscrtdlg.cxx66
-rw-r--r--uui/source/masterpasscrtdlg.hrc33
-rw-r--r--uui/source/masterpasscrtdlg.hxx12
-rw-r--r--uui/source/masterpasscrtdlg.src72
-rw-r--r--uui/source/openlocked.src4
-rw-r--r--uui/source/trylater.cxx54
-rw-r--r--uui/source/trylater.hxx43
-rw-r--r--uui/source/trylater.src53
30 files changed, 1492 insertions, 208 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index ab0234ff0073..de0159bb9f28 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5574,6 +5574,14 @@ Dymamic border coloring means that when the mouse is hovered over a control, and
</info>
<value>true</value>
</prop>
+ <prop oor:name="UseDocumentSystemFileLocking" oor:type="xs:boolean">
+ <info>
+ <author>MAV</author>
+ <desc>Allows to specify whether the OOo document file locking mechanics should use the system file locking additionaly.</desc>
+ </info>
+ <value>true</value>
+ </prop>
+
<prop oor:name="UseSystemPrintDialog" oor:type="xs:boolean">
<info>
<author>PL</author>
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index 50007ce3a35c..75900531a70f 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -35,6 +35,7 @@
#include "sfx2/dllapi.h"
#include "sal/types.h"
#include <com/sun/star/util/RevisionTag.hpp>
+#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -180,6 +181,10 @@ public:
#else
const INetURLObject& GetURLObject() const;
#endif
+
+ void CheckFileDate( const ::com::sun::star::util::DateTime& aInitDate );
+ ::com::sun::star::util::DateTime GetInitFileDate();
+
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > GetContent() const;
const String& GetPhysicalName() const;
void SetTemporary( sal_Bool bTemp );
@@ -223,7 +228,8 @@ public:
SAL_DLLPRIVATE ErrCode Unpack_Impl( const String& );
sal_Bool IsStorage();
- sal_Bool LockOrigFileOnDemand( sal_Bool bLoading );
+ 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();
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage();
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 367dffbc6fa3..dc49ee6b1e2b 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -39,6 +39,10 @@
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/document/XDocumentRevisionListPersistence.hpp>
#include <com/sun/star/document/LockedDocumentRequest.hpp>
+#include <com/sun/star/document/OwnLockOnDocumentRequest.hpp>
+#include <com/sun/star/document/LockedOnSavingRequest.hpp>
+#include <com/sun/star/document/LockFileIgnoreRequest.hpp>
+#include <com/sun/star/document/ChangedByOthersRequest.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -108,6 +112,7 @@ using namespace ::com::sun::star::io;
#include <comphelper/storagehelper.hxx>
#include <comphelper/mediadescriptor.hxx>
+#include <comphelper/configurationhelper.hxx>
#include <tools/urlobj.hxx>
#include <tools/inetmime.hxx>
#include <unotools/ucblockbytes.hxx>
@@ -144,6 +149,12 @@ using namespace ::com::sun::star::io;
#define MAX_REDIRECT 5
+namespace {
+ static const sal_Int8 LOCK_UI_NOLOCK = 0;
+ static const sal_Int8 LOCK_UI_SUCCEEDED = 1;
+ static const sal_Int8 LOCK_UI_TRY = 2;
+}
+
class SfxMediumHandler_Impl : public ::cppu::WeakImplHelper1< com::sun::star::task::XInteractionHandler >
{
com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInter;
@@ -272,6 +283,9 @@ public:
sal_Bool m_bSalvageMode: 1;
sal_Bool m_bVersionsAlreadyLoaded: 1;
sal_Bool m_bLocked: 1;
+ sal_Bool m_bHandleSysLocked: 1;
+ sal_Bool m_bGotDateTime: 1;
+
uno::Reference < embed::XStorage > xStorage;
SfxPoolCancelManager_ImplRef xCancelManager;
@@ -312,6 +326,8 @@ public:
// in this case the member will hold this information
sal_uInt16 m_nSignatureState;
+ util::DateTime m_aDateTime;
+
SfxPoolCancelManager_Impl* GetCancelManager();
SfxMedium_Impl( SfxMedium* pAntiImplP );
@@ -362,6 +378,8 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP )
m_bSalvageMode( sal_False ),
m_bVersionsAlreadyLoaded( sal_False ),
m_bLocked( sal_False ),
+ m_bHandleSysLocked( sal_False ),
+ m_bGotDateTime( sal_False ),
pAntiImpl( pAntiImplP ),
nFileVersion( 0 ),
pOrigFilter( 0 ),
@@ -453,6 +471,86 @@ long SfxMedium::GetFileVersion() const
}
//------------------------------------------------------------------
+void SfxMedium::CheckFileDate( const util::DateTime& aInitDate )
+{
+ GetInitFileDate();
+ if ( pImp->m_aDateTime.Seconds != aInitDate.Seconds
+ || pImp->m_aDateTime.Minutes != aInitDate.Minutes
+ || pImp->m_aDateTime.Hours != aInitDate.Hours
+ || pImp->m_aDateTime.Day != aInitDate.Day
+ || pImp->m_aDateTime.Month != aInitDate.Month
+ || pImp->m_aDateTime.Year != aInitDate.Year )
+ {
+ // check whether system file locking has been used, the default value is false
+ sal_Bool bUseSystemLock = sal_False;
+ try
+ {
+
+ uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
+ ::comphelper::getProcessServiceFactory(),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
+ ::comphelper::ConfigurationHelper::E_STANDARD );
+ if ( !xCommonConfig.is() )
+ throw uno::RuntimeException();
+
+ ::comphelper::ConfigurationHelper::readRelativeKey(
+ xCommonConfig,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseSystemLock;
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ if ( !bUseSystemLock )
+ {
+ uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
+
+ if ( xHandler.is() )
+ {
+ try
+ {
+ ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny(
+ document::ChangedByOthersRequest() ) );
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
+ aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() );
+ aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() );
+ xInteractionRequestImpl->setContinuations( aContinuations );
+
+ xHandler->handle( xInteractionRequestImpl.get() );
+
+ ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
+ if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
+ {
+ SetError( ERRCODE_ABORT );
+ }
+ }
+ catch ( uno::Exception& )
+ {}
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------
+util::DateTime SfxMedium::GetInitFileDate()
+{
+ if ( !pImp->m_bGotDateTime && GetContent().is() )
+ {
+ try
+ {
+ pImp->aContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DateModified" )) ) >>= pImp->m_aDateTime;
+ pImp->m_bGotDateTime = sal_True;
+ }
+ catch ( ::com::sun::star::uno::Exception& )
+ {
+ }
+ }
+
+ return pImp->m_aDateTime;
+}
+
+//------------------------------------------------------------------
Reference < XContent > SfxMedium::GetContent() const
{
if ( !pImp->aContent.get().is() )
@@ -692,9 +790,17 @@ sal_Bool SfxMedium::Commit()
Transfer_Impl();
}
+ sal_Bool bResult = ( GetError() == SVSTREAM_OK );
+
+ if ( bResult )
+ {
+ pImp->m_bGotDateTime = sal_False;
+ GetInitFileDate();
+ }
+
// remove truncation mode from the flags
- nStorOpenMode &= ( ~STREAM_TRUNC );
- return GetError() == SVSTREAM_OK;
+ nStorOpenMode &= (~STREAM_TRUNC);
+ return bResult;
}
//------------------------------------------------------------------
@@ -924,7 +1030,116 @@ void SfxMedium::SetPasswordToStorage_Impl()
}
//------------------------------------------------------------------
-sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading )
+sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< ::rtl::OUString >& aData, sal_Bool bIsLoading, sal_Bool bOwnLock )
+{
+ sal_Int8 nResult = LOCK_UI_NOLOCK;
+
+ // show the interaction regarding the document opening
+ uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
+
+ if ( ::svt::DocumentLockFile::IsInteractionAllowed() && xHandler.is() && ( bIsLoading || bOwnLock ) )
+ {
+ ::rtl::OUString aDocumentURL = GetURLObject().GetLastName();
+ ::rtl::OUString aInfo;
+ ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl;
+
+ if ( bOwnLock )
+ {
+ if ( aData.getLength() > LOCKFILE_EDITTIME_ID )
+ aInfo = aData[LOCKFILE_EDITTIME_ID];
+
+ xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny(
+ document::OwnLockOnDocumentRequest( ::rtl::OUString(), uno::Reference< uno::XInterface >(), aDocumentURL, aInfo, !bIsLoading ) ) );
+ }
+ else
+ {
+ if ( aData.getLength() > LOCKFILE_EDITTIME_ID )
+ {
+ if ( aData[LOCKFILE_OOOUSERNAME_ID].getLength() )
+ aInfo = aData[LOCKFILE_OOOUSERNAME_ID];
+ else
+ aInfo = aData[LOCKFILE_SYSUSERNAME_ID];
+
+ if ( aInfo.getLength() && aData[LOCKFILE_EDITTIME_ID].getLength() )
+ {
+ aInfo += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " ( " ) );
+ aInfo += aData[LOCKFILE_EDITTIME_ID];
+ aInfo += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " )" ) );
+ }
+ }
+
+ if ( bIsLoading )
+ {
+ xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny(
+ document::LockedDocumentRequest( ::rtl::OUString(), uno::Reference< uno::XInterface >(), aDocumentURL, aInfo ) ) );
+ }
+ else
+ {
+ xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny(
+ document::LockedOnSavingRequest( ::rtl::OUString(), uno::Reference< uno::XInterface >(), aDocumentURL, aInfo ) ) );
+
+ }
+ }
+
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
+ aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() );
+ aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() );
+ aContinuations[2] = new ::ucbhelper::InteractionDisapprove( xInteractionRequestImpl.get() );
+ xInteractionRequestImpl->setContinuations( aContinuations );
+
+ xHandler->handle( xInteractionRequestImpl.get() );
+
+ ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
+ if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
+ {
+ SetError( ERRCODE_ABORT );
+ }
+ else if ( uno::Reference< task::XInteractionDisapprove >( xSelected.get(), uno::UNO_QUERY ).is() )
+ {
+ // own lock on loading, user has selected to ignore the lock
+ // own lock on saving, user has selected to ignore the lock
+ // alien lock on loading, user has selected to edit a copy of document
+ // TODO/LATER: alien lock on saving, user has selected to do SaveAs to different location
+ if ( bIsLoading && !bOwnLock )
+ {
+ // means that a copy of the document should be opened
+ GetItemSet()->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
+ }
+ else if ( bOwnLock )
+ nResult = LOCK_UI_SUCCEEDED;
+ }
+ else // if ( XSelected == aContinuations[1] )
+ {
+ // own lock on loading, user has selected to open readonly
+ // own lock on saving, user has selected to open readonly
+ // alien lock on loading, user has selected to retry saving
+ // TODO/LATER: alien lock on saving, user has selected to retry saving
+
+ if ( bIsLoading )
+ GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) );
+ else
+ nResult = LOCK_UI_TRY;
+ }
+ }
+ else
+ {
+ if ( bIsLoading )
+ {
+ // if no interaction handler is provided the default answer is open readonly
+ // that usually happens in case the document is loaded per API
+ // so the document must be opened readonly for backward compatibility
+ GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) );
+ }
+ else
+ SetError( ERRCODE_IO_ACCESSDENIED );
+
+ }
+
+ return nResult;
+}
+
+//------------------------------------------------------------------
+sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
{
// returns true if the document can be opened for editing ( even if it should be a copy )
// otherwise the document should be opened readonly
@@ -936,103 +1151,141 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading )
{
// the special file locking should be used only for file URLs
+ // in case of storing the document should request the output before locking
+ if ( bLoading )
+ {
+ // let the stream be opened to check the system file locking
+ GetMedium_Impl();
+ }
+
+ SFX_ITEMSET_ARG( GetItemSet(), pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, sal_False);
+
// no locking is necessary on loading if the document is explicitly opened as copy
SFX_ITEMSET_ARG( GetItemSet(), pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False);
bResult = ( bLoading && pTemplateItem && pTemplateItem->GetValue() );
- try
+ if ( !bResult && ( !IsReadOnly() || pImp->m_bHandleSysLocked ) )
{
- if ( !bResult && !IsReadOnly() )
+ sal_Int8 bUIStatus = LOCK_UI_NOLOCK;
+
+ // check whether system file locking has been used, the default value is false
+ sal_Bool bUseSystemLock = sal_False;
+ try
{
- ::svt::DocumentLockFile aLockFile( aLogicName );
- bResult = aLockFile.CreateOwnLockFile();
- pImp->m_bLocked = bResult;
- if ( !bResult )
- {
- uno::Sequence< ::rtl::OUString > aData = aLockFile.GetLockData();
- uno::Sequence< ::rtl::OUString > aOwnData = aLockFile.GenerateOwnEntry();
-
- if ( aData.getLength() > LOCKFILE_USERURL_ID
- && aOwnData.getLength() > LOCKFILE_USERURL_ID
- && aOwnData[LOCKFILE_SYSUSERNAME_ID].equals( aData[LOCKFILE_SYSUSERNAME_ID] )
- && aOwnData[LOCKFILE_LOCALHOST_ID].equals( aData[LOCKFILE_LOCALHOST_ID] )
- && aOwnData[LOCKFILE_USERURL_ID].equals( aData[LOCKFILE_USERURL_ID] ) )
- {
- // this is own lock, it could remain because of crash
- pImp->m_bLocked = bResult = sal_True;
- }
+ uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
+ ::comphelper::getProcessServiceFactory(),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
+ ::comphelper::ConfigurationHelper::E_STANDARD );
+ if ( !xCommonConfig.is() )
+ throw uno::RuntimeException();
- if ( !bResult )
+ ::comphelper::ConfigurationHelper::readRelativeKey(
+ xCommonConfig,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseSystemLock;
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ // TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem
+ if ( bUseSystemLock && !pImp->xStream.is() && !pOutStream )
+ pImp->m_bHandleSysLocked = sal_True; // if system lock is used the writeable stream should be available
+
+ do
+ {
+ try
+ {
+ ::svt::DocumentLockFile aLockFile( aLogicName );
+ if ( !pImp->m_bHandleSysLocked )
{
- if ( bLoading )
+ try
{
- // show the interaction regarding the document opening
- uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
- if ( ::svt::DocumentLockFile::IsInteractionAllowed() && xHandler.is() )
+ bResult = aLockFile.CreateOwnLockFile();
+ }
+ catch ( ucb::InteractiveIOException& e )
+ {
+ if ( e.Code == IOErrorCode_INVALID_PARAMETER )
{
- document::LockedDocumentRequest aRequest;
- aRequest.DocumentURL = GetURLObject().GetLastName();
- if ( aData.getLength() > LOCKFILE_EDITTIME_ID )
+ // it looks like the lock file name is not accepted by the content
+ if ( !bUseSystemLock )
{
- if ( aData[LOCKFILE_OOOUSERNAME_ID].getLength() )
- aRequest.UserInfo += aData[LOCKFILE_OOOUSERNAME_ID];
- else
- aRequest.UserInfo += aData[LOCKFILE_SYSUSERNAME_ID];
+ // system file locking is not active, ask user whether he wants to open the document without any locking
+ uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
- if ( aRequest.UserInfo.getLength() && aData[LOCKFILE_EDITTIME_ID].getLength() )
+ if ( xHandler.is() )
{
- aRequest.UserInfo += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " ( " ) );
- aRequest.UserInfo += aData[LOCKFILE_EDITTIME_ID];
- aRequest.UserInfo += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " )" ) );
- }
- }
-
- ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny( aRequest ) );
+ ::rtl::Reference< ::ucbhelper::InteractionRequest > xIgnoreRequestImpl
+ = new ::ucbhelper::InteractionRequest( uno::makeAny( document::LockFileIgnoreRequest() ) );
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 );
+ aContinuations[0] = new ::ucbhelper::InteractionAbort( xIgnoreRequestImpl.get() );
+ aContinuations[1] = new ::ucbhelper::InteractionApprove( xIgnoreRequestImpl.get() );
+ xIgnoreRequestImpl->setContinuations( aContinuations );
- uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
- aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() );
- aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() );
- aContinuations[2] = new ::ucbhelper::InteractionDisapprove( xInteractionRequestImpl.get() );
- xInteractionRequestImpl->setContinuations( aContinuations );
+ xHandler->handle( xIgnoreRequestImpl.get() );
- xHandler->handle( xInteractionRequestImpl.get() );
-
- ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
- if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
- {
- SetError( ERRCODE_ABORT );
+ ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xIgnoreRequestImpl->getSelection();
+ bResult = ( uno::Reference< task::XInteractionApprove >( xSelected.get(), uno::UNO_QUERY ).is() );
+ }
}
- else if ( uno::Reference< task::XInteractionDisapprove >( xSelected.get(), uno::UNO_QUERY ).is() )
- {
- // means that a copy of the document should be opened
- GetItemSet()->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
+ else
bResult = sal_True;
- }
- // Approve means open readonly here, do not need to do anything
- // else if ( XSelected == aContinuations[1] )
}
else
+ throw;
+ }
+ }
+
+
+ if ( !bResult )
+ {
+ uno::Sequence< ::rtl::OUString > aData;
+ try
+ {
+ // impossibility to get data is no real problem
+ aData = aLockFile.GetLockData();
+ }
+ catch( uno::Exception ) {}
+
+ sal_Bool bOwnLock = sal_False;
+
+ if ( !pImp->m_bHandleSysLocked )
+ {
+ uno::Sequence< ::rtl::OUString > aOwnData = aLockFile.GenerateOwnEntry();
+ bOwnLock = ( aData.getLength() > LOCKFILE_USERURL_ID
+ && aOwnData.getLength() > LOCKFILE_USERURL_ID
+ && aOwnData[LOCKFILE_SYSUSERNAME_ID].equals( aData[LOCKFILE_SYSUSERNAME_ID] ) );
+
+ if ( bOwnLock
+ && aOwnData[LOCKFILE_LOCALHOST_ID].equals( aData[LOCKFILE_LOCALHOST_ID] )
+ && aOwnData[LOCKFILE_USERURL_ID].equals( aData[LOCKFILE_USERURL_ID] ) )
{
- // if no interaction handler is provided the default answer is yes
- // that usually happens in case the document is loaded per API
- // so the document must be opened readonly for backward compatibility
- GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) );
+ // this is own lock from the same installation, it could remain because of crash
+ bResult = sal_True;
}
}
- else
+
+ if ( !bResult && !bNoUI )
{
- // TODO/LATER: introduce a new interaction for this
- // this is saving, show just an error
- SetError( ERRCODE_IO_ACCESSDENIED );
+ bUIStatus = ShowLockedDocumentDialog( aData, bLoading, bOwnLock );
+ if ( bUIStatus == LOCK_UI_SUCCEEDED )
+ {
+ // take the ownership over the lock file
+ bResult = aLockFile.OverwriteOwnLockFile();
+ }
}
+
+ pImp->m_bHandleSysLocked = sal_False;
}
}
- }
- }
- catch( uno::Exception& )
- {
+ catch( uno::Exception& )
+ {
+ }
+ } while( !bResult && bUIStatus == LOCK_UI_TRY );
+
+ pImp->m_bLocked = bResult;
}
if ( !bResult && GetError() == ERRCODE_NONE )
@@ -1787,7 +2040,6 @@ void SfxMedium::Transfer_Impl()
SFX_ITEMSET_ARG( pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, sal_False);
if( pOutStreamItem && ( pOutStreamItem->GetValue() >>= rOutStream ) )
{
- // write directly to the stream
if ( pImp->xStorage.is() )
CloseStorage();
@@ -1983,10 +2235,6 @@ void SfxMedium::Transfer_Impl()
CloseStreams_Impl();
- // don't create content before Close(), because if the storage was opened in direct mode, it will be flushed
- // in Close() and this leads to a transfer command executed in the package, which currently is implemented as
- // remove+move in the file FCP. The "remove" is notified to the ::ucbhelper::Content, that clears its URL and its
- // content reference in this notification and thus will never get back any URL, so my transfer will fail!
::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xEnv, aSourceContent );
// check for external parameters that may customize the handling of NameClash situations
@@ -2269,6 +2517,7 @@ void SfxMedium::GetMedium_Impl()
{
TransformItems( SID_OPENDOC, *GetItemSet(), xProps );
comphelper::MediaDescriptor aMedium( xProps );
+ sal_Bool bRequestedReadOnly = aMedium.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_READONLY(), sal_False );
if ( bFromTempFile )
{
@@ -2279,15 +2528,24 @@ void SfxMedium::GetMedium_Impl()
else if ( ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
{
// use the special locking approach only for file URLs
- aMedium.addInputStreamNoLock();
+ aMedium.addInputStreamOwnLock();
}
else
aMedium.addInputStream();
+ // the warning is shown if the user wants to edit the document, but it is not possible
+ pImp->m_bHandleSysLocked = ( !bRequestedReadOnly && aMedium.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_READONLY(), sal_False ) );
+
sal_Bool bReadOnly = sal_False;
aMedium[comphelper::MediaDescriptor::PROP_READONLY()] >>= bReadOnly;
if ( bReadOnly )
+ {
+ SFX_ITEMSET_ARG( GetItemSet(), pROItem, SfxBoolItem, SID_DOC_READONLY, sal_False);
+ BOOL bForceWritable = ( pROItem && !pROItem->GetValue() );
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) );
+ if( bForceWritable )
+ SetError( ERRCODE_IO_ACCESSDENIED );
+ }
//TODO/MBA: what happens if property is not there?!
GetContent();
@@ -2319,6 +2577,8 @@ void SfxMedium::GetMedium_Impl()
pInStream = utl::UcbStreamHelper::CreateStream( pImp->xInputStream );
}
+ GetInitFileDate();
+
pImp->bDownloadDone = sal_True;
pImp->aDoneLink.ClearPendingCall();
pImp->aDoneLink.Call( (void*) GetError() );
@@ -2680,10 +2940,10 @@ void SfxMedium::UnlockFile()
{
try
{
+ pImp->m_bLocked = sal_False;
::svt::DocumentLockFile aLockFile( aLogicName );
- // TODO/LATER: A worning could be shown in case the file is not the own one
+ // TODO/LATER: A warning could be shown in case the file is not the own one
aLockFile.RemoveFile();
- pImp->m_bLocked = sal_False;
}
catch( uno::Exception& )
{}
@@ -3871,7 +4131,7 @@ BOOL SfxMedium::IsOpen() const
GetItemSet()->ClearItem( SID_DOC_READONLY );
GetMedium_Impl();
- LockOrigFileOnDemand( sal_False );
+ LockOrigFileOnDemand( sal_False, sal_False );
CreateTempFile();
GetMedium_Impl();
@@ -3929,7 +4189,7 @@ sal_Bool SfxMedium::SwitchDocumentToFile( ::rtl::OUString aURL )
// open the temporary file based document
GetMedium_Impl();
- LockOrigFileOnDemand( sal_False );
+ LockOrigFileOnDemand( sal_False, sal_False );
CreateTempFile();
GetMedium_Impl();
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 7745abd8e68a..dff75d14d459 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -637,7 +637,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
EnableSetModified( sal_False );
- pMedium->LockOrigFileOnDemand( sal_True );
+ pMedium->LockOrigFileOnDemand( sal_True, sal_False );
if ( GetError() == ERRCODE_NONE && bOwnStorageFormat && ( !pFilter || !( pFilter->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) ) )
{
uno::Reference< embed::XStorage > xStorage;
@@ -1222,6 +1222,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
{
bStoreToSameLocation = sal_True;
+ rMedium.CheckFileDate( pMedium->GetInitFileDate() );
+
if ( bCopyTo && GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
{
// export to the same location is vorbidden
@@ -1312,19 +1314,32 @@ sal_Bool SfxObjectShell::SaveTo_Impl
}
}
}
+ else
+ {
+ // This is SaveAs or export action, prepare the target medium
+ rMedium.CloseAndRelease();
+ if ( bStorageBasedTarget )
+ {
+ rMedium.GetOutputStorage();
+ }
+ else
+ {
+ rMedium.CreateTempFileNoCopy();
+ rMedium.GetOutStream();
+ }
+ }
// TODO/LATER: error handling
if( rMedium.GetErrorCode() || pMedium->GetErrorCode() || GetErrorCode() )
return sal_False;
- rMedium.LockOrigFileOnDemand( sal_False );
+ rMedium.LockOrigFileOnDemand( sal_False, sal_False );
+
if ( bStorageBasedTarget )
{
if ( rMedium.GetErrorCode() )
return sal_False;
- rMedium.GetOutputStorage();
-
// If the filter is a "cross export" filter ( f.e. a filter for exporting an impress document from
// a draw document ), the ClassId of the destination storage is different from the ClassId of this
// document. It can be retrieved from the default filter for the desired target format
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 12e7cead9e94..5565b3a10f49 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -472,9 +472,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
pMed->CloseAndRelease();
pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) );
pMed->SetOpenMode( nOpenMode, pMed->IsDirect() );
+
pMed->CompleteReOpen();
if ( nOpenMode & STREAM_WRITE )
- pMed->LockOrigFileOnDemand( sal_False );
+ pMed->LockOrigFileOnDemand( sal_False, sal_True );
// LockOrigFileOnDemand might set the readonly flag itself, it should be set back
pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) );
@@ -777,7 +778,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
{
// back to old medium
pMedium->ReOpen();
- pMedium->LockOrigFileOnDemand( sal_True );
+ pMedium->LockOrigFileOnDemand( sal_False, sal_True );
xOldObj->DoSaveCompleted( pMedium );
}
diff --git a/svx/inc/optinet2.hrc b/svx/inc/optinet2.hrc
index 2aa78d05bdd4..da394d6d249f 100644
--- a/svx/inc/optinet2.hrc
+++ b/svx/inc/optinet2.hrc
@@ -112,16 +112,17 @@
#define PB_SEC_SECURITYOPTIONS 12
#define FL_SEC_PASSWORDS 13
#define CB_SEC_SAVEPASSWORDS 14
-#define PB_SEC_MASTERPASSWORD 15
-#define FI_SEC_MASTERPASSWORD 16
-#define PB_SEC_SHOWPASSWORDS 17
-#define FL_SEC_MACROSEC 18
-#define FI_SEC_MACROSEC 19
-#define PB_SEC_MACROSEC 20
-#define FL_SEC_FILESHARING 21
-#define CB_SEC_RECOMMREADONLY 22
-#define CB_SEC_RECORDCHANGES 23
-#define PB_SEC_PROTRECORDS 24
+#define PB_SEC_CONNECTIONS 15
+#define CB_SEC_MASTERPASSWORD 16
+#define FI_SEC_MASTERPASSWORD 17
+#define PB_SEC_MASTERPASSWORD 18
+#define FL_SEC_MACROSEC 19
+#define FI_SEC_MACROSEC 20
+#define PB_SEC_MACROSEC 21
+#define FL_SEC_FILESHARING 22
+#define CB_SEC_RECOMMREADONLY 23
+#define CB_SEC_RECORDCHANGES 24
+#define PB_SEC_PROTRECORDS 25
#define STR_SEC_PROTRECORDS 10
#define STR_SEC_UNPROTRECORDS 11
@@ -133,25 +134,23 @@
#define BORDER_OFFSET 8
#define COL_0 (RSC_SP_TBPG_INNERBORDER_LEFT)
#define COL_1 (COL_0+RSC_SP_FLGR_SPACE_X)
+#define COL_1a (COL_1+RSC_SP_CHK_TEXTINDENT)
#define COL_4 (TP_WIDTH-RSC_SP_TBPG_INNERBORDER_RIGHT)
#define COL_3 (COL_4-RSC_CD_PUSHBUTTON_WIDTH)
#define COL_2 (COL_3-RSC_SP_CTRL_DESC_X)
#define ROW_0 (RSC_SP_FLGR_INNERBORDER_TOP)
-#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
-#define ROW_2 (ROW_1+3*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_2 (ROW_1+3*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
#define ROW_2a (ROW_2-RSC_SP_FLGR_SPACE_Y-RSC_CD_PUSHBUTTON_HEIGHT)
-#define ROW_3 (ROW_2+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
-#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
-#define ROW_5 (ROW_4+4*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_FLGR_SPACE_Y)
-#define ROW_5a (ROW_5-RSC_SP_FLGR_SPACE_Y-RSC_CD_PUSHBUTTON_HEIGHT)
-#define ROW_6 (ROW_5+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
-#define ROW_7 (ROW_6+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_FLGR_SPACE_Y+OFFS_BUTTON_Y)
-#define ROW_8 (ROW_7+RSC_CD_PUSHBUTTON_HEIGHT)
-#define ROW_9 (ROW_8+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
-#define ROW_10 (ROW_9+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
-#define ROW_11 (ROW_10+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
-#define ROW_11a (ROW_11-RSC_SP_FLGR_SPACE_Y-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_3 (ROW_2+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_DESC_Y-1)
+#define ROW_4a (ROW_4+RSC_CD_CHECKBOX_HEIGHT+1)
+#define ROW_5 (ROW_4a+4*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_6 (ROW_5+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_7 (ROW_6+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_8 (ROW_7+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_9 (ROW_8+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_DESC_Y)
// Defines - JavaScriptDisableQueryBox_Impl -------------------------------
diff --git a/svx/source/dialog/optinet2.cxx b/svx/source/dialog/optinet2.cxx
index 3475a4990fc1..01d97a9e7e0b 100644
--- a/svx/source/dialog/optinet2.cxx
+++ b/svx/source/dialog/optinet2.cxx
@@ -122,7 +122,7 @@
#include <comphelper/processfactory.hxx>
#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
-#include "com/sun/star/task/XMasterPasswordHandling.hpp"
+#include "com/sun/star/task/XMasterPasswordHandling2.hpp"
#include "com/sun/star/task/XPasswordContainer.hpp"
#include "securityoptions.hxx"
#include "webconninfo.hxx"
@@ -1342,11 +1342,14 @@ SvxSecurityTabPage::SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet
,maSecurityOptionsFL( this, SVX_RES( FL_SEC_SECURITYOPTIONS ) )
,maSecurityOptionsFI( this, SVX_RES( FI_SEC_SECURITYOPTIONS ) )
,maSecurityOptionsPB( this, SVX_RES( PB_SEC_SECURITYOPTIONS ) )
+
,maPasswordsFL ( this, SVX_RES( FL_SEC_PASSWORDS ) )
,maSavePasswordsCB ( this, SVX_RES( CB_SEC_SAVEPASSWORDS ) )
- ,maMasterPasswordPB ( this, SVX_RES( PB_SEC_MASTERPASSWORD ) )
+ ,maShowConnectionsPB( this, SVX_RES( PB_SEC_CONNECTIONS ) )
+ ,maMasterPasswordCB ( this, SVX_RES( CB_SEC_MASTERPASSWORD ) )
,maMasterPasswordFI ( this, SVX_RES( FI_SEC_MASTERPASSWORD ) )
- ,maShowPasswordsPB ( this, SVX_RES( PB_SEC_SHOWPASSWORDS ) )
+ ,maMasterPasswordPB ( this, SVX_RES( PB_SEC_MASTERPASSWORD ) )
+
,maMacroSecFL ( this, SVX_RES( FL_SEC_MACROSEC ) )
,maMacroSecFI ( this, SVX_RES( FI_SEC_MACROSEC ) )
,maMacroSecPB ( this, SVX_RES( PB_SEC_MACROSEC ) )
@@ -1359,9 +1362,9 @@ SvxSecurityTabPage::SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet
,mpSecOptDlg ( NULL )
,meRedlingMode ( RL_NONE )
- ,msProtectRecordsStr( SVX_RES( STR_SEC_PROTRECORDS ) )
- ,msUnprotectRecordsStr( SVX_RES( STR_SEC_UNPROTRECORDS ) )
- ,msPasswordStoringDeactivateStr( SVX_RES( STR_SEC_NOPASSWDSAVE ) )
+ ,msProtectRecordsStr( SVX_RES( STR_SEC_PROTRECORDS ) )
+ ,msUnprotectRecordsStr( SVX_RES( STR_SEC_UNPROTRECORDS ) )
+ ,msPasswordStoringDeactivateStr( SVX_RES( STR_SEC_NOPASSWDSAVE ) )
{
FreeResource();
@@ -1371,7 +1374,8 @@ SvxSecurityTabPage::SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet
maSecurityOptionsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, SecurityOptionsHdl ) );
maSavePasswordsCB.SetClickHdl( LINK( this, SvxSecurityTabPage, SavePasswordHdl ) );
maMasterPasswordPB.SetClickHdl( LINK( this, SvxSecurityTabPage, MasterPasswordHdl ) );
- maShowPasswordsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ShowPasswordsHdl ) );
+ maMasterPasswordCB.SetClickHdl( LINK( this, SvxSecurityTabPage, MasterPasswordCBHdl ) );
+ maShowConnectionsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ShowPasswordsHdl ) );
maMacroSecPB.SetClickHdl( LINK( this, SvxSecurityTabPage, MacroSecPBHdl ) );
maProtectRecordsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ProtectRecordsPBHdl ) );
maRecordChangesCB.SetClickHdl( LINK( this, SvxSecurityTabPage, RecordChangesCBHdl ) );
@@ -1409,7 +1413,10 @@ IMPL_LINK( SvxSecurityTabPage, SavePasswordHdl, void*, EMPTYARG )
if ( xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() ) )
{
maMasterPasswordPB.Enable( TRUE );
- maShowPasswordsPB.Enable( TRUE );
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordCB.Enable( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
}
else
{
@@ -1425,14 +1432,17 @@ IMPL_LINK( SvxSecurityTabPage, SavePasswordHdl, void*, EMPTYARG )
if( RET_YES == nRet )
{
xMasterPasswd->allowPersistentStoring( sal_False );
+ maMasterPasswordCB.Check( TRUE );
maMasterPasswordPB.Enable( FALSE );
- maShowPasswordsPB.Enable( FALSE );
+ maMasterPasswordCB.Enable( FALSE );
+ maMasterPasswordFI.Enable( FALSE );
+ maShowConnectionsPB.Enable( FALSE );
}
else
{
maSavePasswordsCB.Check( TRUE );
maMasterPasswordPB.Enable( TRUE );
- maShowPasswordsPB.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
}
}
}
@@ -1462,6 +1472,52 @@ IMPL_LINK( SvxSecurityTabPage, MasterPasswordHdl, PushButton*, EMPTYARG )
return 0;
}
+IMPL_LINK( SvxSecurityTabPage, MasterPasswordCBHdl, void*, EMPTYARG )
+{
+ try
+ {
+ Reference< task::XMasterPasswordHandling2 > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ UNO_QUERY_THROW );
+
+ if ( maMasterPasswordCB.IsChecked() )
+ {
+ if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() ) )
+ {
+ maMasterPasswordPB.Enable( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ }
+ else
+ {
+ maMasterPasswordCB.Check( FALSE );
+ maMasterPasswordPB.Enable( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ }
+ }
+ else
+ {
+ if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->useDefaultMasterPassword( Reference< task::XInteractionHandler >() ) )
+ {
+ maMasterPasswordPB.Enable( FALSE );
+ maMasterPasswordFI.Enable( FALSE );
+ }
+ else
+ {
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordPB.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ maSavePasswordsCB.Check( !maSavePasswordsCB.IsChecked() );
+ }
+
+ return 0;
+}
+
IMPL_LINK( SvxSecurityTabPage, ShowPasswordsHdl, PushButton*, EMPTYARG )
{
try
@@ -1652,7 +1708,7 @@ void SvxSecurityTabPage::InitControls()
sal_Int32 i = 0;
long nBtnTextWidth = 0;
Window* pButtons[] = { &maSecurityOptionsPB, &maMasterPasswordPB,
- &maShowPasswordsPB, &maMacroSecPB, &maProtectRecordsPB };
+ &maShowConnectionsPB, &maMacroSecPB, &maProtectRecordsPB };
Window** pButton = pButtons;
const sal_Int32 nBCount = sizeof( pButtons ) / sizeof( pButtons[ 0 ] );
for ( ; i < nBCount; ++i, ++pButton )
@@ -1705,7 +1761,10 @@ void SvxSecurityTabPage::InitControls()
}
maMasterPasswordPB.Enable( FALSE );
- maShowPasswordsPB.Enable( FALSE );
+ maMasterPasswordCB.Enable( FALSE );
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordFI.Enable( FALSE );
+ maShowConnectionsPB.Enable( FALSE );
// initialize the password saving checkbox
try
@@ -1717,9 +1776,19 @@ void SvxSecurityTabPage::InitControls()
if ( xMasterPasswd->isPersistentStoringAllowed() )
{
- maMasterPasswordPB.Enable( TRUE );
- maShowPasswordsPB.Enable( TRUE );
+ maMasterPasswordCB.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
maSavePasswordsCB.Check( TRUE );
+
+ Reference< task::XMasterPasswordHandling2 > xMasterPasswd2( xMasterPasswd, UNO_QUERY );
+ if ( xMasterPasswd2.is() && xMasterPasswd2->isDefaultMasterPasswordUsed() )
+ maMasterPasswordCB.Check( FALSE );
+ else
+ {
+ maMasterPasswordPB.Enable( TRUE );
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ }
}
}
catch( Exception& )
diff --git a/svx/source/dialog/optinet2.hxx b/svx/source/dialog/optinet2.hxx
index 6d08b2ec9607..0f1364b716f8 100644
--- a/svx/source/dialog/optinet2.hxx
+++ b/svx/source/dialog/optinet2.hxx
@@ -247,9 +247,10 @@ private:
FixedLine maPasswordsFL;
CheckBox maSavePasswordsCB;
- PushButton maMasterPasswordPB;
+ PushButton maShowConnectionsPB;
+ CheckBox maMasterPasswordCB;
FixedInfo maMasterPasswordFI;
- PushButton maShowPasswordsPB;
+ PushButton maMasterPasswordPB;
FixedLine maMacroSecFL;
FixedInfo maMacroSecFI;
@@ -271,6 +272,7 @@ private:
DECL_LINK( SecurityOptionsHdl, PushButton* );
DECL_LINK( SavePasswordHdl, void* );
DECL_LINK( MasterPasswordHdl, PushButton* );
+ DECL_LINK( MasterPasswordCBHdl, void* );
DECL_LINK( ShowPasswordsHdl, PushButton* );
DECL_LINK( MacroSecPBHdl, void* );
DECL_LINK( RecordChangesCBHdl, void* );
diff --git a/svx/source/options/optinet2.src b/svx/source/options/optinet2.src
index b4591a56d657..2737ae2fb3bb 100644
--- a/svx/source/options/optinet2.src
+++ b/svx/source/options/optinet2.src
@@ -434,7 +434,6 @@ TabPage RID_SVXPAGE_INET_SECURITY
SVLook = TRUE;
Hide = TRUE;
Text [ en-US ] = "Security";
-
FixedLine FL_SEC_SECURITYOPTIONS
{
Pos = MAP_APPFONT( COL_0, ROW_0 );
@@ -465,26 +464,32 @@ TabPage RID_SVXPAGE_INET_SECURITY
Pos = MAP_APPFONT( COL_1, ROW_3 - 4 );
Size = MAP_APPFONT( COL_2-COL_1, 16 );
Wordbreak = TRUE;
- Text [ en-US ] = "Persistently save passwords protected by a master password";
+ Text [ en-US ] = "Persistently save passwords for web connections";
};
- PushButton PB_SEC_MASTERPASSWORD
+ PushButton PB_SEC_CONNECTIONS
{
- Pos = MAP_APPFONT( COL_3, ROW_3 - 4 );
+ Pos = MAP_APPFONT( COL_3, ROW_3-3 );
Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
- Text [ en-US ] = "Master Password...";
+ Text [ en-US ] = "Connections...";
+ };
+ CheckBox CB_SEC_MASTERPASSWORD
+ {
+ Pos = MAP_APPFONT( COL_1a, ROW_4 + 2);
+ Size = MAP_APPFONT( COL_2-COL_1a, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Protected by a master password (recommended)";
};
FixedText FI_SEC_MASTERPASSWORD
{
- Pos = MAP_APPFONT( COL_1, ROW_4 + 2 );
- Size = MAP_APPFONT( COL_2-COL_1, 4*RSC_CD_FIXEDLINE_HEIGHT );
+ Pos = MAP_APPFONT( COL_1a, ROW_4a );
+ Size = MAP_APPFONT( COL_2-COL_1a, 4*RSC_CD_FIXEDLINE_HEIGHT );
Wordbreak = TRUE;
Text [ en-US ] = "Passwords are protected by a master password. You will be asked to enter it once per session, if %PRODUCTNAME retrieves a password from the protected password list.";
};
- PushButton PB_SEC_SHOWPASSWORDS
+ PushButton PB_SEC_MASTERPASSWORD
{
- Pos = MAP_APPFONT( COL_3, ROW_5a );
+ Pos = MAP_APPFONT( COL_3, ROW_4a );
Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
- Text [ en-US ] = "Show Passwords...";
+ Text [ en-US ] = "Master Password...";
};
FixedLine FL_SEC_MACROSEC
{
@@ -495,37 +500,37 @@ TabPage RID_SVXPAGE_INET_SECURITY
FixedText FI_SEC_MACROSEC
{
Pos = MAP_APPFONT( COL_1, ROW_6 );
- Size = MAP_APPFONT( COL_2-COL_1, ROW_8 - ROW_6 - RSC_SP_FLGR_SPACE_Y );
+ Size = MAP_APPFONT( COL_2-COL_1, 3*RSC_CD_FIXEDLINE_HEIGHT );
Wordbreak = TRUE;
Text [ en-US ] = "Adjust the security level for executing macros and specify trusted macro developers.";
};
PushButton PB_SEC_MACROSEC
{
- Pos = MAP_APPFONT( COL_3, ROW_7 );
+ Pos = MAP_APPFONT( COL_3, ROW_6-2 );
Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
Text [ en-US ] = "Macro Security...";
};
FixedLine FL_SEC_FILESHARING
{
- Pos = MAP_APPFONT( COL_0, ROW_8 );
+ Pos = MAP_APPFONT( COL_0, ROW_7 );
Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
Text [ en-US ] = "File sharing options for this document";
};
CheckBox CB_SEC_RECOMMREADONLY
{
- Pos = MAP_APPFONT( COL_1, ROW_9 );
+ Pos = MAP_APPFONT( COL_1, ROW_8 );
Size = MAP_APPFONT( COL_2-COL_1, RSC_CD_CHECKBOX_HEIGHT );
Text [ en-US ] = "Open this document in read-only mode";
};
CheckBox CB_SEC_RECORDCHANGES
{
- Pos = MAP_APPFONT( COL_1, ROW_10 );
+ Pos = MAP_APPFONT( COL_1, ROW_9 );
Size = MAP_APPFONT( COL_2-COL_1, RSC_CD_CHECKBOX_HEIGHT );
Text [ en-US ] = "Record changes";
};
PushButton PB_SEC_PROTRECORDS
{
- Pos = MAP_APPFONT( COL_3, ROW_11a );
+ Pos = MAP_APPFONT( COL_3, ROW_9-2 );
Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
};
String STR_SEC_PROTRECORDS
diff --git a/uui/source/alreadyopen.cxx b/uui/source/alreadyopen.cxx
new file mode 100644
index 000000000000..1f2b170f60fc
--- /dev/null
+++ b/uui/source/alreadyopen.cxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * 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: openlocked.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "ids.hrc"
+#include "alreadyopen.hxx"
+
+AlreadyOpenQueryBox::AlreadyOpenQueryBox( Window* pParent, ResMgr* pResMgr, const String& aMessage, sal_Bool bIsStoring ) :
+ MessBox(pParent, 0,
+ String( ResId( STR_ALREADYOPEN_TITLE, *pResMgr ) ),
+ aMessage )
+{
+ SetImage( QueryBox::GetStandardImage() );
+
+ if ( bIsStoring )
+ {
+ AddButton( String( ResId( STR_ALREADYOPEN_RETRY_SAVE_BTN, *pResMgr ) ), RET_YES,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
+ AddButton( String( ResId( STR_ALREADYOPEN_SAVE_BTN, *pResMgr ) ), RET_NO, 0 );
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ }
+ else
+ {
+ AddButton( String( ResId( STR_ALREADYOPEN_READONLY_BTN, *pResMgr ) ), RET_YES,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
+ AddButton( String( ResId( STR_ALREADYOPEN_OPEN_BTN, *pResMgr ) ), RET_NO, 0 );
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ }
+
+ SetButtonHelpText( RET_YES, String::EmptyString() );
+ SetButtonHelpText( RET_NO, String::EmptyString() );
+}
+
+AlreadyOpenQueryBox::~AlreadyOpenQueryBox()
+{
+}
+
diff --git a/uui/source/alreadyopen.hxx b/uui/source/alreadyopen.hxx
new file mode 100644
index 000000000000..2ba2db8a06b9
--- /dev/null
+++ b/uui/source/alreadyopen.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * 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: openlocked.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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 _UUI_ALREADYOPEN_HXX
+#define _UUI_ALREADYOPEN_HXX
+
+#include <vcl/msgbox.hxx>
+
+class AlreadyOpenQueryBox : public MessBox
+{
+public:
+ AlreadyOpenQueryBox( Window* pParent, ResMgr* pResMgr, const String& aMessage, sal_Bool bIsStoring );
+ ~AlreadyOpenQueryBox();
+};
+
+#endif
+
diff --git a/uui/source/alreadyopen.src b/uui/source/alreadyopen.src
new file mode 100644
index 000000000000..e4222af91dce
--- /dev/null
+++ b/uui/source/alreadyopen.src
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * 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: openlocked.src,v $
+ * $Revision: 1.3 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+
+String STR_ALREADYOPEN_TITLE
+{
+ Text = "Document in Use";
+};
+String STR_ALREADYOPEN_MSG
+{
+ Text [ en-US ] = "Document file '$(ARG1)' is locked for editing by yourself on a different system since $(ARG2)\n\nOpen document read-only, or ignore own file locking and open the document for editing.\n\n";
+};
+String STR_ALREADYOPEN_READONLY_BTN
+{
+ Text [ en-US ] = "Open ~Read-Only";
+};
+String STR_ALREADYOPEN_OPEN_BTN
+{
+ Text [ en-US ] = "~Open";
+};
+String STR_ALREADYOPEN_SAVE_MSG
+{
+ Text [ en-US ] = "Document file '$(ARG1)' is locked for editing by yourself on a different system since $(ARG2)\n\nClose document on other system and retry saving or ignore own file locking and save current document.\n\n";
+};
+String STR_ALREADYOPEN_RETRY_SAVE_BTN
+{
+ Text [ en-US ] = "~Retry Saving";
+};
+String STR_ALREADYOPEN_SAVE_BTN
+{
+ Text [ en-US ] = "~Save";
+};
+
diff --git a/uui/source/filechanged.cxx b/uui/source/filechanged.cxx
new file mode 100644
index 000000000000..31e942309c0d
--- /dev/null
+++ b/uui/source/filechanged.cxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * 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: openlocked.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "ids.hrc"
+#include "filechanged.hxx"
+
+FileChangedQueryBox::FileChangedQueryBox( Window* pParent, ResMgr* pResMgr ) :
+ MessBox(pParent, 0,
+ String( ResId( STR_FILECHANGED_TITLE, *pResMgr ) ),
+ String::EmptyString() )
+{
+ SetImage( QueryBox::GetStandardImage() );
+
+ AddButton( String( ResId( STR_FILECHANGED_SAVEANYWAY_BTN, *pResMgr ) ), RET_YES,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+
+ SetButtonHelpText( RET_YES, String::EmptyString() );
+ SetMessText( String( ResId( STR_FILECHANGED_MSG, *pResMgr ) ) );
+}
+
+FileChangedQueryBox::~FileChangedQueryBox()
+{
+}
+
diff --git a/uui/source/filechanged.hxx b/uui/source/filechanged.hxx
new file mode 100644
index 000000000000..76f4ad3e8e97
--- /dev/null
+++ b/uui/source/filechanged.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * 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: openlocked.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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 _UUI_FILECHANGED_HXX
+#define _UUI_FILECHANGED_HXX
+
+#include <vcl/msgbox.hxx>
+
+class FileChangedQueryBox : public MessBox
+{
+public:
+ FileChangedQueryBox( Window* pParent, ResMgr* pResMgr );
+ ~FileChangedQueryBox();
+};
+
+#endif
+
diff --git a/uui/source/filechanged.src b/uui/source/filechanged.src
new file mode 100644
index 000000000000..4ebf0826e0a5
--- /dev/null
+++ b/uui/source/filechanged.src
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * 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: openlocked.src,v $
+ * $Revision: 1.3 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+
+String STR_FILECHANGED_TITLE
+{
+ Text = "Document Has Been Changed by Others";
+};
+String STR_FILECHANGED_MSG
+{
+ Text [ en-US ] = "The file has been changed since it was opened for editing in %PRODUCTNAME. Saving your version of the document will overwrite changes made by others.\n\nDo you want to save anyway?\n\n";
+};
+String STR_FILECHANGED_SAVEANYWAY_BTN
+{
+ Text [ en-US ] = "~Save Anyway";
+};
+
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 7c8781979629..ca5e13fa54c3 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -48,6 +48,10 @@
#include "com/sun/star/document/NoSuchFilterRequest.hpp"
#include "com/sun/star/document/AmbigousFilterRequest.hpp"
#include "com/sun/star/document/LockedDocumentRequest.hpp"
+#include "com/sun/star/document/OwnLockOnDocumentRequest.hpp"
+#include "com/sun/star/document/LockedOnSavingRequest.hpp"
+#include "com/sun/star/document/ChangedByOthersRequest.hpp"
+#include "com/sun/star/document/LockFileIgnoreRequest.hpp"
#include "com/sun/star/document/XImporter.hpp"
#include "com/sun/star/document/XInteractionFilterOptions.hpp"
#include "com/sun/star/document/XInteractionFilterSelect.hpp"
@@ -118,6 +122,10 @@
#include "sslwarndlg.hxx"
#include "openlocked.hxx"
#include "newerverwarn.hxx"
+#include "alreadyopen.hxx"
+#include "filechanged.hxx"
+#include "trylater.hxx"
+#include "lockfailed.hxx"
#include <comphelper/processfactory.hxx>
#include <svtools/zforlist.hxx>
using namespace com::sun;
@@ -1156,8 +1164,44 @@ void UUIInteractionHelper::handleDialogRequests(
star::document::LockedDocumentRequest aLockedDocumentRequest;
if (aAnyRequest >>= aLockedDocumentRequest )
{
- handleLockedDocumentRequest( aLockedDocumentRequest,
- rRequest->getContinuations() );
+ handleLockedDocumentRequest( aLockedDocumentRequest.DocumentURL,
+ aLockedDocumentRequest.UserInfo,
+ rRequest->getContinuations(),
+ UUI_DOC_LOAD_LOCK );
+ return;
+ }
+
+ star::document::OwnLockOnDocumentRequest aOwnLockOnDocumentRequest;
+ if (aAnyRequest >>= aOwnLockOnDocumentRequest )
+ {
+ handleLockedDocumentRequest( aOwnLockOnDocumentRequest.DocumentURL,
+ aOwnLockOnDocumentRequest.TimeInfo,
+ rRequest->getContinuations(),
+ aOwnLockOnDocumentRequest.IsStoring ? UUI_DOC_OWN_SAVE_LOCK : UUI_DOC_OWN_LOAD_LOCK );
+ return;
+ }
+
+ star::document::LockedOnSavingRequest aLockedOnSavingRequest;
+ if (aAnyRequest >>= aLockedOnSavingRequest )
+ {
+ handleLockedDocumentRequest( aLockedOnSavingRequest.DocumentURL,
+ aLockedOnSavingRequest.UserInfo,
+ rRequest->getContinuations(),
+ UUI_DOC_SAVE_LOCK );
+ return;
+ }
+
+ star::document::ChangedByOthersRequest aChangedByOthersRequest;
+ if (aAnyRequest >>= aChangedByOthersRequest )
+ {
+ handleChangedByOthersRequest( rRequest->getContinuations() );
+ return;
+ }
+
+ star::document::LockFileIgnoreRequest aLockFileIgnoreRequest;
+ if (aAnyRequest >>= aLockFileIgnoreRequest )
+ {
+ handleLockFileIgnoreRequest( rRequest->getContinuations() );
return;
}
}
@@ -3306,10 +3350,12 @@ UUIInteractionHelper::handleBrokenPackageRequest(
void
UUIInteractionHelper::handleLockedDocumentRequest(
- star::document::LockedDocumentRequest const & aRequest,
+ const ::rtl::OUString& aDocumentURL,
+ const ::rtl::OUString& aInfo,
star::uno::Sequence< star::uno::Reference<
star::task::XInteractionContinuation > > const &
- rContinuations )
+ rContinuations,
+ sal_uInt16 nMode )
SAL_THROW((star::uno::RuntimeException))
{
star::uno::Reference< star::task::XInteractionApprove > xApprove;
@@ -3329,22 +3375,49 @@ UUIInteractionHelper::handleLockedDocumentRequest(
if (!xManager.get())
return;
- ::rtl::OUString aMessage = String( ResId( STR_OPENLOCKED_MSG, *xManager.get() ) );
+ ::rtl::OUString aMessage;
std::vector< rtl::OUString > aArguments;
- aArguments.push_back( aRequest.DocumentURL );
- aArguments.push_back( aRequest.UserInfo.getLength()
- ? aRequest.UserInfo
- : ::rtl::OUString( String( ResId( STR_OPENLOCKED_UNKNOWNUSER, *xManager.get() ) ) ) );
+ aArguments.push_back( aDocumentURL );
- aMessage = replaceMessageWithArguments( aMessage, aArguments );
+ sal_Int32 nResult = RET_CANCEL;
+ if ( nMode == UUI_DOC_LOAD_LOCK )
+ {
+ aArguments.push_back( aInfo.getLength()
+ ? aInfo
+ : ::rtl::OUString( String( ResId( STR_UNKNOWNUSER, *xManager.get() ) ) ) );
+ aMessage = String( ResId( STR_OPENLOCKED_MSG, *xManager.get() ) );
+ aMessage = replaceMessageWithArguments( aMessage, aArguments );
+
+ std::auto_ptr< OpenLockedQueryBox > xDialog(new OpenLockedQueryBox(
+ getParentProperty(), xManager.get(), aMessage ) );
+ nResult = xDialog->Execute();
+ }
+ else if ( nMode == UUI_DOC_SAVE_LOCK )
+ {
+ aArguments.push_back( aInfo.getLength()
+ ? aInfo
+ : ::rtl::OUString( String( ResId( STR_UNKNOWNUSER, *xManager.get() ) ) ) );
+ aMessage = String( ResId( STR_TRYLATER_MSG, *xManager.get() ) );
+ aMessage = replaceMessageWithArguments( aMessage, aArguments );
+
+ std::auto_ptr< TryLaterQueryBox > xDialog(new TryLaterQueryBox(
+ getParentProperty(), xManager.get(), aMessage ) );
+ nResult = xDialog->Execute();
+ }
+ else if ( nMode == UUI_DOC_OWN_LOAD_LOCK || nMode == UUI_DOC_OWN_SAVE_LOCK )
+ {
+ aArguments.push_back( aInfo );
+ aMessage = String( ResId( nMode == UUI_DOC_OWN_SAVE_LOCK ? STR_ALREADYOPEN_SAVE_MSG : STR_ALREADYOPEN_MSG, *xManager.get() ) );
+ aMessage = replaceMessageWithArguments( aMessage, aArguments );
- std::auto_ptr< OpenLockedQueryBox >
- xDialog(new OpenLockedQueryBox(
- getParentProperty(), xManager.get(), aMessage ) );
- sal_Int32 nResult = xDialog->Execute();
- if ( nResult == RET_YES ) // open the document readonly
+ std::auto_ptr< AlreadyOpenQueryBox > xDialog(new AlreadyOpenQueryBox(
+ getParentProperty(), xManager.get(), aMessage, nMode == UUI_DOC_OWN_SAVE_LOCK ) );
+ nResult = xDialog->Execute();
+ }
+
+ if ( nResult == RET_YES )
xApprove->select();
- else if ( nResult == RET_NO ) // open the copy of the document
+ else if ( nResult == RET_NO )
xDisapprove->select();
else
xAbort->select();
@@ -3357,3 +3430,84 @@ UUIInteractionHelper::handleLockedDocumentRequest(
}
}
+void
+UUIInteractionHelper::handleChangedByOthersRequest(
+ star::uno::Sequence< star::uno::Reference<
+ star::task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((star::uno::RuntimeException))
+{
+ star::uno::Reference< star::task::XInteractionApprove > xApprove;
+ star::uno::Reference< star::task::XInteractionAbort > xAbort;
+ getContinuations(
+ rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0);
+
+ if ( !xApprove.is() || !xAbort.is() )
+ return;
+
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if (!xManager.get())
+ return;
+
+ std::auto_ptr< FileChangedQueryBox > xDialog(new FileChangedQueryBox(
+ getParentProperty(), xManager.get() ) );
+ sal_Int32 nResult = xDialog->Execute();
+
+ if ( nResult == RET_YES )
+ xApprove->select();
+ else
+ xAbort->select();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ star::uno::Reference< star::uno::XInterface >());
+ }
+}
+
+void
+UUIInteractionHelper::handleLockFileIgnoreRequest(
+ star::uno::Sequence< star::uno::Reference<
+ star::task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((star::uno::RuntimeException))
+{
+ star::uno::Reference< star::task::XInteractionApprove > xApprove;
+ star::uno::Reference< star::task::XInteractionAbort > xAbort;
+ getContinuations(
+ rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0);
+
+ if ( !xApprove.is() || !xAbort.is() )
+ return;
+
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if (!xManager.get())
+ return;
+
+ std::auto_ptr< LockFailedQueryBox > xDialog(new LockFailedQueryBox(
+ getParentProperty(), xManager.get() ) );
+ sal_Int32 nResult = xDialog->Execute();
+
+ if ( nResult == RET_OK )
+ xApprove->select();
+ else
+ xAbort->select();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ star::uno::Reference< star::uno::XInterface >());
+ }
+}
+
+
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index f3a82029dfad..b3257688cb8c 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -60,6 +60,11 @@ struct CntHTTPCookieRequest;
#define DESCRIPTION_2 2
#define TITLE 3
+#define UUI_DOC_LOAD_LOCK 0
+#define UUI_DOC_OWN_LOAD_LOCK 1
+#define UUI_DOC_SAVE_LOCK 2
+#define UUI_DOC_OWN_SAVE_LOCK 3
+
namespace cssu = com::sun::star::uno;
namespace dcss = ::com::sun::star;
@@ -68,7 +73,6 @@ namespace com { namespace sun { namespace star {
class AmbigousFilterRequest;
class FilterOptionsRequest;
class NoSuchFilterRequest;
- class LockedDocumentRequest;
}
namespace lang {
class XMultiServiceFactory;
@@ -374,11 +378,26 @@ private:
rtl::OUString & rErrorString);
void handleLockedDocumentRequest(
- ::com::sun::star::document::LockedDocumentRequest const & aRequest,
+ const ::rtl::OUString& aDocumentURL,
+ const ::rtl::OUString& aInfo,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ sal_uInt16 nMode )
+ SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ void handleChangedByOthersRequest(
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
::com::sun::star::task::XInteractionContinuation > > const &
rContinuations )
SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ void handleLockFileIgnoreRequest(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((::com::sun::star::uno::RuntimeException));
+
};
#endif // UUI_IAHNDL_HXX
diff --git a/uui/source/ids.hrc b/uui/source/ids.hrc
index 047b96b100f4..bfe6a48aed94 100644
--- a/uui/source/ids.hrc
+++ b/uui/source/ids.hrc
@@ -65,11 +65,28 @@
#define DLG_UUI_SSLWARN (RID_UUI_START + 28)
#define DLG_UUI_SSLWARN_CRT (RID_UUI_START + 29)
#define RID_XMLSECDLG_MACROWARN (RID_UUI_START + 30)
-#define STR_OPENLOCKED_TITLE (RID_UUI_START + 31)
-#define STR_OPENLOCKED_MSG (RID_UUI_START + 32)
-#define STR_OPENLOCKED_OPENREADONLY_BTN (RID_UUI_START + 33)
-#define STR_OPENLOCKED_OPENCOPY_BTN (RID_UUI_START + 34)
-#define STR_OPENLOCKED_UNKNOWNUSER (RID_UUI_START + 35)
+#define STR_UNKNOWNUSER (RID_UUI_START + 31)
+#define STR_OPENLOCKED_TITLE (RID_UUI_START + 32)
+#define STR_OPENLOCKED_MSG (RID_UUI_START + 33)
+#define STR_OPENLOCKED_OPENREADONLY_BTN (RID_UUI_START + 34)
+#define STR_OPENLOCKED_OPENCOPY_BTN (RID_UUI_START + 35)
+#define STR_FILECHANGED_TITLE (RID_UUI_START + 36)
+#define STR_FILECHANGED_MSG (RID_UUI_START + 37)
+#define STR_FILECHANGED_SAVEANYWAY_BTN (RID_UUI_START + 38)
+#define STR_ALREADYOPEN_TITLE (RID_UUI_START + 39)
+#define STR_ALREADYOPEN_MSG (RID_UUI_START + 40)
+#define STR_ALREADYOPEN_READONLY_BTN (RID_UUI_START + 41)
+#define STR_ALREADYOPEN_OPEN_BTN (RID_UUI_START + 42)
+#define STR_LOCKFAILED_TITLE (RID_UUI_START + 43)
+#define STR_LOCKFAILED_MSG (RID_UUI_START + 44)
+#define STR_LOCKFAILED_DONTSHOWAGAIN (RID_UUI_START + 45)
+#define STR_TRYLATER_TITLE (RID_UUI_START + 46)
+#define STR_TRYLATER_MSG (RID_UUI_START + 47)
+#define STR_TRYLATER_RETRYSAVING_BTN (RID_UUI_START + 48)
+#define STR_TRYLATER_SAVEAS_BTN (RID_UUI_START + 49)
+#define STR_ALREADYOPEN_SAVE_MSG (RID_UUI_START + 50)
+#define STR_ALREADYOPEN_RETRY_SAVE_BTN (RID_UUI_START + 51)
+#define STR_ALREADYOPEN_SAVE_BTN (RID_UUI_START + 52)
#define RID_DLG_NEWER_VERSION_WARNING (RID_UUI_START + 36)
#define ERRCODE_UUI_IO_ABORT (ERRCODE_AREA_UUI + 0)
diff --git a/uui/source/lockfailed.cxx b/uui/source/lockfailed.cxx
new file mode 100644
index 000000000000..20a3ff4798bd
--- /dev/null
+++ b/uui/source/lockfailed.cxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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: openlocked.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "ids.hrc"
+#include "lockfailed.hxx"
+
+#include <vcl/button.hxx>
+
+LockFailedQueryBox::LockFailedQueryBox( Window* pParent, ResMgr* pResMgr ) :
+ MessBox(pParent, 0,
+ String( ResId( STR_LOCKFAILED_TITLE, *pResMgr ) ),
+ String::EmptyString() )
+{
+ SetImage( ErrorBox::GetStandardImage() );
+
+ AddButton( BUTTON_OK, RET_OK, BUTTONDIALOG_OKBUTTON );
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+
+ SetMessText( String( ResId( STR_LOCKFAILED_MSG, *pResMgr ) ) );
+ SetCheckBoxText( String( ResId( STR_LOCKFAILED_DONTSHOWAGAIN, *pResMgr ) ) );
+}
+
+LockFailedQueryBox::~LockFailedQueryBox()
+{
+}
+
diff --git a/uui/source/lockfailed.hxx b/uui/source/lockfailed.hxx
new file mode 100644
index 000000000000..9d368037475d
--- /dev/null
+++ b/uui/source/lockfailed.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * 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: openlocked.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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 _UUI_LOCKFAILED_HXX
+#define _UUI_LOCKFAILED_HXX
+
+#include <vcl/msgbox.hxx>
+
+class CheckBox;
+
+class LockFailedQueryBox : public MessBox
+{
+public:
+ LockFailedQueryBox( Window* pParent, ResMgr* pResMgr );
+ ~LockFailedQueryBox();
+};
+
+#endif
+
diff --git a/uui/source/lockfailed.src b/uui/source/lockfailed.src
new file mode 100644
index 000000000000..6b21d6fc6448
--- /dev/null
+++ b/uui/source/lockfailed.src
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * 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: openlocked.src,v $
+ * $Revision: 1.3 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+
+String STR_LOCKFAILED_TITLE
+{
+ Text = "Document Could Not Be Locked";
+};
+String STR_LOCKFAILED_MSG
+{
+ Text [ en-US ] = "The file could not be locked for exclusive access by %PRODUCTNAME, due to missing permission to created a lock file on that file location.";
+};
+String STR_LOCKFAILED_DONTSHOWAGAIN
+{
+ Text = "~Do not show this message again";
+};
+
diff --git a/uui/source/makefile.mk b/uui/source/makefile.mk
index 456e28ce6b75..95b998ffd36d 100644
--- a/uui/source/makefile.mk
+++ b/uui/source/makefile.mk
@@ -1,8 +1,7 @@
#*************************************************************************
-#*************************************************************************
#
# 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
@@ -53,6 +52,10 @@ SLOFILES = \
$(SLO)$/unknownauthdlg.obj\
$(SLO)$/sslwarndlg.obj\
$(SLO)$/secmacrowarnings.obj\
+ $(SLO)$/filechanged.obj\
+ $(SLO)$/alreadyopen.obj\
+ $(SLO)$/lockfailed.obj\
+ $(SLO)$/trylater.obj\
$(SLO)$/newerverwarn.obj
SRS1NAME=$(TARGET)
@@ -70,6 +73,11 @@ SRC1FILES = \
unknownauthdlg.src\
sslwarndlg.src\
secmacrowarnings.src\
+ filechanged.src\
+ alreadyopen.src\
+ lockfailed.src\
+ trylater.src\
newerverwarn.src
.INCLUDE: target.mk
+
diff --git a/uui/source/masterpasscrtdlg.cxx b/uui/source/masterpasscrtdlg.cxx
index 65a414a88542..30e8d1c64500 100644
--- a/uui/source/masterpasscrtdlg.cxx
+++ b/uui/source/masterpasscrtdlg.cxx
@@ -78,17 +78,25 @@ MasterPasswordCreateDialog::MasterPasswordCreateDialog
ModalDialog( pParent, ResId( DLG_UUI_MASTERPASSWORD_CRT, *pResMgr ) ),
- aFTMasterPasswordCrt ( this, ResId( FT_MASTERPASSWORD_CRT, *pResMgr ) ),
- aEDMasterPasswordCrt ( this, ResId( ED_MASTERPASSWORD_CRT, *pResMgr ) ),
+ aFTInfoText ( this, ResId( FT_INFOTEXT, *pResMgr ) ),
+ aFLInfoText ( this, ResId( FL_INFOTEXT, *pResMgr ) ),
+
+ aFTMasterPasswordCrt ( this, ResId( FT_MASTERPASSWORD_CRT, *pResMgr ) ),
+ aEDMasterPasswordCrt ( this, ResId( ED_MASTERPASSWORD_CRT, *pResMgr ) ),
aFTMasterPasswordRepeat ( this, ResId( FT_MASTERPASSWORD_REPEAT, *pResMgr ) ),
aEDMasterPasswordRepeat ( this, ResId( ED_MASTERPASSWORD_REPEAT, *pResMgr ) ),
+
+ aFTCautionText ( this, ResId( FT_CAUTIONTEXT, *pResMgr ) ),
+ aFLCautionText ( this, ResId( FL_CAUTIONTEXT, *pResMgr ) ),
+
aFTMasterPasswordWarning ( this, ResId( FT_MASTERPASSWORD_WARNING, *pResMgr ) ),
aFL ( this, ResId( FL_FIXED_LINE, *pResMgr ) ),
aOKBtn ( this, ResId( BTN_MASTERPASSCRT_OK, *pResMgr ) ),
aCancelBtn ( this, ResId( BTN_MASTERPASSCRT_CANCEL, *pResMgr ) ),
aHelpBtn ( this, ResId( BTN_MASTERPASSCRT_HELP, *pResMgr ) ),
+
pResourceMgr ( pResMgr ),
- nMinLen(5)
+ nMinLen ( 5 )
{
FreeResource();
@@ -96,6 +104,8 @@ MasterPasswordCreateDialog::MasterPasswordCreateDialog
aOKBtn.SetClickHdl( LINK( this, MasterPasswordCreateDialog, OKHdl_Impl ) );
aEDMasterPasswordCrt.SetModifyHdl( LINK( this, MasterPasswordCreateDialog, EditHdl_Impl ) );
+ CalculateTextHeight();
+
long nLableWidth = aFTMasterPasswordWarning.GetSizePixel().Width();
long nLabelHeight = aFTMasterPasswordWarning.GetSizePixel().Height();
long nTextWidth = aFTMasterPasswordWarning.GetCtrlTextWidth( aFTMasterPasswordWarning.GetText() );
@@ -128,3 +138,53 @@ MasterPasswordCreateDialog::MasterPasswordCreateDialog
}
};
+void MasterPasswordCreateDialog::CalculateTextHeight()
+{
+ Size aSize = aFTInfoText.GetSizePixel();
+ Size aMinSize = aFTInfoText.CalcMinimumSize( aSize.Width() );
+ long nDelta = 0;
+
+ if ( aSize.Height() > aMinSize.Height() )
+ {
+ aFTInfoText.SetSizePixel( aMinSize );
+ nDelta = aSize.Height() - aMinSize.Height();
+ Window* pWins[] = { &aFLInfoText, &aFTMasterPasswordCrt, &aEDMasterPasswordCrt,
+ &aFTMasterPasswordRepeat, &aEDMasterPasswordRepeat, &aFTCautionText,
+ &aFLCautionText, &aOKBtn, &aCancelBtn, &aHelpBtn };
+ Window** pWindow = pWins;
+ const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[0] );
+ for ( sal_Int32 i = 0; i < nCount; ++i, ++pWindow )
+ {
+ Point aNewPos = (*pWindow)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pWindow)->SetPosPixel( aNewPos );
+ }
+ }
+
+ aSize = aFTCautionText.GetSizePixel();
+ aMinSize = aFTCautionText.CalcMinimumSize( aSize.Width() );
+
+ if ( aSize.Height() > aMinSize.Height() )
+ {
+ aFTCautionText.SetSizePixel( aMinSize );
+ long nTemp = aSize.Height() - aMinSize.Height();
+ nDelta += nTemp;
+ Window* pWins[] = { &aFLCautionText, &aOKBtn, &aCancelBtn, &aHelpBtn };
+ Window** pWindow = pWins;
+ const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[0] );
+ for ( sal_Int32 i = 0; i < nCount; ++i, ++pWindow )
+ {
+ Point aNewPos = (*pWindow)->GetPosPixel();
+ aNewPos.Y() -= nTemp;
+ (*pWindow)->SetPosPixel( aNewPos );
+ }
+ }
+
+ if ( nDelta > 0 )
+ {
+ Size aDlgSize = GetOutputSizePixel();
+ aDlgSize.Height() -= nDelta;
+ SetSizePixel( aDlgSize );
+ }
+}
+
diff --git a/uui/source/masterpasscrtdlg.hrc b/uui/source/masterpasscrtdlg.hrc
index dec23e7edabc..1c10e849fb5b 100644
--- a/uui/source/masterpasscrtdlg.hrc
+++ b/uui/source/masterpasscrtdlg.hrc
@@ -31,16 +31,45 @@
#ifndef UUI_MASTERPASSCRT_HRC
#define UUI_MASTERPASSCRT_HRC
+#include <svtools/controldims.hrc>
+
//============================================================================
-#define FT_MASTERPASSWORD_CRT 20
-#define ED_MASTERPASSWORD_CRT 21
+
+#define FT_INFOTEXT 10
+#define FL_INFOTEXT 11
+
+#define FT_MASTERPASSWORD_CRT 20
+#define ED_MASTERPASSWORD_CRT 21
#define FT_MASTERPASSWORD_REPEAT 22
#define ED_MASTERPASSWORD_REPEAT 23
#define FT_MASTERPASSWORD_WARNING 24
#define FL_FIXED_LINE 30
+#define FT_CAUTIONTEXT 30
+#define FL_CAUTIONTEXT 31
+
#define BTN_MASTERPASSCRT_OK 50
#define BTN_MASTERPASSCRT_CANCEL 51
#define BTN_MASTERPASSCRT_HELP 52
+#define ROW_0 (RSC_SP_FLGR_INNERBORDER_TOP)
+#define ROW_1 (ROW_0+7*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_2 (ROW_1+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_3 (ROW_2+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_4 (ROW_3+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_5 (ROW_4+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_6 (ROW_5+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_CTRL_X)
+#define ROW_7 (ROW_6+8*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_8 (ROW_7+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_9 (ROW_8+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_X)
+
+#define COL_0 (RSC_SP_FLGR_INNERBORDER_LEFT)
+#define COL_2 (DLG_WIDTH-RSC_SP_FLGR_INNERBORDER_LEFT-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_1 (COL_2-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define DLG_WIDTH 180
+#define CTRL_WIDTH (DLG_WIDTH-2*RSC_SP_FLGR_INNERBORDER_LEFT)
+#define DLG_HEIGHT (ROW_9)
+
#endif // UUI_MASTERPASSCRT_HRC
+
diff --git a/uui/source/masterpasscrtdlg.hxx b/uui/source/masterpasscrtdlg.hxx
index dba9ee0f130a..26d130a7a737 100644
--- a/uui/source/masterpasscrtdlg.hxx
+++ b/uui/source/masterpasscrtdlg.hxx
@@ -46,14 +46,22 @@
//============================================================================
class MasterPasswordCreateDialog : public ModalDialog
{
+private:
+ FixedText aFTInfoText;
+ FixedLine aFLInfoText;
+
FixedText aFTMasterPasswordCrt;
Edit aEDMasterPasswordCrt;
FixedText aFTMasterPasswordRepeat;
Edit aEDMasterPasswordRepeat;
+
+ FixedText aFTCautionText;
+ FixedLine aFLCautionText;
+
FixedText aFTMasterPasswordWarning;
FixedLine aFL;
OKButton aOKBtn;
- CancelButton aCancelBtn;
+ CancelButton aCancelBtn;
HelpButton aHelpBtn;
@@ -68,6 +76,8 @@ public:
private:
ResMgr* pResourceMgr;
sal_uInt16 nMinLen;
+
+ void CalculateTextHeight();
};
#endif // UUI_MASTERPASSCRTDLG_HXX
diff --git a/uui/source/masterpasscrtdlg.src b/uui/source/masterpasscrtdlg.src
index cc16800feadd..e11d9abd166d 100644
--- a/uui/source/masterpasscrtdlg.src
+++ b/uui/source/masterpasscrtdlg.src
@@ -44,64 +44,74 @@ ModalDialog DLG_UUI_MASTERPASSWORD_CRT
Moveable = TRUE ;
OutputSize = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT ( 175 ,135 ) ;
+ Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGHT ) ;
+ Text [ en-US ] = "Set Master Password";
+ FixedText FT_INFOTEXT
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_0 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , 7*RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Passwords for web connections are protected by a master password. You will be asked to enter it once per session, if %PRODUCTNAME retrieves a password from the protected password list.";
+ };
+ FixedLine FL_INFOTEXT
+ {
+ Pos = MAP_APPFONT ( 0 , ROW_1 ) ;
+ Size = MAP_APPFONT ( DLG_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
FixedText FT_MASTERPASSWORD_CRT
{
- Pos = MAP_APPFONT ( 3 , 4 ) ;
- Size = MAP_APPFONT ( 169 , 9 ) ;
- Text [ en-US ] = "Enter new password";
+ Pos = MAP_APPFONT ( COL_0 , ROW_2 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "~Enter password";
};
Edit ED_MASTERPASSWORD_CRT
{
+ Pos = MAP_APPFONT ( COL_0 , ROW_3 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
Border = TRUE ;
- Pos = MAP_APPFONT ( 3 , 17 ) ;
- Size = MAP_APPFONT ( 169 , 13 ) ;
PassWord = TRUE ;
};
FixedText FT_MASTERPASSWORD_REPEAT
{
- Pos = MAP_APPFONT ( 3 , 33 ) ;
- Size = MAP_APPFONT ( 169 , 9 ) ;
+ Pos = MAP_APPFONT ( COL_0 , ROW_4 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
Text [ en-US ] = "~Reenter password";
};
Edit ED_MASTERPASSWORD_REPEAT
{
+ Pos = MAP_APPFONT ( COL_0 , ROW_5 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
Border = TRUE ;
- Pos = MAP_APPFONT ( 3 , 46 ) ;
- Size = MAP_APPFONT ( 169 , 13 ) ;
PassWord = TRUE ;
};
- FixedText FT_MASTERPASSWORD_WARNING
+ FixedText FT_CAUTIONTEXT
{
- Pos = MAP_APPFONT ( 3 , 62 ) ;
- Size = MAP_APPFONT ( 169 , 42 ) ;
- Text [ en-US ] = "~Caution: Make sure you remember the Master Password you have set. If you forget your Master Password, you will be unable to access any of the information protected by it. Passwords are case-sensitive and at least five characters long.";
- WordBreak = TRUE;
+ Pos = MAP_APPFONT ( COL_0 , ROW_6 ) ;
+ Size = MAP_APPFONT ( CTRL_WIDTH , 8*RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Caution: Make sure you remember the Master Password you have set. If you forget your Master Password, you will be unable to access any of the information protected by it. Passwords are case-sensitive and at least five characters long.";
};
- FixedLine FL_FIXED_LINE
- {
- Pos = MAP_APPFONT( 0, 105 );
- Size = MAP_APPFONT( 175, 6 );
+ FixedLine FL_CAUTIONTEXT
+ {
+ Pos = MAP_APPFONT ( 0 , ROW_7 ) ;
+ Size = MAP_APPFONT ( DLG_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+ HelpButton BTN_MASTERPASSCRT_HELP
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_8 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
};
-
-
OKButton BTN_MASTERPASSCRT_OK
{
- Pos = MAP_APPFONT ( 65 , 115 ) ;
- Size = MAP_APPFONT ( 51 , 13 ) ;
+ Pos = MAP_APPFONT ( COL_1 , ROW_8 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
DefButton = TRUE ;
};
CancelButton BTN_MASTERPASSCRT_CANCEL
{
- Pos = MAP_APPFONT ( 120 , 115 ) ;
- Size = MAP_APPFONT ( 51 , 13 ) ;
- };
- HelpButton BTN_MASTERPASSCRT_HELP
- {
- Pos = MAP_APPFONT ( 5 , 115 ) ;
- Size = MAP_APPFONT ( 51 , 13 ) ;
+ Pos = MAP_APPFONT ( COL_2 , ROW_8 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
};
- Text [ en-US ] = "Change Master Password";
};
diff --git a/uui/source/openlocked.src b/uui/source/openlocked.src
index 17f74b340fa1..58d65f54a4d3 100644
--- a/uui/source/openlocked.src
+++ b/uui/source/openlocked.src
@@ -40,7 +40,7 @@ String STR_OPENLOCKED_TITLE
};
String STR_OPENLOCKED_MSG
{
- Text [ en-US ] = "Document file '$(ARG1)' is locked for editing by:\n\n$(ARG2)\n\nOpen document read-only or open a copy of the document for editing.";
+ Text [ en-US ] = "Document file '$(ARG1)' is locked for editing by:\n\n$(ARG2)\n\nOpen document read-only or open a copy of the document for editing.\n\n";
};
String STR_OPENLOCKED_OPENREADONLY_BTN
{
@@ -50,7 +50,7 @@ String STR_OPENLOCKED_OPENCOPY_BTN
{
Text [ en-US ] = "Open ~Copy";
};
-String STR_OPENLOCKED_UNKNOWNUSER
+String STR_UNKNOWNUSER
{
Text [ en-US ] = "Unknown User";
};
diff --git a/uui/source/trylater.cxx b/uui/source/trylater.cxx
new file mode 100644
index 000000000000..9e7857dfc886
--- /dev/null
+++ b/uui/source/trylater.cxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * 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: openlocked.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "ids.hrc"
+#include "trylater.hxx"
+
+TryLaterQueryBox::TryLaterQueryBox( Window* pParent, ResMgr* pResMgr, const String& aMessage ) :
+ MessBox(pParent, 0,
+ String( ResId( STR_TRYLATER_TITLE, *pResMgr ) ),
+ aMessage )
+{
+ SetImage( QueryBox::GetStandardImage() );
+
+ AddButton( String( ResId( STR_TRYLATER_RETRYSAVING_BTN, *pResMgr ) ), RET_YES,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON);
+ AddButton( String( ResId( STR_TRYLATER_SAVEAS_BTN, *pResMgr ) ), RET_NO, 0);
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+
+ SetButtonHelpText( RET_YES, String::EmptyString() );
+ SetButtonHelpText( RET_NO, String::EmptyString() );
+}
+
+TryLaterQueryBox::~TryLaterQueryBox()
+{
+}
+
+
diff --git a/uui/source/trylater.hxx b/uui/source/trylater.hxx
new file mode 100644
index 000000000000..64140966fb3e
--- /dev/null
+++ b/uui/source/trylater.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * 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: openlocked.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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 _UUI_TRYLATER_HXX
+#define _UUI_TRYLATER_HXX
+
+#include <vcl/msgbox.hxx>
+
+class TryLaterQueryBox : public MessBox
+{
+public:
+ TryLaterQueryBox( Window* pParent, ResMgr* pResMgr, const String& aMessage );
+ ~TryLaterQueryBox();
+};
+
+#endif
+
diff --git a/uui/source/trylater.src b/uui/source/trylater.src
new file mode 100644
index 000000000000..945ac8c74153
--- /dev/null
+++ b/uui/source/trylater.src
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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: openlocked.src,v $
+ * $Revision: 1.3 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include <ids.hrc>
+#endif
+
+String STR_TRYLATER_TITLE
+{
+ Text [ en-US ] = "Document in Use";
+};
+String STR_TRYLATER_MSG
+{
+ Text [ en-US ] = "Document file '$(ARG1)' is locked for editing by:\n\n$(ARG2)\n\nTry again later to save document or save a copy of that document.\n\n";
+};
+String STR_TRYLATER_RETRYSAVING_BTN
+{
+ Text [ en-US ] = "~Retry Saving";
+};
+String STR_TRYLATER_SAVEAS_BTN
+{
+ Text [ en-US ] = "~Save As...";
+};
+