Update ooo320-m1
[ooovba.git] / extensions / source / oooimprovement / corecontroller.cxx
blob64734b4ea40a1a9b7bd037b3021821d4b029ec53
1 /*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * Copyright 2008 by Sun Microsystems, Inc.
6 * OpenOffice.org - a multi-platform office productivity suite
8 * $RCSfile: corecontroller.cxx,v $
10 * $Revision: 1.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
28 ************************************************************************/
30 // MARKER(update_precomp.py): autogen include statement, do not remove
31 #include "precompiled_extensions.hxx"
33 #include "corecontroller.hxx"
34 #include "config.hxx"
36 using ::rtl::OUString;
37 using namespace ::com::sun::star::lang;
38 using namespace ::com::sun::star::uno;
41 namespace oooimprovement
43 CoreController::CoreController(const Reference<XMultiServiceFactory>& sf)
44 : m_ServiceFactory(sf)
45 { }
47 CoreController::~CoreController()
48 { }
50 sal_Bool SAL_CALL CoreController::enablingUiEventsLoggerAllowed(sal_Int16 version) throw(RuntimeException)
52 Config config(m_ServiceFactory);
53 if(version==1 && config.getEnablingAllowed() && config.getShowedInvitation() && config.getInvitationAccepted())
54 return true;
55 return false;
58 sal_Bool SAL_CALL CoreController::showBuiltinOptionsPage(sal_Int16 version) throw(RuntimeException)
60 Config config(m_ServiceFactory);
61 if(version==1 && config.getEnablingAllowed())
62 return true;
63 return false;
66 sal_Bool SAL_CALL CoreController::supportsService(const OUString& service_name) throw(RuntimeException)
68 const Sequence<OUString> service_names(getSupportedServiceNames());
69 for (sal_Int32 idx = service_names.getLength()-1; idx>=0; --idx)
70 if(service_name == service_names[idx]) return sal_True;
71 return sal_False;
74 OUString SAL_CALL CoreController::getImplementationName() throw(RuntimeException)
75 { return getImplementationName_static(); }
77 Sequence<OUString> SAL_CALL CoreController::getSupportedServiceNames() throw(RuntimeException)
78 { return getSupportedServiceNames_static(); }
80 OUString SAL_CALL CoreController::getImplementationName_static()
81 { return OUString::createFromAscii("com.sun.star.comp.extensions.oooimprovement.CoreController"); }
83 Sequence<OUString> SAL_CALL CoreController::getSupportedServiceNames_static()
85 Sequence<OUString> aServiceNames(1);
86 aServiceNames[0] = OUString::createFromAscii("com.sun.star.oooimprovement.CoreController");
87 return aServiceNames;
90 Reference<XInterface> SAL_CALL CoreController::Create(const Reference<XMultiServiceFactory>& sm)
91 { return *(new CoreController(sm)); }