| 1 |
Index: ucbhelper/source/client/content.cxx
|
| 2 |
===================================================================
|
| 3 |
--- ucbhelper/source/client/content.cxx (revision 270567)
|
| 4 |
+++ ucbhelper/source/client/content.cxx (working copy)
|
| 5 |
@@ -42,6 +42,7 @@
|
| 6 |
#include <cppuhelper/weak.hxx>
|
| 7 |
|
| 8 |
#include <cppuhelper/implbase1.hxx>
|
| 9 |
+#include <com/sun/star/beans/PropertyValue.hpp>
|
| 10 |
#include <com/sun/star/ucb/ContentCreationError.hpp>
|
| 11 |
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
|
| 12 |
#include <com/sun/star/ucb/XCommandInfo.hpp>
|
| 13 |
@@ -51,6 +52,8 @@
|
| 14 |
#include <com/sun/star/ucb/ContentAction.hpp>
|
| 15 |
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
|
| 16 |
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
|
| 17 |
+#include <com/sun/star/ucb/IOErrorCode.hpp>
|
| 18 |
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
|
| 19 |
#include <com/sun/star/ucb/GlobalTransferCommandArgument.hpp>
|
| 20 |
#include <com/sun/star/ucb/NameClash.hpp>
|
| 21 |
#include <com/sun/star/ucb/OpenMode.hpp>
|
| 22 |
@@ -68,6 +71,8 @@
|
| 23 |
#include <com/sun/star/sdbc/XRow.hpp>
|
| 24 |
#include <com/sun/star/lang/IllegalArgumentException.hpp>
|
| 25 |
#include <com/sun/star/beans/UnknownPropertyException.hpp>
|
| 26 |
+#include <com/sun/star/task/XInteractionRequest.hpp>
|
| 27 |
+
|
| 28 |
#include <ucbhelper/macros.hxx>
|
| 29 |
#include <ucbhelper/content.hxx>
|
| 30 |
#include <ucbhelper/contentbroker.hxx>
|
| 31 |
@@ -77,7 +82,11 @@
|
| 32 |
#include <ucbhelper/interactionrequest.hxx>
|
| 33 |
#endif
|
| 34 |
#include <ucbhelper/cancelcommandexecution.hxx>
|
| 35 |
+#include <ucbhelper/fileidentifierconverter.hxx>
|
| 36 |
+#include <ucbhelper/simpleinteractionrequest.hxx>
|
| 37 |
|
| 38 |
+#include <memory>
|
| 39 |
+
|
| 40 |
using namespace com::sun::star::container;
|
| 41 |
using namespace com::sun::star::beans;
|
| 42 |
using namespace com::sun::star::io;
|
| 43 |
@@ -377,6 +386,54 @@
|
| 44 |
return Reference< XContent >();
|
| 45 |
}
|
| 46 |
|
| 47 |
+namespace
|
| 48 |
+{
|
| 49 |
+
|
| 50 |
+void
|
| 51 |
+lcl_displayMessage(
|
| 52 |
+ const Reference<XCommandEnvironment>& rEnvironment,
|
| 53 |
+ const rtl::OUString& rUri)
|
| 54 |
+{
|
| 55 |
+ // Create exception
|
| 56 |
+ const Reference<XContentProviderManager> xCPM(
|
| 57 |
+ getContentBroker(true)->getContentProviderManagerInterface());
|
| 58 |
+ const PropertyValue aUriProperty(
|
| 59 |
+ rtl::OUString::createFromAscii("Uri"),
|
| 60 |
+ -1,
|
| 61 |
+ makeAny(getSystemPathFromFileURL(xCPM, rUri)),
|
| 62 |
+ PropertyState_DIRECT_VALUE)
|
| 63 |
+ ;
|
| 64 |
+ Sequence<Any> lArguments(1);
|
| 65 |
+ lArguments[0] <<= aUriProperty;
|
| 66 |
+ const InteractiveAugmentedIOException xError(
|
| 67 |
+ rtl::OUString(),
|
| 68 |
+ 0,
|
| 69 |
+ InteractionClassification_ERROR,
|
| 70 |
+ IOErrorCode_NO_FILE,
|
| 71 |
+ lArguments)
|
| 72 |
+ ;
|
| 73 |
+
|
| 74 |
+ // Create interaction request
|
| 75 |
+ std::auto_ptr<ucbhelper::SimpleInteractionRequest> aRequest(
|
| 76 |
+ new ucbhelper::SimpleInteractionRequest(makeAny(xError), CONTINUATION_APPROVE));
|
| 77 |
+ {
|
| 78 |
+ Reference<XInteractionContinuation> xContinuation(
|
| 79 |
+ new ::ucbhelper::InteractionApprove(aRequest.get()));
|
| 80 |
+ Sequence<Reference<XInteractionContinuation> > lContinuations(1);
|
| 81 |
+ lContinuations[0].set(xContinuation);
|
| 82 |
+ aRequest->setContinuations(lContinuations);
|
| 83 |
+ }
|
| 84 |
+
|
| 85 |
+ Reference<XInteractionHandler> xInteraction(rEnvironment->getInteractionHandler());
|
| 86 |
+ if (xInteraction.is())
|
| 87 |
+ {
|
| 88 |
+ Reference<XInteractionRequest> xRequest(aRequest.release());
|
| 89 |
+ xInteraction->handle(xRequest);
|
| 90 |
+ }
|
| 91 |
+}
|
| 92 |
+
|
| 93 |
+}
|
| 94 |
+
|
| 95 |
//=========================================================================
|
| 96 |
//=========================================================================
|
| 97 |
//
|
| 98 |
@@ -1188,7 +1245,10 @@
|
| 99 |
throw( CommandAbortedException, RuntimeException, Exception )
|
| 100 |
{
|
| 101 |
if ( !isDocument() )
|
| 102 |
+ {
|
| 103 |
+ lcl_displayMessage(m_xImpl->getEnvironment(), getURL());
|
| 104 |
return Reference< XInputStream >();
|
| 105 |
+ }
|
| 106 |
|
| 107 |
Reference< XActiveDataSink > xSink = new ActiveDataSink;
|
| 108 |
|
| 109 |
@@ -1213,7 +1273,10 @@
|
| 110 |
throw( CommandAbortedException, RuntimeException, Exception )
|
| 111 |
{
|
| 112 |
if ( !isDocument() )
|
| 113 |
+ {
|
| 114 |
+ lcl_displayMessage(m_xImpl->getEnvironment(), getURL());
|
| 115 |
return Reference< XInputStream >();
|
| 116 |
+ }
|
| 117 |
|
| 118 |
Reference< XActiveDataSink > xSink = new ActiveDataSink;
|
| 119 |
|
| 120 |
@@ -1238,7 +1301,10 @@
|
| 121 |
throw( CommandAbortedException, RuntimeException, Exception )
|
| 122 |
{
|
| 123 |
if ( !isDocument() )
|
| 124 |
+ {
|
| 125 |
+ lcl_displayMessage(m_xImpl->getEnvironment(), getURL());
|
| 126 |
return Reference< XStream >();
|
| 127 |
+ }
|
| 128 |
|
| 129 |
Reference< XActiveDataStreamer > xStreamer = new ActiveDataStreamer;
|
| 130 |
|
| 131 |
@@ -1263,7 +1329,10 @@
|
| 132 |
throw( CommandAbortedException, RuntimeException, Exception )
|
| 133 |
{
|
| 134 |
if ( !isDocument() )
|
| 135 |
+ {
|
| 136 |
+ lcl_displayMessage(m_xImpl->getEnvironment(), getURL());
|
| 137 |
return Reference< XStream >();
|
| 138 |
+ }
|
| 139 |
|
| 140 |
Reference< XActiveDataStreamer > xStreamer = new ActiveDataStreamer;
|
| 141 |
|
| 142 |
@@ -1288,7 +1357,10 @@
|
| 143 |
throw( CommandAbortedException, RuntimeException, Exception )
|
| 144 |
{
|
| 145 |
if ( !isDocument() )
|
| 146 |
+ {
|
| 147 |
+ lcl_displayMessage(m_xImpl->getEnvironment(), getURL());
|
| 148 |
return sal_False;
|
| 149 |
+ }
|
| 150 |
|
| 151 |
OpenCommandArgument2 aArg;
|
| 152 |
aArg.Mode = OpenMode::DOCUMENT;
|
| 153 |
@@ -1311,7 +1383,10 @@
|
| 154 |
throw( CommandAbortedException, RuntimeException, Exception )
|
| 155 |
{
|
| 156 |
if ( !isDocument() )
|
| 157 |
+ {
|
| 158 |
+ lcl_displayMessage(m_xImpl->getEnvironment(), getURL());
|
| 159 |
return sal_False;
|
| 160 |
+ }
|
| 161 |
|
| 162 |
OpenCommandArgument2 aArg;
|
| 163 |
aArg.Mode = OpenMode::DOCUMENT;
|
| 164 |
Index: comphelper/source/misc/mediadescriptor.cxx
|
| 165 |
===================================================================
|
| 166 |
--- comphelper/source/misc/mediadescriptor.cxx (revision 270567)
|
| 167 |
+++ comphelper/source/misc/mediadescriptor.cxx (working copy)
|
| 168 |
@@ -728,6 +728,7 @@
|
| 169 |
bAbort = (
|
| 170 |
(exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED )
|
| 171 |
|| (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION )
|
| 172 |
+ || (exIO.Code == css::ucb::IOErrorCode_NO_FILE )
|
| 173 |
#ifdef MACOSX
|
| 174 |
// this is a workaround for MAC, on this platform if the file is locked
|
| 175 |
// the returned error code looks to be wrong
|