diff options
Diffstat (limited to 'extensions')
34 files changed, 1 insertions, 3366 deletions
diff --git a/extensions/prj/build.lst b/extensions/prj/build.lst index 45bea6a46e3f..f29d117d3dc8 100644 --- a/extensions/prj/build.lst +++ b/extensions/prj/build.lst @@ -23,15 +23,13 @@ ex extensions\source\propctrlr nmake - all ex_propctrlr ex_ ex extensions\source\dbpilots nmake - all ex_dbpilots ex_inc NULL ex extensions\source\abpilot nmake - all ex_abpilot ex_inc NULL ex extensions\source\logging nmake - all ex_logging ex_inc NULL -ex extensions\source\oooimprovecore nmake - all ex_oooimprovecore ex_inc NULL -ex extensions\source\oooimprovement nmake - all ex_oooimprovement ex_inc NULL ex extensions\source\config\ldap nmake - all ex_ldap ex_inc NULL ex extensions\source\nsplugin\source nmake - u ex_nsplugin ex_inc NULL ex extensions\source\nsplugin\source nmake - w ex_nsplugin ex_inc NULL ex extensions\source\update\feed nmake - all ex_updchkfeed ex_inc NULL ex extensions\source\update\check nmake - all ex_updchk ex_inc NULL ex extensions\source\update\ui nmake - all ex_updchkui ex_inc NULL -ex extensions\util nmake - all ex_util ex_abpilot ex_dbpilots ex_logging ex_ldap ex_propctrlr ex_bib ex_plutil ex_oooimprovecore NULL +ex extensions\util nmake - all ex_util ex_abpilot ex_dbpilots ex_logging ex_ldap ex_propctrlr ex_bib ex_plutil NULL # Fails at the moment # ex extensions\qa\complex\extensions nmake - all ex_complex ex_util NULL diff --git a/extensions/prj/d.lst b/extensions/prj/d.lst index 8f726eb87a9a..01025ae00c68 100644 --- a/extensions/prj/d.lst +++ b/extensions/prj/d.lst @@ -45,8 +45,6 @@ mkdir: %_DEST%\xml\registry\spool\org\openoffice\Office\Logging ..\%__SRC%\misc\dbp.component %_DEST%\xml\dbp.component ..\%__SRC%\misc\ldapbe2.component %_DEST%\xml\ldapbe2.component ..\%__SRC%\misc\log.component %_DEST%\xml\log.component -..\%__SRC%\misc\oooimprovecore.component %_DEST%\xml\oooimprovecore.component -..\%__SRC%\misc\oooimprovement.component %_DEST%\xml\oooimprovement.component ..\%__SRC%\misc\pcr.component %_DEST%\xml\pcr.component ..\%__SRC%\misc\pl.component %_DEST%\xml\pl.component ..\%__SRC%\misc\res.component %_DEST%\xml\res.component diff --git a/extensions/source/oooimprovecore/core.cxx b/extensions/source/oooimprovecore/core.cxx deleted file mode 100644 index b857c68cf4d6..000000000000 --- a/extensions/source/oooimprovecore/core.cxx +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#include <com/sun/star/oooimprovement/XCore.hpp> - -#include "oooimprovecore_module.hxx" -#include <com/sun/star/frame/XTerminateListener.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/oooimprovement/XCoreController.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <comphelper/configurationhelper.hxx> -#include <comphelper/processfactory.hxx> -#include <comphelper/uieventslogger.hxx> -#include <cppuhelper/implbase3.hxx> -#include <svx/svxdlg.hxx> -#include <vcl/svapp.hxx> -#include <osl/mutex.hxx> -#include <svl/itemset.hxx> -#include <svl/stritem.hxx> -#include <sfx2/app.hxx> -#include <svx/dialogs.hrc> -#include <sfx2/sfxsids.hrc> - -using namespace ::com::sun::star::oooimprovement; -using ::com::sun::star::frame::XTerminateListener; -using ::com::sun::star::lang::EventObject; -using ::com::sun::star::lang::XMultiServiceFactory; -using ::com::sun::star::lang::XServiceInfo; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::RuntimeException; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::UNO_QUERY; -using ::com::sun::star::uno::XComponentContext; -using ::com::sun::star::uno::XInterface; -using ::comphelper::UiEventsLogger; -using ::rtl::OUString; - -// declaration -namespace oooimprovecore -{ - class Core : public ::cppu::WeakImplHelper3<XCore,XServiceInfo,XTerminateListener> - { - public: - // XServiceInfo - static version - static OUString SAL_CALL getImplementationName_static(); - static Sequence<OUString> SAL_CALL getSupportedServiceNames_static(); - static Reference<XInterface> Create(const Reference<XComponentContext>& context ); - - protected: - Core(const Reference<XComponentContext>&); - virtual ~Core(); - - // XCore - virtual sal_Int32 SAL_CALL getSessionLogEventCount() throw(RuntimeException); - virtual sal_Bool SAL_CALL getUiEventsLoggerEnabled() throw(RuntimeException); - virtual void SAL_CALL inviteUser() throw(RuntimeException); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw(RuntimeException); - virtual sal_Bool SAL_CALL supportsService(const OUString& service_name) throw(RuntimeException); - virtual Sequence<OUString> SAL_CALL getSupportedServiceNames() throw(RuntimeException); - - // XTerminateListener - virtual void SAL_CALL queryTermination(const EventObject&) throw(RuntimeException); - virtual void SAL_CALL notifyTermination(const EventObject&) throw(RuntimeException); - - // XEventListener - virtual void SAL_CALL disposing(const EventObject&) throw(RuntimeException); - }; -} - - -// implementation -namespace oooimprovecore -{ - - Core::Core(const Reference<XComponentContext>&) - { } - - Core::~Core() - { } - - sal_Int32 SAL_CALL Core::getSessionLogEventCount() throw(RuntimeException) - { return UiEventsLogger::getSessionLogEventCount(); } - - sal_Bool SAL_CALL Core::getUiEventsLoggerEnabled() throw(RuntimeException) - { return UiEventsLogger::isEnabled(); } - - void SAL_CALL Core::inviteUser() throw(RuntimeException) - { - Reference<XMultiServiceFactory> xServiceFactory = ::comphelper::getProcessServiceFactory(); - - OUString help_url; - Reference<XCoreController> core_c( - xServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.CoreController"))), - UNO_QUERY); - if(core_c.is()) - ::comphelper::ConfigurationHelper::readDirectKey( - xServiceFactory, - OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.OOoImprovement.Settings")), - OUString(RTL_CONSTASCII_USTRINGPARAM("Participation")), - OUString(RTL_CONSTASCII_USTRINGPARAM("HelpUrl")), - ::comphelper::ConfigurationHelper::E_READONLY) >>= help_url; - else - help_url = OUString(RTL_CONSTASCII_USTRINGPARAM("http://www.libreoffice.org")); - { - SolarMutexGuard aGuard; - SfxAllItemSet aSet( SFX_APP()->GetPool() ); - aSet.Put( SfxStringItem( SID_CURRENT_URL, help_url ) ); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - { - SfxAbstractDialog *pDlg = pFact->CreateSfxDialog( NULL, aSet, 0, RID_SVXPAGE_IMPROVEMENT ); - pDlg->Execute(); - delete pDlg; - } - } - } - - sal_Bool SAL_CALL Core::supportsService(const OUString& service_name) throw(RuntimeException) - { - const Sequence<OUString> service_names(getSupportedServiceNames()); - for (sal_Int32 idx = service_names.getLength()-1; idx>=0; --idx) - if(service_name == service_names[idx]) return sal_True; - return sal_False; - } - - OUString SAL_CALL Core::getImplementationName() throw(RuntimeException) - { return getImplementationName_static(); } - - Sequence<OUString> SAL_CALL Core::getSupportedServiceNames() throw(RuntimeException) - { return getSupportedServiceNames_static(); } - - OUString SAL_CALL Core::getImplementationName_static() - { return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.extensions.oooimprovecore.Core")); } - - Sequence<OUString> SAL_CALL Core::getSupportedServiceNames_static() - { - Sequence<OUString> aServiceNames(1); - aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.Core")); - return aServiceNames; - } - - void Core::queryTermination(const EventObject&) throw(RuntimeException) - { } - - void Core::notifyTermination(const EventObject&) throw(RuntimeException) - { - UiEventsLogger::disposing(); - } - - void Core::disposing(const EventObject&) throw(RuntimeException) - { } - - Reference<XInterface> Core::Create(const Reference<XComponentContext>& context) - { return *(new Core(context)); } - - void createRegistryInfo_Core() - { - static OAutoRegistration<Core> auto_reg; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovecore/makefile.mk b/extensions/source/oooimprovecore/makefile.mk deleted file mode 100644 index 66ab6cd1090c..000000000000 --- a/extensions/source/oooimprovecore/makefile.mk +++ /dev/null @@ -1,82 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# 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=extensions -TARGET=oooimprovecore - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk - -# --- Files ------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/core.obj \ - $(SLO)$/oooimprovecore_services.obj \ - -SLOFILES= \ - $(EXCEPTIONSFILES) \ - $(SLO)$/oooimprovecore_module.obj \ - -LIB1TARGET=$(SLB)$/$(TARGET)_t.lib -LIB1FILES= \ - $(SLB)$/$(TARGET).lib \ - -SHL1TARGET=$(TARGET)$(DLLPOSTFIX) - -SHL1STDLIBS= \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(VCLLIB) \ - $(SVLLIB) \ - $(SVTOOLLIB) \ - $(SFXLIB) \ - $(SVXCORELIB) \ - $(SVXLIB) \ - $(TOOLSLIB) - - -SHL1LIBS=$(LIB1TARGET) -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - - -ALLTAR : $(MISC)/oooimprovecore.component - -$(MISC)/oooimprovecore.component .ERRREMOVE : \ - $(SOLARENV)/bin/createcomponent.xslt oooimprovecore.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt oooimprovecore.component diff --git a/extensions/source/oooimprovecore/oooimprovecore.component b/extensions/source/oooimprovecore/oooimprovecore.component deleted file mode 100644 index 58bdaf37c2c5..000000000000 --- a/extensions/source/oooimprovecore/oooimprovecore.component +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--********************************************************************** -* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2000, 2010 Oracle and/or its affiliates. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* 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. -* -**********************************************************************--> - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.extensions.oooimprovecore.Core"> - <service name="com.sun.star.oooimprovement.Core"/> - </implementation> -</component> diff --git a/extensions/source/oooimprovecore/oooimprovecore_module.cxx b/extensions/source/oooimprovecore/oooimprovecore_module.cxx deleted file mode 100644 index 11be045ecf7a..000000000000 --- a/extensions/source/oooimprovecore/oooimprovecore_module.cxx +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - -#include "oooimprovecore_module.hxx" -#include <rtl/instance.hxx> - -namespace oooimprovecore -{ - struct OooimprovecoreModuleCreator - { - OooimprovecoreModule m_aOooimprovecoreModule; - }; - namespace - { - class theOooimprovecoreModuleInstance : public rtl::Static<OooimprovecoreModuleCreator, theOooimprovecoreModuleInstance> {}; - } - - OooimprovecoreModule::OooimprovecoreModule() - :BaseClass() - { - } - - OooimprovecoreModule& OooimprovecoreModule::getInstance() - { - return theOooimprovecoreModuleInstance::get().m_aOooimprovecoreModule; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovecore/oooimprovecore_module.hxx b/extensions/source/oooimprovecore/oooimprovecore_module.hxx deleted file mode 100644 index 3dda474cc7ce..000000000000 --- a/extensions/source/oooimprovecore/oooimprovecore_module.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - -#ifndef EXTENSIONS_OOOIMPROVECORE_MODULE_HXX -#define EXTENSIONS_OOOIMPROVECORE_MODULE_HXX - -#include <comphelper/componentmodule.hxx> - -namespace oooimprovecore -{ - /* -------------------------------------------------------------------- */ - class OooimprovecoreModule : public ::comphelper::OModule - { - friend struct OooimprovecoreModuleCreator; - typedef ::comphelper::OModule BaseClass; - - public: - static OooimprovecoreModule& getInstance(); - - private: - OooimprovecoreModule(); - }; - - /* -------------------------------------------------------------------- */ - class OooimprovecoreModuleClient : public ::comphelper::OModuleClient - { - private: - typedef ::comphelper::OModuleClient BaseClass; - - public: - OooimprovecoreModuleClient() : BaseClass( OooimprovecoreModule::getInstance() ) - { - } - }; - - /* -------------------------------------------------------------------- */ - template < class TYPE > - class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE > - { - private: - typedef ::comphelper::OAutoRegistration< TYPE > BaseClass; - - public: - OAutoRegistration() : BaseClass( OooimprovecoreModule::getInstance() ) - { - } - }; - - /* -------------------------------------------------------------------- */ - template < class TYPE > - class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE > - { - private: - typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass; - - public: - OSingletonRegistration() : BaseClass( OooimprovecoreModule::getInstance() ) - { - } - }; -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovecore/oooimprovecore_services.cxx b/extensions/source/oooimprovecore/oooimprovecore_services.cxx deleted file mode 100644 index 56c8ed56de8e..000000000000 --- a/extensions/source/oooimprovecore/oooimprovecore_services.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#include "oooimprovecore_module.hxx" - -namespace oooimprovecore -{ - extern void createRegistryInfo_Core(); - - static void initializeModule() - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - createRegistryInfo_Core(); - } - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) -{ - ::oooimprovecore::initializeModule(); - return ::oooimprovecore::OooimprovecoreModule::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/Jobs.xcu b/extensions/source/oooimprovement/Jobs.xcu deleted file mode 100644 index 206d83dd7eb2..000000000000 --- a/extensions/source/oooimprovement/Jobs.xcu +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<oor:component-data oor:name="Jobs" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <node oor:name="Jobs"> - <node oor:name="OOoImprovement.OnLogRotateJob" oor:op="replace"> - <prop oor:name="Service"> - <value>com.sun.star.comp.extensions.oooimprovement.OnLogRotateJob</value> - </prop> - <node oor:name="Arguments"/> - </node> - <node oor:name="OOoImprovement.InviteJob" oor:op="replace"> - <prop oor:name="Service"> - <value>com.sun.star.comp.extensions.oooimprovement.InviteJob</value> - </prop> - <node oor:name="Arguments"/> - </node> - </node> - <node oor:name="Events"> - <node oor:name="onFirstVisibleTask" oor:op="fuse"> - <node oor:name="JobList"> - <node oor:name="OOoImprovement.OnLogRotateJob" oor:op="replace"/> - <node oor:name="OOoImprovement.InviteJob" oor:op="replace"/> - </node> - </node> - </node> -</oor:component-data> diff --git a/extensions/source/oooimprovement/Logging.xcu b/extensions/source/oooimprovement/Logging.xcu deleted file mode 100644 index 4ea492d67737..000000000000 --- a/extensions/source/oooimprovement/Logging.xcu +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<oor:component-data oor:name="Logging" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <node oor:name="OOoImprovement"> - <prop oor:name="EnablingAllowed"> - <value>true</value> - </prop> - </node> -</oor:component-data> diff --git a/extensions/source/oooimprovement/config.cxx b/extensions/source/oooimprovement/config.cxx deleted file mode 100644 index 7611ffee499e..000000000000 --- a/extensions/source/oooimprovement/config.cxx +++ /dev/null @@ -1,297 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#include "config.hxx" -#include "myconfigurationhelper.hxx" -#include <rtl/ustrbuf.hxx> - - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - - -namespace -{ - using namespace oooimprovement; - - static const OUString CFG_COUNTERS(RTL_CONSTASCII_USTRINGPARAM("Counters")); - static const OUString CFG_ENABLINGALLOWED(RTL_CONSTASCII_USTRINGPARAM("EnablingAllowed")); - static const OUString CFG_EVENTSCOUNT(RTL_CONSTASCII_USTRINGPARAM("LoggedEvents")); - static const OUString CFG_EXTENSION(RTL_CONSTASCII_USTRINGPARAM("ooSetupExtension")); - static const OUString CFG_FAILEDATTEMPTS(RTL_CONSTASCII_USTRINGPARAM("FailedAttempts")); - static const OUString CFG_INVACCEPT(RTL_CONSTASCII_USTRINGPARAM("InvitationAccepted")); - static const OUString CFG_L10N(RTL_CONSTASCII_USTRINGPARAM("L10N")); - static const OUString CFG_LOCALE(RTL_CONSTASCII_USTRINGPARAM("ooLocale")); - static const OUString CFG_LOGGING(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Logging")); - static const OUString CFG_LOGPATH(RTL_CONSTASCII_USTRINGPARAM("LogPath")); - static const OUString CFG_NAME(RTL_CONSTASCII_USTRINGPARAM("ooName")); - static const OUString CFG_OFFICESTARTCOUNTDOWN(RTL_CONSTASCII_USTRINGPARAM("OfficeStartCounterdown")); - static const OUString CFG_OOOIMPROVEMENT(RTL_CONSTASCII_USTRINGPARAM("OOoImprovement")); - static const OUString CFG_OOOIMPROVEMENTPACK(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.OOoImprovement.Settings")); - static const OUString CFG_PARTICIPATION(RTL_CONSTASCII_USTRINGPARAM("Participation")); - static const OUString CFG_PRODUCT(RTL_CONSTASCII_USTRINGPARAM("Product")); - static const OUString CFG_REPORTCOUNT(RTL_CONSTASCII_USTRINGPARAM("UploadedReports")); - static const OUString CFG_REPORTEREMAIL(RTL_CONSTASCII_USTRINGPARAM("ReporterEmail")); - static const OUString CFG_SETUP(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")); - static const OUString CFG_SHOWEDINV(RTL_CONSTASCII_USTRINGPARAM("ShowedInvitation")); - static const OUString CFG_SOAPIDADD(RTL_CONSTASCII_USTRINGPARAM("SoapIdAdditions")); - static const OUString CFG_SOAPURL(RTL_CONSTASCII_USTRINGPARAM("SoapUrl")); - static const OUString CFG_UPLOAD(RTL_CONSTASCII_USTRINGPARAM("Upload")); - static const OUString CFG_VERSION(RTL_CONSTASCII_USTRINGPARAM("ooSetupVersion")); - - static const OUString SOAPID(RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org Improvement Report - Version 1\n")); - - static sal_Int32 incrementCfgValue( - const Reference<XMultiServiceFactory> sm, - const OUString& package, - const OUString& rel_path, - const OUString& key, - sal_Int32 increment_by) - { - sal_Int32 value; - Reference<XInterface> cfg = - MyConfigurationHelper::openConfig( - sm, - package, MyConfigurationHelper::E_STANDARD); - MyConfigurationHelper::readRelativeKey( - cfg, - rel_path, key) >>= value; - value += increment_by; - MyConfigurationHelper::writeRelativeKey( - cfg, - rel_path, key, - Any(value)); - MyConfigurationHelper::flush(cfg); - return value; - }; -} - -namespace oooimprovement -{ - Config::Config(const Reference<XMultiServiceFactory>& sf) - : m_ServiceFactory(sf) - {} - - OUString Config::getSoapUrl() const - { - OUString result; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_UPLOAD, CFG_SOAPURL, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - OUString Config::getSoapId() const - { - OUString value; - OUStringBuffer result = SOAPID; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_UPLOAD, CFG_SOAPIDADD, - MyConfigurationHelper::E_READONLY) >>= value; - result.append(value); - return result.makeStringAndClear(); - } - - OUString Config::getReporterEmail() const - { - OUString result; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_UPLOAD, CFG_REPORTEREMAIL, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - OUString Config::getLogPath() const - { - OUString result; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_LOGGING, CFG_OOOIMPROVEMENT, CFG_LOGPATH, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - bool Config::getEnablingAllowed() const - { - bool result = false; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_LOGGING, CFG_OOOIMPROVEMENT, CFG_ENABLINGALLOWED, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - bool Config::getInvitationAccepted() const - { - bool result = false; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_PARTICIPATION, CFG_INVACCEPT, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - }; - - bool Config::getShowedInvitation() const - { - bool result = false; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_PARTICIPATION, CFG_SHOWEDINV, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - }; - - OUString Config::getCompleteProductname() const - { - OUStringBuffer result; - OUString value; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_SETUP, CFG_PRODUCT, CFG_NAME, - MyConfigurationHelper::E_READONLY) >>= value; - result.append(value); - - value = OUString(); - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_SETUP, CFG_PRODUCT, CFG_VERSION, - MyConfigurationHelper::E_READONLY) >>= value; - if(value.getLength()) result.appendAscii(" ").append(value); - - value = OUString(); - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_SETUP, CFG_PRODUCT, CFG_EXTENSION, - MyConfigurationHelper::E_READONLY) >>= value; - if(value.getLength()) result.appendAscii(" ").append(value); - - return result.makeStringAndClear(); - } - - OUString Config::getSetupLocale() const - { - OUString result; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_SETUP, CFG_L10N, CFG_LOCALE, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - sal_Int32 Config::getReportCount() const - { - sal_Int32 result = 0; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_REPORTCOUNT, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - -#ifdef FUTURE - sal_Int32 Config::getFailedAttempts() const - { - sal_Int32 result = 0; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_FAILEDATTEMPTS, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } -#endif - - sal_Int32 Config::getOfficeStartCounterdown() const - { - sal_Int32 result = 0; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_PARTICIPATION, CFG_OFFICESTARTCOUNTDOWN, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - sal_Int32 Config::incrementReportCount(sal_Int32 by) - { - return incrementCfgValue( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_REPORTCOUNT, - by); - } - - sal_Int32 Config::incrementEventCount(sal_Int32 by) - { - return incrementCfgValue( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_EVENTSCOUNT, - by); - } - - sal_Int32 Config::incrementFailedAttempts(sal_Int32 by) - { - return incrementCfgValue( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_FAILEDATTEMPTS, - by); - } - - sal_Int32 Config::decrementOfficeStartCounterdown(sal_Int32 by) - { - return incrementCfgValue( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_PARTICIPATION, CFG_OFFICESTARTCOUNTDOWN, - -by); - } - - void Config::resetFailedAttempts() - { - sal_Int32 zero = 0; - MyConfigurationHelper::writeDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_FAILEDATTEMPTS, - Any(zero), - MyConfigurationHelper::E_STANDARD); - } - - void Config::giveupUploading() - { - sal_Bool f = false; - MyConfigurationHelper::writeDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_PARTICIPATION, CFG_INVACCEPT, - Any(f), - MyConfigurationHelper::E_STANDARD); - resetFailedAttempts(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/config.hxx b/extensions/source/oooimprovement/config.hxx deleted file mode 100644 index fe8e38ca820a..000000000000 --- a/extensions/source/oooimprovement/config.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_CONFIG_HXX -#define EXTENSIONS_OOOIMPROVEMENT_CONFIG_HXX - -#include <rtl/ustring.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - - -namespace oooimprovement -{ - class Config - { - public: - Config(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& sf); - bool getEnablingAllowed() const; - bool getInvitationAccepted() const; - bool getShowedInvitation() const; - ::rtl::OUString getCompleteProductname() const; - ::rtl::OUString getLogPath() const; - ::rtl::OUString getReporterEmail() const; - ::rtl::OUString getSetupLocale() const; - ::rtl::OUString getSoapId() const; - ::rtl::OUString getSoapUrl() const; - sal_Int32 getReportCount() const; - sal_Int32 getOfficeStartCounterdown() const; - sal_Int32 incrementEventCount(sal_Int32 by); - sal_Int32 incrementReportCount(sal_Int32 by); - sal_Int32 incrementFailedAttempts(sal_Int32 by); - sal_Int32 decrementOfficeStartCounterdown(sal_Int32 by); - void resetFailedAttempts(); - void giveupUploading(); - - private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_ServiceFactory; - }; -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/corecontroller.cxx b/extensions/source/oooimprovement/corecontroller.cxx deleted file mode 100644 index e233b681e573..000000000000 --- a/extensions/source/oooimprovement/corecontroller.cxx +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#include "corecontroller.hxx" -#include "config.hxx" - -using ::rtl::OUString; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; - - -namespace oooimprovement -{ - CoreController::CoreController(const Reference<XMultiServiceFactory>& sf) - : m_ServiceFactory(sf) - { } - - CoreController::~CoreController() - { } - - sal_Bool SAL_CALL CoreController::enablingUiEventsLoggerAllowed(sal_Int16 version) throw(RuntimeException) - { - Config config(m_ServiceFactory); - if(version==1 && config.getEnablingAllowed() && config.getShowedInvitation() && config.getInvitationAccepted()) - return true; - return false; - } - - sal_Bool SAL_CALL CoreController::showBuiltinOptionsPage(sal_Int16 version) throw(RuntimeException) - { - Config config(m_ServiceFactory); - if(version==1 && config.getEnablingAllowed()) - return true; - return false; - } - - sal_Bool SAL_CALL CoreController::supportsService(const OUString& service_name) throw(RuntimeException) - { - const Sequence<OUString> service_names(getSupportedServiceNames()); - for (sal_Int32 idx = service_names.getLength()-1; idx>=0; --idx) - if(service_name == service_names[idx]) return sal_True; - return sal_False; - } - - OUString SAL_CALL CoreController::getImplementationName() throw(RuntimeException) - { return getImplementationName_static(); } - - Sequence<OUString> SAL_CALL CoreController::getSupportedServiceNames() throw(RuntimeException) - { return getSupportedServiceNames_static(); } - - OUString SAL_CALL CoreController::getImplementationName_static() - { return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.extensions.oooimprovement.CoreController")); } - - Sequence<OUString> SAL_CALL CoreController::getSupportedServiceNames_static() - { - Sequence<OUString> aServiceNames(1); - aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.CoreController")); - return aServiceNames; - } - - Reference<XInterface> SAL_CALL CoreController::Create(const Reference<XMultiServiceFactory>& sm) - { return *(new CoreController(sm)); } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/corecontroller.hxx b/extensions/source/oooimprovement/corecontroller.hxx deleted file mode 100644 index a1c04deb448f..000000000000 --- a/extensions/source/oooimprovement/corecontroller.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_CORECONTROLLER_HXX -#define EXTENSIONS_OOOIMPROVEMENT_CORECONTROLLER_HXX - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/oooimprovement/XCoreController.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <cppuhelper/implbase2.hxx> - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class CoreController : public ::cppu::WeakImplHelper2< - css::oooimprovement::XCoreController, - css::lang::XServiceInfo> - { - public: - // css::lang::XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_static(); - static css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames_static(); - //static css::uno::Reference< css::uno::XInterface> SAL_CALL Create( - // const css::uno::Reference<css::uno::XComponentContext>& context); - - static css::uno::Reference< css::uno::XInterface> SAL_CALL Create( - const css::uno::Reference< css::lang::XMultiServiceFactory>& sm); - - protected: - CoreController(const css::uno::Reference< css::uno::XComponentContext>& context); - CoreController(const css::uno::Reference< css::lang::XMultiServiceFactory>& sm); - virtual ~CoreController(); - - // css::oooimprovement::XCoreController - virtual sal_Bool SAL_CALL enablingUiEventsLoggerAllowed(sal_Int16 version) - throw(css::uno::RuntimeException); - virtual sal_Bool SAL_CALL showBuiltinOptionsPage(sal_Int16 version) - throw(css::uno::RuntimeException); - - // css::lang::XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw(css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString& service_name) - throw(css::uno::RuntimeException); - virtual css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() - throw(css::uno::RuntimeException); - - private: - css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/errormail.cxx b/extensions/source/oooimprovement/errormail.cxx deleted file mode 100644 index 45ebf3b6ee19..000000000000 --- a/extensions/source/oooimprovement/errormail.cxx +++ /dev/null @@ -1,206 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#include "errormail.hxx" -#include "config.hxx" -#include <unotools/bootstrap.hxx> -#include <rtl/ustring.hxx> -#include <rtl/string.hxx> -#include <rtl/strbuf.hxx> - -#if defined(UNIX) - #include <sys/utsname.h> -#endif -#ifdef WIN32 - #include <windows.h> -#endif - - -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace oooimprovement; -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OStringBuffer; - - -namespace { - static OString replaceAll(const OString& str, sal_Char old, const OString& replacement) - { - OStringBuffer result; - sal_Int32 idx = 0; - do { - result.append(str.getToken(0, old, idx)); - if(idx>=0) result.append(replacement); - } while(idx >= 0); - return result.makeStringAndClear(); - }; - - static OString xmlAttrEncode(const OString& input) - { - OString result = replaceAll(input, '&', OString("&")); - result = replaceAll(result, '<', OString("<")); - result = replaceAll(result, '"', OString(""")); - return replaceAll(result, '>', OString(">")); - } - - static OString getPlatform() - { - #ifdef SOLARIS - return "Solaris"; - #elif defined LINUX - return "Linux"; - #elif defined WIN32 - return "Win32"; - #elif defined UNIX - return "Unix"; - #else - return "Unknown"; - #endif - }; - -#if defined(UNIX) - static const OString getLocale() - { - const char * locale = getenv( "LC_ALL" ); - if( NULL == locale ) - locale = getenv( "LC_CTYPE" ); - - if( NULL == locale ) - locale = getenv( "LANG" ); - - if( NULL == locale ) - locale = "C"; - return locale; - }; - - static OString getSystemInfoXml(const Reference<XMultiServiceFactory>&) - { - struct utsname info; - //memset(&info, 0, sizeof(info)); - uname(&info); - OStringBuffer result = - "<systeminfo:systeminfo xmlns:systeminfo=\"http://openoffice.org/2002/systeminfo\">\n" - "<systeminfo:System name=\"" - + xmlAttrEncode(OString(info.sysname)) + "\" version=\"" - + xmlAttrEncode(OString(info.version)) + "\" build=\"" - + xmlAttrEncode(OString(info.release)) + "\" locale=\"" - + xmlAttrEncode(OString(getLocale())) + "\"/>\n" - "<systeminfo:CPU type=\"" - + xmlAttrEncode(OString(info.machine)) + "\"/>\n" - "</systeminfo:systeminfo>\n"; - return result.makeStringAndClear(); - }; -#else - static OString getSystemInfoXml(const Reference<XMultiServiceFactory>&) - { - OSVERSIONINFO info; - ZeroMemory(&info, sizeof(OSVERSIONINFO)); - info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&info); - OStringBuffer result = OString( - "<systeminfo:systeminfo xmlns:systeminfo=\"http://openoffice.org/2002/systeminfo\">\n" - "<systeminfo:System name=\""); - if(VER_PLATFORM_WIN32_NT == info.dwPlatformId) - result.append(OString("Windows NT")); - else - result.append(OString("Windows")); - result.append("\" version=\"").append(static_cast<long>(info.dwMajorVersion)); - result.append(".").append(static_cast<long>(info.dwMinorVersion)); - result.append("\" build=\"").append(static_cast<long>(info.dwBuildNumber)); - result.append("\" locale=\"").append(static_cast<long>(GetUserDefaultLangID())); - result.append("\"/>\n"); - result.append("<systeminfo:CPU type=\"" - /* x86 or AMD64 */ "\"/>\n" - "</systeminfo:systeminfo>\n"); - return result.makeStringAndClear(); - }; -#endif - - static OString getOfficeInfoXml(const Reference<XMultiServiceFactory>& sf) - { - Config config(sf); - const OString product = OUStringToOString(config.getCompleteProductname(), RTL_TEXTENCODING_ASCII_US); - const OString platform = getPlatform(); - const OString language = OUStringToOString(config.getSetupLocale(), RTL_TEXTENCODING_ASCII_US); - // If the oooimprovement lib is packaged in an extension, this needs to - // be done in another way: The build version string needs to be made - // available in an UNO service (if no better place is found for this, - // com.sun.star.comp.extensions.oooimprovecore.Core in oooimprovecore - // is likely the best fit) - const OString build = OUStringToOString(::utl::Bootstrap::getBuildIdData(OUString()), RTL_TEXTENCODING_ASCII_US); - const OString exceptiontype = ""; - OStringBuffer result = - "<officeinfo:officeinfo xmlns:officeinfo=\"http://openoffice.org/2002/officeinfo\" platform=\"" - + xmlAttrEncode(platform) + "\" language=\"" - + xmlAttrEncode(language) + "\" build=\"" - + xmlAttrEncode(build) + "\" exceptiontype=\"" - + xmlAttrEncode(exceptiontype) + "\" product=\"" - + xmlAttrEncode(product) + " \" />\n"; - return result.makeStringAndClear(); - }; -} - -namespace oooimprovement -{ - Errormail::Errormail(const Reference<XMultiServiceFactory>& sf) - : m_ServiceFactory(sf) - {} - - OString Errormail::getXml() - { - Config config(m_ServiceFactory); - const OString usertype; - const OString email = OUStringToOString(config.getReporterEmail(), RTL_TEXTENCODING_ASCII_US); - OString feedback; - { - OStringBuffer temp; - temp.append(config.getReportCount()); - feedback = temp.makeStringAndClear(); - } - const OString title; - OStringBuffer result = - "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" - "<!DOCTYPE errormail:errormail PUBLIC \"-//OpenOffice.org//DTD ErrorMail 1.0//EN\" \"errormail.dtd\">\n" - "<errormail:errormail xmlns:errormail=\"http://openoffice.org/2002/errormail\" usertype=\"" - + xmlAttrEncode(usertype) + "\">\n" - "<reportmail:mail xmlns:reportmail=\"http://openoffice.org/2002/reportmail\" version=\"1.1\" feedback=\"" - + xmlAttrEncode(feedback) + "\" email=\"" - + xmlAttrEncode(email) + "\">\n" - "<reportmail:title>" - + xmlAttrEncode(title) + "</reportmail:title>\n" - "<reportmail:attachment name=\"data.zip\" media-type=\"application/zip\" class=\"OOoImprovementLog\"/>\n" - "</reportmail:mail>\n" - + getOfficeInfoXml(m_ServiceFactory) - + getSystemInfoXml(m_ServiceFactory) + - "</errormail:errormail>\n"; - return result.makeStringAndClear(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/errormail.hxx b/extensions/source/oooimprovement/errormail.hxx deleted file mode 100644 index 8b836514fcac..000000000000 --- a/extensions/source/oooimprovement/errormail.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_ERRORMAIL_HXX -#define EXTENSIONS_OOOIMPROVEMENT_ERRORMAIL_HXX - -#include <rtl/string.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class Errormail - { - public: - Errormail(const css::uno::Reference<css::lang::XMultiServiceFactory>& sf); - // Errormail does NOT use CDATA so it can be included - // in a CDATA of another XML document without further - // quoting - ::rtl::OString getXml(); - private: - css::uno::Reference<css::lang::XMultiServiceFactory> m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/invite_job.cxx b/extensions/source/oooimprovement/invite_job.cxx deleted file mode 100644 index 80418ddcc4d6..000000000000 --- a/extensions/source/oooimprovement/invite_job.cxx +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - - -#include "invite_job.hxx" -#include "config.hxx" -#include "logstorage.hxx" -#include <com/sun/star/oooimprovement/XCore.hpp> -#include <rtl/process.h> - - -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::task; -using namespace ::com::sun::star::uno; -using ::com::sun::star::oooimprovement::XCore; -using ::rtl::OUString; - -namespace -{ - // dont show Invitation, when: - // -nofirststartwizard commandline switch is present - // [add additional conditions here] - static bool lcl_IsInvitationAllowed() - { - static OUString sNoFirstStartWizard(RTL_CONSTASCII_USTRINGPARAM("-nofirststartwizard")); - sal_Int32 nCount = rtl_getAppCommandArgCount(); - for(sal_Int32 nCurrent=0; nCurrent<nCount; nCurrent++) - { - OUString sArg; - rtl_getAppCommandArg(nCurrent, &sArg.pData); - if(sNoFirstStartWizard == sArg) - return false; - } - return true; - } -} - -namespace oooimprovement -{ - - InviteJob::InviteJob(const Reference<XMultiServiceFactory>& sf) - : m_ServiceFactory(sf) - { } - - InviteJob::~InviteJob() - { } - - void SAL_CALL InviteJob::executeAsync(const Sequence<NamedValue>&, const Reference<XJobListener>& listener) throw(RuntimeException) - { - Config config(m_ServiceFactory); - { - LogStorage log_storage(m_ServiceFactory); - log_storage.assureExists(); - } - if(config.getOfficeStartCounterdown() > 0) - config.decrementOfficeStartCounterdown(1); - else - { - if(lcl_IsInvitationAllowed() && !config.getShowedInvitation()) - { - Reference<XCore> core( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.Core"))), - UNO_QUERY); - if(core.is()) core->inviteUser(); - } - } - Any result; - listener->jobFinished(Reference<XAsyncJob>(this), result); - } - - sal_Bool SAL_CALL InviteJob::supportsService(const OUString& service_name) throw(RuntimeException) - { - const Sequence<OUString> service_names(getSupportedServiceNames()); - for (sal_Int32 idx = service_names.getLength()-1; idx>=0; --idx) - if(service_name == service_names[idx]) return sal_True; - return sal_False; - } - - OUString SAL_CALL InviteJob::getImplementationName() throw(RuntimeException) - { return getImplementationName_static(); } - - Sequence<OUString> SAL_CALL InviteJob::getSupportedServiceNames() throw(RuntimeException) - { return getSupportedServiceNames_static(); } - - OUString SAL_CALL InviteJob::getImplementationName_static() - { return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.extensions.oooimprovement.InviteJob")); } - - Sequence<OUString> SAL_CALL InviteJob::getSupportedServiceNames_static() - { - Sequence<OUString> aServiceNames(1); - aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.AsyncJob")); - return aServiceNames; - } - - Reference<XInterface> InviteJob::Create(const Reference<XMultiServiceFactory>& sm) - { return *(new InviteJob(sm)); } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/invite_job.hxx b/extensions/source/oooimprovement/invite_job.hxx deleted file mode 100644 index 599649f62205..000000000000 --- a/extensions/source/oooimprovement/invite_job.hxx +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_INVITEJOB_HXX -#define EXTENSIONS_OOOIMPROVEMENT_INVITEJOB_HXX - -#include <com/sun/star/task/XAsyncJob.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/implbase2.hxx> - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class InviteJob : public ::cppu::WeakImplHelper2< - css::task::XAsyncJob, - css::lang::XServiceInfo> - { - public: - // XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_static(); - static css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames_static(); - //static css::uno::Reference< css::uno::XInterface> SAL_CALL Create( - // const css::uno::Reference< css::uno::XComponentContext>& context); - - static css::uno::Reference< css::uno::XInterface> SAL_CALL Create(const css::uno::Reference< css::lang::XMultiServiceFactory>& sm); - - protected: - InviteJob(const css::uno::Reference< css::uno::XComponentContext>& context); - InviteJob(const css::uno::Reference< css::lang::XMultiServiceFactory>& sf); - virtual ~InviteJob(); - - // XAsyncJob - virtual void SAL_CALL executeAsync( - const css::uno::Sequence< css::beans::NamedValue>& args, - const css::uno::Reference< css::task::XJobListener>& listener) - throw(css::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw(css::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& service_name) - throw(css::uno::RuntimeException); - virtual css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() - throw(css::uno::RuntimeException); - - private: - css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/logpacker.cxx b/extensions/source/oooimprovement/logpacker.cxx deleted file mode 100644 index fe04c885f3e8..000000000000 --- a/extensions/source/oooimprovement/logpacker.cxx +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#include "logpacker.hxx" -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/embed/XStorage.hpp> -#include <com/sun/star/embed/XTransactedObject.hpp> -#include <com/sun/star/embed/ElementModes.hpp> -#include <rtl/ustrbuf.hxx> - - -using namespace com::sun::star::embed; -using namespace com::sun::star::io; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using ::com::sun::star::ucb::XSimpleFileAccess; -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - - -namespace -{ - static const OUString getZipfileurl(const OUString& csvfileurl) - { - OUStringBuffer buf(csvfileurl); - buf.setLength(csvfileurl.getLength()-3); - buf.appendAscii("zip"); - return buf.makeStringAndClear(); - }; - - static sal_Int32 countLines(const Sequence<sal_Int8>& data) - { - sal_Int32 result = 0; - for(sal_Int32 idx = data.getLength()-1; idx>=0; --idx) - if(data[idx]==0x0a) result++; - return result; - }; -} - -namespace oooimprovement -{ - LogPacker::LogPacker(const Reference<XMultiServiceFactory>& sf) - : m_ServiceFactory(sf) - {} - - sal_Int32 LogPacker::pack(const OUString& fileurl) - { - Reference<XSimpleFileAccess> file_access( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - - Reference<XStorage> storage; - { - Reference<XSingleServiceFactory> storage_factory( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory"))), - UNO_QUERY_THROW); - Sequence<Any> storage_init_args(2); - storage_init_args[0] = Any(getZipfileurl(fileurl)); - storage_init_args[1] = Any(ElementModes::WRITE); - storage = Reference<XStorage>( - storage_factory->createInstanceWithArguments(storage_init_args), - UNO_QUERY_THROW); - } - - Reference<XOutputStream> zipped_stream = storage->openStreamElement( - OUString(RTL_CONSTASCII_USTRINGPARAM("logdata.csv")), - ElementModes::WRITE)->getOutputStream(); - Reference<XInputStream> unzipped_stream = file_access->openFileRead(fileurl); - const sal_Int32 bufsize = 1024; - sal_Int32 read_bytes; - sal_Int32 logged_events = -1; // ignore header row - Sequence<sal_Int8> buf(bufsize); - do - { - read_bytes = unzipped_stream->readBytes(buf, bufsize); - buf.realloc(read_bytes); - logged_events += countLines(buf); - zipped_stream->writeBytes(buf); - } while(read_bytes == bufsize); - unzipped_stream->closeInput(); - zipped_stream->flush(); - zipped_stream->closeOutput(); - Reference<XTransactedObject>(storage, UNO_QUERY_THROW)->commit(); - file_access->kill(fileurl); - return logged_events; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/logpacker.hxx b/extensions/source/oooimprovement/logpacker.hxx deleted file mode 100644 index fdf08141ba03..000000000000 --- a/extensions/source/oooimprovement/logpacker.hxx +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_LOGPACKER_HXX -#define EXTENSIONS_OOOIMPROVEMENT_LOGPACKER_HXX - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <rtl/ustring.hxx> - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class LogPacker - { - public: - LogPacker(const css::uno::Reference< css::lang::XMultiServiceFactory>& sf); - sal_Int32 pack(const ::rtl::OUString& fileurl); - private: - const css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/logstorage.cxx b/extensions/source/oooimprovement/logstorage.cxx deleted file mode 100644 index 4be4fa01fff5..000000000000 --- a/extensions/source/oooimprovement/logstorage.cxx +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#include "logstorage.hxx" -#include "config.hxx" -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> -#include <com/sun/star/util/XStringSubstitution.hpp> - - -using namespace com::sun::star::io; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::util; -using ::com::sun::star::ucb::XSimpleFileAccess; -using ::rtl::OUString; -using ::std::vector; - - -namespace -{ - using namespace oooimprovement; - - static const OUString CSSU_PATHSUB(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.PathSubstitution")); - - static OUString getLogPathFromCfg(const Reference<XMultiServiceFactory>& sf) - { - Config config(sf); - OUString result=config.getLogPath(); - Reference<XStringSubstitution> path_sub( - sf->createInstance(CSSU_PATHSUB), - UNO_QUERY); - if(path_sub.is()) - result = path_sub->substituteVariables(result, sal_False); - return result; - } - - static bool isZipfile(const OUString& fileurl) - { - static const OUString file_extension(RTL_CONSTASCII_USTRINGPARAM(".zip")); - return fileurl.match(file_extension, fileurl.getLength()-file_extension.getLength()); - }; - - static bool isLogfile(const OUString& fileurl) - { - static const OUString file_extension(RTL_CONSTASCII_USTRINGPARAM(".csv")); - static const OUString current(RTL_CONSTASCII_USTRINGPARAM("Current.csv")); - return - fileurl.match(file_extension, fileurl.getLength()-file_extension.getLength()) - && !fileurl.match(current, fileurl.getLength()-current.getLength()); - }; - - static bool isZipOrLogFile(const OUString& fileurl) - { - return isZipfile(fileurl) || isLogfile(fileurl); - } - - static Sequence<OUString> getAllLogStoragefiles(const Reference<XMultiServiceFactory>& sf) - { - Reference<XSimpleFileAccess> file_access( - sf->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - return file_access->getFolderContents( - getLogPathFromCfg(sf), - false); - }; - - static vector<OUString> getLogStoragefiles( - const Reference<XMultiServiceFactory>& sf, - bool (*condition)(const OUString& path)) - { - Sequence<OUString> candidates = getAllLogStoragefiles(sf); - vector<OUString> result; - result.reserve(candidates.getLength()); - for(sal_Int32 idx=0; idx<candidates.getLength(); ++idx) - if(condition(candidates[idx])) - result.push_back(candidates[idx]); - return result; - }; - - static void assureLogStorageExists(const Reference<XMultiServiceFactory>& sf) - { - Reference<XSimpleFileAccess> file_access( - sf->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - OUString log_path(getLogPathFromCfg(sf)); - if(!file_access->isFolder(log_path)) - file_access->createFolder(log_path); - }; -} - -namespace oooimprovement -{ - - LogStorage::LogStorage(const Reference<XMultiServiceFactory>& sf) - : m_ServiceFactory(sf) - {} - - void LogStorage::assureExists() - { - assureLogStorageExists(m_ServiceFactory); - } - - void LogStorage::clear() - { - Reference<XSimpleFileAccess> file_access( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - vector<OUString> files_to_kill = getLogStoragefiles(m_ServiceFactory, &isZipOrLogFile); - for(vector<OUString>::iterator item = files_to_kill.begin(); - item != files_to_kill.end(); - ++item) - file_access->kill(*item); - } - - const vector<OUString> LogStorage::getUnzippedLogFiles() const - { return getLogStoragefiles(m_ServiceFactory, &isLogfile); } - - const vector<OUString> LogStorage::getZippedLogFiles() const - { return getLogStoragefiles(m_ServiceFactory, &isZipfile); } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/logstorage.hxx b/extensions/source/oooimprovement/logstorage.hxx deleted file mode 100644 index 82dcdf331f59..000000000000 --- a/extensions/source/oooimprovement/logstorage.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_LOGSTORAGE_HXX -#define EXTENSIONS_OOOIMPROVEMENT_LOGSTORAGE_HXX - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <rtl/ustring.hxx> -#include <vector> - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class LogStorage - { - public: - LogStorage(const css::uno::Reference< css::lang::XMultiServiceFactory>& sf); - void assureExists(); - void clear(); - const std::vector< ::rtl::OUString> getUnzippedLogFiles() const; - const std::vector< ::rtl::OUString> getZippedLogFiles() const; - private: - const css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/makefile.mk b/extensions/source/oooimprovement/makefile.mk deleted file mode 100644 index 1a7e4ba17711..000000000000 --- a/extensions/source/oooimprovement/makefile.mk +++ /dev/null @@ -1,110 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# 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=extensions -TARGET=oooimprovement -ENABLE_EXCEPTIONS=TRUE - -PACKAGE=org.openoffice.Office -ABSXCSROOT=$(SOLARXMLDIR) -XCSROOT=.. -DTDDIR=$(ABSXCSROOT) -XSLDIR=$(ABSXCSROOT)$/processing -PROCESSOUT=$(MISC)$/$(TARGET) -PROCESSORDIR=$(SOLARBINDIR) - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -SLOFILES= \ - $(SLO)$/myconfigurationhelper.obj \ - $(SLO)$/config.obj \ - $(SLO)$/corecontroller.obj \ - $(SLO)$/errormail.obj \ - $(SLO)$/invite_job.obj \ - $(SLO)$/logpacker.obj \ - $(SLO)$/logstorage.obj \ - $(SLO)$/onlogrotate_job.obj \ - $(SLO)$/oooimprovement_exports.obj \ - $(SLO)$/soaprequest.obj \ - $(SLO)$/soapsender.obj \ - -SHL1STDLIBS= \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(UNOTOOLSLIB) \ - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) - -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -DEF1NAME= $(SHL1TARGET) -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -PACKAGEDIR=$(subst,.,$/ $(PACKAGE)) -SPOOLDIR=$(MISC)$/registry$/spool - -XCUFILES= \ - Jobs.xcu \ - Logging.xcu - -MYXCUFILES= \ - $(SPOOLDIR)$/$(PACKAGEDIR)$/Jobs$/Jobs-oooimprovement.xcu \ - $(SPOOLDIR)$/$(PACKAGEDIR)$/Logging$/Logging-oooimprovement.xcu - - -# --- Targets --- - -.INCLUDE : target.mk - -ALLTAR : $(MYXCUFILES) - -XCU_SOURCEDIR:=. - -$(SPOOLDIR)$/$(PACKAGEDIR)$/Jobs$/Jobs-oooimprovement.xcu : $(XCU_SOURCEDIR)$/Jobs.xcu - @-$(MKDIRHIER) $(@:d) - @$(COPY) $< $@ - -$(SPOOLDIR)$/$(PACKAGEDIR)$/Logging$/Logging-oooimprovement.xcu : $(XCU_SOURCEDIR)$/Logging.xcu - @-$(MKDIRHIER) $(@:d) - @$(COPY) $< $@ - -ALLTAR : $(MISC)/oooimprovement.component - -$(MISC)/oooimprovement.component .ERRREMOVE : \ - $(SOLARENV)/bin/createcomponent.xslt oooimprovement.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt oooimprovement.component diff --git a/extensions/source/oooimprovement/makefile.pmk b/extensions/source/oooimprovement/makefile.pmk deleted file mode 100644 index f5c8da25b54a..000000000000 --- a/extensions/source/oooimprovement/makefile.pmk +++ /dev/null @@ -1,29 +0,0 @@ -# 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. -# -#************************************************************************* - -XSLDIR=$(SOLARXMLDIR)$/processing -XCSROOT=$(SOLARXMLDIR) -ABSXCSROOT=$(SOLARXMLDIR) -DTDDIR=$(SOLARXMLDIR) -PROCESSOUT=$(MISC)$/$(CUSTID) -PROCESSORDIR=$(SOLARBINDIR) - -# no validation by inspector class -NO_INSPECTION=TRUE - diff --git a/extensions/source/oooimprovement/myconfigurationhelper.cxx b/extensions/source/oooimprovement/myconfigurationhelper.cxx deleted file mode 100644 index 493ae01cc7fe..000000000000 --- a/extensions/source/oooimprovement/myconfigurationhelper.cxx +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#include "myconfigurationhelper.hxx" -#include <com/sun/star/beans/NamedValue.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/configuration/theDefaultProvider.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <comphelper/processfactory.hxx> -#include <rtl/ustrbuf.hxx> - -namespace css = ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - -namespace -{ - static const OUString noSuchElement(const OUString& path) - { - OUStringBuffer buf(256); - buf.appendAscii("The requested path \""); - buf.append(path); - buf.appendAscii("\" does not exists."); - return buf.makeStringAndClear(); - }; -} - -namespace oooimprovement -{ - Reference<XInterface> MyConfigurationHelper::openConfig( - const Reference<XMultiServiceFactory> xSMGR, - const OUString& sPackage, - sal_Int32 eMode) - { - Reference<XMultiServiceFactory> xConfigProvider( - css::configuration::theDefaultProvider::get( - comphelper::getComponentContext(xSMGR))); - - css::uno::Sequence<Any> lParams(1); - css::beans::NamedValue aParam; - - // set root path - aParam.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")); - aParam.Value <<= sPackage; - lParams[0] = makeAny(aParam); - - // open it - Reference<XInterface> xCFG; - - sal_Bool bReadOnly = ((eMode & MyConfigurationHelper::E_READONLY)==MyConfigurationHelper::E_READONLY); - if (bReadOnly) - xCFG = xConfigProvider->createInstanceWithArguments( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")), - lParams); - else - xCFG = xConfigProvider->createInstanceWithArguments( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess")), - lParams); - return xCFG; - } - - Any MyConfigurationHelper::readRelativeKey( - const Reference<XInterface> xCFG, - const OUString& sRelPath, - const OUString& sKey) - { - Reference<css::container::XHierarchicalNameAccess> xAccess(xCFG, UNO_QUERY_THROW); - - Reference<css::beans::XPropertySet> xProps; - xAccess->getByHierarchicalName(sRelPath) >>= xProps; - if (!xProps.is()) - throw css::container::NoSuchElementException( - noSuchElement(sRelPath), - Reference<XInterface>()); - return xProps->getPropertyValue(sKey); - } - - void MyConfigurationHelper::writeRelativeKey( - const Reference<XInterface> xCFG, - const OUString& sRelPath, - const OUString& sKey, - const Any& aValue) - { - Reference<css::container::XHierarchicalNameAccess> xAccess(xCFG, UNO_QUERY_THROW); - - Reference<css::beans::XPropertySet> xProps; - xAccess->getByHierarchicalName(sRelPath) >>= xProps; - if (!xProps.is()) - throw css::container::NoSuchElementException( - noSuchElement(sRelPath), - Reference<XInterface>()); - xProps->setPropertyValue(sKey, aValue); - } - - Any MyConfigurationHelper::readDirectKey( - const Reference<XMultiServiceFactory> xSMGR, - const OUString& sPackage, - const OUString& sRelPath, - const OUString& sKey, - sal_Int32 eMode) - { - Reference<XInterface> xCFG = MyConfigurationHelper::openConfig(xSMGR, sPackage, eMode); - return MyConfigurationHelper::readRelativeKey(xCFG, sRelPath, sKey); - } - - void MyConfigurationHelper::writeDirectKey( - const Reference<XMultiServiceFactory> xSMGR, - const OUString& sPackage, - const OUString& sRelPath, - const OUString& sKey, - const Any& aValue, - sal_Int32 eMode) - { - Reference<XInterface> xCFG = MyConfigurationHelper::openConfig(xSMGR, sPackage, eMode); - MyConfigurationHelper::writeRelativeKey(xCFG, sRelPath, sKey, aValue); - MyConfigurationHelper::flush(xCFG); - } - - void MyConfigurationHelper::flush(const Reference<XInterface>& xCFG) - { - Reference<css::util::XChangesBatch> xBatch(xCFG, UNO_QUERY_THROW); - xBatch->commitChanges(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/myconfigurationhelper.hxx b/extensions/source/oooimprovement/myconfigurationhelper.hxx deleted file mode 100644 index 56b3d1353c8f..000000000000 --- a/extensions/source/oooimprovement/myconfigurationhelper.hxx +++ /dev/null @@ -1,213 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_CONFIGURATIONHELPER_HXX -#define EXTENSIONS_OOOIMPROVEMENT_CONFIGURATIONHELPER_HXX - -#include <com/sun/star/uno/XInterface.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/container/XHierarchicalNameAccess.hpp> -#include <com/sun/star/util/XChangesBatch.hpp> -#include <rtl/ustring.hxx> - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - // Copy from comphelper module, we cant use that directly from an extension - class MyConfigurationHelper - { - public: - //----------------------------------------------- - /** specify all possible modes, which can be used to open a configuration access. - * - * @see openConfig() - * @see readDirectKey() - * @see writeDirectKey() - */ - enum EConfigurationModes - { - /// opens configuration in read/write mode (without LAZY writing!) - E_STANDARD = 0, - /// configuration will be opened readonly - E_READONLY = 1, - }; - - //----------------------------------------------- - /** returns access to the specified configuration package. - * - * This method should be used, if e.g. more then one request to the same - * configuration package is needed. The configuration access can be cached - * outside and used inbetween. - * - * @param xSMGR - * the uno service manager, which should be used to create the - * configuration access. - * - * @param sPackage - * the name of the configuration package. - * e.g. <ul> - * <li>org.openoffice.Office.Common</li> - * <li>org.openoffice.Office.Common/Menu</li> - * </ul> - * - * @param eMode - * specify the open mode for the returned configuration access. - * It's interpreted as a flag field and can be any usefull combination - * of values of EConfigurationModes. - * - * @throw css::uno::Any exceptions the underlying configuration can throw. - * E.g. css::uno::Exception if the configuration could not be opened. - */ - static css::uno::Reference< css::uno::XInterface> openConfig( - const css::uno::Reference< css::lang::XMultiServiceFactory> xSMGR, - const ::rtl::OUString& sPackage, - sal_Int32 eMode); - - //----------------------------------------------- - /** reads the value of an existing(!) configuration key, - * which is searched relative to the specified configuration access. - * - * This method must be used in combination with openConfig(). - * The cached configuration access must be provided here ... and - * all operations are made relativ to this access point. - * - * @param xCFG - * the configuration root, where sRelPath should be interpreted. - * as relativ path - * - * @param sRelPath - * path relative to xCFG parameter. - * - * @param sKey - * the configuration node, where we should read the value. - * - * @return [css.uno.css::uno::Any] - * the value of sKey. - * - * @throw css::uno::Any exceptions the underlying configuration can throw. - * E.g. css::container::NoSuchElementException if the specified - * key does not exists. - */ - static css::uno::Any readRelativeKey( - const css::uno::Reference< css::uno::XInterface> xCFG, - const ::rtl::OUString& sRelPath, - const ::rtl::OUString& sKey); - - //----------------------------------------------- - /** writes a new value for an existing(!) configuration key, - * which is searched relative to the specified configuration access. - * - * This method must be used in combination with openConfig(). - * The cached configuration access must be provided here ... and - * all operations are made relativ to this access point. - * - * @param xCFG - * the configuration root, where sRelPath should be interpreted. - * as relativ path - * - * @param sRelPath - * path relative to xCFG parameter. - * - * @param sKey - * the configuration node, where we should write the new value. - * - * @param aValue - * the new value for sKey. - * - * @throw css::uno::Any exceptions the underlying configuration can throw. - * E.g. css::container::NoSuchElementException if the specified - * key does not exists or css::uno::Exception if the provided configuration - * access does not allow writing for this key. - */ - static void writeRelativeKey( - const css::uno::Reference< css::uno::XInterface> xCFG, - const ::rtl::OUString& sRelPath, - const ::rtl::OUString& sKey, - const css::uno::Any& aValue); - - //----------------------------------------------- - /** commit all changes made on the specified configuration access. - * - * This method must be used in combination with openConfig(). - * The cached configuration access must be provided here. - * - * @param xCFG - * the configuration root, where changes should be commited. - * - * @throw css::uno::Any exceptions the underlying configuration can throw. - * E.g. uno::Exception if the provided configuration - * access does not allow writing for this set. - */ - static void flush(const css::uno::Reference< css::uno::XInterface>& xCFG); - - //----------------------------------------------- - /** does the same then openConfig() & readRelativeKey() together. - * - * This method should be used for reading one key at one code place only. - * Because it opens the specified configuration package, reads the key and - * closes the configuration again. - * - * So its not very usefull to use this method for reading multiple keys at the same time. - * (Excepting these keys exists inside different configuration packages ...)) - */ - static css::uno::Any readDirectKey( - const css::uno::Reference< css::lang::XMultiServiceFactory> xSMGR, - const ::rtl::OUString& sPackage, - const ::rtl::OUString& sRelPath, - const ::rtl::OUString& sKey, - sal_Int32 eMode); - - //----------------------------------------------- - /** does the same then openConfig() / writeRelativeKey() & flush() together. - * - * This method should be used for writing one key at one code place only. - * Because it opens the specified configuration package, writes the key, flush - * all changes and closes the configuration again. - * - * So its not very usefull to use this method for writing multiple keys at the same time. - * (Excepting these keys exists inside different configuration packages ...)) - */ - static void writeDirectKey( - const css::uno::Reference< css::lang::XMultiServiceFactory> xSMGR, - const ::rtl::OUString& sPackage, - const ::rtl::OUString& sRelPath, - const ::rtl::OUString& sKey, - const css::uno::Any& aValue, - sal_Int32 eMode); - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/onlogrotate_job.cxx b/extensions/source/oooimprovement/onlogrotate_job.cxx deleted file mode 100644 index 43efaeb80668..000000000000 --- a/extensions/source/oooimprovement/onlogrotate_job.cxx +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#include "onlogrotate_job.hxx" -#include "config.hxx" -#include "logpacker.hxx" -#include "logstorage.hxx" -#include "soaprequest.hxx" -#include "soapsender.hxx" - -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> -#include <com/sun/star/frame/XDesktop.hpp> -#include <com/sun/star/frame/XTerminateListener.hpp> -#include <osl/conditn.hxx> -#include <osl/thread.hxx> -#include <osl/time.h> -#include <cppuhelper/implbase1.hxx> -#include <memory> - - -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::task; -using namespace ::com::sun::star::uno; -using ::com::sun::star::frame::XTerminateListener; -using ::com::sun::star::frame::XDesktop; -using ::com::sun::star::ucb::XSimpleFileAccess; -using ::rtl::OUString; -using ::std::vector; - -namespace -{ - using namespace oooimprovement; - - static void packLogs(const Reference<XMultiServiceFactory>& sf) - { - try - { - Config config(sf); - LogPacker log_packer(sf); - vector<OUString> csvfiles = LogStorage(sf).getUnzippedLogFiles(); - for( - vector<OUString>::iterator item = csvfiles.begin(); - item!=csvfiles.end(); - item++) - config.incrementEventCount(log_packer.pack(*item)); - } catch(...) {}; - }; - - static void uploadLogs(const Reference<XMultiServiceFactory>& sf) - { - try - { - Config config(sf); - Reference<XSimpleFileAccess> file_access( - sf->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - SoapSender sender(sf, config.getSoapUrl()); - OUString soap_id = config.getSoapId(); - vector<OUString> zipfiles = LogStorage(sf).getZippedLogFiles(); - for( - vector<OUString>::iterator item = zipfiles.begin(); - item!=zipfiles.end(); - item++) - { - if(config.incrementFailedAttempts(1) > 25) - { - config.giveupUploading(); - LogStorage(sf).clear(); - return; - } - sender.send(SoapRequest(sf, soap_id, *item)); - config.incrementReportCount(1); - file_access->kill(*item); - config.resetFailedAttempts(); - } - } catch(...) {}; - } - - class OnLogRotateThread : public ::osl::Thread - { - public: - OnLogRotateThread(Reference<XMultiServiceFactory> sf); - virtual void SAL_CALL run(); - void stop(); - - private: - Reference<XMultiServiceFactory> m_ServiceFactory; - ::osl::Condition m_Stop; - }; - - OnLogRotateThread::OnLogRotateThread(Reference<XMultiServiceFactory> sf) - : m_ServiceFactory(sf) - { - OSL_ASSERT(sf.is()); - } - - void SAL_CALL OnLogRotateThread::run() - { - TimeValue wait_intervall = {30,0}; - if (m_Stop.wait(&wait_intervall) == ::osl::Condition::result_timeout) - { - try - { - if(Config(m_ServiceFactory).getInvitationAccepted()) - { - packLogs(m_ServiceFactory); - uploadLogs(m_ServiceFactory); - } - else - LogStorage(m_ServiceFactory).clear(); - } - catch(...) {} - } - } - - void OnLogRotateThread::stop() - { - m_Stop.set(); - } - - class OnLogRotateThreadWatcher : public ::cppu::WeakImplHelper1<XTerminateListener> - { - public: - OnLogRotateThreadWatcher(Reference<XMultiServiceFactory> sf) - : m_Thread(new OnLogRotateThread(sf)) - { - m_Thread->create(); - } - virtual ~OnLogRotateThreadWatcher() - { - m_Thread->stop(); - m_Thread->join(); - }; - - // XTerminateListener - virtual void SAL_CALL queryTermination(const EventObject&) throw(RuntimeException) - { }; - virtual void SAL_CALL notifyTermination(const EventObject&) throw(RuntimeException) - { - m_Thread->stop(); - m_Thread->join(); - }; - // XEventListener - virtual void SAL_CALL disposing(const EventObject&) throw(RuntimeException) - { - m_Thread->stop(); - m_Thread->join(); - }; - private: - ::std::auto_ptr<OnLogRotateThread> m_Thread; - }; -} - -namespace oooimprovement -{ - OnLogRotateJob::OnLogRotateJob(const Reference<XComponentContext>& context) - : m_ServiceFactory(Reference<XMultiServiceFactory>( - context->getServiceManager()->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.XMultiServiceFactory")), context), - UNO_QUERY)) - { } - - OnLogRotateJob::OnLogRotateJob(const Reference<XMultiServiceFactory>& sf) - : m_ServiceFactory(sf) - { } - - OnLogRotateJob::~OnLogRotateJob() - { } - - void SAL_CALL OnLogRotateJob::executeAsync( - const Sequence<NamedValue>&, - const Reference<XJobListener>& listener) - throw(RuntimeException) - { - Reference<XDesktop> xDesktop( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), - UNO_QUERY); - if(xDesktop.is()) - xDesktop->addTerminateListener(Reference<XTerminateListener>(new OnLogRotateThreadWatcher(m_ServiceFactory))); - Any result; - listener->jobFinished(Reference<XAsyncJob>(this), result); - } - - sal_Bool SAL_CALL OnLogRotateJob::supportsService(const OUString& service_name) throw(RuntimeException) - { - const Sequence<OUString> service_names(getSupportedServiceNames()); - for (sal_Int32 idx = service_names.getLength()-1; idx>=0; --idx) - if(service_name == service_names[idx]) return sal_True; - return sal_False; - } - - OUString SAL_CALL OnLogRotateJob::getImplementationName() throw(RuntimeException) - { return getImplementationName_static(); } - - Sequence<OUString> SAL_CALL OnLogRotateJob::getSupportedServiceNames() throw(RuntimeException) - { return getSupportedServiceNames_static(); } - - OUString SAL_CALL OnLogRotateJob::getImplementationName_static() - { return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.extensions.oooimprovement.OnLogRotateJob")); } - - Sequence<OUString> SAL_CALL OnLogRotateJob::getSupportedServiceNames_static() - { - Sequence<OUString> aServiceNames(1); - aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.AsyncJob")); - return aServiceNames; - } - - Reference<XInterface> OnLogRotateJob::Create(const Reference<XComponentContext>& context) - { return *(new OnLogRotateJob(context)); } - - Reference<XInterface> OnLogRotateJob::Create(const Reference<XMultiServiceFactory>& sf) - { return *(new OnLogRotateJob(sf)); } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/onlogrotate_job.hxx b/extensions/source/oooimprovement/onlogrotate_job.hxx deleted file mode 100644 index a84575c9f187..000000000000 --- a/extensions/source/oooimprovement/onlogrotate_job.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_ONLOGROTATEJOB_HXX -#define EXTENSIONS_OOOIMPROVEMENT_ONLOGROTATEJOB_HXX - -#include <com/sun/star/task/XAsyncJob.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/implbase2.hxx> - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class OnLogRotateJob : public ::cppu::WeakImplHelper2< - ::com::sun::star::task::XAsyncJob, - ::com::sun::star::lang::XServiceInfo> - { - public: - // XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_static(); - static ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames_static(); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> SAL_CALL Create( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& context); - - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> SAL_CALL Create( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& sf); - - protected: - OnLogRotateJob(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& context); - OnLogRotateJob(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& sm); - virtual ~OnLogRotateJob(); - - // XAsyncJob - virtual void SAL_CALL executeAsync( - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue>& args, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XJobListener>& listener) - throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& service_name) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() - throw(::com::sun::star::uno::RuntimeException); - - private: - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/oooimprovement.component b/extensions/source/oooimprovement/oooimprovement.component deleted file mode 100644 index e133f932c199..000000000000 --- a/extensions/source/oooimprovement/oooimprovement.component +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--********************************************************************** -* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2000, 2010 Oracle and/or its affiliates. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* 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. -* -**********************************************************************--> - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation - name="com.sun.star.comp.extensions.oooimprovement.CoreController"> - <service name="com.sun.star.oooimprovement.CoreController"/> - </implementation> - <implementation name="com.sun.star.comp.extensions.oooimprovement.InviteJob"/> - <implementation - name="com.sun.star.comp.extensions.oooimprovement.OnLogRotateJob"/> -</component> diff --git a/extensions/source/oooimprovement/oooimprovement_exports.cxx b/extensions/source/oooimprovement/oooimprovement_exports.cxx deleted file mode 100644 index ef7d9dac476d..000000000000 --- a/extensions/source/oooimprovement/oooimprovement_exports.cxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#include "corecontroller.hxx" -#include "invite_job.hxx" -#include "onlogrotate_job.hxx" -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <cppuhelper/factory.hxx> -#include <osl/mutex.hxx> -#include <osl/thread.h> -#include <rtl/ustrbuf.hxx> -#include <rtl/ustring.hxx> - - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::uno; -using namespace ::oooimprovement; -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - - -namespace -{ - void writeInfo(const Reference<XRegistryKey>& reg_key, - const OUString& implementation_name, - const OUString& service_name) - { - OUStringBuffer buf(256); - buf.append(implementation_name); - buf.appendAscii("/UNO/SERVICES/"); - buf.append(service_name); - reg_key->createKey(buf.makeStringAndClear()); - } -} - -extern "C" -{ - SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplName, void* pServiceManager, void*) - { - if ( !pServiceManager || !pImplName ) return 0; - - Reference<XSingleServiceFactory> factory; - Reference<XMultiServiceFactory> sm(reinterpret_cast<XMultiServiceFactory*>(pServiceManager), UNO_QUERY); - OUString impl_name = OUString::createFromAscii(pImplName); - Sequence<OUString> names(1); - names[0] = impl_name; - - if (impl_name.equals(CoreController::getImplementationName_static())) - factory = ::cppu::createSingleFactory(sm, impl_name, CoreController::Create, names); - if (impl_name.equals(OnLogRotateJob::getImplementationName_static())) - factory = ::cppu::createSingleFactory(sm, impl_name, OnLogRotateJob::Create, names); - if (impl_name.equals(InviteJob::getImplementationName_static())) - factory = ::cppu::createSingleFactory(sm, impl_name, InviteJob::Create, names); - if (!factory.is()) return 0; - factory->acquire(); - return factory.get(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/soaprequest.cxx b/extensions/source/oooimprovement/soaprequest.cxx deleted file mode 100644 index e2b90618ea0c..000000000000 --- a/extensions/source/oooimprovement/soaprequest.cxx +++ /dev/null @@ -1,201 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - - -#include "soaprequest.hxx" -#include "errormail.hxx" -#include "config.hxx" -#include <boost/shared_ptr.hpp> -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> -#include <rtl/strbuf.hxx> -#include <rtl/ustring.hxx> - - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::io; -using boost::shared_ptr; -using com::sun::star::io::XOutputStream; -using com::sun::star::ucb::XSimpleFileAccess; -using rtl::OUString; -using rtl::OString; -using rtl::OStringBuffer; - - -namespace -{ - static unsigned long asUlong(sal_Int8 input) - { - return *reinterpret_cast<unsigned char *>(&input); - }; - - static Sequence<sal_Int8> base64_encode(const Sequence<sal_Int8>& input) - { - static const char base64_tab[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - Sequence<sal_Int8> result(4); - unsigned long value = asUlong(input[0]) << 16; - if(input.getLength() > 1) value |= asUlong(input[1]) << 8; - if(input.getLength() > 2) value |= asUlong(input[2]); - - result[0] = static_cast<sal_Int8>(base64_tab[(value >> 18) & 0x3F]); - result[1] = static_cast<sal_Int8>(base64_tab[(value >> 12) & 0x3F]); - result[2] = static_cast<sal_Int8>('='); - result[3] = static_cast<sal_Int8>('='); - - if (input.getLength() > 1) - { - result[2] = base64_tab[(value >> 6) & 0x3F]; - if (input.getLength() > 2) - result[3] = base64_tab[(value >> 0) & 0x3F]; - } - return result; - }; - - static OString replaceAll(const OString& str, sal_Char old, const OString& replacement) - { - OStringBuffer result; - sal_Int32 idx = 0; - do { - result.append(str.getToken(0, old, idx)); - if(idx>=0) result.append(replacement); - } while(idx >= 0); - return result.makeStringAndClear(); - }; - - static OString xmlEncode(const OString& input) - { - OString result = replaceAll(input, '&', OString("&")); - result = replaceAll(result, '<', OString("<")); - return replaceAll(result, '>', OString(">")); - } - - static shared_ptr<Sequence<sal_Int8> > createSequenceFromString(const OString& str) - { - const sal_Int32 size = str.getLength(); - shared_ptr<Sequence<sal_Int8> > result(new Sequence<sal_Int8>(size)); - for(sal_Int32 idx=0; idx < size; idx++) - (*result)[idx] = str[idx]; - return result; - }; - - static void writeString(const Reference<XOutputStream>& target, const OString& str) - { - shared_ptr<Sequence<sal_Int8> > seq = createSequenceFromString(str); - target->writeBytes(*seq); - }; - - static void writeFile(const Reference<XMultiServiceFactory>& sf, const Reference<XOutputStream>& target, const OUString& fileurl) - { - Reference<XSimpleFileAccess> file_access( - sf->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY); - Reference<XInputStream> file = file_access->openFileRead(fileurl); - const sal_Int32 bufsize = 3; - sal_Int32 bytes_read; - Sequence<sal_Int8> buf(bufsize); - do - { - bytes_read = file->readBytes(buf, bufsize); - if(bytes_read < buf.getLength()) buf.realloc(bytes_read); - if(bytes_read) target->writeBytes(base64_encode(buf)); - } while(bytes_read == bufsize); - }; - - static const OString SOAP_START( - "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" - "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" - "xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\"\n" - "xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\"\n" - "xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\"\n" - "xmlns:rds=\"urn:ReportDataService\"\n" - "xmlns:apache=\"http://xml.apache.org/xml-soap\"\n" - "SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n" - "<SOAP-ENV:Body>\n" - "<rds:submitReport>\n"); - static const OString SOAP_ITEMS_START("<hash xsi:type=\"apache:Map\">\n"); - static const OString SOAP_ITEMS_END("</hash>\n"); - static const OString SOAP_END( - "</rds:submitReport>\n" - "</SOAP-ENV:Body>\n" - "</SOAP-ENV:Envelope>\n"); - static const OString SOAP_ITEM_END("]]></value></item>\n"); - - static const OString getSoapOfficeversion(const Reference<XMultiServiceFactory>& sf) - { - return ::rtl::OUStringToOString(oooimprovement::Config(sf).getCompleteProductname(), RTL_TEXTENCODING_ASCII_US); - }; - - static const OString getSoapSoapId(const Reference<XMultiServiceFactory>& sf, const OString& soap_id) - { - OStringBuffer buf; - buf.append("<body xsi:type=\"xsd:string\">"); - buf.append(xmlEncode(soap_id)).append("\n"); - buf.append(xmlEncode(getSoapOfficeversion(sf))).append("\n"); - buf.append("</body>\n"); - return buf.makeStringAndClear(); - }; - - static const OString getSoapItemStart(const OString& key) - { - OStringBuffer buf = - "<item>\n" - "<key xsi:type=\"xsd:string\">" + key + "</key>\n" - "<value xsi:type=\"xsd:string\"><![CDATA["; - return buf.makeStringAndClear(); - }; -} - -namespace oooimprovement -{ - SoapRequest::SoapRequest(const Reference<XMultiServiceFactory>& sf, const OUString& soap_id, const OUString& logfile) - : m_ServiceFactory(sf) - , m_SoapId(soap_id) - , m_Logfile(logfile) - {} - - void SoapRequest::writeTo(const Reference<XOutputStream>& target) const - { - writeString(target, SOAP_START); - writeString( - target, - getSoapSoapId(m_ServiceFactory, rtl::OUStringToOString(m_SoapId, RTL_TEXTENCODING_ASCII_US))); - writeString(target, SOAP_ITEMS_START); - writeString(target, getSoapItemStart("reportmail.xml")); - writeString(target, Errormail(m_ServiceFactory).getXml()); - writeString(target, SOAP_ITEM_END); - writeString(target, getSoapItemStart("data.zip")); - writeFile(m_ServiceFactory, target, m_Logfile); - writeString(target, SOAP_ITEM_END); - writeString(target, SOAP_ITEMS_END); - writeString(target, SOAP_END); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/soaprequest.hxx b/extensions/source/oooimprovement/soaprequest.hxx deleted file mode 100644 index 313569a2c0d0..000000000000 --- a/extensions/source/oooimprovement/soaprequest.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_SOAPREQUEST_HXX -#define EXTENSIONS_OOOIMPROVEMENT_SOAPREQUEST_HXX - -#include <com/sun/star/io/XOutputStream.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <rtl/ustring.hxx> - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class SoapRequest - { - public: - SoapRequest( - const css::uno::Reference< css::lang::XMultiServiceFactory>& sf, - const ::rtl::OUString& soap_id, - const ::rtl::OUString& logfile); - void writeTo(const css::uno::Reference< css::io::XOutputStream>& target) const; - private: - const css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - // soap_id has to be a plain 7-Bit ASCII String for identification of - // automated test logs etc. - const ::rtl::OUString m_SoapId; - // logfile is the file-url to the file to include - const ::rtl::OUString m_Logfile; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/soapsender.cxx b/extensions/source/oooimprovement/soapsender.cxx deleted file mode 100644 index e52679439fbc..000000000000 --- a/extensions/source/oooimprovement/soapsender.cxx +++ /dev/null @@ -1,161 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#include "soapsender.hxx" -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> -#include <com/sun/star/uno/RuntimeException.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/io/XTempFile.hpp> -#include <com/sun/star/io/XOutputStream.hpp> -#include <com/sun/star/io/XInputStream.hpp> -#include <osl/socket.hxx> -#include <rtl/strbuf.hxx> -#include <boost/shared_ptr.hpp> - - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::io; -using boost::shared_ptr; -using com::sun::star::io::XTempFile; -using com::sun::star::ucb::XSimpleFileAccess; -using com::sun::star::util::URL; -using com::sun::star::util::XURLTransformer; -using osl::ConnectorSocket; -using rtl::OString; -using rtl::OUString; -using rtl::OStringBuffer; - - -namespace -{ - static OString getHttpPostHeader(OString path, sal_Int32 length) - { - OStringBuffer result = - "POST " + path + " HTTP/1.0\r\n" - "Content-Type: text/xml; charset=\"utf-8\"\r\n" - "Content-Length: "; - result.append(length); - result.append("\r\nSOAPAction: \"\"\r\n\r\n"); - return result.makeStringAndClear(); - }; -} - -namespace oooimprovement -{ - SoapSender::SoapSender(const Reference<XMultiServiceFactory> sf, const OUString& url) - : m_ServiceFactory(sf) - , m_Url(url) - { } - - void SoapSender::send(const SoapRequest& request) const - { - Reference<XTempFile> temp_file( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile"))), - UNO_QUERY_THROW); - Reference<XSimpleFileAccess> file_access( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - Reference<XURLTransformer> url_trans( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), - UNO_QUERY_THROW); - - // writing request to tempfile - { - Reference<XOutputStream> temp_stream = temp_file->getOutputStream(); - request.writeTo(temp_stream); - temp_stream->flush(); - temp_stream->closeOutput(); - } - - // parse Url - URL url; - { - url.Complete = m_Url; - url_trans->parseStrict(url); - } - - // connect socket - shared_ptr<ConnectorSocket> socket(new ConnectorSocket(osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream)); - { - ::osl::SocketAddr addr(url.Server, url.Port); - oslSocketResult result = socket->connect(addr); - if(result != osl_Socket_Ok) - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("unable to connect to SOAP server")), - Reference<XInterface>()); - } - - // send header - { - OStringBuffer path_on_server = - OUStringToOString(url.Path, RTL_TEXTENCODING_ASCII_US) + - OUStringToOString(url.Name, RTL_TEXTENCODING_ASCII_US); - const OString header = getHttpPostHeader(path_on_server.makeStringAndClear(), file_access->getSize(temp_file->getUri())); - if(socket->write(header.getStr(), header.getLength()) != static_cast<sal_Int32>(header.getLength())) - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("error while sending HTTP header")), - Reference<XInterface>()); - } - - // send soap request - { - Reference<XInputStream> temp_stream = file_access->openFileRead(temp_file->getUri()); - const sal_Int32 bufsize = 1024; - sal_Int32 bytes_read; - Sequence<sal_Int8> buf(bufsize); - char buf2[bufsize]; - do - { - bytes_read = temp_stream->readBytes(buf, bufsize); - buf.realloc(bytes_read); - for(sal_Int32 idx = 0; idx < bytes_read; idx++) - buf2[idx] = buf[idx]; - if(socket->write(buf2, bytes_read) != bytes_read) - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("error while sending SOAP request")), - Reference<XInterface>()); - } while(bytes_read == bufsize); - } - - // receive answer - { - const sal_Int32 bufsize = 1024; - char buf[bufsize]; - sal_Int32 bytes_read = socket->read(buf, bufsize); - OString answer(buf, bytes_read); - const sal_Int32 returncode_start = answer.indexOf(' '); - if(returncode_start==-1 || !answer.copy(returncode_start, 4).equals(OString(" 200"))) - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("SOAP server returns a error")), - Reference<XInterface>()); - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/soapsender.hxx b/extensions/source/oooimprovement/soapsender.hxx deleted file mode 100644 index b21cbe95e011..000000000000 --- a/extensions/source/oooimprovement/soapsender.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_SOAPSENDER_HXX -#define EXTENSIONS_OOOIMPROVEMENT_SOAPSENDER_HXX - -#include "soaprequest.hxx" -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/util/URL.hpp> -#include <rtl/ustring.hxx> - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class SoapSender - { - public: - SoapSender( - const css::uno::Reference< css::lang::XMultiServiceFactory> sf, - const ::rtl::OUString& url); - void send(const SoapRequest& request) const; - private: - const css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - const ::rtl::OUString m_Url; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |