diff options
author | Release Engineers <releng@openoffice.org> | 2009-08-07 10:16:34 +0000 |
---|---|---|
committer | Release Engineers <releng@openoffice.org> | 2009-08-07 10:16:34 +0000 |
commit | 15ea827542a38ac9c6998977b077695906e281c6 (patch) | |
tree | 223f50cefe024aedfdcaf3cdfe7762a54df2aac6 /shell/source | |
parent | 622ebc559d47a55930c5710bf8382a3b3c49bbe9 (diff) |
CWS-TOOLING: integrate CWS kde4int
2009-07-15 10:40:52 +0200 pl r273993 : #i103288# configure
2009-07-09 14:57:24 +0200 pl r273867 : #i103284# spin fields
2009-07-09 13:49:13 +0200 pl r273864 : #i103284# min size for dropdown comboboxes
2009-07-09 13:46:11 +0200 pl r273860 : #i103284# min size fro dropdown listboxes
2009-07-09 13:01:48 +0200 pl r273857 : #i103284# fix most radiobuttons and checboxes, also on tabpages
2009-07-08 19:38:12 +0200 pl r273847 : #i103290# clean up, enable KDE4 fpicker
2009-07-08 15:54:06 +0200 pl r273837 : #i103284# background mode opaque doesn't look that good
2009-07-07 19:29:01 +0200 pl r273814 : add kde4 directory and deliverables
2009-07-07 11:18:08 +0200 pl r273786 : make compile with Qt 4.1
2009-07-02 19:20:47 +0200 pl r273673 : #i103290# add: KDE4 file picker (thanks Roman Shtylman)
2009-07-02 19:16:07 +0200 pl r273672 : #i103289# add: KDE4integration (thanks Roman Shtylman)
2009-07-02 19:01:20 +0200 pl r273671 : #i103286# add: KDE4 checks (thanks Roman Shtylman)
2009-07-02 18:58:15 +0200 pl r273670 : #i103286# initial import for KDE4 backend (thanks Roman Shtylman)
2009-07-02 18:08:06 +0200 pl r273668 : #i103284# initial import for KDE4 plugin (thanks Roman Shtylman)
Diffstat (limited to 'shell/source')
-rw-r--r-- | shell/source/backends/kde4be/exports.map | 10 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4backend.cxx | 158 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4backend.hxx | 123 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4be.xml | 35 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4be1-ucd.txt | 6 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4becdef.cxx | 143 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4commonlayer.cxx | 157 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4commonlayer.hxx | 51 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4inetlayer.cxx | 255 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4inetlayer.hxx | 59 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4pathslayer.cxx | 124 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4pathslayer.hxx | 82 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4vcllayer.cxx | 115 | ||||
-rw-r--r-- | shell/source/backends/kde4be/kde4vcllayer.hxx | 53 | ||||
-rw-r--r-- | shell/source/backends/kde4be/makefile.mk | 94 |
15 files changed, 1465 insertions, 0 deletions
diff --git a/shell/source/backends/kde4be/exports.map b/shell/source/backends/kde4be/exports.map new file mode 100644 index 000000000000..ba501f9ae076 --- /dev/null +++ b/shell/source/backends/kde4be/exports.map @@ -0,0 +1,10 @@ +UDK_3_0_0 { + global: + GetVersionInfo; + component_getImplementationEnvironment; + component_getFactory; + component_writeInfo; + + local: + *; +}; diff --git a/shell/source/backends/kde4be/kde4backend.cxx b/shell/source/backends/kde4be/kde4backend.cxx new file mode 100644 index 000000000000..7eb093bf7217 --- /dev/null +++ b/shell/source/backends/kde4be/kde4backend.cxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * 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" + +//------------------------------------------------------------------------------ + +KDEBackend* KDEBackend::mInstance= 0; + +KDEBackend* KDEBackend::createInstance(const uno::Reference<uno::XComponentContext>& xContext) +{ + if (mInstance == 0) + { + mInstance = new KDEBackend (xContext); + } + + return mInstance; +} + +//------------------------------------------------------------------------------ + +KDEBackend::KDEBackend(const uno::Reference<uno::XComponentContext>& xContext) + throw (backend::BackendAccessException) + : BackendBase(mMutex), m_xContext(xContext) +{ +} + +//------------------------------------------------------------------------------ + +KDEBackend::~KDEBackend(void) +{ +} + +//------------------------------------------------------------------------------ + +uno::Reference<backend::XLayer> SAL_CALL KDEBackend::getLayer( + const rtl::OUString& aComponent, const rtl::OUString& /* aTimestamp */) + throw (backend::BackendAccessException, lang::IllegalArgumentException) +{ + uno::Reference<backend::XLayer> 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); + } + + return xLayer; +} + +//------------------------------------------------------------------------------ + +uno::Reference<backend::XUpdatableLayer> SAL_CALL +KDEBackend::getUpdatableLayer(const rtl::OUString& /* aComponent */) + throw (backend::BackendAccessException,lang::NoSupportException, + lang::IllegalArgumentException) +{ + throw lang::NoSupportException( rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("KDEBackend: No Update Operation allowed, Read Only access") ), + *this) ; +} + +//------------------------------------------------------------------------------ + +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) +{ + return getBackendName() ; +} + +//------------------------------------------------------------------------------ + +uno::Sequence<rtl::OUString> SAL_CALL KDEBackend::getBackendServiceNames(void) +{ + uno::Sequence<rtl::OUString> aServices(1) ; + aServices[0] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.KDE4Backend")) ; + + return aServices ; +} + +//------------------------------------------------------------------------------ + +sal_Bool SAL_CALL KDEBackend::supportsService(const rtl::OUString& aServiceName) + throw (uno::RuntimeException) +{ + 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<rtl::OUString> +SAL_CALL KDEBackend::getSupportedServiceNames(void) + throw (uno::RuntimeException) +{ + return getBackendServiceNames() ; +} + +// --------------------------------------------------------------------------------------- diff --git a/shell/source/backends/kde4be/kde4backend.hxx b/shell/source/backends/kde4be/kde4backend.hxx new file mode 100644 index 000000000000..01599c41a74d --- /dev/null +++ b/shell/source/backends/kde4be/kde4backend.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#pragma once + +#include <com/sun/star/configuration/backend/XSingleLayerStratum.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/configuration/InvalidBootstrapFileException.hpp> +#include <com/sun/star/configuration/backend/CannotConnectException.hpp> +#include <cppuhelper/compbase2.hxx> + +#ifndef INCLUDED_MAP +#include <map> +#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<backend::XSingleLayerStratum, + lang::XServiceInfo> BackendBase ; + +/** + Implements the SingleLayerStratum service for KDE access. + */ +class KDEBackend : public BackendBase { + public : + + static KDEBackend* createInstance(const uno::Reference<uno::XComponentContext>& 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<rtl::OUString> 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<rtl::OUString> SAL_CALL getBackendServiceNames(void) ; + + //XSingleLayerStratum + virtual uno::Reference<backend::XLayer> SAL_CALL + getLayer( const rtl::OUString& aLayerId, const rtl::OUString& aTimestamp ) + throw (backend::BackendAccessException, lang::IllegalArgumentException) ; + + virtual uno::Reference<backend::XUpdatableLayer> 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<uno::XComponentContext>& xContext) + throw (backend::BackendAccessException); + + /** Destructor */ + ~KDEBackend(void) ; + + private: + + /** Build KDE/OO mapping table */ + void initializeMappingTable (); + + + /** The component context */ + uno::Reference<uno::XComponentContext> 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 new file mode 100644 index 000000000000..ea2d9be6dd6b --- /dev/null +++ b/shell/source/backends/kde4be/kde4be.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>kde4be</module-name> + <component-description> + <author> Éric Bischoff </author> + <name>com.sun.star.comp.configuration.backend.KDE4Backend</name> + <description> The KDE4 configuration backend </description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="beta"/> + <supported-service>com.sun.star.comp.configuration.backend.KDE4Backend</supported-service> + <service-dependency>...</service-dependency> + <type>com.sun.star.configuration.backend.XBackendChangesListener</type> + <type>com.sun.star.configuration.backend.XBackendChangesNotifier</type> + <type>com.sun.star.configuration.backend.XLayerHandler</type> + <type>com.sun.star.configuration.backend.XSingleLayerStratum</type> + <type>com.sun.star.lang.XMultiComponentFactory</type> + <type>com.sun.star.lang.XServiceInfo</type> + <type>com.sun.star.lang.XSingleComponentFactory</type> + <type>com.sun.star.lang.XTypeProvider</type> + <type>com.sun.star.uno.TypeClass</type> + <type>com.sun.star.uno.XAggregation</type> + <type>com.sun.star.uno.XComponentContext</type> + <type>com.sun.star.uno.XCurrentContext</type> + <type>com.sun.star.uno.XWeak</type> + <type>com.sun.star.registry.XRegistryKey</type> + </component-description> + <project-build-dependency>cppuhelper</project-build-dependency> + <project-build-dependency>cppu</project-build-dependency> + <project-build-dependency>sal</project-build-dependency> + <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency> + <runtime-module-dependency>cppu3</runtime-module-dependency> + <runtime-module-dependency>sal3</runtime-module-dependency> +</module-description> diff --git a/shell/source/backends/kde4be/kde4be1-ucd.txt b/shell/source/backends/kde4be/kde4be1-ucd.txt new file mode 100644 index 000000000000..9671199b26e3 --- /dev/null +++ b/shell/source/backends/kde4be/kde4be1-ucd.txt @@ -0,0 +1,6 @@ +[ComponentDescriptor] +ImplementationName=com.sun.star.comp.configuration.backend.KDE4Backend +ComponentName=kde4be1.uno.so +LoaderName=com.sun.star.loader.SharedLibrary +[SupportedServices] +com.sun.star.configuration.backend.KDE4Backend diff --git a/shell/source/backends/kde4be/kde4becdef.cxx b/shell/source/backends/kde4be/kde4becdef.cxx new file mode 100644 index 000000000000..da0d22ead22e --- /dev/null +++ b/shell/source/backends/kde4be/kde4becdef.cxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * 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 <kapplication.h> + +#include <cppuhelper/implementationentry.hxx> + +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#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<uno::XInterface> SAL_CALL createKDEBackend(const uno::Reference<uno::XComponentContext>& 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<uno::XInterface>(); + + } catch (uno::RuntimeException e) { + return uno::Reference<uno::XInterface>(); + } + +} + +//============================================================================== + +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<rtl::OUString> 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 new file mode 100644 index 000000000000..1ce844672225 --- /dev/null +++ b/shell/source/backends/kde4be/kde4commonlayer.cxx @@ -0,0 +1,157 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * 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 <kemailsettings.h> +#include <kglobalsettings.h> + +#include <QFont> + +#include <com/sun/star/configuration/backend/PropertyInfo.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +#define SPACE ' ' + +//============================================================================== + +KDECommonLayer::KDECommonLayer(const uno::Reference<uno::XComponentContext>& xContext) +{ + //Create instance of LayerContentDescriber Service + rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.configuration.backend.LayerDescriber")); + + typedef uno::Reference<backend::XLayerContentDescriber> 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<backend::XLayerHandler>& 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<backend::PropertyInfo> 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 new file mode 100644 index 000000000000..9ce4cd4dc962 --- /dev/null +++ b/shell/source/backends/kde4be/kde4commonlayer.hxx @@ -0,0 +1,51 @@ +#pragma once + +#include "kde4backend.hxx" +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/configuration/backend/XLayer.hpp> +#include <com/sun/star/configuration/backend/BackendAccessException.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/util/XTimeStamped.hpp> +#include <cppuhelper/implbase2.hxx> + +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<backend::XLayer, util::XTimeStamped> +{ +public : + /** + Constructor given the component context + + @param xContext The component context + */ + + KDECommonLayer(const uno::Reference<uno::XComponentContext>& xContext); + + // XLayer + virtual void SAL_CALL readData( + const uno::Reference<backend::XLayerHandler>& 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<backend::XLayerContentDescriber> m_xLayerContentDescriber ; +}; diff --git a/shell/source/backends/kde4be/kde4inetlayer.cxx b/shell/source/backends/kde4be/kde4inetlayer.cxx new file mode 100644 index 000000000000..bc661a093fb7 --- /dev/null +++ b/shell/source/backends/kde4be/kde4inetlayer.cxx @@ -0,0 +1,255 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_shell.hxx" + +#include <kprotocolmanager.h> + +#include "kde4inetlayer.hxx" +#include <com/sun/star/configuration/backend/PropertyInfo.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +#define COMMA ',' +#define SEMI_COLON ';' + +//============================================================================== + +KDEInetLayer::KDEInetLayer(const uno::Reference<uno::XComponentContext>& xContext) +{ + //Create instance of LayerContentDescriber Service + rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.configuration.backend.LayerDescriber")); + + typedef uno::Reference<backend::XLayerContentDescriber> 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<backend::XLayerHandler>& 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<backend::PropertyInfo> 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<backend::PropertyInfo> &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 new file mode 100644 index 000000000000..64d00fec45fc --- /dev/null +++ b/shell/source/backends/kde4be/kde4inetlayer.hxx @@ -0,0 +1,59 @@ +#pragma once + +#include <QString> + +#include "kde4backend.hxx" + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/configuration/backend/XLayer.hpp> +#include <com/sun/star/configuration/backend/BackendAccessException.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/util/XTimeStamped.hpp> +#include <cppuhelper/implbase2.hxx> + +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<backend::XLayer, util::XTimeStamped> +{ +public : + /** + Constructor given the component context + + @param xContext The component context + */ + + KDEInetLayer(const uno::Reference<uno::XComponentContext>& xContext); + + // XLayer + virtual void SAL_CALL readData( + const uno::Reference<backend::XLayerHandler>& 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<backend::XLayerContentDescriber> m_xLayerContentDescriber ; + + void SAL_CALL setProxy + (uno::Sequence<backend::PropertyInfo> &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 new file mode 100644 index 000000000000..2511d0b57405 --- /dev/null +++ b/shell/source/backends/kde4be/kde4pathslayer.cxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * 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 <QString> +#include <kglobalsettings.h> + +#include <com/sun/star/configuration/backend/PropertyInfo.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> + +#include <osl/security.hxx> +#include <osl/file.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#define SPACE ' ' + +//============================================================================== + +KDEPathsLayer::KDEPathsLayer(const uno::Reference<uno::XComponentContext>& xContext) +{ + //Create instance of LayerContentDescriber Service + rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.configuration.backend.LayerDescriber")); + + typedef uno::Reference<backend::XLayerContentDescriber> 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<backend::XLayerHandler>& 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<backend::PropertyInfo> 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 new file mode 100644 index 000000000000..40d31a73c4f9 --- /dev/null +++ b/shell/source/backends/kde4be/kde4pathslayer.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#pragma once + +#include "kde4backend.hxx" +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/configuration/backend/XLayer.hpp> +#include <com/sun/star/configuration/backend/BackendAccessException.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/util/XTimeStamped.hpp> + +#include <cppuhelper/implbase2.hxx> + +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<backend::XLayer, util::XTimeStamped> +{ +public : + /** + Constructor given the component context + + @param xContext The component context + */ + + KDEPathsLayer(const uno::Reference<uno::XComponentContext>& xContext); + + // XLayer + virtual void SAL_CALL readData( + const uno::Reference<backend::XLayerHandler>& 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<backend::XLayerContentDescriber> m_xLayerContentDescriber ; +}; diff --git a/shell/source/backends/kde4be/kde4vcllayer.cxx b/shell/source/backends/kde4be/kde4vcllayer.cxx new file mode 100644 index 000000000000..780c3e4e7ce1 --- /dev/null +++ b/shell/source/backends/kde4be/kde4vcllayer.cxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * 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 <com/sun/star/configuration/backend/PropertyInfo.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +//============================================================================== + +KDEVCLLayer::KDEVCLLayer(const uno::Reference<uno::XComponentContext>& xContext) +{ + //Create instance of LayerContentDescriber Service + rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.configuration.backend.LayerDescriber")); + + typedef uno::Reference<backend::XLayerContentDescriber> 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<backend::XLayerHandler>& 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<backend::PropertyInfo> 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 new file mode 100644 index 000000000000..16036ee89122 --- /dev/null +++ b/shell/source/backends/kde4be/kde4vcllayer.hxx @@ -0,0 +1,53 @@ +#pragma once + +#include "kde4backend.hxx" + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/configuration/backend/XLayer.hpp> +#include <com/sun/star/configuration/backend/BackendAccessException.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/util/XTimeStamped.hpp> + +#include <cppuhelper/implbase2.hxx> + +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<backend::XLayer, util::XTimeStamped> +{ +public : + /** + Constructor given the component context + + @param xContext The component context + */ + + KDEVCLLayer(const uno::Reference<uno::XComponentContext>& xContext); + + // XLayer + virtual void SAL_CALL readData( + const uno::Reference<backend::XLayerHandler>& 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<backend::XLayerContentDescriber> m_xLayerContentDescriber ; +}; diff --git a/shell/source/backends/kde4be/makefile.mk b/shell/source/backends/kde4be/makefile.mk new file mode 100644 index 000000000000..6f92762e5ae1 --- /dev/null +++ b/shell/source/backends/kde4be/makefile.mk @@ -0,0 +1,94 @@ +#************************************************************************* +# +# 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: makefile.mk,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 +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* +PRJ=..$/..$/.. + +PRJNAME=shell +TARGET=kde4be + +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE + +COMP1TYPELIST=$(TARGET) +COMPRDB=$(SOLARBINDIR)$/types.rdb +UNOUCROUT=$(OUT)$/inc$/$(TARGET) +INCPRE=$(UNOUCROUT) + +# --- Settings --- + +.INCLUDE : settings.mk + +# For some of the included external KDE headers, GCC complains about shadowed +# symbols in instantiated template code only at the end of a compilation unit, +# so the only solution is to disable that warning here: +.IF "$(COM)" == "GCC" +CFLAGSCXX+=-Wno-shadow +.ENDIF + +UNIXTEXT=$(MISC)/$(TARGET)1-ucd.txt + +# no "lib" prefix +DLLPRE = + +.IF "$(ENABLE_KDE4)" == "TRUE" + +CFLAGS+=$(KDE4_CFLAGS) + +# --- Files --- + +SLOFILES=\ + $(SLO)$/kde4backend.obj \ + $(SLO)$/kde4commonlayer.obj \ + $(SLO)$/kde4inetlayer.obj \ + $(SLO)$/kde4vcllayer.obj \ + $(SLO)$/kde4pathslayer.obj \ + $(SLO)$/kde4becdef.obj + +SHL1NOCHECK=TRUE +SHL1TARGET=$(TARGET)1.uno +SHL1OBJS=$(SLOFILES) +SHL1DEF=$(MISC)$/$(SHL1TARGET).def + +SHL1IMPLIB=i$(SHL1TARGET) +SHL1STDLIBS= \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) \ + $(KDE4_LIBS) -lkio + +SHL1VERSIONMAP=exports.map +SHL1DEF=$(MISC)$/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) + +.ENDIF + +# --- Targets --- + +.INCLUDE : target.mk |