summaryrefslogtreecommitdiff
path: root/scripting/source/protocolhandler
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-11-04 10:36:15 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-11-04 10:36:15 +0100
commit9d30af3dab07e35b3a02218a693ebd349803d495 (patch)
tree8ee3fc245ca2902e20ebc5911344c248967660c0 /scripting/source/protocolhandler
parentaf22075998a021d23ec1b266433f239d3200c35d (diff)
undoapi: replace validateXRef with UNO_QUERY/SET_THROW resp. ENSURE_OR_THROW
Diffstat (limited to 'scripting/source/protocolhandler')
-rw-r--r--scripting/source/protocolhandler/scripthandler.cxx35
1 files changed, 7 insertions, 28 deletions
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index 7c24b98e5a71..e9d12be12b5e 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -49,6 +49,7 @@
#include <sfx2/frame.hxx>
#include <sfx2/sfxdlg.hxx>
#include <vcl/abstdlg.hxx>
+#include <tools/diagnose_ex.h>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -70,7 +71,6 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::script;
using namespace ::com::sun::star::script::provider;
using namespace ::com::sun::star::document;
-using namespace ::scripting_util;
namespace scripting_protocolhandler
{
@@ -98,8 +98,7 @@ void SAL_CALL ScriptProtocolHandler::initialize(
throw RuntimeException( temp, Reference< XInterface >() );
}
- validateXRef( m_xFactory,
- "ScriptProtocolHandler::initialize: No Service Manager available" );
+ ENSURE_OR_THROW( m_xFactory.is(), "ScriptProtocolHandler::initialize: No Service Manager available" );
m_bInitialised = true;
}
@@ -163,7 +162,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
{
try
{
- bool bIsDocumentScript = ( aURL.Complete.indexOf( ::rtl::OUString::createFromAscii( "document" ) ) !=-1 );
+ bool bIsDocumentScript = ( aURL.Complete.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "document" ) ) !=-1 );
// TODO: isn't this somewhat strange? This should be a test for a location=document parameter, shouldn't it?
if ( bIsDocumentScript )
@@ -183,7 +182,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
Reference< provider::XScript > xFunc =
m_xScriptProvider->getScript( aURL.Complete );
- validateXRef( xFunc,
+ ENSURE_OR_THROW( xFunc.is(),
"ScriptProtocolHandler::dispatchWithNotification: validate xFunc - unable to obtain XScript interface" );
@@ -254,16 +253,6 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
bCaughtException = TRUE;
}
-#ifdef _DEBUG
- catch ( ... )
- {
- ::rtl::OUString reason = ::rtl::OUString::createFromAscii(
- "ScriptProtocolHandler::dispatch: caught unknown exception" );
-
- invokeResult <<= reason;
- }
-#endif
-
}
else
{
@@ -364,13 +353,11 @@ ScriptProtocolHandler::getScriptInvocation()
return m_xScriptInvocation.is();
}
-void
-ScriptProtocolHandler::createScriptProvider()
+void ScriptProtocolHandler::createScriptProvider()
{
if ( m_xScriptProvider.is() )
- {
return;
- }
+
try
{
// first, ask the component supporting the XScriptInvocationContext interface
@@ -403,6 +390,7 @@ ScriptProtocolHandler::createScriptProvider()
m_xScriptProvider = xSPS->getScriptProvider();
}
+ // if nothing of this is successful, use the master script provider
if ( !m_xScriptProvider.is() )
{
Reference< XPropertySet > xProps( m_xFactory, UNO_QUERY_THROW );
@@ -436,15 +424,6 @@ ScriptProtocolHandler::createScriptProvider()
::rtl::OUString temp = OUSTR( "ScriptProtocolHandler::createScriptProvider: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
}
-#ifdef _DEBUG
- catch ( ... )
- {
- throw RuntimeException(
- OUSTR( "ScriptProtocolHandler::createScriptProvider: UnknownException: " ),
- Reference< XInterface > () );
- }
-#endif
-
}
ScriptProtocolHandler::ScriptProtocolHandler(