summaryrefslogtreecommitdiff
path: root/sfx2/source/appl/appopen.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/appl/appopen.cxx')
-rw-r--r--sfx2/source/appl/appopen.cxx64
1 files changed, 45 insertions, 19 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 272ae1e40f..0612f51df5 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -80,7 +81,7 @@
#include <comphelper/docpasswordhelper.hxx>
#include <vcl/svapp.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <rtl/logfile.hxx>
@@ -327,7 +328,7 @@ sal_uInt32 CheckPasswd_Impl
{
sal_Bool bIsEncrypted = sal_False;
try {
- xStorageProps->getPropertyValue( ::rtl::OUString::createFromAscii("HasEncryptedEntries") )
+ xStorageProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasEncryptedEntries")) )
>>= bIsEncrypted;
} catch( uno::Exception& )
{
@@ -679,6 +680,29 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq )
//---------------------------------------------------------------------------
+namespace {
+
+/**
+ * Check if a given filter type should open the hyperlinked document
+ * natively.
+ *
+ * @param rFilter filter object
+ */
+bool lcl_isFilterNativelySupported(const SfxFilter& rFilter)
+{
+ if (rFilter.IsOwnFormat())
+ return true;
+
+ ::rtl::OUString aName = rFilter.GetFilterName();
+ if (aName.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MS Excel"))) == 0)
+ // We can handle all Excel variants natively.
+ return true;
+
+ return false;
+}
+
+}
+
void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
{
DBG_MEMTEST();
@@ -924,7 +948,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
{
Reference< ::com::sun::star::document::XTypeDetection > xTypeDetection(
::comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" )),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection"))),
UNO_QUERY );
if ( xTypeDetection.is() )
{
@@ -933,7 +957,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
aURL.Complete = aFileName;
Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY );
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY );
xTrans->parseStrict( aURL );
INetProtocol aINetProtocol = INetURLObject( aURL.Complete ).GetProtocol();
@@ -951,7 +975,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
if ( !bIsDir && !aExtendedSecurityOptions.IsSecureHyperlink( aURL.Complete ) )
{
// Security check for local files depending on the extension
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
Window *pWindow = SFX_APP()->GetTopWindow();
String aSecurityWarningBoxTitle( SfxResId( RID_SECURITY_WARNING_TITLE ));
@@ -975,7 +999,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
}
else if ( eMode == SvtExtendedSecurityOptions::OPEN_NEVER && aINetProtocol != INET_PROT_VND_SUN_STAR_HELP )
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
Window *pWindow = SFX_APP()->GetTopWindow();
String aSecurityWarningBoxTitle( SfxResId( RID_SECURITY_WARNING_TITLE ));
@@ -988,11 +1012,11 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
aTypeName = xTypeDetection->queryTypeByURL( aURL.Main );
SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher();
const SfxFilter* pFilter = rMatcher.GetFilter4EA( aTypeName );
- if ( !pFilter || !( pFilter->IsOwnFormat() ))
+ if (!pFilter || !lcl_isFilterNativelySupported(*pFilter))
{
// hyperlink does not link to own type => special handling (http, ftp) browser and (other external protocols) OS
Reference< XSystemShellExecute > xSystemShellExecute( ::comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), UNO_QUERY );
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))), UNO_QUERY );
if ( xSystemShellExecute.is() )
{
if ( aINetProtocol == INET_PROT_MAILTO )
@@ -1013,13 +1037,13 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
}
catch ( ::com::sun::star::lang::IllegalArgumentException& )
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
Window *pWindow = SFX_APP()->GetTopWindow();
ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute();
}
catch ( ::com::sun::star::system::SystemShellExecuteException& )
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
Window *pWindow = SFX_APP()->GetTopWindow();
ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute();
}
@@ -1032,14 +1056,14 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
Sequence < ::rtl::OUString > aProtocols(2);
// add special protocols that always should be treated as internal
- aProtocols[0] = ::rtl::OUString::createFromAscii("private:*");
- aProtocols[1] = ::rtl::OUString::createFromAscii("vnd.sun.star.*");
+ aProtocols[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:*"));
+ aProtocols[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.*"));
try
{
// get registered protocol handlers from configuration
Reference < XNameAccess > xAccess( ::comphelper::ConfigurationHelper::openConfig( ::comphelper::getProcessServiceFactory(),
- ::rtl::OUString::createFromAscii("org.openoffice.Office.ProtocolHandler/HandlerSet"), ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY );
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.ProtocolHandler/HandlerSet")), ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY );
if ( xAccess.is() )
{
Sequence < ::rtl::OUString > aNames = xAccess->getElementNames();
@@ -1051,7 +1075,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
if ( xSet.is() )
{
// copy protocols
- aRet = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("Protocols") );
+ aRet = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Protocols")) );
Sequence < ::rtl::OUString > aTmp;
aRet >>= aTmp;
@@ -1096,7 +1120,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
}
catch ( ::com::sun::star::lang::IllegalArgumentException& )
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
Window *pWindow = SFX_APP()->GetTopWindow();
ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute();
}
@@ -1104,7 +1128,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
{
if ( !pFilter )
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
Window *pWindow = SFX_APP()->GetTopWindow();
ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute();
}
@@ -1188,7 +1212,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
if (!pInteractionItem)
{
- Reference < ::com::sun::star::task::XInteractionHandler > xHdl( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.comp.uui.UUIInteractionHandler")), UNO_QUERY );
+ Reference < ::com::sun::star::task::XInteractionHandler > xHdl( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.uui.UUIInteractionHandler"))), UNO_QUERY );
if (xHdl.is())
rReq.AppendItem( SfxUnoAnyItem(SID_INTERACTIONHANDLER,::com::sun::star::uno::makeAny(xHdl)) );
}
@@ -1284,7 +1308,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
{
URL aURL;
aURL.Complete = aFileName;
- Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY );
+ Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY );
xTrans->parseStrict( aURL );
Reference < XDispatchProvider > xProv( xTargetFrame, UNO_QUERY );
@@ -1302,7 +1326,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
// Desktop service must exists! dont catch() or check for problems here ...
// But loading of documents can fail by other reasons. Handle it more gracefully.
- Reference < XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY );
+ Reference < XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), UNO_QUERY );
Reference < XComponent > xComp;
try
{
@@ -1357,3 +1381,5 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
delete pLinkItem;
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */