summaryrefslogtreecommitdiff
path: root/uui
diff options
context:
space:
mode:
Diffstat (limited to 'uui')
-rw-r--r--uui/inc/strings.hrc3
-rw-r--r--uui/source/iahndl-locking.cxx12
-rw-r--r--uui/source/iahndl.cxx9
-rw-r--r--uui/source/openlocked.cxx14
-rw-r--r--uui/source/openlocked.hxx2
5 files changed, 28 insertions, 12 deletions
diff --git a/uui/inc/strings.hrc b/uui/inc/strings.hrc
index 760402c1d57b..590a582eba06 100644
--- a/uui/inc/strings.hrc
+++ b/uui/inc/strings.hrc
@@ -47,7 +47,8 @@
#define STR_LOCKFAILED_OPENREADONLY_BTN NC_("STR_LOCKFAILED_OPENREADONLY_BTN", "Open ~Read-Only")
#define STR_OPENLOCKED_TITLE NC_("STR_OPENLOCKED_TITLE", "Document in Use")
-#define STR_OPENLOCKED_MSG NC_("STR_OPENLOCKED_MSG", "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")
+#define STR_OPENLOCKED_MSG NC_("STR_OPENLOCKED_MSG", "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$(ARG3)")
+#define STR_OPENLOCKED_ALLOWIGNORE_MSG NC_("STR_OPENLOCKED_ALLOWIGNORE_MSG", "You may also ignore the file locking and open the document for editing.\n\n")
#define STR_OPENLOCKED_OPENREADONLY_BTN NC_("STR_OPENLOCKED_OPENREADONLY_BTN", "Open ~Read-Only")
#define STR_OPENLOCKED_OPENCOPY_BTN NC_("STR_OPENLOCKED_OPENCOPY_BTN", "Open ~Copy")
#define STR_UNKNOWNUSER NC_("STR_UNKNOWNUSER", "Unknown User")
diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx
index 53b0e6a2fc77..08b5b5c7fd99 100644
--- a/uui/source/iahndl-locking.cxx
+++ b/uui/source/iahndl-locking.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/task/XInteractionDisapprove.hpp>
#include <com/sun/star/task/XInteractionAbort.hpp>
#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
#include <unotools/resmgr.hxx>
#include <vcl/svapp.hxx>
@@ -66,7 +67,9 @@ handleLockedDocumentRequest_(
uno::Reference< task::XInteractionApprove > xApprove;
uno::Reference< task::XInteractionDisapprove > xDisapprove;
uno::Reference< task::XInteractionAbort > xAbort;
- getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort);
+ // In case an option to ignore lock and open the file is available
+ uno::Reference< task::XInteractionRetry > xRetry;
+ getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort, &xRetry);
if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() )
return;
@@ -86,11 +89,14 @@ handleLockedDocumentRequest_(
aArguments.push_back( !aInfo.isEmpty()
? aInfo
: Translate::get( STR_UNKNOWNUSER, aResLocale) );
+ aArguments.push_back( xRetry.is()
+ ? Translate::get( STR_OPENLOCKED_ALLOWIGNORE_MSG, aResLocale )
+ : "" );
aMessage = Translate::get(STR_OPENLOCKED_MSG, aResLocale);
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
- ScopedVclPtrInstance< OpenLockedQueryBox > xDialog(pParent, aResLocale, aMessage);
+ ScopedVclPtrInstance< OpenLockedQueryBox > xDialog(pParent, aResLocale, aMessage, xRetry.is());
nResult = xDialog->Execute();
}
else if ( nMode == UUI_DOC_SAVE_LOCK )
@@ -128,6 +134,8 @@ handleLockedDocumentRequest_(
xApprove->select();
else if ( nResult == RET_NO )
xDisapprove->select();
+ else if ( nResult == RET_IGNORE && xRetry.is() )
+ xRetry->select();
else
xAbort->select();
}
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 3d9d331476e6..f03372de3f54 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -238,10 +238,11 @@ UUIInteractionHelper::replaceMessageWithArguments(
OUString aMessage = _aMessage;
SAL_WARN_IF(rArguments.size() == 0, "uui", "replaceMessageWithArguments: No arguments passed!");
- if (rArguments.size() > 0)
- aMessage = aMessage.replaceAll("$(ARG1)", rArguments[0]);
- if (rArguments.size() > 1)
- aMessage = aMessage.replaceAll("$(ARG2)", rArguments[1]);
+ for (size_t i = 0; i < rArguments.size(); ++i)
+ {
+ const OUString sReplaceTemplate = "$(ARG" + OUString::number(i+1) + ")";
+ aMessage = aMessage.replaceAll(sReplaceTemplate, rArguments[i]);
+ }
return aMessage;
}
diff --git a/uui/source/openlocked.cxx b/uui/source/openlocked.cxx
index 074242b964b8..3267610b78d1 100644
--- a/uui/source/openlocked.cxx
+++ b/uui/source/openlocked.cxx
@@ -21,7 +21,7 @@
#include "openlocked.hxx"
#include <unotools/resmgr.hxx>
-OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage ) :
+OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage, bool bEnableOverride ) :
MessBox(pParent, MessBoxStyle::NONE, 0,
Translate::get(STR_OPENLOCKED_TITLE, rResLocale),
aMessage )
@@ -30,13 +30,19 @@ OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, const std::locale&
AddButton(Translate::get(STR_OPENLOCKED_OPENREADONLY_BTN, rResLocale), RET_YES,
ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus);
+ SetButtonHelpText(RET_YES, OUString());
AddButton(Translate::get(STR_OPENLOCKED_OPENCOPY_BTN, rResLocale), RET_NO);
+ SetButtonHelpText(RET_NO, OUString());
- AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel );
- SetButtonHelpText( RET_YES, OUString() );
- SetButtonHelpText( RET_NO, OUString() );
+ if (bEnableOverride)
+ {
+ // Present option to ignore the (stale?) lock file and open the document
+ AddButton(Translate::get(STR_ALREADYOPEN_OPEN_BTN, rResLocale), RET_IGNORE);
+ SetButtonHelpText(RET_IGNORE, OUString());
+ }
+ AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel );
}
OpenLockedQueryBox::~OpenLockedQueryBox()
diff --git a/uui/source/openlocked.hxx b/uui/source/openlocked.hxx
index 8584c45c2c7e..bb80a3c64146 100644
--- a/uui/source/openlocked.hxx
+++ b/uui/source/openlocked.hxx
@@ -24,7 +24,7 @@
class OpenLockedQueryBox : public MessBox
{
public:
- OpenLockedQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& rMessage);
+ OpenLockedQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& rMessage, bool bEnableOverride);
virtual ~OpenLockedQueryBox() override;
};