1*2a97ec55SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2a97ec55SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2a97ec55SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2a97ec55SAndrew Rist  * distributed with this work for additional information
6*2a97ec55SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2a97ec55SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2a97ec55SAndrew Rist  * "License"); you may not use this file except in compliance
9*2a97ec55SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2a97ec55SAndrew Rist  *
11*2a97ec55SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2a97ec55SAndrew Rist  *
13*2a97ec55SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2a97ec55SAndrew Rist  * software distributed under the License is distributed on an
15*2a97ec55SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2a97ec55SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2a97ec55SAndrew Rist  * specific language governing permissions and limitations
18*2a97ec55SAndrew Rist  * under the License.
19*2a97ec55SAndrew Rist  *
20*2a97ec55SAndrew Rist  *************************************************************/
21*2a97ec55SAndrew Rist 
22*2a97ec55SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_extensions.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "corecontroller.hxx"
28cdf0e10cSrcweir #include "config.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir using ::rtl::OUString;
31cdf0e10cSrcweir using namespace ::com::sun::star::lang;
32cdf0e10cSrcweir using namespace ::com::sun::star::uno;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace oooimprovement
36cdf0e10cSrcweir {
CoreController(const Reference<XMultiServiceFactory> & sf)37cdf0e10cSrcweir     CoreController::CoreController(const Reference<XMultiServiceFactory>& sf)
38cdf0e10cSrcweir         : m_ServiceFactory(sf)
39cdf0e10cSrcweir     { }
40cdf0e10cSrcweir 
~CoreController()41cdf0e10cSrcweir     CoreController::~CoreController()
42cdf0e10cSrcweir     { }
43cdf0e10cSrcweir 
enablingUiEventsLoggerAllowed(sal_Int16 version)44cdf0e10cSrcweir     sal_Bool SAL_CALL CoreController::enablingUiEventsLoggerAllowed(sal_Int16 version) throw(RuntimeException)
45cdf0e10cSrcweir     {
46cdf0e10cSrcweir         Config config(m_ServiceFactory);
47cdf0e10cSrcweir         if(version==1 && config.getEnablingAllowed() && config.getShowedInvitation() && config.getInvitationAccepted())
48cdf0e10cSrcweir             return true;
49cdf0e10cSrcweir         return false;
50cdf0e10cSrcweir     }
51cdf0e10cSrcweir 
showBuiltinOptionsPage(sal_Int16 version)52cdf0e10cSrcweir     sal_Bool SAL_CALL CoreController::showBuiltinOptionsPage(sal_Int16 version) throw(RuntimeException)
53cdf0e10cSrcweir     {
54cdf0e10cSrcweir         Config config(m_ServiceFactory);
55cdf0e10cSrcweir         if(version==1 && config.getEnablingAllowed())
56cdf0e10cSrcweir             return true;
57cdf0e10cSrcweir         return false;
58cdf0e10cSrcweir     }
59cdf0e10cSrcweir 
supportsService(const OUString & service_name)60cdf0e10cSrcweir     sal_Bool SAL_CALL CoreController::supportsService(const OUString& service_name) throw(RuntimeException)
61cdf0e10cSrcweir     {
62cdf0e10cSrcweir         const Sequence<OUString> service_names(getSupportedServiceNames());
63cdf0e10cSrcweir         for (sal_Int32 idx = service_names.getLength()-1; idx>=0; --idx)
64cdf0e10cSrcweir             if(service_name == service_names[idx]) return sal_True;
65cdf0e10cSrcweir         return sal_False;
66cdf0e10cSrcweir     }
67cdf0e10cSrcweir 
getImplementationName()68cdf0e10cSrcweir     OUString SAL_CALL CoreController::getImplementationName() throw(RuntimeException)
69cdf0e10cSrcweir     { return getImplementationName_static(); }
70cdf0e10cSrcweir 
getSupportedServiceNames()71cdf0e10cSrcweir     Sequence<OUString> SAL_CALL CoreController::getSupportedServiceNames() throw(RuntimeException)
72cdf0e10cSrcweir     { return getSupportedServiceNames_static(); }
73cdf0e10cSrcweir 
getImplementationName_static()74cdf0e10cSrcweir     OUString SAL_CALL CoreController::getImplementationName_static()
75cdf0e10cSrcweir     { return OUString::createFromAscii("com.sun.star.comp.extensions.oooimprovement.CoreController"); }
76cdf0e10cSrcweir 
getSupportedServiceNames_static()77cdf0e10cSrcweir     Sequence<OUString> SAL_CALL CoreController::getSupportedServiceNames_static()
78cdf0e10cSrcweir     {
79cdf0e10cSrcweir         Sequence<OUString> aServiceNames(1);
80cdf0e10cSrcweir         aServiceNames[0] = OUString::createFromAscii("com.sun.star.oooimprovement.CoreController");
81cdf0e10cSrcweir         return aServiceNames;
82cdf0e10cSrcweir     }
83cdf0e10cSrcweir 
Create(const Reference<XMultiServiceFactory> & sm)84cdf0e10cSrcweir     Reference<XInterface> SAL_CALL CoreController::Create(const Reference<XMultiServiceFactory>& sm)
85cdf0e10cSrcweir     { return *(new CoreController(sm)); }
86cdf0e10cSrcweir }
87