summaryrefslogtreecommitdiff
path: root/uui/source/iahndl.cxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-01-06 16:18:24 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-01-06 16:18:24 +0000
commit3dfe5a3feda289b66e92f17550e359d6c2460c0d (patch)
tree2d306b7ef59c57b80ed1b9ffab3224b0d95a83f2 /uui/source/iahndl.cxx
parent13e27b36a954d5dac7e1b35e3752656050074c1d (diff)
CWS-TOOLING: integrate CWS mav43
2008-12-17 14:42:56 +0100 tbo r265602 : #i97269# changed hid.lst and etab.win 2008-12-15 15:36:04 +0100 mav r265508 : #i95809# remove the stream as well 2008-12-12 13:20:09 +0100 mav r265411 : #i95809# small fixes 2008-12-12 13:12:07 +0100 mav r265410 : #i95809# fix streams handling 2008-12-12 10:45:29 +0100 mav r265397 : #i95809# close the stream if there is no storage 2008-12-12 10:24:38 +0100 mav r265396 : #i95809# close the stream if there is no temporary file 2008-12-12 00:56:13 +0100 mav r265383 : #i95809# adopt for linux 2008-12-12 00:51:25 +0100 mav r265382 : #i95809# adopt for linux 2008-12-12 00:38:31 +0100 mav r265381 : #i95809# check timestamp only if fs locking not active 2008-12-12 00:35:32 +0100 mav r265380 : #i95809# small fixes 2008-12-12 00:29:33 +0100 mav r265379 : #i95809# small fixes 2008-12-11 22:30:15 +0100 mav r265374 : #i97092# allow to use default master password 2008-12-11 22:20:56 +0100 mav r265372 : #i95809# avoid storage closing 2008-12-11 21:11:37 +0100 mav r265368 : #i97092# do not publish for now 2008-12-11 21:08:22 +0100 mav r265366 : #i95809# fix typo 2008-12-11 21:06:49 +0100 mav r265364 : #i95809# small fixes 2008-12-11 21:05:13 +0100 mav r265363 : #i95809# small fixes 2008-12-11 20:40:05 +0100 mav r265360 : #i95809# show warning if the document was touched 2008-12-11 20:39:44 +0100 mav r265359 : #i95809# show warning if the document was touched 2008-12-11 19:54:45 +0100 mav r265355 : #i95809# small fixes 2008-12-11 19:42:52 +0100 mav r265353 : #i95809# small fixes 2008-12-11 19:30:30 +0100 mav r265351 : #i95809# small fixes 2008-12-11 19:16:40 +0100 mav r265349 : #i95809# small fixes 2008-12-11 19:05:56 +0100 mav r265348 : #i95809# small fixes 2008-12-11 18:26:03 +0100 mav r265346 : #i95809# ignore the exception 2008-12-11 18:19:28 +0100 mav r265345 : #i95809# pure imput stream in case of local file URL means opening of document readonly 2008-12-11 17:41:56 +0100 mav r265341 : #i95809# unfortunately SfxMedium can not take the decision 2008-12-11 17:37:07 +0100 mav r265340 : #i95809# fix typo 2008-12-11 17:33:47 +0100 mav r265339 : #i95809# pure imput stream in case of local file URL means opening of document readonly 2008-12-11 16:12:26 +0100 mav r265330 : #i95809# let dialogs look better 2008-12-11 15:50:43 +0100 mav r265322 : #i97092# allow to use default master password 2008-12-11 13:35:39 +0100 mav r265295 : #i97092# allow to use default master password 2008-12-11 13:04:28 +0100 mav r265290 : #i97092# allow to use default master password 2008-12-11 12:34:52 +0100 mav r265284 : #i97092# allow to use default master password 2008-12-11 11:21:33 +0100 mav r265267 : #i95809# adopt for linux 2008-12-11 10:25:22 +0100 mav r265255 : #i97092# allow to use default master password 2008-12-11 10:24:35 +0100 mav r265254 : #i97092# allow to use default master password 2008-12-10 17:02:32 +0100 pb r265207 : fix: #i97092# more info text 2008-12-10 16:40:53 +0100 mav r265205 : #i95809# integrate new file locking UI in sfx workflow 2008-12-10 16:38:55 +0100 mav r265204 : #i95809# allow to ignore own lock on saving 2008-12-10 14:52:12 +0100 pb r265192 : fix: #i97092# new master password behavior 2008-12-10 14:51:22 +0100 pb r265191 : fix: #i97092# new master password bahavior 2008-12-10 14:49:46 +0100 pb r265189 : fix: #i97092# new master password bahavior 2008-12-10 10:55:19 +0100 mav r265155 : #i95809# allow to ignore own lock on saving 2008-12-09 17:47:51 +0100 mav r265124 : #i95809# allow to ignore own lock on saving 2008-12-07 11:24:57 +0100 mav r264949 : #i95809# let the request be derived from IOException 2008-12-05 18:31:35 +0100 mav r264915 : #i95809# use the locking related dialogs from InteractionHandler 2008-12-04 18:33:36 +0100 mav r264867 : #i95809# the requests for the new locking UI 2008-12-04 10:26:52 +0100 pb r264822 : fix: #i95809# new message boxes for locking 2008-12-04 10:23:51 +0100 pb r264821 : fix: #i95809# STR_OPENLOCKED_UNKNOWNUSER replaced by STR_UNKNOWNUSER 2008-12-04 10:18:23 +0100 pb r264820 : fix: #i95809# new message boxes for locking 2008-12-04 10:15:56 +0100 pb r264819 : fix: #i95809# new message boxes for locking 2008-12-03 16:06:46 +0100 mav r264796 : #i95809# system file locking support 2008-12-02 16:19:30 +0100 mav r264717 : #i95809# system file locking support 2008-12-02 16:07:10 +0100 mav r264716 : #i95809# system file locking support 2008-12-02 15:58:53 +0100 mav r264714 : #i95809# change the name 2008-12-02 15:58:06 +0100 mav r264713 : #i95809# do not allow to change ReadOnly flag in TypeDetection 2008-12-02 15:56:00 +0100 mav r264712 : #i95809# system file locking support 2008-12-02 15:43:20 +0100 mav r264708 : #i95809# change the name 2008-12-02 15:38:08 +0100 mav r264706 : #i95809# an options to control system file locking usage
Diffstat (limited to 'uui/source/iahndl.cxx')
-rw-r--r--uui/source/iahndl.cxx186
1 files changed, 170 insertions, 16 deletions
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 >());
+ }
+}
+
+