From 3ffb5481b5e116c4a39dd07335439e711f0ca706 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 1 Oct 2009 10:39:31 +0200 Subject: #i101955# adapted more platform backends to new interface --- shell/source/backends/desktopbe/desktopbackend.cxx | 8 +- shell/source/backends/gconfbe/gconfbackend.cxx | 2 +- shell/source/backends/kde4be/exports.map | 10 - shell/source/backends/kde4be/kde4access.cxx | 306 ++++++++++++++ shell/source/backends/kde4be/kde4access.hxx | 46 +++ shell/source/backends/kde4be/kde4backend.cxx | 315 ++++++++------ shell/source/backends/kde4be/kde4backend.hxx | 123 ------ shell/source/backends/kde4be/kde4be.xml | 35 -- shell/source/backends/kde4be/kde4becdef.cxx | 143 ------- shell/source/backends/kde4be/kde4commonlayer.cxx | 157 ------- shell/source/backends/kde4be/kde4commonlayer.hxx | 51 --- shell/source/backends/kde4be/kde4inetlayer.cxx | 255 ------------ shell/source/backends/kde4be/kde4inetlayer.hxx | 59 --- shell/source/backends/kde4be/kde4pathslayer.cxx | 124 ------ shell/source/backends/kde4be/kde4pathslayer.hxx | 82 ---- shell/source/backends/kde4be/kde4vcllayer.cxx | 115 ------ shell/source/backends/kde4be/kde4vcllayer.hxx | 53 --- shell/source/backends/kde4be/makefile.mk | 17 +- shell/source/backends/kdebe/exports.map | 10 - shell/source/backends/kdebe/kdeaccess.cxx | 301 ++++++++++++++ shell/source/backends/kdebe/kdeaccess.hxx | 46 +++ shell/source/backends/kdebe/kdebackend.cxx | 314 ++++++++------ shell/source/backends/kdebe/kdebackend.hxx | 128 ------ shell/source/backends/kdebe/kdebe.xml | 35 -- shell/source/backends/kdebe/kdebecdef.cxx | 143 ------- shell/source/backends/kdebe/kdecommonlayer.cxx | 153 ------- shell/source/backends/kdebe/kdecommonlayer.hxx | 56 --- shell/source/backends/kdebe/kdeinetlayer.cxx | 254 ------------ shell/source/backends/kdebe/kdeinetlayer.hxx | 62 --- shell/source/backends/kdebe/kdepathslayer.cxx | 121 ------ shell/source/backends/kdebe/kdepathslayer.hxx | 86 ---- shell/source/backends/kdebe/kdevcllayer.cxx | 116 ------ shell/source/backends/kdebe/kdevcllayer.hxx | 56 --- shell/source/backends/kdebe/makefile.mk | 17 +- shell/source/backends/localebe/localebe.xml | 1 - shell/source/backends/macbe/macbackend.cxx | 455 ++++++++++++++++++--- shell/source/backends/macbe/macbackend.hxx | 51 +-- shell/source/backends/macbe/macbe.xml | 1 - shell/source/backends/macbe/macbecdef.cxx | 43 +- shell/source/backends/macbe/makefile.mk | 3 +- shell/source/backends/wininetbe/makefile.mk | 5 +- shell/source/backends/wininetbe/wininetbackend.cxx | 403 +++++++++++++++--- shell/source/backends/wininetbe/wininetbackend.hxx | 87 ++-- shell/source/backends/wininetbe/wininetbe.xml | 1 - shell/source/backends/wininetbe/wininetbecdef.cxx | 43 +- shell/source/backends/wininetbe/wininetlayer.cxx | 377 ----------------- shell/source/backends/wininetbe/wininetlayer.hxx | 73 ---- 47 files changed, 1921 insertions(+), 3421 deletions(-) delete mode 100644 shell/source/backends/kde4be/exports.map create mode 100644 shell/source/backends/kde4be/kde4access.cxx create mode 100644 shell/source/backends/kde4be/kde4access.hxx delete mode 100644 shell/source/backends/kde4be/kde4backend.hxx delete mode 100644 shell/source/backends/kde4be/kde4be.xml delete mode 100644 shell/source/backends/kde4be/kde4becdef.cxx delete mode 100644 shell/source/backends/kde4be/kde4commonlayer.cxx delete mode 100644 shell/source/backends/kde4be/kde4commonlayer.hxx delete mode 100644 shell/source/backends/kde4be/kde4inetlayer.cxx delete mode 100644 shell/source/backends/kde4be/kde4inetlayer.hxx delete mode 100644 shell/source/backends/kde4be/kde4pathslayer.cxx delete mode 100644 shell/source/backends/kde4be/kde4pathslayer.hxx delete mode 100644 shell/source/backends/kde4be/kde4vcllayer.cxx delete mode 100644 shell/source/backends/kde4be/kde4vcllayer.hxx delete mode 100644 shell/source/backends/kdebe/exports.map create mode 100644 shell/source/backends/kdebe/kdeaccess.cxx create mode 100644 shell/source/backends/kdebe/kdeaccess.hxx delete mode 100644 shell/source/backends/kdebe/kdebackend.hxx delete mode 100644 shell/source/backends/kdebe/kdebe.xml delete mode 100644 shell/source/backends/kdebe/kdebecdef.cxx delete mode 100644 shell/source/backends/kdebe/kdecommonlayer.cxx delete mode 100644 shell/source/backends/kdebe/kdecommonlayer.hxx delete mode 100644 shell/source/backends/kdebe/kdeinetlayer.cxx delete mode 100644 shell/source/backends/kdebe/kdeinetlayer.hxx delete mode 100644 shell/source/backends/kdebe/kdepathslayer.cxx delete mode 100644 shell/source/backends/kdebe/kdepathslayer.hxx delete mode 100644 shell/source/backends/kdebe/kdevcllayer.cxx delete mode 100644 shell/source/backends/kdebe/kdevcllayer.hxx delete mode 100644 shell/source/backends/wininetbe/wininetlayer.cxx delete mode 100644 shell/source/backends/wininetbe/wininetlayer.hxx (limited to 'shell/source/backends') diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx index bdc45e737687..a214b08edb18 100644 --- a/shell/source/backends/desktopbe/desktopbackend.cxx +++ b/shell/source/backends/desktopbe/desktopbackend.cxx @@ -213,7 +213,13 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.backend.KDEBackend"))); - } //TODO: KDE4? + } else if (desktop.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("KDE4"))) { + backend = createBackend( + context, + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.backend.KDE4Backend"))); + } return backend.is() ? backend : static_cast< cppu::OWeakObject * >(new Default); } diff --git a/shell/source/backends/gconfbe/gconfbackend.cxx b/shell/source/backends/gconfbe/gconfbackend.cxx index cb18559c1b43..2410ca85171f 100644 --- a/shell/source/backends/gconfbe/gconfbackend.cxx +++ b/shell/source/backends/gconfbe/gconfbackend.cxx @@ -42,8 +42,8 @@ #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/Type.hxx" -#include "com/sun/star/uno/XCurrentContext.hpp" #include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XCurrentContext.hpp" #include "cppu/unotype.hxx" #include "cppuhelper/factory.hxx" #include "cppuhelper/implbase2.hxx" diff --git a/shell/source/backends/kde4be/exports.map b/shell/source/backends/kde4be/exports.map deleted file mode 100644 index ba501f9ae076..000000000000 --- a/shell/source/backends/kde4be/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { - global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/shell/source/backends/kde4be/kde4access.cxx b/shell/source/backends/kde4be/kde4access.cxx new file mode 100644 index 000000000000..fc3ae7043330 --- /dev/null +++ b/shell/source/backends/kde4be/kde4access.cxx @@ -0,0 +1,306 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: code,v $ +* +* $Revision: 1.4 $ +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#include "precompiled_shell.hxx" +#include "sal/config.h" + +#include "QFont" +#include "QString" +#include "kemailsettings.h" +#include "kglobalsettings.h" +#include "kprotocolmanager.h" + +#include "com/sun/star/uno/Any.hxx" +#include "cppu/unotype.hxx" +#include "osl/diagnose.h" +#include "osl/file.h" +#include "rtl/string.h" +#include "rtl/ustring.hxx" + +#define SPACE ' ' +#define COMMA ',' +#define SEMI_COLON ';' + +namespace kde4access { + +namespace { + +namespace css = com::sun::star ; +namespace uno = css::uno ; + +} + +css::uno::Any getValue(rtl::OUString const & id) { + if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ExternalMailer"))) { + KEMailSettings aEmailSettings; + QString aClientProgram; + ::rtl::OUString sClientProgram; + + aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram ); + if ( aClientProgram.isEmpty() ) + aClientProgram = "kmail"; + else + aClientProgram = aClientProgram.section(SPACE, 0, 0); + sClientProgram = (const sal_Unicode *) aClientProgram.utf16(); + return uno::makeAny( sClientProgram ); + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight"))) + { + QFont aFixedFont; + short nFontHeight; + + aFixedFont = KGlobalSettings::fixedFont(); + nFontHeight = aFixedFont.pointSize(); + return uno::makeAny( nFontHeight ); + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("SourceViewFontName"))) + { + QFont aFixedFont; + QString aFontName; + :: rtl::OUString sFontName; + + aFixedFont = KGlobalSettings::fixedFont(); + aFontName = aFixedFont.family(); + sFontName = (const sal_Unicode *) aFontName.utf16(); + return uno::makeAny( sFontName ); + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("EnableATToolSupport"))) + { + /* does not make much sense without an accessibility bridge */ + sal_Bool ATToolSupport = sal_False; + return uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) ); + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("WorkPathVariable"))) + { + QString aDocumentsDir( KGlobalSettings::documentPath() ); + rtl::OUString sDocumentsDir; + rtl::OUString sDocumentsURL; + if ( aDocumentsDir.endsWith(QChar('/')) ) + aDocumentsDir.truncate ( aDocumentsDir.length() - 1 ); + sDocumentsDir = (const sal_Unicode *) aDocumentsDir.utf16(); + osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData ); + return uno::makeAny( sDocumentsURL ); + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName"))) + { + QString aFTPProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aFTPProxy = KProtocolManager::proxyFor( "FTP" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") ); + break; + default: // No proxy is used + break; + } + if ( !aFTPProxy.isEmpty() ) + { + KUrl aProxy(aFTPProxy); + ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16(); + return uno::makeAny( sProxy ); + } + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort"))) + { + QString aFTPProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aFTPProxy = KProtocolManager::proxyFor( "FTP" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") ); + break; + default: // No proxy is used + break; + } + if ( !aFTPProxy.isEmpty() ) + { + KUrl aProxy(aFTPProxy); + sal_Int32 nPort = aProxy.port(); + return uno::makeAny( nPort ); + } + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName"))) + { + QString aHTTPProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPProxy = KProtocolManager::proxyFor( "HTTP" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://http.openoffice.org") ); + break; + default: // No proxy is used + break; + } + if ( !aHTTPProxy.isEmpty() ) + { + KUrl aProxy(aHTTPProxy); + ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16(); + return uno::makeAny( sProxy ); + } + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort"))) + { + QString aHTTPProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPProxy = KProtocolManager::proxyFor( "HTTP" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://http.openoffice.org") ); + break; + default: // No proxy is used + break; + } + if ( !aHTTPProxy.isEmpty() ) + { + KUrl aProxy(aHTTPProxy); + sal_Int32 nPort = aProxy.port(); + return uno::makeAny( nPort ); + } + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName"))) + { + QString aHTTPSProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://https.openoffice.org") ); + break; + default: // No proxy is used + break; + } + if ( !aHTTPSProxy.isEmpty() ) + { + KUrl aProxy(aHTTPSProxy); + ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16(); + return uno::makeAny( sProxy ); + } + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort"))) + { + QString aHTTPSProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://https.openoffice.org") ); + break; + default: // No proxy is used + break; + } + if ( !aHTTPSProxy.isEmpty() ) + { + KUrl aProxy(aHTTPSProxy); + sal_Int32 nPort = aProxy.port(); + return uno::makeAny( nPort ); + } + } else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"))) { + QString aNoProxyFor; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables + aNoProxyFor = KProtocolManager::noProxyFor(); + break; + default: // No proxy is used + break; + } + if ( !aNoProxyFor.isEmpty() ) + { + ::rtl::OUString sNoProxyFor; + + aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON ); + sNoProxyFor = (const sal_Unicode *) aNoProxyFor.utf16(); + return uno::makeAny( sNoProxyFor ); + } + } else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"))) { + int nProxyType; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables + nProxyType = 1; + break; + default: // No proxy is used + nProxyType = 0; + } + return uno::makeAny( (sal_Int32) nProxyType ); + } else { + OSL_ASSERT(false); // this cannot happen + } + return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); +} + +} diff --git a/shell/source/backends/kde4be/kde4access.hxx b/shell/source/backends/kde4be/kde4access.hxx new file mode 100644 index 000000000000..043dff6476ec --- /dev/null +++ b/shell/source/backends/kde4be/kde4access.hxx @@ -0,0 +1,46 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: code,v $ +* +* $Revision: 1.4 $ +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef INCLUDED_SHELL_SOURCE_BACKENDS_KDE4BE_KDE4ACCESS_HXX +#define INCLUDED_SHELL_SOURCE_BACKENDS_KDE4BE_KDE4ACCESS_HXX + +#include "sal/config.h" + +namespace com { namespace sun { namespace star { namespace uno { + class Any; +} } } } +namespace rtl { class OUString; } + +namespace kde4access { + +com::sun::star::uno::Any getValue(rtl::OUString const & id); + +} + +#endif diff --git a/shell/source/backends/kde4be/kde4backend.cxx b/shell/source/backends/kde4be/kde4backend.cxx index 7eb093bf7217..feef44562d49 100644 --- a/shell/source/backends/kde4be/kde4backend.cxx +++ b/shell/source/backends/kde4be/kde4backend.cxx @@ -1,158 +1,221 @@ /************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kde4backend.cxx,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" - -#include "kde4backend.hxx" -#include "kde4commonlayer.hxx" -#include "kde4inetlayer.hxx" -#include "kde4vcllayer.hxx" -#include "kde4pathslayer.hxx" +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: code,v $ +* +* $Revision: 1.4 $ +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ -//------------------------------------------------------------------------------ +#include "precompiled_shell.hxx" +#include "sal/config.h" + +#include "kapplication.h" + +#include "boost/noncopyable.hpp" +#include "com/sun/star/container/NoSuchElementException.hpp" +#include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/lang/WrappedTargetException.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XCurrentContext.hpp" +#include "cppu/unotype.hxx" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/weak.hxx" +#include "rtl/string.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/current_context.hxx" +#include "uno/lbnames.h" + +#include "kde4access.hxx" + +namespace { + +namespace css = com::sun::star; + +rtl::OUString SAL_CALL getServiceImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.configuration.backend.KDE4Backend")); +} -KDEBackend* KDEBackend::mInstance= 0; +css::uno::Sequence< rtl::OUString > SAL_CALL getServiceSupportedServiceNames() { + rtl::OUString name( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.backend.KDE4Backend")); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} -KDEBackend* KDEBackend::createInstance(const uno::Reference& xContext) +class Service: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::container::XNameAccess >, + private boost::noncopyable { - if (mInstance == 0) - { - mInstance = new KDEBackend (xContext); +public: + Service(); + +private: + virtual ~Service() {} + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return getServiceImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException) + { return ServiceName == getSupportedServiceNames()[0]; } + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return getServiceSupportedServiceNames(); } + + virtual css::uno::Type SAL_CALL getElementType() + throw (css::uno::RuntimeException) + { return cppu::UnoType< cppu::UnoVoidType >::get(); } + + virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException) + { return true; } + + virtual css::uno::Any SAL_CALL getByName(rtl::OUString const & aName) + throw ( + css::container::NoSuchElementException, + css::lang::WrappedTargetException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getElementNames() + throw (css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasByName(rtl::OUString const & aName) + throw (css::uno::RuntimeException); + + bool enabled_; +}; + +Service::Service(): enabled_(false) { + css::uno::Reference< css::uno::XCurrentContext > context( + css::uno::getCurrentContext()); + if (context.is()) { + rtl::OUString desktop; + context->getValueByName( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("system.desktop-environment"))) >>= + desktop; + enabled_ = desktop.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("KDE4")) && + KApplication::kApplication() != 0; } - - return mInstance; } -//------------------------------------------------------------------------------ - -KDEBackend::KDEBackend(const uno::Reference& xContext) - throw (backend::BackendAccessException) - : BackendBase(mMutex), m_xContext(xContext) +css::uno::Any Service::getByName(rtl::OUString const & aName) + throw ( + css::container::NoSuchElementException, + css::lang::WrappedTargetException, css::uno::RuntimeException) { + if (!hasByName(aName)) { + throw css::container::NoSuchElementException( + aName, static_cast< cppu::OWeakObject * >(this)); + } + return enabled_ + ? kde4access::getValue(aName) + : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); } -//------------------------------------------------------------------------------ - -KDEBackend::~KDEBackend(void) +css::uno::Sequence< rtl::OUString > Service::getElementNames() + throw (css::uno::RuntimeException) { + css::uno::Sequence< rtl::OUString > names(13); + names[0] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("EnableATToolSupport")); + names[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExternalMailer")); + names[2] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("SourceViewFontHeight")); + names[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SourceViewFontName")); + names[4] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkPathVariable")); + names[5] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName")); + names[6] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort")); + names[7] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName")); + names[8] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort")); + names[9] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName")); + names[10] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort")); + names[11] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy")); + names[12] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType")); + return names; } -//------------------------------------------------------------------------------ - -uno::Reference SAL_CALL KDEBackend::getLayer( - const rtl::OUString& aComponent, const rtl::OUString& /* aTimestamp */) - throw (backend::BackendAccessException, lang::IllegalArgumentException) +sal_Bool Service::hasByName(rtl::OUString const & aName) + throw (css::uno::RuntimeException) { - uno::Reference xLayer; - - if( aComponent.equalsAscii("org.openoffice.Office.Common" ) ) - { - xLayer = new KDECommonLayer(m_xContext); - } - else if( aComponent.equalsAscii("org.openoffice.Inet" ) ) - { - xLayer = new KDEInetLayer(m_xContext); - } - else if( aComponent.equalsAscii("org.openoffice.VCL" ) ) - { - xLayer = new KDEVCLLayer(m_xContext); - } - else if( aComponent.equalsAscii("org.openoffice.Office.Paths" ) ) - { - xLayer = new KDEPathsLayer(m_xContext); + css::uno::Sequence< rtl::OUString > names(getElementNames()); + for (sal_Int32 i = 0; i < names.getLength(); ++i) { + if (aName == names[i]) { + return true; + } } - - return xLayer; + return false; } -//------------------------------------------------------------------------------ - -uno::Reference SAL_CALL -KDEBackend::getUpdatableLayer(const rtl::OUString& /* aComponent */) - throw (backend::BackendAccessException,lang::NoSupportException, - lang::IllegalArgumentException) +css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( + css::uno::Reference< css::uno::XComponentContext > const &) { - throw lang::NoSupportException( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("KDEBackend: No Update Operation allowed, Read Only access") ), - *this) ; + return static_cast< cppu::OWeakObject * >(new Service); } -//------------------------------------------------------------------------------ +static cppu::ImplementationEntry const services[] = { + { &createInstance, &getServiceImplementationName, + &getServiceSupportedServiceNames, &cppu::createSingleComponentFactory, 0, + 0 }, + { 0, 0, 0, 0, 0, 0 } +}; -rtl::OUString SAL_CALL KDEBackend::getBackendName(void) -{ - return rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.configuration.backend.KDE4Backend") ); } -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL KDEBackend::getImplementationName(void) - throw (uno::RuntimeException) +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( + char const * pImplName, void * pServiceManager, void * pRegistryKey) { - return getBackendName() ; + return cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, services); } -//------------------------------------------------------------------------------ - -uno::Sequence SAL_CALL KDEBackend::getBackendServiceNames(void) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL +component_getImplementationEnvironment( + char const ** ppEnvTypeName, uno_Environment **) { - uno::Sequence aServices(1) ; - aServices[0] = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.KDE4Backend")) ; - - return aServices ; + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//------------------------------------------------------------------------------ - -sal_Bool SAL_CALL KDEBackend::supportsService(const rtl::OUString& aServiceName) - throw (uno::RuntimeException) +extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( + void * pServiceManager, void * pRegistryKey) { - uno::Sequence< rtl::OUString > const svc = getBackendServiceNames(); - - for(sal_Int32 i = 0; i < svc.getLength(); ++i ) - if(svc[i] == aServiceName) - return true; - - return false; -} - -//------------------------------------------------------------------------------ - -uno::Sequence -SAL_CALL KDEBackend::getSupportedServiceNames(void) - throw (uno::RuntimeException) -{ - return getBackendServiceNames() ; + return component_writeInfoHelper(pServiceManager, pRegistryKey, services); } - -// --------------------------------------------------------------------------------------- diff --git a/shell/source/backends/kde4be/kde4backend.hxx b/shell/source/backends/kde4be/kde4backend.hxx deleted file mode 100644 index 01599c41a74d..000000000000 --- a/shell/source/backends/kde4be/kde4backend.hxx +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kde4backend.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -#ifndef INCLUDED_MAP -#include -#define INCLUDED_MAP -#endif - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; - - -//------------------------------------------------------------------------------ -typedef cppu::WeakComponentImplHelper2 BackendBase ; - -/** - Implements the SingleLayerStratum service for KDE access. - */ -class KDEBackend : public BackendBase { - public : - - static KDEBackend* createInstance(const uno::Reference& xContext); - - // XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName( ) - throw (uno::RuntimeException) ; - - virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& aServiceName ) - throw (uno::RuntimeException) ; - - virtual uno::Sequence SAL_CALL getSupportedServiceNames( ) - throw (uno::RuntimeException) ; - - /** - Provides the implementation name. - - @return implementation name - */ - static rtl::OUString SAL_CALL getBackendName(void) ; - - /** - Provides the supported services names - - @return service names - */ - static uno::Sequence SAL_CALL getBackendServiceNames(void) ; - - //XSingleLayerStratum - virtual uno::Reference SAL_CALL - getLayer( const rtl::OUString& aLayerId, const rtl::OUString& aTimestamp ) - throw (backend::BackendAccessException, lang::IllegalArgumentException) ; - - virtual uno::Reference SAL_CALL - getUpdatableLayer( const rtl::OUString& aLayerId ) - throw (backend::BackendAccessException, lang::NoSupportException, - lang::IllegalArgumentException) ; - - protected: - /** - Service constructor from a service factory. - - @param xContext component context - */ - KDEBackend(const uno::Reference& xContext) - throw (backend::BackendAccessException); - - /** Destructor */ - ~KDEBackend(void) ; - - private: - - /** Build KDE/OO mapping table */ - void initializeMappingTable (); - - - /** The component context */ - uno::Reference m_xContext; - - /** Mutex for reOOurces protection */ - osl::Mutex mMutex ; - - static KDEBackend* mInstance; -}; diff --git a/shell/source/backends/kde4be/kde4be.xml b/shell/source/backends/kde4be/kde4be.xml deleted file mode 100644 index ea2d9be6dd6b..000000000000 --- a/shell/source/backends/kde4be/kde4be.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - kde4be - - Éric Bischoff - com.sun.star.comp.configuration.backend.KDE4Backend - The KDE4 configuration backend - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.comp.configuration.backend.KDE4Backend - ... - com.sun.star.configuration.backend.XBackendChangesListener - com.sun.star.configuration.backend.XBackendChangesNotifier - com.sun.star.configuration.backend.XLayerHandler - com.sun.star.configuration.backend.XSingleLayerStratum - com.sun.star.lang.XMultiComponentFactory - com.sun.star.lang.XServiceInfo - com.sun.star.lang.XSingleComponentFactory - com.sun.star.lang.XTypeProvider - com.sun.star.uno.TypeClass - com.sun.star.uno.XAggregation - com.sun.star.uno.XComponentContext - com.sun.star.uno.XCurrentContext - com.sun.star.uno.XWeak - com.sun.star.registry.XRegistryKey - - cppuhelper - cppu - sal - cppuhelper3$(COM) - cppu3 - sal3 - diff --git a/shell/source/backends/kde4be/kde4becdef.cxx b/shell/source/backends/kde4be/kde4becdef.cxx deleted file mode 100644 index da0d22ead22e..000000000000 --- a/shell/source/backends/kde4be/kde4becdef.cxx +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kde4becdef.cxx,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" -#include "kde4backend.hxx" - -#include - -#include - -#include -#include - -#include "uno/current_context.hxx" - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; - -//============================================================================== - -static uno::Reference SAL_CALL createKDEBackend(const uno::Reference& xContext) -{ - try { - uno::Reference< uno::XCurrentContext > xCurrentContext(uno::getCurrentContext()); - - if (xCurrentContext.is()) - { - uno::Any aValue = xCurrentContext->getValueByName( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "system.desktop-environment" ) ) ); - - rtl::OUString aDesktopEnvironment; - if ( (aValue >>= aDesktopEnvironment) && (aDesktopEnvironment.equalsAscii("KDE")) && (KApplication::kApplication() != NULL) ) - return * KDEBackend::createInstance(xContext); - } - - return uno::Reference(); - - } catch (uno::RuntimeException e) { - return uno::Reference(); - } - -} - -//============================================================================== - -static const cppu::ImplementationEntry kImplementations_entries[] = -{ - { - createKDEBackend, - KDEBackend::getBackendName, - KDEBackend::getBackendServiceNames, - cppu::createSingleComponentFactory, - NULL, - 0 - }, - { NULL, NULL, NULL, NULL, NULL, 0 } -} ; -//------------------------------------------------------------------------------ - -extern "C" void SAL_CALL component_getImplementationEnvironment( - const sal_Char **aEnvTypeName, - uno_Environment **) { - *aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; -} - -//------------------------------------------------------------------------------ - -extern "C" sal_Bool SAL_CALL component_writeInfo(void *, - void *pRegistryKey) { - - using namespace ::com::sun::star::registry; - if (pRegistryKey) - { - try - { - uno::Reference< XRegistryKey > xImplKey = static_cast< XRegistryKey* >( pRegistryKey )->createKey( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + KDEBackend::getBackendName() - ); - - // Register associated service names - uno::Reference< XRegistryKey > xServicesKey = xImplKey->createKey( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES") ) - ); - - uno::Sequence sServiceNames = KDEBackend::getBackendServiceNames(); - for (sal_Int32 i = 0 ; i < sServiceNames.getLength() ; ++ i) - xServicesKey->createKey(sServiceNames[i]); - - return sal_True; - } - - catch( InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "InvalidRegistryException caught"); - } - } - - return sal_False; -} - -//------------------------------------------------------------------------------ - -extern "C" void *component_getFactory(const sal_Char *aImplementationName, - void *aServiceManager, - void *aRegistryKey) { - - return cppu::component_getFactoryHelper( - aImplementationName, - aServiceManager, - aRegistryKey, - kImplementations_entries) ; -} -//------------------------------------------------------------------------------ diff --git a/shell/source/backends/kde4be/kde4commonlayer.cxx b/shell/source/backends/kde4be/kde4commonlayer.cxx deleted file mode 100644 index 1ce844672225..000000000000 --- a/shell/source/backends/kde4be/kde4commonlayer.cxx +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kde4commonlayer.cxx,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" - -#include "kde4commonlayer.hxx" - -#include -#include - -#include - -#include -#include -#include - -#define SPACE ' ' - -//============================================================================== - -KDECommonLayer::KDECommonLayer(const uno::Reference& xContext) -{ - //Create instance of LayerContentDescriber Service - rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.configuration.backend.LayerDescriber")); - - typedef uno::Reference LayerDescriber; - uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); - if( xServiceManager.is() ) - { - m_xLayerContentDescriber = LayerDescriber::query( - xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); - } - else - { - OSL_TRACE("Could not retrieve ServiceManager"); - } -} - -//------------------------------------------------------------------------------ - -void SAL_CALL KDECommonLayer::readData( const uno::Reference& xHandler) - throw ( backend::MalformedDataException, lang::NullPointerException, - lang::WrappedTargetException, uno::RuntimeException) -{ - if( ! m_xLayerContentDescriber.is() ) - { - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" - ) ), static_cast < backend::XLayer * > (this) ); - } - - uno::Sequence aPropInfoList(3); - sal_Int32 nProperties = 0; - - // Email client settings - KEMailSettings aEmailSettings; - QString aClientProgram; - ::rtl::OUString sClientProgram; - - aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram ); - if ( aClientProgram.isEmpty() ) - aClientProgram = "kmail"; - else - aClientProgram = aClientProgram.section(SPACE, 0, 0); - sClientProgram = (const sal_Unicode *) aClientProgram.utf16(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/ExternalMailer/Program") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sClientProgram ); - - // Source code font settings - QFont aFixedFont; - QString aFontName; - :: rtl::OUString sFontName; - short nFontHeight; - - aFixedFont = KGlobalSettings::fixedFont(); - aFontName = aFixedFont.family(); - sFontName = (const sal_Unicode *) aFontName.utf16(); - nFontHeight = aFixedFont.pointSize(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontName") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sFontName ); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontHeight") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "short" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( nFontHeight ); - - if( nProperties > 0 ) - { - aPropInfoList.realloc(nProperties); - m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); - } -} - -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL KDECommonLayer::getTimestamp(void) - throw (uno::RuntimeException) -{ - // Return the value as timestamp to avoid regenerating the binary cache - // on each office launch. - - KEMailSettings aEmailSettings; - QString aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram ); - aClientProgram = aClientProgram.section(SPACE, 0, 0); - - QString aFixedFont = KGlobalSettings::fixedFont().toString(); - - ::rtl::OUString sTimeStamp, - sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) ); - - sTimeStamp = (const sal_Unicode *) aClientProgram.utf16(); - sTimeStamp += sep; - sTimeStamp += (const sal_Unicode *) aFixedFont.utf16(); - - return sTimeStamp; -} diff --git a/shell/source/backends/kde4be/kde4commonlayer.hxx b/shell/source/backends/kde4be/kde4commonlayer.hxx deleted file mode 100644 index 9ce4cd4dc962..000000000000 --- a/shell/source/backends/kde4be/kde4commonlayer.hxx +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include "kde4backend.hxx" -#include -#include -#include -#include -#include -#include - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; -namespace util = css::util ; - -/** - Implementation of the XLayer interface for the KDE values mapped into - the org.openoffice.Office.Common configuration component. - */ -class KDECommonLayer : public cppu::WeakImplHelper2 -{ -public : - /** - Constructor given the component context - - @param xContext The component context - */ - - KDECommonLayer(const uno::Reference& xContext); - - // XLayer - virtual void SAL_CALL readData( - const uno::Reference& xHandler) - throw ( backend::MalformedDataException, - lang::NullPointerException, - lang::WrappedTargetException, - uno::RuntimeException) ; - - // XTimeStamped - virtual rtl::OUString SAL_CALL getTimestamp(void) - throw (uno::RuntimeException); - - protected: - - /** Destructor */ - ~KDECommonLayer(void) {} - - private : - uno::Reference m_xLayerContentDescriber ; -}; diff --git a/shell/source/backends/kde4be/kde4inetlayer.cxx b/shell/source/backends/kde4be/kde4inetlayer.cxx deleted file mode 100644 index bc661a093fb7..000000000000 --- a/shell/source/backends/kde4be/kde4inetlayer.cxx +++ /dev/null @@ -1,255 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kde4inetlayer.cxx,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" - -#include - -#include "kde4inetlayer.hxx" -#include -#include -#include - -#define COMMA ',' -#define SEMI_COLON ';' - -//============================================================================== - -KDEInetLayer::KDEInetLayer(const uno::Reference& xContext) -{ - //Create instance of LayerContentDescriber Service - rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.configuration.backend.LayerDescriber")); - - typedef uno::Reference LayerDescriber; - uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); - if( xServiceManager.is() ) - { - m_xLayerContentDescriber = LayerDescriber::query( - xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); - } - else - { - OSL_TRACE("Could not retrieve ServiceManager"); - } -} - -//------------------------------------------------------------------------------ - -void SAL_CALL KDEInetLayer::readData( const uno::Reference& xHandler) - throw ( backend::MalformedDataException, lang::NullPointerException, - lang::WrappedTargetException, uno::RuntimeException) -{ - if( ! m_xLayerContentDescriber.is() ) - { - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" - ) ), static_cast < backend::XLayer * > (this) ); - } - - uno::Sequence aPropInfoList(8); - sal_Int32 nProperties = 0; - - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - setProxy(aPropInfoList, nProperties, 1, - KProtocolManager::noProxyFor(), - KProtocolManager::proxyFor( "HTTP" ), - KProtocolManager::proxyFor( "FTP" ), - KProtocolManager::proxyFor( "HTTPS" )); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables -// In such cases, the proxy address is not stored in KDE, but determined dynamically. -// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... -// The best we can do here is to ask the current value for a given address. - setProxy(aPropInfoList, nProperties, 1, - KProtocolManager::noProxyFor(), - KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") ), - KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") ), - KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") )); - break; - default: // No proxy is used - setProxy(aPropInfoList, nProperties, 0); - } - - if ( nProperties > 0 ) - { - aPropInfoList.realloc(nProperties); - m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); - } -} - -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL KDEInetLayer::getTimestamp(void) - throw (uno::RuntimeException) -{ - // Return the value as timestamp to avoid regenerating the binary cache - // on each office launch. - - QString aProxyType, aNoProxyFor, aHTTPProxy, aHTTPSProxy, aFTPProxy; - - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: - aProxyType = '1'; - aNoProxyFor = KProtocolManager::noProxyFor(); - aHTTPProxy = KProtocolManager::proxyFor( "HTTP" ); - aHTTPProxy = KProtocolManager::proxyFor( "HTTPS" ); - aFTPProxy = KProtocolManager::proxyFor( "FTP" ); - break; - case KProtocolManager::PACProxy: - case KProtocolManager::WPADProxy: - case KProtocolManager::EnvVarProxy: - aProxyType = '1'; - aNoProxyFor = KProtocolManager::noProxyFor(); - aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") ); - aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") ); - aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") ); - break; - default: - aProxyType = '0'; - } - - ::rtl::OUString sTimeStamp, - sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) ); - - sTimeStamp = (const sal_Unicode *) aProxyType.utf16(); - sTimeStamp += sep; - sTimeStamp += (const sal_Unicode *) aNoProxyFor.utf16(); - sTimeStamp += sep; - sTimeStamp += (const sal_Unicode *) aHTTPProxy.utf16(); - sTimeStamp += sep; - sTimeStamp += (const sal_Unicode *) aHTTPSProxy.utf16(); - sTimeStamp += sep; - sTimeStamp += (const sal_Unicode *) aFTPProxy.utf16(); - - return sTimeStamp; -} - -//------------------------------------------------------------------------------ - -void SAL_CALL KDEInetLayer::setProxy - (uno::Sequence &aPropInfoList, sal_Int32 &nProperties, - int nProxyType, const QString &aNoProxy, const QString &aHTTPProxy, const QString &aFTPProxy, const QString &aHTTPSProxy ) const -{ - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetProxyType") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( (sal_Int32) nProxyType ); - - if (nProxyType == 0) return; - - if ( !aNoProxy.isEmpty() ) - { - QString aNoProxyFor(aNoProxy); - ::rtl::OUString sNoProxyFor; - - aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON ); - sNoProxyFor = (const sal_Unicode *) aNoProxyFor.utf16(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetNoProxy") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sNoProxyFor ); - } - - if ( !aHTTPProxy.isEmpty() ) - { - KUrl aProxy(aHTTPProxy); - ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16(); - sal_Int32 nPort = aProxy.port(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyName") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sProxy ); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyPort") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( nPort ); - } - - if ( !aHTTPSProxy.isEmpty() ) - { - KUrl aProxy(aHTTPSProxy); - ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16(); - sal_Int32 nPort = aProxy.port(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyName") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sProxy ); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyPort") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( nPort ); - } - - if ( !aFTPProxy.isEmpty() ) - { - KUrl aProxy(aFTPProxy); - ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16(); - sal_Int32 nPort = aProxy.port(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyName") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sProxy ); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyPort") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( nPort ); - } -} - diff --git a/shell/source/backends/kde4be/kde4inetlayer.hxx b/shell/source/backends/kde4be/kde4inetlayer.hxx deleted file mode 100644 index 64d00fec45fc..000000000000 --- a/shell/source/backends/kde4be/kde4inetlayer.hxx +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include - -#include "kde4backend.hxx" - -#include -#include -#include -#include -#include -#include - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; -namespace util = css::util ; - -/** - Implementation of the XLayer interface for the KDE values mapped into - the org.openoffice.Inet configuration component. - */ -class KDEInetLayer : public cppu::WeakImplHelper2 -{ -public : - /** - Constructor given the component context - - @param xContext The component context - */ - - KDEInetLayer(const uno::Reference& xContext); - - // XLayer - virtual void SAL_CALL readData( - const uno::Reference& xHandler) - throw ( backend::MalformedDataException, - lang::NullPointerException, - lang::WrappedTargetException, - uno::RuntimeException) ; - - // XTimeStamped - virtual rtl::OUString SAL_CALL getTimestamp(void) - throw (uno::RuntimeException); - - protected: - - /** Destructor */ - ~KDEInetLayer(void) {} - -private : - uno::Reference m_xLayerContentDescriber ; - - void SAL_CALL setProxy - (uno::Sequence &aPropInfoList, sal_Int32 &nProperties, - int nProxyType, const QString &aNoProxyfor = QString(), - const QString &aHTTPProxy = QString(), const QString &aFTPProxy = QString(), const QString &aHTTPSProxy = QString()) const; -}; diff --git a/shell/source/backends/kde4be/kde4pathslayer.cxx b/shell/source/backends/kde4be/kde4pathslayer.cxx deleted file mode 100644 index 2511d0b57405..000000000000 --- a/shell/source/backends/kde4be/kde4pathslayer.cxx +++ /dev/null @@ -1,124 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kde4pathslayer.cxx,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" - -#include "kde4pathslayer.hxx" - -#include -#include - -#include -#include - -#include -#include -#include - -#define SPACE ' ' - -//============================================================================== - -KDEPathsLayer::KDEPathsLayer(const uno::Reference& xContext) -{ - //Create instance of LayerContentDescriber Service - rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.configuration.backend.LayerDescriber")); - - typedef uno::Reference LayerDescriber; - uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); - if( xServiceManager.is() ) - { - m_xLayerContentDescriber = LayerDescriber::query( - xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); - } - else - { - OSL_TRACE("Could not retrieve ServiceManager"); - } -} - -//------------------------------------------------------------------------------ - -void SAL_CALL KDEPathsLayer::readData( const uno::Reference& xHandler) - throw ( backend::MalformedDataException, lang::NullPointerException, - lang::WrappedTargetException, uno::RuntimeException) -{ - if( ! m_xLayerContentDescriber.is() ) - { - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" - ) ), static_cast < backend::XLayer * > (this) ); - } - - uno::Sequence aPropInfoList(1); - sal_Int32 nProperties = 0; - - QString aDocumentsDir( KGlobalSettings::documentPath() ); - rtl::OUString sDocumentsDir; - rtl::OUString sDocumentsURL; - if ( aDocumentsDir.endsWith(QChar('/')) ) - aDocumentsDir.truncate ( aDocumentsDir.length() - 1 ); - sDocumentsDir = (const sal_Unicode *) aDocumentsDir.utf16(); - osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData ); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Paths/Variables/Work") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sDocumentsURL ); - - if( nProperties > 0 ) - { - aPropInfoList.realloc(nProperties); - m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); - } -} - -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL KDEPathsLayer::getTimestamp(void) - throw (uno::RuntimeException) -{ - // Return the value as timestamp to avoid regenerating the binary cache - // on each office launch. - - ::rtl::OUString sTimeStamp, - sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) ); - - QString aDocumentsDir; - aDocumentsDir = KGlobalSettings::documentPath(); - - sTimeStamp += (const sal_Unicode *) aDocumentsDir.utf16(); - - return sTimeStamp; -} diff --git a/shell/source/backends/kde4be/kde4pathslayer.hxx b/shell/source/backends/kde4be/kde4pathslayer.hxx deleted file mode 100644 index 40d31a73c4f9..000000000000 --- a/shell/source/backends/kde4be/kde4pathslayer.hxx +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kde4pathslayer.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#pragma once - -#include "kde4backend.hxx" -#include -#include -#include -#include -#include - -#include - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; -namespace util = css::util ; - -/** - Implementation of the XLayer interface for the KDE values mapped into - the org.openoffice.Office.Paths configuration component. - */ -class KDEPathsLayer : public cppu::WeakImplHelper2 -{ -public : - /** - Constructor given the component context - - @param xContext The component context - */ - - KDEPathsLayer(const uno::Reference& xContext); - - // XLayer - virtual void SAL_CALL readData( - const uno::Reference& xHandler) - throw ( backend::MalformedDataException, - lang::NullPointerException, - lang::WrappedTargetException, - uno::RuntimeException) ; - - // XTimeStamped - virtual rtl::OUString SAL_CALL getTimestamp(void) - throw (uno::RuntimeException); - - protected: - - /** Destructor */ - ~KDEPathsLayer(void) {} - - private : - uno::Reference m_xLayerContentDescriber ; -}; diff --git a/shell/source/backends/kde4be/kde4vcllayer.cxx b/shell/source/backends/kde4be/kde4vcllayer.cxx deleted file mode 100644 index 780c3e4e7ce1..000000000000 --- a/shell/source/backends/kde4be/kde4vcllayer.cxx +++ /dev/null @@ -1,115 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kde4vcllayer.cxx,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" - -#include "kde4vcllayer.hxx" - -#include -#include -#include - -//============================================================================== - -KDEVCLLayer::KDEVCLLayer(const uno::Reference& xContext) -{ - //Create instance of LayerContentDescriber Service - rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.configuration.backend.LayerDescriber")); - - typedef uno::Reference LayerDescriber; - uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); - if( xServiceManager.is() ) - { - m_xLayerContentDescriber = LayerDescriber::query( - xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); - } - else - { - OSL_TRACE("Could not retrieve ServiceManager"); - } -} - -//------------------------------------------------------------------------------ - -void SAL_CALL KDEVCLLayer::readData( const uno::Reference& xHandler) - throw ( backend::MalformedDataException, lang::NullPointerException, - lang::WrappedTargetException, uno::RuntimeException) -{ - if( ! m_xLayerContentDescriber.is() ) - { - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" - ) ), static_cast < backend::XLayer * > (this) ); - } - - uno::Sequence aPropInfoList(1); - -/* - Commenting out, does not make much sense without an accessibility bridge -=========================================================================== -#if defined(QT_ACCESSIBILITY_SUPPORT) -// Accessibility tools under Qt for UNIX are available starting with Qt 4.0 - int nVersionMajor = 0; - const char *q = qVersion(); // "3.1.0" for example - while ('0' <= *q && *q <= '9') - nVersionMajor = nVersionMajor * 10 + *q++ - '0'; - sal_Bool ATToolSupport = (sal_Bool) (nVersionMajor >= 4); -#else - sal_Bool ATToolSupport = sal_False; -#endif -=========================================================================== - End of commented out section -*/ sal_Bool ATToolSupport = sal_False; - - aPropInfoList[0].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.VCL/Settings/Accessibility/EnableATToolSupport") ); - aPropInfoList[0].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[0].Protected = sal_False; - aPropInfoList[0].Value = uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) ); - - m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); -} - -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL KDEVCLLayer::getTimestamp(void) - throw (uno::RuntimeException) -{ - // Return the value as timestamp to avoid regenerating the binary cache - // on each office launch. - - ::rtl::OUString sTimeStamp( - RTL_CONSTASCII_USTRINGPARAM( "FALSE" ) ); - - return sTimeStamp; -} diff --git a/shell/source/backends/kde4be/kde4vcllayer.hxx b/shell/source/backends/kde4be/kde4vcllayer.hxx deleted file mode 100644 index 16036ee89122..000000000000 --- a/shell/source/backends/kde4be/kde4vcllayer.hxx +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -#include "kde4backend.hxx" - -#include -#include -#include -#include -#include - -#include - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; -namespace util = css::util ; - -/** - Implementation of the XLayer interface for the KDE values mapped into - the org.openoffice.VCL configuration component. - */ -class KDEVCLLayer : public cppu::WeakImplHelper2 -{ -public : - /** - Constructor given the component context - - @param xContext The component context - */ - - KDEVCLLayer(const uno::Reference& xContext); - - // XLayer - virtual void SAL_CALL readData( - const uno::Reference& xHandler) - throw ( backend::MalformedDataException, - lang::NullPointerException, - lang::WrappedTargetException, - uno::RuntimeException) ; - - // XTimeStamped - virtual rtl::OUString SAL_CALL getTimestamp(void) - throw (uno::RuntimeException); - - protected: - - /** Destructor */ - ~KDEVCLLayer(void) {} - - private : - uno::Reference m_xLayerContentDescriber ; -}; diff --git a/shell/source/backends/kde4be/makefile.mk b/shell/source/backends/kde4be/makefile.mk index 6f92762e5ae1..560f06882c64 100644 --- a/shell/source/backends/kde4be/makefile.mk +++ b/shell/source/backends/kde4be/makefile.mk @@ -35,11 +35,7 @@ TARGET=kde4be LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE - -COMP1TYPELIST=$(TARGET) -COMPRDB=$(SOLARBINDIR)$/types.rdb -UNOUCROUT=$(OUT)$/inc$/$(TARGET) -INCPRE=$(UNOUCROUT) +VISIBILITY_HIDDEN=TRUE # --- Settings --- @@ -64,12 +60,8 @@ CFLAGS+=$(KDE4_CFLAGS) # --- Files --- SLOFILES=\ - $(SLO)$/kde4backend.obj \ - $(SLO)$/kde4commonlayer.obj \ - $(SLO)$/kde4inetlayer.obj \ - $(SLO)$/kde4vcllayer.obj \ - $(SLO)$/kde4pathslayer.obj \ - $(SLO)$/kde4becdef.obj + $(SLO)$/kde4access.obj \ + $(SLO)$/kde4backend.obj SHL1NOCHECK=TRUE SHL1TARGET=$(TARGET)1.uno @@ -82,8 +74,7 @@ SHL1STDLIBS= \ $(CPPULIB) \ $(SALLIB) \ $(KDE4_LIBS) -lkio - -SHL1VERSIONMAP=exports.map + SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/shell/source/backends/kdebe/exports.map b/shell/source/backends/kdebe/exports.map deleted file mode 100644 index ba501f9ae076..000000000000 --- a/shell/source/backends/kdebe/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { - global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/shell/source/backends/kdebe/kdeaccess.cxx b/shell/source/backends/kdebe/kdeaccess.cxx new file mode 100644 index 000000000000..9dd9ecd7478b --- /dev/null +++ b/shell/source/backends/kdebe/kdeaccess.cxx @@ -0,0 +1,301 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: code,v $ +* +* $Revision: 1.4 $ +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#include "precompiled_shell.hxx" +#include "sal/config.h" + +#include "com/sun/star/uno/Any.hxx" +#include "cppu/unotype.hxx" +#include "osl/diagnose.h" +#include "osl/file.h" +#include "rtl/string.h" +#include "rtl/ustring.hxx" +#include "vcl/kde_headers.h" + +#define SPACE ' ' +#define COMMA ',' +#define SEMI_COLON ';' + +namespace kdeaccess { + +namespace { + +namespace css = com::sun::star ; +namespace uno = css::uno ; + +} + +css::uno::Any getValue(rtl::OUString const & id) { + if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ExternalMailer"))) { + KEMailSettings aEmailSettings; + QString aClientProgram; + ::rtl::OUString sClientProgram; + + aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram ); + if ( aClientProgram.isEmpty() ) + aClientProgram = "kmail"; + else + aClientProgram = aClientProgram.section(SPACE, 0, 0); + sClientProgram = (const sal_Unicode *) aClientProgram.ucs2(); + return uno::makeAny( sClientProgram ); + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight"))) + { + QFont aFixedFont; + short nFontHeight; + + aFixedFont = KGlobalSettings::fixedFont(); + nFontHeight = aFixedFont.pointSize(); + return uno::makeAny( nFontHeight ); + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("SourceViewFontName"))) + { + QFont aFixedFont; + QString aFontName; + :: rtl::OUString sFontName; + + aFixedFont = KGlobalSettings::fixedFont(); + aFontName = aFixedFont.family(); + sFontName = (const sal_Unicode *) aFontName.ucs2(); + return uno::makeAny( sFontName ); + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("EnableATToolSupport"))) + { + /* does not make much sense without an accessibility bridge */ + sal_Bool ATToolSupport = sal_False; + return uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) ); + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("WorkPathVariable"))) + { + QString aDocumentsDir( KGlobalSettings::documentPath() ); + rtl::OUString sDocumentsDir; + rtl::OUString sDocumentsURL; + if ( aDocumentsDir.endsWith(QChar('/')) ) + aDocumentsDir.truncate ( aDocumentsDir.length() - 1 ); + sDocumentsDir = (const sal_Unicode *) aDocumentsDir.ucs2(); + osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData ); + return uno::makeAny( sDocumentsURL ); + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName"))) + { + QString aFTPProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aFTPProxy = KProtocolManager::proxyFor( "FTP" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aFTPProxy = KProtocolManager::proxyForURL( "ftp://ftp.openoffice.org" ); + break; + default: // No proxy is used + break; + } + if ( !aFTPProxy.isEmpty() ) + { + KURL aProxy(aFTPProxy); + ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2(); + return uno::makeAny( sProxy ); + } + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort"))) + { + QString aFTPProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aFTPProxy = KProtocolManager::proxyFor( "FTP" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aFTPProxy = KProtocolManager::proxyForURL( "ftp://ftp.openoffice.org" ); + break; + default: // No proxy is used + break; + } + if ( !aFTPProxy.isEmpty() ) + { + KURL aProxy(aFTPProxy); + sal_Int32 nPort = aProxy.port(); + return uno::makeAny( nPort ); + } + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName"))) + { + QString aHTTPProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPProxy = KProtocolManager::proxyFor( "HTTP" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aHTTPProxy = KProtocolManager::proxyForURL( "http://http.openoffice.org" ); + break; + default: // No proxy is used + break; + } + if ( !aHTTPProxy.isEmpty() ) + { + KURL aProxy(aHTTPProxy); + ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2(); + return uno::makeAny( sProxy ); + } + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort"))) + { + QString aHTTPProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPProxy = KProtocolManager::proxyFor( "HTTP" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aHTTPProxy = KProtocolManager::proxyForURL( "http://http.openoffice.org" ); + break; + default: // No proxy is used + break; + } + if ( !aHTTPProxy.isEmpty() ) + { + KURL aProxy(aHTTPProxy); + sal_Int32 nPort = aProxy.port(); + return uno::makeAny( nPort ); + } + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName"))) + { + QString aHTTPSProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aHTTPSProxy = KProtocolManager::proxyForURL( "https://https.openoffice.org" ); + break; + default: // No proxy is used + break; + } + if ( !aHTTPSProxy.isEmpty() ) + { + KURL aProxy(aHTTPSProxy); + ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2(); + return uno::makeAny( sProxy ); + } + } else if (id.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort"))) + { + QString aHTTPSProxy; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" ); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + aHTTPSProxy = KProtocolManager::proxyForURL( "https://https.openoffice.org" ); + break; + default: // No proxy is used + break; + } + if ( !aHTTPSProxy.isEmpty() ) + { + KURL aProxy(aHTTPSProxy); + sal_Int32 nPort = aProxy.port(); + return uno::makeAny( nPort ); + } + } else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"))) { + QString aNoProxyFor; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables + aNoProxyFor = KProtocolManager::noProxyFor(); + break; + default: // No proxy is used + break; + } + if ( !aNoProxyFor.isEmpty() ) + { + ::rtl::OUString sNoProxyFor; + + aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON ); + sNoProxyFor = (const sal_Unicode *) aNoProxyFor.ucs2(); + return uno::makeAny( sNoProxyFor ); + } + } else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"))) { + int nProxyType; + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables + nProxyType = 1; + break; + default: // No proxy is used + nProxyType = 0; + } + return uno::makeAny( (sal_Int32) nProxyType ); + } else { + OSL_ASSERT(false); // this cannot happen + } + return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); +} + +} diff --git a/shell/source/backends/kdebe/kdeaccess.hxx b/shell/source/backends/kdebe/kdeaccess.hxx new file mode 100644 index 000000000000..cb916a44d61b --- /dev/null +++ b/shell/source/backends/kdebe/kdeaccess.hxx @@ -0,0 +1,46 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: code,v $ +* +* $Revision: 1.4 $ +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef INCLUDED_SHELL_SOURCE_BACKENDS_KDEBE_KDEACCESS_HXX +#define INCLUDED_SHELL_SOURCE_BACKENDS_KDEBE_KDEACCESS_HXX + +#include "sal/config.h" + +namespace com { namespace sun { namespace star { namespace uno { + class Any; +} } } } +namespace rtl { class OUString; } + +namespace kdeaccess { + +com::sun::star::uno::Any getValue(rtl::OUString const & id); + +} + +#endif diff --git a/shell/source/backends/kdebe/kdebackend.cxx b/shell/source/backends/kdebe/kdebackend.cxx index 5f1ab4e7bc0d..0f52c2a917c1 100644 --- a/shell/source/backends/kdebe/kdebackend.cxx +++ b/shell/source/backends/kdebe/kdebackend.cxx @@ -1,158 +1,220 @@ /************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kdebackend.cxx,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" - -#include "kdebackend.hxx" -#include "kdecommonlayer.hxx" -#include "kdeinetlayer.hxx" -#include "kdevcllayer.hxx" -#include "kdepathslayer.hxx" +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: code,v $ +* +* $Revision: 1.4 $ +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ -//------------------------------------------------------------------------------ +#include "precompiled_shell.hxx" +#include "sal/config.h" + +#include "boost/noncopyable.hpp" +#include "com/sun/star/container/NoSuchElementException.hpp" +#include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/lang/WrappedTargetException.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XCurrentContext.hpp" +#include "cppu/unotype.hxx" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/weak.hxx" +#include "rtl/string.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/current_context.hxx" +#include "uno/lbnames.h" +#include "vcl/kde_headers.h" + +#include "kdeaccess.hxx" + +namespace { + +namespace css = com::sun::star; + +rtl::OUString SAL_CALL getServiceImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.configuration.backend.KDEBackend")); +} -KDEBackend* KDEBackend::mInstance= 0; +css::uno::Sequence< rtl::OUString > SAL_CALL getServiceSupportedServiceNames() { + rtl::OUString name( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.backend.KDEBackend")); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} -KDEBackend* KDEBackend::createInstance(const uno::Reference& xContext) +class Service: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::container::XNameAccess >, + private boost::noncopyable { - if (mInstance == 0) - { - mInstance = new KDEBackend (xContext); +public: + Service(); + +private: + virtual ~Service() {} + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return getServiceImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException) + { return ServiceName == getSupportedServiceNames()[0]; } + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return getServiceSupportedServiceNames(); } + + virtual css::uno::Type SAL_CALL getElementType() + throw (css::uno::RuntimeException) + { return cppu::UnoType< cppu::UnoVoidType >::get(); } + + virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException) + { return true; } + + virtual css::uno::Any SAL_CALL getByName(rtl::OUString const & aName) + throw ( + css::container::NoSuchElementException, + css::lang::WrappedTargetException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getElementNames() + throw (css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasByName(rtl::OUString const & aName) + throw (css::uno::RuntimeException); + + bool enabled_; +}; + +Service::Service(): enabled_(false) { + css::uno::Reference< css::uno::XCurrentContext > context( + css::uno::getCurrentContext()); + if (context.is()) { + rtl::OUString desktop; + context->getValueByName( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("system.desktop-environment"))) >>= + desktop; + enabled_ = desktop.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("KDE")) && + KApplication::kApplication() != 0; } - - return mInstance; } -//------------------------------------------------------------------------------ - -KDEBackend::KDEBackend(const uno::Reference& xContext) - throw (backend::BackendAccessException) - : BackendBase(mMutex), m_xContext(xContext) +css::uno::Any Service::getByName(rtl::OUString const & aName) + throw ( + css::container::NoSuchElementException, + css::lang::WrappedTargetException, css::uno::RuntimeException) { + if (!hasByName(aName)) { + throw css::container::NoSuchElementException( + aName, static_cast< cppu::OWeakObject * >(this)); + } + return enabled_ + ? kdeaccess::getValue(aName) + : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); } -//------------------------------------------------------------------------------ - -KDEBackend::~KDEBackend(void) +css::uno::Sequence< rtl::OUString > Service::getElementNames() + throw (css::uno::RuntimeException) { + css::uno::Sequence< rtl::OUString > names(13); + names[0] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("EnableATToolSupport")); + names[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExternalMailer")); + names[2] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("SourceViewFontHeight")); + names[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SourceViewFontName")); + names[4] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkPathVariable")); + names[5] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName")); + names[6] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort")); + names[7] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName")); + names[8] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort")); + names[9] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName")); + names[10] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort")); + names[11] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy")); + names[12] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType")); + return names; } -//------------------------------------------------------------------------------ - -uno::Reference SAL_CALL KDEBackend::getLayer( - const rtl::OUString& aComponent, const rtl::OUString& /* aTimestamp */) - throw (backend::BackendAccessException, lang::IllegalArgumentException) +sal_Bool Service::hasByName(rtl::OUString const & aName) + throw (css::uno::RuntimeException) { - uno::Reference xLayer; - - if( aComponent.equalsAscii("org.openoffice.Office.Common" ) ) - { - xLayer = new KDECommonLayer(m_xContext); - } - else if( aComponent.equalsAscii("org.openoffice.Inet" ) ) - { - xLayer = new KDEInetLayer(m_xContext); - } - else if( aComponent.equalsAscii("org.openoffice.VCL" ) ) - { - xLayer = new KDEVCLLayer(m_xContext); - } - else if( aComponent.equalsAscii("org.openoffice.Office.Paths" ) ) - { - xLayer = new KDEPathsLayer(m_xContext); + css::uno::Sequence< rtl::OUString > names(getElementNames()); + for (sal_Int32 i = 0; i < names.getLength(); ++i) { + if (aName == names[i]) { + return true; + } } - - return xLayer; + return false; } -//------------------------------------------------------------------------------ - -uno::Reference SAL_CALL -KDEBackend::getUpdatableLayer(const rtl::OUString& /* aComponent */) - throw (backend::BackendAccessException,lang::NoSupportException, - lang::IllegalArgumentException) +css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( + css::uno::Reference< css::uno::XComponentContext > const &) { - throw lang::NoSupportException( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("KDEBackend: No Update Operation allowed, Read Only access") ), - *this) ; + return static_cast< cppu::OWeakObject * >(new Service); } -//------------------------------------------------------------------------------ +static cppu::ImplementationEntry const services[] = { + { &createInstance, &getServiceImplementationName, + &getServiceSupportedServiceNames, &cppu::createSingleComponentFactory, 0, + 0 }, + { 0, 0, 0, 0, 0, 0 } +}; -rtl::OUString SAL_CALL KDEBackend::getBackendName(void) -{ - return rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.configuration.backend.KDEBackend") ); } -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL KDEBackend::getImplementationName(void) - throw (uno::RuntimeException) +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( + char const * pImplName, void * pServiceManager, void * pRegistryKey) { - return getBackendName() ; + return cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, services); } -//------------------------------------------------------------------------------ - -uno::Sequence SAL_CALL KDEBackend::getBackendServiceNames(void) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL +component_getImplementationEnvironment( + char const ** ppEnvTypeName, uno_Environment **) { - uno::Sequence aServices(1) ; - aServices[0] = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.KDEBackend")) ; - - return aServices ; + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//------------------------------------------------------------------------------ - -sal_Bool SAL_CALL KDEBackend::supportsService(const rtl::OUString& aServiceName) - throw (uno::RuntimeException) +extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( + void * pServiceManager, void * pRegistryKey) { - uno::Sequence< rtl::OUString > const svc = getBackendServiceNames(); - - for(sal_Int32 i = 0; i < svc.getLength(); ++i ) - if(svc[i] == aServiceName) - return true; - - return false; -} - -//------------------------------------------------------------------------------ - -uno::Sequence -SAL_CALL KDEBackend::getSupportedServiceNames(void) - throw (uno::RuntimeException) -{ - return getBackendServiceNames() ; + return component_writeInfoHelper(pServiceManager, pRegistryKey, services); } - -// --------------------------------------------------------------------------------------- diff --git a/shell/source/backends/kdebe/kdebackend.hxx b/shell/source/backends/kdebe/kdebackend.hxx deleted file mode 100644 index 57cb2338a5bf..000000000000 --- a/shell/source/backends/kdebe/kdebackend.hxx +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kdebackend.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef KDEBACKEND_HXX_ -#define KDEBACKEND_HXX_ - -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XSCHEMASUPPLIER_HPP_ -#include -#endif -#include -#include -#include -#include -#include -#include - -#ifndef INCLUDED_MAP -#include -#define INCLUDED_MAP -#endif - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; - - -//------------------------------------------------------------------------------ -typedef cppu::WeakComponentImplHelper2 BackendBase ; - -/** - Implements the SingleLayerStratum service for KDE access. - */ -class KDEBackend : public BackendBase { - public : - - static KDEBackend* createInstance(const uno::Reference& xContext); - - // XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName( ) - throw (uno::RuntimeException) ; - - virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& aServiceName ) - throw (uno::RuntimeException) ; - - virtual uno::Sequence SAL_CALL getSupportedServiceNames( ) - throw (uno::RuntimeException) ; - - /** - Provides the implementation name. - - @return implementation name - */ - static rtl::OUString SAL_CALL getBackendName(void) ; - - /** - Provides the supported services names - - @return service names - */ - static uno::Sequence SAL_CALL getBackendServiceNames(void) ; - - //XSingleLayerStratum - virtual uno::Reference SAL_CALL - getLayer( const rtl::OUString& aLayerId, const rtl::OUString& aTimestamp ) - throw (backend::BackendAccessException, lang::IllegalArgumentException) ; - - virtual uno::Reference SAL_CALL - getUpdatableLayer( const rtl::OUString& aLayerId ) - throw (backend::BackendAccessException, lang::NoSupportException, - lang::IllegalArgumentException) ; - - protected: - /** - Service constructor from a service factory. - - @param xContext component context - */ - KDEBackend(const uno::Reference& xContext) - throw (backend::BackendAccessException); - - /** Destructor */ - ~KDEBackend(void) ; - - private: - - /** Build KDE/OO mapping table */ - void initializeMappingTable (); - - - /** The component context */ - uno::Reference m_xContext; - - /** Mutex for reOOurces protection */ - osl::Mutex mMutex ; - - static KDEBackend* mInstance; -}; - -#endif // CONFIGMGR_LOCALBE_LOCALSINGLESTRATUM_HXX_ diff --git a/shell/source/backends/kdebe/kdebe.xml b/shell/source/backends/kdebe/kdebe.xml deleted file mode 100644 index edb1beb0698e..000000000000 --- a/shell/source/backends/kdebe/kdebe.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - kdebe - - Éric Bischoff - com.sun.star.comp.configuration.backend.KDEBackend - The KDE configuration backend - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.comp.configuration.backend.KDEBackend - ... - com.sun.star.configuration.backend.XBackendChangesListener - com.sun.star.configuration.backend.XBackendChangesNotifier - com.sun.star.configuration.backend.XLayerHandler - com.sun.star.configuration.backend.XSingleLayerStratum - com.sun.star.lang.XMultiComponentFactory - com.sun.star.lang.XServiceInfo - com.sun.star.lang.XSingleComponentFactory - com.sun.star.lang.XTypeProvider - com.sun.star.uno.TypeClass - com.sun.star.uno.XAggregation - com.sun.star.uno.XComponentContext - com.sun.star.uno.XCurrentContext - com.sun.star.uno.XWeak - com.sun.star.registry.XRegistryKey - - cppuhelper - cppu - sal - cppuhelper3$(COM) - cppu3 - sal3 - diff --git a/shell/source/backends/kdebe/kdebecdef.cxx b/shell/source/backends/kdebe/kdebecdef.cxx deleted file mode 100644 index 4ef90e992b03..000000000000 --- a/shell/source/backends/kdebe/kdebecdef.cxx +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kdebecdef.cxx,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" -#include "kdebackend.hxx" -#include - -#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ -#include -#endif -#include -#include - -#include "uno/current_context.hxx" - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; - -//============================================================================== - -static uno::Reference SAL_CALL createKDEBackend(const uno::Reference& xContext) -{ - try { - uno::Reference< uno::XCurrentContext > xCurrentContext(uno::getCurrentContext()); - - if (xCurrentContext.is()) - { - uno::Any aValue = xCurrentContext->getValueByName( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "system.desktop-environment" ) ) ); - - rtl::OUString aDesktopEnvironment; - if ( (aValue >>= aDesktopEnvironment) && (aDesktopEnvironment.equalsAscii("KDE")) && (KApplication::kApplication() != NULL) ) - return * KDEBackend::createInstance(xContext); - } - - return uno::Reference(); - - } catch (uno::RuntimeException e) { - return uno::Reference(); - } - -} - -//============================================================================== - -static const cppu::ImplementationEntry kImplementations_entries[] = -{ - { - createKDEBackend, - KDEBackend::getBackendName, - KDEBackend::getBackendServiceNames, - cppu::createSingleComponentFactory, - NULL, - 0 - }, - { NULL, NULL, NULL, NULL, NULL, 0 } -} ; -//------------------------------------------------------------------------------ - -extern "C" void SAL_CALL component_getImplementationEnvironment( - const sal_Char **aEnvTypeName, - uno_Environment **) { - *aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; -} - -//------------------------------------------------------------------------------ - -extern "C" sal_Bool SAL_CALL component_writeInfo(void *, - void *pRegistryKey) { - - using namespace ::com::sun::star::registry; - if (pRegistryKey) - { - try - { - uno::Reference< XRegistryKey > xImplKey = static_cast< XRegistryKey* >( pRegistryKey )->createKey( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + KDEBackend::getBackendName() - ); - - // Register associated service names - uno::Reference< XRegistryKey > xServicesKey = xImplKey->createKey( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES") ) - ); - - uno::Sequence sServiceNames = KDEBackend::getBackendServiceNames(); - for (sal_Int32 i = 0 ; i < sServiceNames.getLength() ; ++ i) - xServicesKey->createKey(sServiceNames[i]); - - return sal_True; - } - - catch( InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "InvalidRegistryException caught"); - } - } - - return sal_False; -} - -//------------------------------------------------------------------------------ - -extern "C" void *component_getFactory(const sal_Char *aImplementationName, - void *aServiceManager, - void *aRegistryKey) { - - return cppu::component_getFactoryHelper( - aImplementationName, - aServiceManager, - aRegistryKey, - kImplementations_entries) ; -} -//------------------------------------------------------------------------------ diff --git a/shell/source/backends/kdebe/kdecommonlayer.cxx b/shell/source/backends/kdebe/kdecommonlayer.cxx deleted file mode 100644 index d2347f7becdb..000000000000 --- a/shell/source/backends/kdebe/kdecommonlayer.cxx +++ /dev/null @@ -1,153 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kdecommonlayer.cxx,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" -#include "kdecommonlayer.hxx" -#include -#include -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_ -#include -#endif -#include - -#define SPACE ' ' - -//============================================================================== - -KDECommonLayer::KDECommonLayer(const uno::Reference& xContext) -{ - //Create instance of LayerContentDescriber Service - rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.configuration.backend.LayerDescriber")); - - typedef uno::Reference LayerDescriber; - uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); - if( xServiceManager.is() ) - { - m_xLayerContentDescriber = LayerDescriber::query( - xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); - } - else - { - OSL_TRACE("Could not retrieve ServiceManager"); - } -} - -//------------------------------------------------------------------------------ - -void SAL_CALL KDECommonLayer::readData( const uno::Reference& xHandler) - throw ( backend::MalformedDataException, lang::NullPointerException, - lang::WrappedTargetException, uno::RuntimeException) -{ - if( ! m_xLayerContentDescriber.is() ) - { - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" - ) ), static_cast < backend::XLayer * > (this) ); - } - - uno::Sequence aPropInfoList(3); - sal_Int32 nProperties = 0; - - // Email client settings - KEMailSettings aEmailSettings; - QString aClientProgram; - ::rtl::OUString sClientProgram; - - aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram ); - if ( aClientProgram.isEmpty() ) - aClientProgram = "kmail"; - else - aClientProgram = aClientProgram.section(SPACE, 0, 0); - sClientProgram = (const sal_Unicode *) aClientProgram.ucs2(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/ExternalMailer/Program") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sClientProgram ); - - // Source code font settings - QFont aFixedFont; - QString aFontName; - :: rtl::OUString sFontName; - short nFontHeight; - - aFixedFont = KGlobalSettings::fixedFont(); - aFontName = aFixedFont.family(); - sFontName = (const sal_Unicode *) aFontName.ucs2(); - nFontHeight = aFixedFont.pointSize(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontName") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sFontName ); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontHeight") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "short" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( nFontHeight ); - - if( nProperties > 0 ) - { - aPropInfoList.realloc(nProperties); - m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); - } -} - -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL KDECommonLayer::getTimestamp(void) - throw (uno::RuntimeException) -{ - // Return the value as timestamp to avoid regenerating the binary cache - // on each office launch. - - KEMailSettings aEmailSettings; - QString aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram ); - aClientProgram = aClientProgram.section(SPACE, 0, 0); - - QString aFixedFont = KGlobalSettings::fixedFont().toString(); - - ::rtl::OUString sTimeStamp, - sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) ); - - sTimeStamp = (const sal_Unicode *) aClientProgram.ucs2(); - sTimeStamp += sep; - sTimeStamp += (const sal_Unicode *) aFixedFont.ucs2(); - - return sTimeStamp; -} diff --git a/shell/source/backends/kdebe/kdecommonlayer.hxx b/shell/source/backends/kdebe/kdecommonlayer.hxx deleted file mode 100644 index e61661589145..000000000000 --- a/shell/source/backends/kdebe/kdecommonlayer.hxx +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef KDECOMMONLAYER_HXX_ -#define KDECOMMONLAYER_HXX_ - -#include "kdebackend.hxx" -#include -#include -#include -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_ -#include -#endif -#include -#include - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; -namespace util = css::util ; - -/** - Implementation of the XLayer interface for the KDE values mapped into - the org.openoffice.Office.Common configuration component. - */ -class KDECommonLayer : public cppu::WeakImplHelper2 -{ -public : - /** - Constructor given the component context - - @param xContext The component context - */ - - KDECommonLayer(const uno::Reference& xContext); - - // XLayer - virtual void SAL_CALL readData( - const uno::Reference& xHandler) - throw ( backend::MalformedDataException, - lang::NullPointerException, - lang::WrappedTargetException, - uno::RuntimeException) ; - - // XTimeStamped - virtual rtl::OUString SAL_CALL getTimestamp(void) - throw (uno::RuntimeException); - - protected: - - /** Destructor */ - ~KDECommonLayer(void) {} - - private : - uno::Reference m_xLayerContentDescriber ; - } ; - -#endif // KDECOMMONLAYER diff --git a/shell/source/backends/kdebe/kdeinetlayer.cxx b/shell/source/backends/kdebe/kdeinetlayer.cxx deleted file mode 100644 index 78cc0f4ba06d..000000000000 --- a/shell/source/backends/kdebe/kdeinetlayer.cxx +++ /dev/null @@ -1,254 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kdeinetlayer.cxx,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" -#include "kdeinetlayer.hxx" -#include -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_ -#include -#endif -#include - -#define COMMA ',' -#define SEMI_COLON ';' - -//============================================================================== - -KDEInetLayer::KDEInetLayer(const uno::Reference& xContext) -{ - //Create instance of LayerContentDescriber Service - rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.configuration.backend.LayerDescriber")); - - typedef uno::Reference LayerDescriber; - uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); - if( xServiceManager.is() ) - { - m_xLayerContentDescriber = LayerDescriber::query( - xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); - } - else - { - OSL_TRACE("Could not retrieve ServiceManager"); - } -} - -//------------------------------------------------------------------------------ - -void SAL_CALL KDEInetLayer::readData( const uno::Reference& xHandler) - throw ( backend::MalformedDataException, lang::NullPointerException, - lang::WrappedTargetException, uno::RuntimeException) -{ - if( ! m_xLayerContentDescriber.is() ) - { - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" - ) ), static_cast < backend::XLayer * > (this) ); - } - - uno::Sequence aPropInfoList(8); - sal_Int32 nProperties = 0; - - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: // Proxies are manually configured - setProxy(aPropInfoList, nProperties, 1, - KProtocolManager::noProxyFor(), - KProtocolManager::proxyFor( "HTTP" ), - KProtocolManager::proxyFor( "FTP" ), - KProtocolManager::proxyFor( "HTTPS" )); - break; - case KProtocolManager::PACProxy: // A proxy configuration URL has been given - case KProtocolManager::WPADProxy: // A proxy should be automatically discovered - case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables -// In such cases, the proxy address is not stored in KDE, but determined dynamically. -// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... -// The best we can do here is to ask the current value for a given address. - setProxy(aPropInfoList, nProperties, 1, - KProtocolManager::noProxyFor(), - KProtocolManager::proxyForURL( "http://www.openoffice.org" ), - KProtocolManager::proxyForURL( "ftp://ftp.openoffice.org" ), - KProtocolManager::proxyForURL( "https://www.openoffice.org" )); - break; - default: // No proxy is used - setProxy(aPropInfoList, nProperties, 0); - } - - if ( nProperties > 0 ) - { - aPropInfoList.realloc(nProperties); - m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); - } -} - -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL KDEInetLayer::getTimestamp(void) - throw (uno::RuntimeException) -{ - // Return the value as timestamp to avoid regenerating the binary cache - // on each office launch. - - QString aProxyType, aNoProxyFor, aHTTPProxy, aHTTPSProxy, aFTPProxy; - - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::ManualProxy: - aProxyType = '1'; - aNoProxyFor = KProtocolManager::noProxyFor(); - aHTTPProxy = KProtocolManager::proxyFor( "HTTP" ); - aHTTPProxy = KProtocolManager::proxyFor( "HTTPS" ); - aFTPProxy = KProtocolManager::proxyFor( "FTP" ); - break; - case KProtocolManager::PACProxy: - case KProtocolManager::WPADProxy: - case KProtocolManager::EnvVarProxy: - aProxyType = '1'; - aNoProxyFor = KProtocolManager::noProxyFor(); - aHTTPProxy = KProtocolManager::proxyForURL( "http://www.openoffice.org" ); - aHTTPSProxy = KProtocolManager::proxyForURL( "https://www.openoffice.org" ); - aFTPProxy = KProtocolManager::proxyForURL( "ftp://ftp.openoffice.org" ); - break; - default: - aProxyType = '0'; - } - - ::rtl::OUString sTimeStamp, - sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) ); - - sTimeStamp = (const sal_Unicode *) aProxyType.ucs2(); - sTimeStamp += sep; - sTimeStamp += (const sal_Unicode *) aNoProxyFor.ucs2(); - sTimeStamp += sep; - sTimeStamp += (const sal_Unicode *) aHTTPProxy.ucs2(); - sTimeStamp += sep; - sTimeStamp += (const sal_Unicode *) aHTTPSProxy.ucs2(); - sTimeStamp += sep; - sTimeStamp += (const sal_Unicode *) aFTPProxy.ucs2(); - - return sTimeStamp; -} - -//------------------------------------------------------------------------------ - -void SAL_CALL KDEInetLayer::setProxy - (uno::Sequence &aPropInfoList, sal_Int32 &nProperties, - int nProxyType, const QString &aNoProxy, const QString &aHTTPProxy, const QString &aFTPProxy, const QString &aHTTPSProxy ) const -{ - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetProxyType") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( (sal_Int32) nProxyType ); - - if (nProxyType == 0) return; - - if ( !aNoProxy.isEmpty() ) - { - QString aNoProxyFor(aNoProxy); - ::rtl::OUString sNoProxyFor; - - aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON ); - sNoProxyFor = (const sal_Unicode *) aNoProxyFor.ucs2(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetNoProxy") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sNoProxyFor ); - } - - if ( !aHTTPProxy.isEmpty() ) - { - KURL aProxy(aHTTPProxy); - ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2(); - sal_Int32 nPort = aProxy.port(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyName") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sProxy ); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyPort") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( nPort ); - } - - if ( !aHTTPSProxy.isEmpty() ) - { - KURL aProxy(aHTTPSProxy); - ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2(); - sal_Int32 nPort = aProxy.port(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyName") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sProxy ); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyPort") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( nPort ); - } - - if ( !aFTPProxy.isEmpty() ) - { - KURL aProxy(aFTPProxy); - ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2(); - sal_Int32 nPort = aProxy.port(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyName") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sProxy ); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyPort") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( nPort ); - } -} - diff --git a/shell/source/backends/kdebe/kdeinetlayer.hxx b/shell/source/backends/kdebe/kdeinetlayer.hxx deleted file mode 100644 index 7e8053a67b7b..000000000000 --- a/shell/source/backends/kdebe/kdeinetlayer.hxx +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef KDEINETLAYER_HXX_ -#define KDEINETLAYER_HXX_ - -#include "kdebackend.hxx" -#include -#include -#include -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_ -#include -#endif -#include -#include -#include - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; -namespace util = css::util ; - -/** - Implementation of the XLayer interface for the KDE values mapped into - the org.openoffice.Inet configuration component. - */ -class KDEInetLayer : public cppu::WeakImplHelper2 -{ -public : - /** - Constructor given the component context - - @param xContext The component context - */ - - KDEInetLayer(const uno::Reference& xContext); - - // XLayer - virtual void SAL_CALL readData( - const uno::Reference& xHandler) - throw ( backend::MalformedDataException, - lang::NullPointerException, - lang::WrappedTargetException, - uno::RuntimeException) ; - - // XTimeStamped - virtual rtl::OUString SAL_CALL getTimestamp(void) - throw (uno::RuntimeException); - - protected: - - /** Destructor */ - ~KDEInetLayer(void) {} - -private : - uno::Reference m_xLayerContentDescriber ; - - void SAL_CALL setProxy - (uno::Sequence &aPropInfoList, sal_Int32 &nProperties, - int nProxyType, const QString &aNoProxyfor = QString(), - const QString &aHTTPProxy = QString(), const QString &aFTPProxy = QString(), const QString &aHTTPSProxy = QString()) const; - } ; - -#endif // KDEINETLAYER diff --git a/shell/source/backends/kdebe/kdepathslayer.cxx b/shell/source/backends/kdebe/kdepathslayer.cxx deleted file mode 100644 index 34d85ee93d6d..000000000000 --- a/shell/source/backends/kdebe/kdepathslayer.cxx +++ /dev/null @@ -1,121 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kdepathslayer.cxx,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" -#include "kdepathslayer.hxx" -#include -#include -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_ -#include -#endif -#include -#include -#include - -#define SPACE ' ' - -//============================================================================== - -KDEPathsLayer::KDEPathsLayer(const uno::Reference& xContext) -{ - //Create instance of LayerContentDescriber Service - rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.configuration.backend.LayerDescriber")); - - typedef uno::Reference LayerDescriber; - uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); - if( xServiceManager.is() ) - { - m_xLayerContentDescriber = LayerDescriber::query( - xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); - } - else - { - OSL_TRACE("Could not retrieve ServiceManager"); - } -} - -//------------------------------------------------------------------------------ - -void SAL_CALL KDEPathsLayer::readData( const uno::Reference& xHandler) - throw ( backend::MalformedDataException, lang::NullPointerException, - lang::WrappedTargetException, uno::RuntimeException) -{ - if( ! m_xLayerContentDescriber.is() ) - { - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" - ) ), static_cast < backend::XLayer * > (this) ); - } - - uno::Sequence aPropInfoList(1); - sal_Int32 nProperties = 0; - - QString aDocumentsDir( KGlobalSettings::documentPath() ); - rtl::OUString sDocumentsDir; - rtl::OUString sDocumentsURL; - if ( aDocumentsDir.endsWith(QChar('/')) ) - aDocumentsDir.truncate ( aDocumentsDir.length() - 1 ); - sDocumentsDir = (const sal_Unicode *) aDocumentsDir.ucs2(); - osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData ); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Paths/Variables/Work") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sDocumentsURL ); - - if( nProperties > 0 ) - { - aPropInfoList.realloc(nProperties); - m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); - } -} - -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL KDEPathsLayer::getTimestamp(void) - throw (uno::RuntimeException) -{ - // Return the value as timestamp to avoid regenerating the binary cache - // on each office launch. - - ::rtl::OUString sTimeStamp, - sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) ); - - QString aDocumentsDir; - aDocumentsDir = KGlobalSettings::documentPath(); - - sTimeStamp += (const sal_Unicode *) aDocumentsDir.ucs2(); - - return sTimeStamp; -} diff --git a/shell/source/backends/kdebe/kdepathslayer.hxx b/shell/source/backends/kdebe/kdepathslayer.hxx deleted file mode 100644 index 5a3b365be277..000000000000 --- a/shell/source/backends/kdebe/kdepathslayer.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kdepathslayer.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef KDEPATHSLAYER_HXX_ -#define KDEPATHSLAYER_HXX_ - -#include "kdebackend.hxx" -#include -#include -#include -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_ -#include -#endif -#include -#include - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; -namespace util = css::util ; - -/** - Implementation of the XLayer interface for the KDE values mapped into - the org.openoffice.Office.Paths configuration component. - */ -class KDEPathsLayer : public cppu::WeakImplHelper2 -{ -public : - /** - Constructor given the component context - - @param xContext The component context - */ - - KDEPathsLayer(const uno::Reference& xContext); - - // XLayer - virtual void SAL_CALL readData( - const uno::Reference& xHandler) - throw ( backend::MalformedDataException, - lang::NullPointerException, - lang::WrappedTargetException, - uno::RuntimeException) ; - - // XTimeStamped - virtual rtl::OUString SAL_CALL getTimestamp(void) - throw (uno::RuntimeException); - - protected: - - /** Destructor */ - ~KDEPathsLayer(void) {} - - private : - uno::Reference m_xLayerContentDescriber ; - } ; - -#endif // KDEPATHSLAYER diff --git a/shell/source/backends/kdebe/kdevcllayer.cxx b/shell/source/backends/kdebe/kdevcllayer.cxx deleted file mode 100644 index d657ea5054a6..000000000000 --- a/shell/source/backends/kdebe/kdevcllayer.cxx +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kdevcllayer.cxx,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" -#include "kdevcllayer.hxx" -#include -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_ -#include -#endif -#include -#include - -//============================================================================== - -KDEVCLLayer::KDEVCLLayer(const uno::Reference& xContext) -{ - //Create instance of LayerContentDescriber Service - rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.configuration.backend.LayerDescriber")); - - typedef uno::Reference LayerDescriber; - uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); - if( xServiceManager.is() ) - { - m_xLayerContentDescriber = LayerDescriber::query( - xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); - } - else - { - OSL_TRACE("Could not retrieve ServiceManager"); - } -} - -//------------------------------------------------------------------------------ - -void SAL_CALL KDEVCLLayer::readData( const uno::Reference& xHandler) - throw ( backend::MalformedDataException, lang::NullPointerException, - lang::WrappedTargetException, uno::RuntimeException) -{ - if( ! m_xLayerContentDescriber.is() ) - { - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" - ) ), static_cast < backend::XLayer * > (this) ); - } - - uno::Sequence aPropInfoList(1); - -/* - Commenting out, does not make much sense without an accessibility bridge -=========================================================================== -#if defined(QT_ACCESSIBILITY_SUPPORT) -// Accessibility tools under Qt for UNIX are available starting with Qt 4.0 - int nVersionMajor = 0; - const char *q = qVersion(); // "3.1.0" for example - while ('0' <= *q && *q <= '9') - nVersionMajor = nVersionMajor * 10 + *q++ - '0'; - sal_Bool ATToolSupport = (sal_Bool) (nVersionMajor >= 4); -#else - sal_Bool ATToolSupport = sal_False; -#endif -=========================================================================== - End of commented out section -*/ sal_Bool ATToolSupport = sal_False; - - aPropInfoList[0].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.VCL/Settings/Accessibility/EnableATToolSupport") ); - aPropInfoList[0].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[0].Protected = sal_False; - aPropInfoList[0].Value = uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) ); - - m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); -} - -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL KDEVCLLayer::getTimestamp(void) - throw (uno::RuntimeException) -{ - // Return the value as timestamp to avoid regenerating the binary cache - // on each office launch. - - ::rtl::OUString sTimeStamp( - RTL_CONSTASCII_USTRINGPARAM( "FALSE" ) ); - - return sTimeStamp; -} diff --git a/shell/source/backends/kdebe/kdevcllayer.hxx b/shell/source/backends/kdebe/kdevcllayer.hxx deleted file mode 100644 index 4b3a50e5c4c8..000000000000 --- a/shell/source/backends/kdebe/kdevcllayer.hxx +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef KDEVCLLAYER_HXX_ -#define KDEVCLLAYER_HXX_ - -#include "kdebackend.hxx" -#include -#include -#include -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_ -#include -#endif -#include -#include - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; -namespace util = css::util ; - -/** - Implementation of the XLayer interface for the KDE values mapped into - the org.openoffice.VCL configuration component. - */ -class KDEVCLLayer : public cppu::WeakImplHelper2 -{ -public : - /** - Constructor given the component context - - @param xContext The component context - */ - - KDEVCLLayer(const uno::Reference& xContext); - - // XLayer - virtual void SAL_CALL readData( - const uno::Reference& xHandler) - throw ( backend::MalformedDataException, - lang::NullPointerException, - lang::WrappedTargetException, - uno::RuntimeException) ; - - // XTimeStamped - virtual rtl::OUString SAL_CALL getTimestamp(void) - throw (uno::RuntimeException); - - protected: - - /** Destructor */ - ~KDEVCLLayer(void) {} - - private : - uno::Reference m_xLayerContentDescriber ; - } ; - -#endif // KDEVCLLAYER diff --git a/shell/source/backends/kdebe/makefile.mk b/shell/source/backends/kdebe/makefile.mk index 8bc0b475be8e..289cf8263d14 100644 --- a/shell/source/backends/kdebe/makefile.mk +++ b/shell/source/backends/kdebe/makefile.mk @@ -35,11 +35,7 @@ TARGET=kdebe LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE - -COMP1TYPELIST=$(TARGET) -COMPRDB=$(SOLARBINDIR)$/types.rdb -UNOUCROUT=$(OUT)$/inc$/$(TARGET) -INCPRE=$(UNOUCROUT) +VISIBILITY_HIDDEN=TRUE # --- Settings --- @@ -64,12 +60,8 @@ CFLAGS+=$(KDE_CFLAGS) # --- Files --- SLOFILES=\ - $(SLO)$/kdebackend.obj \ - $(SLO)$/kdecommonlayer.obj \ - $(SLO)$/kdeinetlayer.obj \ - $(SLO)$/kdevcllayer.obj \ - $(SLO)$/kdepathslayer.obj \ - $(SLO)$/kdebecdef.obj + $(SLO)$/kdeaccess.obj \ + $(SLO)$/kdebackend.obj SHL1NOCHECK=TRUE SHL1TARGET=$(TARGET)1.uno @@ -82,8 +74,7 @@ SHL1STDLIBS= \ $(CPPULIB) \ $(SALLIB) \ $(KDE_LIBS) -lkio - -SHL1VERSIONMAP=exports.map + SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/shell/source/backends/localebe/localebe.xml b/shell/source/backends/localebe/localebe.xml index fb6823b43a05..3c22a4970881 100644 --- a/shell/source/backends/localebe/localebe.xml +++ b/shell/source/backends/localebe/localebe.xml @@ -10,7 +10,6 @@ c++ com.sun.star.comp.configuration.backend.LocaleBackend - com.sun.star.comp.configuration.backend.PlatformBackend ... com.sun.star.configuration.backend.XBackendChangesListener com.sun.star.configuration.backend.XBackendChangesNotifier diff --git a/shell/source/backends/macbe/macbackend.cxx b/shell/source/backends/macbe/macbackend.cxx index 06589e4d6574..f532e943e9c7 100644 --- a/shell/source/backends/macbe/macbackend.cxx +++ b/shell/source/backends/macbe/macbackend.cxx @@ -31,18 +31,139 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_shell.hxx" +// For MAXHOSTNAMELEN constant +#include + +#include +#include +#include +#include + #include "macbackend.hxx" -#include "macbelayer.hxx" -#include -#include -#define MACBE_INET_COMPONENT "org.openoffice.Inet" -#define MACBE_PATHS_COMPONENT "org.openoffice.Office.Paths" +#include "rtl/ustrbuf.hxx" +#include "osl/file.h" + +#define SPACE ' ' +#define SEMI_COLON ';' + +typedef struct +{ + rtl::OUString Server; + sal_Int32 Port; +} ProxyEntry; + +typedef enum { + sHTTP, + sHTTPS, + sFTP +} ServiceType; + +//------------------------------------------------------------------------ +// helper functions +//------------------------------------------------------------------------ + +namespace // private +{ + +/* + * Returns current proxy settings for selected service type (HTTP or + * FTP) as a C string (in the buffer specified by host and hostSize) + * and a port number. + */ + +bool GetProxySetting(ServiceType sType, char *host, size_t hostSize, UInt16 *port) +{ + bool result; + CFDictionaryRef proxyDict; + CFNumberRef enableNum; + int enable; + CFStringRef hostStr; + CFNumberRef portNum; + int portInt; + + proxyDict = SCDynamicStoreCopyProxies(NULL); + + if (!proxyDict) + return false; + + CFStringRef proxiesEnable; + CFStringRef proxiesProxy; + CFStringRef proxiesPort; + + switch ( sType ) + { + case sHTTP : proxiesEnable = kSCPropNetProxiesHTTPEnable; + proxiesProxy = kSCPropNetProxiesHTTPProxy; + proxiesPort = kSCPropNetProxiesHTTPPort; + break; + case sHTTPS: proxiesEnable = kSCPropNetProxiesHTTPSEnable; + proxiesProxy = kSCPropNetProxiesHTTPSProxy; + proxiesPort = kSCPropNetProxiesHTTPSPort; + break; + default: proxiesEnable = kSCPropNetProxiesFTPEnable; + proxiesProxy = kSCPropNetProxiesFTPProxy; + proxiesPort = kSCPropNetProxiesFTPPort; + break; + } + // Proxy enabled? + enableNum = (CFNumberRef) CFDictionaryGetValue( proxyDict, + proxiesEnable ); + + result = (enableNum != NULL) && (CFGetTypeID(enableNum) == CFNumberGetTypeID()); + + if (result) + result = CFNumberGetValue(enableNum, kCFNumberIntType, &enable) && (enable != 0); + + // Proxy enabled -> get hostname + if (result) + { + hostStr = (CFStringRef) CFDictionaryGetValue( proxyDict, + proxiesProxy ); + + result = (hostStr != NULL) && (CFGetTypeID(hostStr) == CFStringGetTypeID()); + } + + if (result) + result = CFStringGetCString(hostStr, host, (CFIndex) hostSize, kCFStringEncodingASCII); + + // Get proxy port + if (result) + { + portNum = (CFNumberRef) CFDictionaryGetValue( proxyDict, + proxiesPort ); + + result = (portNum != NULL) && (CFGetTypeID(portNum) == CFNumberGetTypeID()); + } + else + { + CFRelease(proxyDict); + return false; + } + + if (result) + result = CFNumberGetValue(portNum, kCFNumberIntType, &portInt); + + if (result) + *port = (UInt16) portInt; + + if (proxyDict) + CFRelease(proxyDict); + + if (!result) + { + *host = 0; + *port = 0; + } + + return result; +} + +} // end private namespace + +//------------------------------------------------------------------------------ -MacOSXBackend::MacOSXBackend(const uno::Reference& xContext) - throw (backend::BackendAccessException) : - ::cppu::WeakImplHelper2 < backend::XSingleLayerStratum, lang::XServiceInfo > (), - m_xContext(xContext) +MacOSXBackend::MacOSXBackend() { } @@ -54,46 +175,293 @@ MacOSXBackend::~MacOSXBackend(void) //------------------------------------------------------------------------------ -MacOSXBackend* MacOSXBackend::createInstance(const uno::Reference& xContext) +MacOSXBackend* MacOSXBackend::createInstance() { - return new MacOSXBackend(xContext); + return new MacOSXBackend; } // --------------------------------------------------------------------------------------- -uno::Reference SAL_CALL MacOSXBackend::getLayer(const rtl::OUString& aComponent, const rtl::OUString& /*aTimestamp*/) - throw (backend::BackendAccessException, lang::IllegalArgumentException) +rtl::OUString CFStringToOUString(const CFStringRef sOrig) { + CFRetain(sOrig); + + CFIndex nStringLen = CFStringGetLength(sOrig)+1; + + // Allocate a c string buffer + char sBuffer[nStringLen]; + + CFStringGetCString(sOrig, sBuffer, nStringLen, kCFStringEncodingASCII); + + CFRelease(sOrig); + + return rtl::OUString::createFromAscii((sal_Char*)sBuffer); +} + +rtl::OUString GetOUString( NSString* pStr ) { - if( aComponent.equalsAscii( MACBE_INET_COMPONENT ) ) - { - if( ! m_xSystemLayer.is() ) - m_xSystemLayer = new MacOSXLayer( m_xContext ); + if( ! pStr ) + return rtl::OUString(); + int nLen = [pStr length]; + if( nLen == 0 ) + return rtl::OUString(); + + rtl::OUStringBuffer aBuf( nLen+1 ); + aBuf.setLength( nLen ); + [pStr getCharacters: const_cast(aBuf.getStr())]; + return aBuf.makeStringAndClear(); +} - return m_xSystemLayer; - } - else if( aComponent.equalsAscii( MACBE_PATHS_COMPONENT ) ) - { - if( ! m_xPathLayer.is() ) - m_xPathLayer = new MacOSXPathLayer( m_xContext ); - return m_xPathLayer; - } +css::uno::Type MacOSXBackend::getElementType() throw(css::uno::RuntimeException) +{ + return cppu::UnoType< cppu::UnoVoidType >::get(); +} - return uno::Reference(); +sal_Bool MacOSXBackend::hasElements() throw(css::uno::RuntimeException) +{ + return true; } -//------------------------------------------------------------------------------ +css::uno::Any MacOSXBackend::getByName(rtl::OUString const & aName) + throw ( + css::container::NoSuchElementException, + css::lang::WrappedTargetException, css::uno::RuntimeException) +{ + if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("WorkPathVariable"))) { + rtl::OUString aDocDir; + NSArray* pPaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, true ); + if( pPaths && [pPaths count] > 0 ) + { + aDocDir = GetOUString( [pPaths objectAtIndex: 0] ); + + rtl::OUString aDocURL; + if( aDocDir.getLength() > 0 && + osl_getFileURLFromSystemPath( aDocDir.pData, &aDocURL.pData ) == osl_File_E_None ) + { + return css::uno::makeAny(aDocURL); + } + else + { + OSL_TRACE( "user documents list contains empty file path or conversion failed" ); + } + } + else + { + OSL_TRACE( "Got nil or empty list of user document directories" ); + } + return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName"))) + { + ProxyEntry aFtpProxy; + + char host[MAXHOSTNAMELEN]; + UInt16 port; + bool retVal; + + retVal = GetProxySetting(sFTP, host, 100, &port); + + if (retVal) + { + aFtpProxy.Server = rtl::OUString::createFromAscii( host ); + } + + // ftp proxy name + if( aFtpProxy.Server.getLength() > 0 ) + { + return uno::makeAny( aFtpProxy.Server ); + } + return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort"))) + { + ProxyEntry aFtpProxy; + + char host[MAXHOSTNAMELEN]; + UInt16 port; + bool retVal; + + retVal = GetProxySetting(sFTP, host, 100, &port); + + if (retVal) + { + aFtpProxy.Port = port; + } + + // ftp proxy port + if( aFtpProxy.Port > 0 ) + { + return uno::makeAny( aFtpProxy.Port ); + } + return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName"))) + { + ProxyEntry aHttpProxy; + + char host[MAXHOSTNAMELEN]; + UInt16 port; + bool retVal; + + retVal = GetProxySetting(sHTTP, host, 100, &port); + + if (retVal) + { + aHttpProxy.Server = rtl::OUString::createFromAscii( host ); + } + + // http proxy name + if( aHttpProxy.Server.getLength() > 0 ) + { + return uno::makeAny( aHttpProxy.Server ); + } + return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort"))) + { + ProxyEntry aHttpProxy; + + char host[MAXHOSTNAMELEN]; + UInt16 port; + bool retVal; + + retVal = GetProxySetting(sHTTP, host, 100, &port); + + if (retVal) + { + aHttpProxy.Port = port; + } + + // http proxy port + if( aHttpProxy.Port > 0 ) + { + return uno::makeAny( aHttpProxy.Port ); + } + return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName"))) + { + ProxyEntry aHttpsProxy; + + char host[MAXHOSTNAMELEN]; + UInt16 port; + bool retVal; + + retVal = GetProxySetting(sHTTPS, host, 100, &port); + + if (retVal) + { + aHttpsProxy.Server = rtl::OUString::createFromAscii( host ); + } + + // https proxy name + if( aHttpsProxy.Server.getLength() > 0 ) + { + return uno::makeAny( aHttpsProxy.Server ); + } + return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort"))) + { + ProxyEntry aHttpsProxy; + + char host[MAXHOSTNAMELEN]; + UInt16 port; + bool retVal; + + retVal = GetProxySetting(sHTTPS, host, 100, &port); + + if (retVal) + { + aHttpsProxy.Port = port; + } + + // https proxy port + if( aHttpsProxy.Port > 0 ) + { + return uno::makeAny( aHttpsProxy.Port ); + } + return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"))) + { + // override default for ProxyType, which is "0" meaning "No proxies". + sal_Int32 nProperties = 1; + return uno::makeAny( nProperties ); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"))) + { + rtl::OUString aProxyBypassList; + + CFArrayRef rExceptionsList; + CFDictionaryRef rProxyDict = SCDynamicStoreCopyProxies(NULL); + + if (!rProxyDict) + rExceptionsList = false; + else + rExceptionsList = (CFArrayRef) CFDictionaryGetValue(rProxyDict, kSCPropNetProxiesExceptionsList); + + if (rExceptionsList) + { + for (CFIndex idx = 0; idx < CFArrayGetCount(rExceptionsList); idx++) + { + CFStringRef rException = (CFStringRef) CFArrayGetValueAtIndex(rExceptionsList, idx); + + if (idx>0) + aProxyBypassList += rtl::OUString::createFromAscii( ";" ); + + aProxyBypassList += CFStringToOUString(rException); + } + } + + if (rProxyDict) + CFRelease(rProxyDict); + + // fill proxy bypass list + if( aProxyBypassList.getLength() > 0 ) + { + return uno::makeAny( aProxyBypassList.replace( SPACE, SEMI_COLON ) ); + } + return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else { + throw css::container::NoSuchElementException( + aName, static_cast< cppu::OWeakObject * >(this)); + } +} -uno::Reference SAL_CALL - MacOSXBackend::getUpdatableLayer(const rtl::OUString& /*aComponent*/) - throw (backend::BackendAccessException,lang::NoSupportException, - lang::IllegalArgumentException) +css::uno::Sequence< rtl::OUString > MacOSXBackend::getElementNames() + throw (css::uno::RuntimeException) { - throw lang::NoSupportException( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "MacOSXBackend: No Update Operation allowed, Read Only access") ), - *this); + css::uno::Sequence< rtl::OUString > names(9); + names[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkPathVariable")); + names[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName")); + names[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort")); + names[3] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName")); + names[4] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort")); + names[5] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName")); + names[6] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort")); + names[7] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy")); + names[8] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType")); + return names; +} - return NULL; +sal_Bool MacOSXBackend::hasByName(rtl::OUString const & aName) + throw (css::uno::RuntimeException) +{ + return aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")) || + aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")) || + aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetProxyType")); } //------------------------------------------------------------------------------ @@ -115,9 +483,8 @@ rtl::OUString SAL_CALL MacOSXBackend::getImplementationName(void) uno::Sequence SAL_CALL MacOSXBackend::getBackendServiceNames(void) { - uno::Sequence aServiceNameList(2); + uno::Sequence aServiceNameList(1); aServiceNameList[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.MacOSXBackend")); - aServiceNameList[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.PlatformBackend")); return aServiceNameList; } @@ -143,15 +510,3 @@ uno::Sequence SAL_CALL MacOSXBackend::getSupportedServiceNames(vo { return getBackendServiceNames(); } - -// --------------------------------------------------------------------------------------- - -uno::Sequence SAL_CALL MacOSXBackend::getSupportedComponents(void) -{ - uno::Sequence aSupportedComponentList(2); - aSupportedComponentList[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( MACBE_INET_COMPONENT ) ); - aSupportedComponentList[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( MACBE_PATHS_COMPONENT ) ); - - return aSupportedComponentList; -} - diff --git a/shell/source/backends/macbe/macbackend.hxx b/shell/source/backends/macbe/macbackend.hxx index c25fe4296c0e..cd15aa83e11a 100644 --- a/shell/source/backends/macbe/macbackend.hxx +++ b/shell/source/backends/macbe/macbackend.hxx @@ -31,10 +31,8 @@ #ifndef _MACBACKEND_HXX_ #define _MACBACKEND_HXX_ -#include -#include +#include #include -#include #include #include @@ -44,18 +42,13 @@ namespace css = com::sun::star; namespace uno = css::uno; namespace lang = css::lang; -namespace backend = css::configuration::backend; - -/** - Implements the SingleLayerStratum service. - */ -class MacOSXBackend : public ::cppu::WeakImplHelper2 +class MacOSXBackend : public ::cppu::WeakImplHelper2 { public: - static MacOSXBackend* createInstance(const uno::Reference& xContext); + static MacOSXBackend* createInstance(); // XServiceInfo virtual rtl::OUString SAL_CALL getImplementationName() @@ -81,19 +74,27 @@ public: */ static uno::Sequence SAL_CALL getBackendServiceNames(void); - /** - Provides the supported component nodes + //XNameAccess + virtual uno::Type SAL_CALL + getElementType() + throw (uno::RuntimeException); - @return supported component nodes - */ - static uno::Sequence SAL_CALL getSupportedComponents(void); + virtual sal_Bool SAL_CALL + hasElements() + throw (uno::RuntimeException); + + virtual uno::Any SAL_CALL + getByName( const rtl::OUString& aName ) + throw (css::container::NoSuchElementException, + lang::WrappedTargetException, uno::RuntimeException); - // XSingleLayerStratum - virtual uno::Reference SAL_CALL getLayer(const rtl::OUString& aLayerId, const rtl::OUString& aTimestamp) - throw (backend::BackendAccessException, lang::IllegalArgumentException); + virtual uno::Sequence SAL_CALL + getElementNames() + throw (uno::RuntimeException); - virtual uno::Reference SAL_CALL getUpdatableLayer(const rtl::OUString& aLayerId) - throw (backend::BackendAccessException, lang::NoSupportException, lang::IllegalArgumentException); + virtual sal_Bool SAL_CALL + hasByName( const rtl::OUString& aName ) + throw (uno::RuntimeException); protected: @@ -102,18 +103,10 @@ protected: @param xContext component context */ - MacOSXBackend(const uno::Reference& xContext) - throw (backend::BackendAccessException); + MacOSXBackend(); /** Destructor */ ~MacOSXBackend(void); - -private: - - uno::Reference m_xContext; - uno::Reference m_xSystemLayer; - uno::Reference m_xPathLayer; - }; #endif // _MACBACKEND_HXX_ diff --git a/shell/source/backends/macbe/macbe.xml b/shell/source/backends/macbe/macbe.xml index 85854250cfe3..7cee5bb14de5 100644 --- a/shell/source/backends/macbe/macbe.xml +++ b/shell/source/backends/macbe/macbe.xml @@ -10,7 +10,6 @@ c++ com.sun.star.comp.configuration.backend.MacOSXBackend - com.sun.star.comp.configuration.backend.PlatformBackend ... com.sun.star.configuration.backend.XBackendChangesListener com.sun.star.configuration.backend.XBackendChangesNotifier diff --git a/shell/source/backends/macbe/macbecdef.cxx b/shell/source/backends/macbe/macbecdef.cxx index 22698eb91ec5..ef1d8a7e2382 100644 --- a/shell/source/backends/macbe/macbecdef.cxx +++ b/shell/source/backends/macbe/macbecdef.cxx @@ -42,14 +42,13 @@ namespace css = com::sun::star; namespace uno = css::uno; namespace lang = css::lang; -namespace backend = css::configuration::backend; //------------------------------------------------------------------------------ static uno::Reference SAL_CALL createMacOSXBackend( - const uno::Reference& xContext) + const uno::Reference&) { - return * MacOSXBackend::createInstance(xContext); + return * MacOSXBackend::createInstance(); } //------------------------------------------------------------------------------ @@ -77,41 +76,9 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( //------------------------------------------------------------------------------ -extern "C" sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/, void *pRegistryKey) { - - using namespace ::com::sun::star::registry; - if (pRegistryKey) - { - try - { - uno::Reference< XRegistryKey > xImplKey = static_cast< XRegistryKey* >( pRegistryKey )->createKey( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + MacOSXBackend::getBackendName() - ); - - // Register associated service names - uno::Reference< XRegistryKey > xServicesKey = xImplKey->createKey( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES") ) - ); - - uno::Sequence sServiceNames = MacOSXBackend::getBackendServiceNames(); - for (sal_Int32 i = 0; i < sServiceNames.getLength(); ++ i) - xServicesKey->createKey(sServiceNames[i]); - - // Register supported components - uno::Reference xComponentKey = xImplKey->createKey( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/DATA/SupportedComponents") ) - ); - - xComponentKey->setAsciiListValue( MacOSXBackend::getSupportedComponents() ); - - return sal_True; - } - catch( InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "InvalidRegistryException caught"); - } - } - return sal_False; +extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void *pRegistryKey) { + return cppu::component_writeInfoHelper( + pServiceManager, pRegistryKey, kImplementations_entries); } //------------------------------------------------------------------------------ diff --git a/shell/source/backends/macbe/makefile.mk b/shell/source/backends/macbe/makefile.mk index c8f6891d6f87..e2cfd3b3b211 100644 --- a/shell/source/backends/macbe/makefile.mk +++ b/shell/source/backends/macbe/makefile.mk @@ -58,8 +58,7 @@ CFLAGSCXX+=$(OBJCXXFLAGS) SLOFILES= \ $(SLO)$/macbecdef.obj \ - $(SLO)$/macbackend.obj \ - $(SLO)$/macbelayer.obj + $(SLO)$/macbackend.obj SHL1TARGET=$(TARGET)1.uno SHL1OBJS=$(SLOFILES) diff --git a/shell/source/backends/wininetbe/makefile.mk b/shell/source/backends/wininetbe/makefile.mk index be43ecaded36..b26e3a252185 100644 --- a/shell/source/backends/wininetbe/makefile.mk +++ b/shell/source/backends/wininetbe/makefile.mk @@ -50,9 +50,8 @@ DLLPRE = SLOFILES=\ $(SLO)$/wininetbecdef.obj \ - $(SLO)$/wininetbackend.obj \ - $(SLO)$/wininetlayer.obj - + $(SLO)$/wininetbackend.obj + SHL1TARGET=$(TARGET)1.uno SHL1OBJS=$(SLOFILES) SHL1DEF=$(MISC)$/$(SHL1TARGET).def diff --git a/shell/source/backends/wininetbe/wininetbackend.cxx b/shell/source/backends/wininetbe/wininetbackend.cxx index 018560f4f762..344eefa1a08d 100644 --- a/shell/source/backends/wininetbe/wininetbackend.cxx +++ b/shell/source/backends/wininetbe/wininetbackend.cxx @@ -31,76 +31,379 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_shell.hxx" +#include "rtl/ustrbuf.hxx" + #include "wininetbackend.hxx" -#include "wininetlayer.hxx" -#include -#include + +#if defined _MSC_VER +#pragma warning(push, 1) +#endif +#include +#include +#if defined _MSC_VER +#pragma warning(pop) +#endif #define WININET_DLL_NAME "wininet.dll" +#define EQUAL_SIGN '=' +#define COLON ':' +#define SPACE ' ' +#define SEMI_COLON ';' + +namespace { + +struct Library { + HMODULE module; + + Library(HMODULE theModule): module(theModule) {} + + ~Library() { if (module) FreeLibrary(module); } +}; + +} -WinInetBackend::WinInetBackend(const uno::Reference& xContext) - throw (backend::BackendAccessException) : - ::cppu::WeakImplHelper2 < backend::XSingleLayerStratum, lang::XServiceInfo > (), - m_xContext(xContext) +typedef struct { - m_hWinInetDll = LoadLibrary( WININET_DLL_NAME ); + rtl::OUString Server; + rtl::OUString Port; +} ProxyEntry; + +//------------------------------------------------------------------------ +// helper functions +//------------------------------------------------------------------------ + +namespace // private +{ + ProxyEntry ReadProxyEntry(const rtl::OUString& aProxy, sal_Int32& i) + { + ProxyEntry aProxyEntry; + + aProxyEntry.Server = aProxy.getToken( 0, COLON, i ); + if ( i > -1 ) + aProxyEntry.Port = aProxy.getToken( 0, COLON, i ); + + return aProxyEntry; + } + + ProxyEntry FindProxyEntry(const rtl::OUString& aProxyList, const rtl::OUString& aType) + { + sal_Int32 nIndex = 0; + + do + { + // get the next token, e.g. ftp=server:port + rtl::OUString nextToken = aProxyList.getToken( 0, SPACE, nIndex ); + + // split the next token again into the parts separated + // through '=', e.g. ftp=server:port -> ftp and server:port + sal_Int32 i = 0; + if( nextToken.indexOf( EQUAL_SIGN ) > -1 ) + { + if( aType.equals( nextToken.getToken( 0, EQUAL_SIGN, i ) ) ) + return ReadProxyEntry(nextToken, i); + } + else if( aType.getLength() == 0) + return ReadProxyEntry(nextToken, i); + + } while ( nIndex >= 0 ); + + return ProxyEntry(); + } + +} // end private namespace + +//------------------------------------------------------------------------------ + +WinInetBackend::WinInetBackend(): + hasProxyType_(false), hasNoProxy_(false), hasHttpProxyName_(false), + hasHttpProxyPort_(false), hasHttpsProxyName_(false), + hasHttpsProxyPort_(false), hasFtpProxyName_(false), hasFtpProxyPort_(false) +{ + Library hWinInetDll( LoadLibrary( WININET_DLL_NAME ) ); + if( hWinInetDll.module ) + { + typedef BOOL ( WINAPI *InternetQueryOption_Proc_T )( HINTERNET, DWORD, LPVOID, LPDWORD ); + + InternetQueryOption_Proc_T lpfnInternetQueryOption = + reinterpret_cast< InternetQueryOption_Proc_T >( + GetProcAddress( hWinInetDll.module, "InternetQueryOptionA" ) ); + if (lpfnInternetQueryOption) + { + LPINTERNET_PROXY_INFO lpi = NULL; + + // query for the neccessary space + DWORD dwLength = 0; + BOOL bRet = lpfnInternetQueryOption( + NULL, + INTERNET_OPTION_PROXY, + (LPVOID)lpi, + &dwLength ); + + // allocate sufficient space on the heap + // insufficient space on the heap results + // in a stack overflow exception, we assume + // this never happens, because of the relatively + // small amount of memory we need + // _alloca is nice because it is fast and we don't + // have to free the allocated memory, it will be + // automatically done + lpi = reinterpret_cast< LPINTERNET_PROXY_INFO >( + _alloca( dwLength ) ); + + bRet = lpfnInternetQueryOption( + NULL, + INTERNET_OPTION_PROXY, + (LPVOID)lpi, + &dwLength ); + + // if a proxy is disabled, InternetQueryOption returns + // an empty proxy list, so we don't have to check if + // proxy is enabled or not + + rtl::OUString aProxyList = rtl::OUString::createFromAscii( lpi->lpszProxy ); + rtl::OUString aProxyBypassList = rtl::OUString::createFromAscii( lpi->lpszProxyBypass ); + + // override default for ProxyType, which is "0" meaning "No proxies". + sal_Int32 nProperties = 1; + + valueProxyType_ = nProperties; + hasProxyType_ = true; + + // fill proxy bypass list + if( aProxyBypassList.getLength() > 0 ) + { + rtl::OUStringBuffer aReverseList; + sal_Int32 nIndex = 0; + do + { + rtl::OUString aToken = aProxyBypassList.getToken( 0, SPACE, nIndex ); + if ( aProxyList.indexOf( aToken ) == -1 ) + { + if ( aReverseList.getLength() ) + { + aReverseList.insert( 0, sal_Unicode( SEMI_COLON ) ); + aReverseList.insert( 0, aToken ); + } + else + aReverseList = aToken; + } + } + while ( nIndex >= 0 ); + + aProxyBypassList = aReverseList.makeStringAndClear(); + + valueNoProxy_ = aProxyBypassList.replace( SPACE, SEMI_COLON ); + hasNoProxy_ = true; + } + + if( aProxyList.getLength() > 0 ) + { + //------------------------------------------------- + // this implementation follows the algorithm + // of the internet explorer + // if there are type-dependent proxy settings + // and type independent proxy settings in the + // registry the internet explorer chooses the + // type independent proxy for all settings + // e.g. imagine the following registry entry + // ftp=server:port;http=server:port;server:port + // the last token server:port is type independent + // so the ie chooses this proxy server + + // if there is no port specified for a type independent + // server the ie uses the port of an http server if + // there is one and it has a port + //------------------------------------------------- + + ProxyEntry aTypeIndepProxy = FindProxyEntry( aProxyList, rtl::OUString()); + ProxyEntry aHttpProxy = FindProxyEntry( aProxyList, rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "http" ) ) ); + ProxyEntry aHttpsProxy = FindProxyEntry( aProxyList, rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "https" ) ) ); + + ProxyEntry aFtpProxy = FindProxyEntry( aProxyList, rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "ftp" ) ) ); + + if( aTypeIndepProxy.Server.getLength() ) + { + aHttpProxy.Server = aTypeIndepProxy.Server; + aHttpsProxy.Server = aTypeIndepProxy.Server; + aFtpProxy.Server = aTypeIndepProxy.Server; + + if( aTypeIndepProxy.Port.getLength() ) + { + aHttpProxy.Port = aTypeIndepProxy.Port; + aHttpsProxy.Port = aTypeIndepProxy.Port; + aFtpProxy.Port = aTypeIndepProxy.Port; + } + else + { + aFtpProxy.Port = aHttpProxy.Port; + aHttpsProxy.Port = aHttpProxy.Port; + } + } + + // http proxy name + if( aHttpProxy.Server.getLength() > 0 ) + { + valueHttpProxyName_ = aHttpProxy.Server; + hasHttpProxyName_ = true; + } + + // http proxy port + if( aHttpProxy.Port.getLength() > 0 ) + { + valueHttpProxyPort_ = aHttpProxy.Port.toInt32(); + hasHttpProxyPort_ = true; + } + + // https proxy name + if( aHttpsProxy.Server.getLength() > 0 ) + { + valueHttpsProxyName_ = aHttpsProxy.Server; + valueHttpsProxyPort_ = true; + } + + // https proxy port + if( aHttpsProxy.Port.getLength() > 0 ) + { + valueHttpsProxyPort_ = aHttpsProxy.Port.toInt32(); + hasHttpsProxyPort_ = true; + } + + // ftp proxy name + if( aFtpProxy.Server.getLength() > 0 ) + { + valueFtpProxyName_ = aFtpProxy.Server; + hasFtpProxyName_ = true; + } + + // ftp proxy port + if( aFtpProxy.Port.getLength() > 0 ) + { + valueFtpProxyPort_ = aFtpProxy.Port.toInt32(); + hasFtpProxyPort_ = true; + } + } + } + } } //------------------------------------------------------------------------------ WinInetBackend::~WinInetBackend(void) { - if ( m_hWinInetDll ) - FreeLibrary( m_hWinInetDll ); } //------------------------------------------------------------------------------ -WinInetBackend* WinInetBackend::createInstance( - const uno::Reference& xContext -) +WinInetBackend* WinInetBackend::createInstance() { - return new WinInetBackend(xContext); + return new WinInetBackend; } // --------------------------------------------------------------------------------------- -uno::Reference SAL_CALL WinInetBackend::getLayer( - const rtl::OUString& aComponent, const rtl::OUString& /*aTimestamp*/) - throw (backend::BackendAccessException, lang::IllegalArgumentException) +css::uno::Type WinInetBackend::getElementType() throw(css::uno::RuntimeException) { + return cppu::UnoType< cppu::UnoVoidType >::get(); +} - if( aComponent.equals( getSupportedComponents()[0]) ) - { - if( ! m_xSystemLayer.is() && m_hWinInetDll ) - { - WinInetLayer::InternetQueryOption_Proc_T lpfnInternetQueryOption = - reinterpret_cast< WinInetLayer::InternetQueryOption_Proc_T >( - GetProcAddress( m_hWinInetDll, "InternetQueryOptionA" ) ); - - if( lpfnInternetQueryOption ) - m_xSystemLayer = new WinInetLayer(lpfnInternetQueryOption, m_xContext); - } +sal_Bool WinInetBackend::hasElements() throw(css::uno::RuntimeException) +{ + return true; +} - return m_xSystemLayer; +css::uno::Any WinInetBackend::getByName(rtl::OUString const & aName) + throw ( + css::container::NoSuchElementException, + css::lang::WrappedTargetException, css::uno::RuntimeException) +{ + if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName"))) { + return hasFtpProxyName_ + ? uno::makeAny( valueFtpProxyName_ ) + : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort"))) + { + return hasFtpProxyPort_ + ? uno::makeAny( valueFtpProxyPort_ ) + : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName"))) + { + return hasHttpProxyName_ + ? uno::makeAny( valueHttpProxyName_ ) + : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort"))) + { + return hasHttpProxyPort_ + ? uno::makeAny( valueHttpProxyPort_ ) + : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName"))) + { + return hasHttpsProxyName_ + ? uno::makeAny( valueHttpsProxyName_ ) + : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort"))) + { + return hasHttpsProxyPort_ + ? uno::makeAny( valueHttpsProxyPort_ ) + : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"))) + { + return hasNoProxy_ + ? uno::makeAny( valueNoProxy_ ) + : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else if (aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"))) + { + return hasProxyType_ + ? uno::makeAny( valueProxyType_ ) + : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get()); + } else { + throw css::container::NoSuchElementException( + aName, static_cast< cppu::OWeakObject * >(this)); } - - return uno::Reference(); } -//------------------------------------------------------------------------------ - -uno::Reference SAL_CALL -WinInetBackend::getUpdatableLayer(const rtl::OUString& /*aComponent*/) - throw (backend::BackendAccessException,lang::NoSupportException, - lang::IllegalArgumentException) +css::uno::Sequence< rtl::OUString > WinInetBackend::getElementNames() + throw (css::uno::RuntimeException) { - throw lang::NoSupportException( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "WinInetBackend: No Update Operation allowed, Read Only access") ), - *this) ; + css::uno::Sequence< rtl::OUString > names(8); + names[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName")); + names[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort")); + names[2] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName")); + names[3] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort")); + names[4] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName")); + names[5] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort")); + names[6] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy")); + names[7] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType")); + return names; +} - return NULL; +sal_Bool WinInetBackend::hasByName(rtl::OUString const & aName) + throw (css::uno::RuntimeException) +{ + return + aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")) || + aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")) || + aName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetProxyType")); } //------------------------------------------------------------------------------ @@ -121,9 +424,8 @@ rtl::OUString SAL_CALL WinInetBackend::getImplementationName(void) uno::Sequence SAL_CALL WinInetBackend::getBackendServiceNames(void) { - uno::Sequence aServiceNameList(2); + uno::Sequence aServiceNameList(1); aServiceNameList[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.WinInetBackend")) ; - aServiceNameList[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.PlatformBackend")) ; return aServiceNameList ; } @@ -149,16 +451,3 @@ uno::Sequence SAL_CALL WinInetBackend::getSupportedServiceNames(v { return getBackendServiceNames() ; } - -// --------------------------------------------------------------------------------------- - -uno::Sequence SAL_CALL WinInetBackend::getSupportedComponents(void) -{ - uno::Sequence aSupportedComponentList(1); - aSupportedComponentList[0] = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet" ) - ); - - return aSupportedComponentList; -} - diff --git a/shell/source/backends/wininetbe/wininetbackend.hxx b/shell/source/backends/wininetbe/wininetbackend.hxx index c335fe005f12..776fdc5e9c16 100644 --- a/shell/source/backends/wininetbe/wininetbackend.hxx +++ b/shell/source/backends/wininetbe/wininetbackend.hxx @@ -31,38 +31,23 @@ #ifndef _FIXEDVALUEBACKEND_HXX_ #define _FIXEDVALUEBACKEND_HXX_ -#include -#include +#include #include #include #include #include -#if defined _MSC_VER -#pragma warning(push, 1) -#endif -#include -#include -#if defined _MSC_VER -#pragma warning(pop) -#endif - namespace css = com::sun::star ; namespace uno = css::uno ; namespace lang = css::lang ; -namespace backend = css::configuration::backend ; - -/** - Implements the SingleLayerStratum service. - */ class WinInetBackend : public ::cppu::WeakImplHelper2 < - backend::XSingleLayerStratum, + css::container::XNameAccess, lang::XServiceInfo > { public : - static WinInetBackend* createInstance(const uno::Reference& xContext); + static WinInetBackend* createInstance(); // XServiceInfo virtual rtl::OUString SAL_CALL @@ -89,43 +74,57 @@ class WinInetBackend : public ::cppu::WeakImplHelper2 < @return service names */ static uno::Sequence SAL_CALL getBackendServiceNames(void) ; - /** - Provides the supported component nodes - - @return supported component nodes - */ - static uno::Sequence SAL_CALL getSupportedComponents(void) ; - - //XSingleLayerStratum - virtual uno::Reference SAL_CALL - getLayer( const rtl::OUString& aLayerId, const rtl::OUString& aTimestamp ) - throw (backend::BackendAccessException, - lang::IllegalArgumentException) ; - - virtual uno::Reference SAL_CALL - getUpdatableLayer( const rtl::OUString& aLayerId ) - throw (backend::BackendAccessException, - lang::NoSupportException, - lang::IllegalArgumentException) ; + + //XNameAccess + virtual uno::Type SAL_CALL + getElementType() + throw (uno::RuntimeException); + + virtual sal_Bool SAL_CALL + hasElements() + throw (uno::RuntimeException); + + virtual uno::Any SAL_CALL + getByName( const rtl::OUString& aName ) + throw (css::container::NoSuchElementException, + lang::WrappedTargetException, uno::RuntimeException); + + virtual uno::Sequence SAL_CALL + getElementNames() + throw (uno::RuntimeException); + + virtual sal_Bool SAL_CALL + hasByName( const rtl::OUString& aName ) + throw (uno::RuntimeException); + protected: /** Service constructor from a service factory. @param xContext component context */ - WinInetBackend(const uno::Reference& xContext) - throw (backend::BackendAccessException); + WinInetBackend(); /** Destructor */ ~WinInetBackend(void) ; private: - - uno::Reference m_xContext ; - uno::Reference m_xSystemLayer ; - - // The wininet.dll module handle - HMODULE m_hWinInetDll; + sal_Int32 valueProxyType_; + rtl::OUString valueNoProxy_; + rtl::OUString valueHttpProxyName_; + sal_Int32 valueHttpProxyPort_; + rtl::OUString valueHttpsProxyName_; + sal_Int32 valueHttpsProxyPort_; + rtl::OUString valueFtpProxyName_; + sal_Int32 valueFtpProxyPort_; + bool hasProxyType_; + bool hasNoProxy_; + bool hasHttpProxyName_; + bool hasHttpProxyPort_; + bool hasHttpsProxyName_; + bool hasHttpsProxyPort_; + bool hasFtpProxyName_; + bool hasFtpProxyPort_; } ; diff --git a/shell/source/backends/wininetbe/wininetbe.xml b/shell/source/backends/wininetbe/wininetbe.xml index 42364deba3cb..1bf4bd2cd053 100644 --- a/shell/source/backends/wininetbe/wininetbe.xml +++ b/shell/source/backends/wininetbe/wininetbe.xml @@ -10,7 +10,6 @@ c++ com.sun.star.comp.configuration.backend.Win32Backend - com.sun.star.comp.configuration.backend.PlatformBackend ... com.sun.star.configuration.backend.XBackendChangesListener com.sun.star.configuration.backend.XBackendChangesNotifier diff --git a/shell/source/backends/wininetbe/wininetbecdef.cxx b/shell/source/backends/wininetbe/wininetbecdef.cxx index ae8ad725da1c..6f696ce6fac2 100644 --- a/shell/source/backends/wininetbe/wininetbecdef.cxx +++ b/shell/source/backends/wininetbe/wininetbecdef.cxx @@ -42,14 +42,13 @@ namespace css = com::sun::star ; namespace uno = css::uno ; namespace lang = css::lang ; -namespace backend = css::configuration::backend ; //------------------------------------------------------------------------------ static uno::Reference SAL_CALL createWinInetBackend( - const uno::Reference& xContext){ + const uno::Reference&){ - return * WinInetBackend::createInstance(xContext); + return * WinInetBackend::createInstance(); } //------------------------------------------------------------------------------ @@ -77,41 +76,9 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( //------------------------------------------------------------------------------ -extern "C" sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/, void *pRegistryKey) { - - using namespace ::com::sun::star::registry; - if (pRegistryKey) - { - try - { - uno::Reference< XRegistryKey > xImplKey = static_cast< XRegistryKey* >( pRegistryKey )->createKey( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + WinInetBackend::getBackendName() - ); - - // Register associated service names - uno::Reference< XRegistryKey > xServicesKey = xImplKey->createKey( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES") ) - ); - - uno::Sequence sServiceNames = WinInetBackend::getBackendServiceNames(); - for (sal_Int32 i = 0 ; i < sServiceNames.getLength() ; ++ i) - xServicesKey->createKey(sServiceNames[i]); - - // Register supported components - uno::Reference xComponentKey = xImplKey->createKey( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/DATA/SupportedComponents") ) - ); - - xComponentKey->setAsciiListValue( WinInetBackend::getSupportedComponents() ); - - return sal_True; - } - catch( InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "InvalidRegistryException caught"); - } - } - return sal_False; +extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void *pRegistryKey) { + return cppu::component_writeInfoHelper( + pServiceManager, pRegistryKey, kImplementations_entries); } //------------------------------------------------------------------------------ diff --git a/shell/source/backends/wininetbe/wininetlayer.cxx b/shell/source/backends/wininetbe/wininetlayer.cxx deleted file mode 100644 index d38bda5a1581..000000000000 --- a/shell/source/backends/wininetbe/wininetlayer.cxx +++ /dev/null @@ -1,377 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: wininetlayer.cxx,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" - -#ifndef _WININETLAYER_HXX_ -#include "wininetlayer.hxx" -#endif - -#include - -#include - -#define EQUAL_SIGN '=' -#define COLON ':' -#define SPACE ' ' -#define SEMI_COLON ';' - -typedef struct -{ - rtl::OUString Server; - rtl::OUString Port; -} ProxyEntry; - -//------------------------------------------------------------------------ -// helper functions -//------------------------------------------------------------------------ - -namespace // private -{ - ProxyEntry ReadProxyEntry(const rtl::OUString& aProxy, sal_Int32& i) - { - ProxyEntry aProxyEntry; - - aProxyEntry.Server = aProxy.getToken( 0, COLON, i ); - if ( i > -1 ) - aProxyEntry.Port = aProxy.getToken( 0, COLON, i ); - - return aProxyEntry; - } - - ProxyEntry FindProxyEntry(const rtl::OUString& aProxyList, const rtl::OUString& aType) - { - sal_Int32 nIndex = 0; - - do - { - // get the next token, e.g. ftp=server:port - rtl::OUString nextToken = aProxyList.getToken( 0, SPACE, nIndex ); - - // split the next token again into the parts separated - // through '=', e.g. ftp=server:port -> ftp and server:port - sal_Int32 i = 0; - if( nextToken.indexOf( EQUAL_SIGN ) > -1 ) - { - if( aType.equals( nextToken.getToken( 0, EQUAL_SIGN, i ) ) ) - return ReadProxyEntry(nextToken, i); - } - else if( aType.getLength() == 0) - return ReadProxyEntry(nextToken, i); - - } while ( nIndex >= 0 ); - - return ProxyEntry(); - } - -} // end private namespace - -//------------------------------------------------------------------------------ - -WinInetLayer::WinInetLayer( InternetQueryOption_Proc_T lpfnInternetQueryOption, - const uno::Reference& xContext) - : m_lpfnInternetQueryOption(lpfnInternetQueryOption) -{ - //Create instance of LayerContentDescriber Service - rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.configuration.backend.LayerDescriber")); - - typedef uno::Reference LayerDescriber; - uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); - if( xServiceManager.is() ) - { - m_xLayerContentDescriber = LayerDescriber::query( - xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); - } - else - { - OSL_TRACE("Could not retrieve ServiceManager"); - } - -} - -//------------------------------------------------------------------------------ - -void SAL_CALL WinInetLayer::readData( - const uno::Reference& xHandler) - throw ( backend::MalformedDataException, - lang::NullPointerException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - - if (m_xLayerContentDescriber.is() && m_lpfnInternetQueryOption) - { - LPINTERNET_PROXY_INFO lpi = NULL; - - // query for the neccessary space - DWORD dwLength = 0; - BOOL bRet = m_lpfnInternetQueryOption( - NULL, - INTERNET_OPTION_PROXY, - (LPVOID)lpi, - &dwLength ); - - // allocate sufficient space on the heap - // insufficient space on the heap results - // in a stack overflow exception, we assume - // this never happens, because of the relatively - // small amount of memory we need - // _alloca is nice because it is fast and we don't - // have to free the allocated memory, it will be - // automatically done - lpi = reinterpret_cast< LPINTERNET_PROXY_INFO >( - _alloca( dwLength ) ); - - bRet = m_lpfnInternetQueryOption( - NULL, - INTERNET_OPTION_PROXY, - (LPVOID)lpi, - &dwLength ); - - // if a proxy is disabled, InternetQueryOption returns - // an empty proxy list, so we don't have to check if - // proxy is enabled or not - - rtl::OUString aProxyList = rtl::OUString::createFromAscii( lpi->lpszProxy ); - rtl::OUString aProxyBypassList = rtl::OUString::createFromAscii( lpi->lpszProxyBypass ); - - // override default for ProxyType, which is "0" meaning "No proxies". - uno::Sequence aPropInfoList(8); - sal_Int32 nProperties = 1; - - aPropInfoList[0].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetProxyType") ); - aPropInfoList[0].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[0].Protected = sal_False; - aPropInfoList[0].Value = uno::makeAny( nProperties ); - - // fill proxy bypass list - if( aProxyBypassList.getLength() > 0 ) - { - rtl::OUStringBuffer aReverseList; - sal_Int32 nIndex = 0; - do - { - rtl::OUString aToken = aProxyBypassList.getToken( 0, SPACE, nIndex ); - if ( aProxyList.indexOf( aToken ) == -1 ) - { - if ( aReverseList.getLength() ) - { - aReverseList.insert( 0, sal_Unicode( SEMI_COLON ) ); - aReverseList.insert( 0, aToken ); - } - else - aReverseList = aToken; - } - } - while ( nIndex >= 0 ); - - aProxyBypassList = aReverseList.makeStringAndClear(); - - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetNoProxy") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( aProxyBypassList.replace( SPACE, SEMI_COLON ) ); - } - - if( aProxyList.getLength() > 0 ) - { - //------------------------------------------------- - // this implementation follows the algorithm - // of the internet explorer - // if there are type-dependent proxy settings - // and type independent proxy settings in the - // registry the internet explorer chooses the - // type independent proxy for all settings - // e.g. imagine the following registry entry - // ftp=server:port;http=server:port;server:port - // the last token server:port is type independent - // so the ie chooses this proxy server - - // if there is no port specified for a type independent - // server the ie uses the port of an http server if - // there is one and it has a port - //------------------------------------------------- - - ProxyEntry aTypeIndepProxy = FindProxyEntry( aProxyList, rtl::OUString()); - ProxyEntry aHttpProxy = FindProxyEntry( aProxyList, rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "http" ) ) ); - ProxyEntry aHttpsProxy = FindProxyEntry( aProxyList, rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "https" ) ) ); - - ProxyEntry aFtpProxy = FindProxyEntry( aProxyList, rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "ftp" ) ) ); - - if( aTypeIndepProxy.Server.getLength() ) - { - aHttpProxy.Server = aTypeIndepProxy.Server; - aHttpsProxy.Server = aTypeIndepProxy.Server; - aFtpProxy.Server = aTypeIndepProxy.Server; - - if( aTypeIndepProxy.Port.getLength() ) - { - aHttpProxy.Port = aTypeIndepProxy.Port; - aHttpsProxy.Port = aTypeIndepProxy.Port; - aFtpProxy.Port = aTypeIndepProxy.Port; - } - else - { - aFtpProxy.Port = aHttpProxy.Port; - aHttpsProxy.Port = aHttpProxy.Port; - } - } - - // http proxy name - if( aHttpProxy.Server.getLength() > 0 ) - { - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyName") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( aHttpProxy.Server ); - } - - // http proxy port - if( aHttpProxy.Port.getLength() > 0 ) - { - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyPort") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( aHttpProxy.Port.toInt32() ); - } - - // https proxy name - if( aHttpsProxy.Server.getLength() > 0 ) - { - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyName") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( aHttpsProxy.Server ); - } - - // https proxy port - if( aHttpsProxy.Port.getLength() > 0 ) - { - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyPort") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( aHttpsProxy.Port.toInt32() ); - } - - // ftp proxy name - if( aFtpProxy.Server.getLength() > 0 ) - { - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyName") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( aFtpProxy.Server ); - } - - // ftp proxy port - if( aFtpProxy.Port.getLength() > 0 ) - { - aPropInfoList[nProperties].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyPort") ); - aPropInfoList[nProperties].Type = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "int" ) ); - aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( aFtpProxy.Port.toInt32() ); - } - } - - // resize the property info list appropriately - aPropInfoList.realloc(nProperties); - - m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); - } - else - { - OSL_TRACE("Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"); - } -} - -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL WinInetLayer::getTimestamp(void) - throw (uno::RuntimeException) -{ - rtl::OUString aTimestamp; - - if (m_lpfnInternetQueryOption) - { - LPINTERNET_PROXY_INFO lpi = NULL; - - // query for the neccessary space - DWORD dwLength = 0; - BOOL bRet = m_lpfnInternetQueryOption( - NULL, - INTERNET_OPTION_PROXY, - (LPVOID)lpi, - &dwLength ); - - // allocate sufficient space on the heap - // insufficient space on the heap results - // in a stack overflow exception, we assume - // this never happens, because of the relatively - // small amount of memory we need - // _alloca is nice because it is fast and we don't - // have to free the allocated memory, it will be - // automatically done - lpi = reinterpret_cast< LPINTERNET_PROXY_INFO >( - _alloca( dwLength ) ); - - bRet = m_lpfnInternetQueryOption( - NULL, - INTERNET_OPTION_PROXY, - (LPVOID)lpi, - &dwLength ); - - aTimestamp = rtl::OUString::createFromAscii( lpi->lpszProxy ); - aTimestamp += rtl::OUString::createFromAscii( lpi->lpszProxyBypass ); - } - - return aTimestamp; -} - -//------------------------------------------------------------------------------ diff --git a/shell/source/backends/wininetbe/wininetlayer.hxx b/shell/source/backends/wininetbe/wininetlayer.hxx deleted file mode 100644 index 761e174d1df5..000000000000 --- a/shell/source/backends/wininetbe/wininetlayer.hxx +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef _WinInetLayer_HXX_ -#define _WinInetLayer_HXX_ - -#include -#include -#include -#include - -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_ -#include -#endif -#include -#include -#include - -#if defined _MSC_VER -#pragma warning(push, 1) -#endif -#include -#include -#if defined _MSC_VER -#pragma warning(pop) -#endif - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace backend = css::configuration::backend ; -namespace util = css::util ; - -/** - Implementation of the XLayer interfaces for fixed values - */ - -class WinInetLayer : public cppu::WeakImplHelper2 -{ - public : - typedef BOOL ( WINAPI *InternetQueryOption_Proc_T )( HINTERNET, DWORD, LPVOID, LPDWORD ); - - /** - Constructor given the requested component name - - @param lpfnInternetQueryOption function pointer into wininet.dll - @param aTimestamp timestamp indicating last modifictaion - */ - WinInetLayer(InternetQueryOption_Proc_T lpfnInternetQueryOption, - const uno::Reference& xContext); - - /** Destructor */ - ~WinInetLayer(void) {} - - // XLayer - virtual void SAL_CALL readData(const uno::Reference& xHandler) - throw ( backend::MalformedDataException, - lang::NullPointerException, - lang::WrappedTargetException, - uno::RuntimeException) ; - - // XTimeStamped - virtual rtl::OUString SAL_CALL getTimestamp(void) - throw (uno::RuntimeException); - - private : - - rtl::OUString m_aComponent ; - - uno::Reference m_xLayerContentDescriber ; - - // The InternetQueryOption function pointer - InternetQueryOption_Proc_T m_lpfnInternetQueryOption; -} ; - -#endif // _WinInetLayer_HXX_ -- cgit