Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "PresenterComponent.hxx"
30 : : #include "cppuhelper/factory.hxx"
31 : : #include "cppuhelper/implementationentry.hxx"
32 : : #include <com/sun/star/deployment/DeploymentException.hpp>
33 : : #include <com/sun/star/deployment/XPackageInformationProvider.hpp>
34 : :
35 : : #include "PresenterExtensionIdentifier.hxx"
36 : : #include "PresenterProtocolHandler.hxx"
37 : : #include "PresenterScreen.hxx"
38 : :
39 : : using namespace ::com::sun::star;
40 : : using namespace ::com::sun::star::uno;
41 : : using namespace cppu;
42 : : using namespace osl;
43 : : using ::rtl::OUString;
44 : :
45 : : namespace sdext { namespace presenter {
46 : :
47 : 0 : ::rtl::OUString PresenterComponent::GetBasePath (
48 : : const Reference<XComponentContext>& rxComponentContext)
49 : : {
50 : 0 : return GetBasePath(rxComponentContext, gsExtensionIdentifier);
51 : : }
52 : :
53 : 0 : ::rtl::OUString PresenterComponent::GetBasePath (
54 : : const Reference<XComponentContext>& rxComponentContext,
55 : : const OUString& rsExtensionIdentifier)
56 : : {
57 [ # # ][ # # ]: 0 : static ::rtl::OUString sBasePath;
58 [ # # ]: 0 : if (sBasePath.isEmpty())
59 : : {
60 : : // Determine the base path of the bitmaps.
61 : : Reference<deployment::XPackageInformationProvider> xInformationProvider (
62 [ # # ]: 0 : rxComponentContext->getValueByName(
63 : : OUString(RTL_CONSTASCII_USTRINGPARAM(
64 : 0 : "/singletons/com.sun.star.deployment.PackageInformationProvider"))),
65 [ # # ][ # # ]: 0 : UNO_QUERY);
[ # # ]
66 [ # # ]: 0 : if (xInformationProvider.is())
67 : : {
68 : : try
69 : : {
70 [ # # ]: 0 : sBasePath = xInformationProvider->getPackageLocation(rsExtensionIdentifier)
71 [ # # ][ # # ]: 0 : + OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
[ # # ]
72 : : }
73 [ # # ]: 0 : catch (const deployment::DeploymentException&)
74 : : {
75 : : }
76 : 0 : }
77 : : }
78 : :
79 : 0 : return sBasePath;
80 : : }
81 : :
82 : : rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
83 : :
84 : : static struct ImplementationEntry gServiceEntries[] =
85 : : {
86 : : {
87 : : PresenterProtocolHandler::Create,
88 : : PresenterProtocolHandler::getImplementationName_static,
89 : : PresenterProtocolHandler::getSupportedServiceNames_static,
90 : : createSingleComponentFactory, &g_moduleCount.modCnt, 0
91 : : },
92 : : {
93 : : PresenterScreenJob::Create,
94 : : PresenterScreenJob::getImplementationName_static,
95 : : PresenterScreenJob::getSupportedServiceNames_static,
96 : : createSingleComponentFactory, 0, 0
97 : : },
98 : : { 0, 0, 0, 0, 0, 0 }
99 : : };
100 : :
101 : : extern "C"
102 : : {
103 : 0 : SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_canUnload( TimeValue *pTime )
104 : : {
105 : 0 : return g_moduleCount.canUnload( &g_moduleCount , pTime );
106 : : }
107 : :
108 : 8 : SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
109 : : const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
110 : : {
111 : 8 : return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , gServiceEntries);
112 : : }
113 : :
114 : : }
115 : :
116 [ + - ][ + - ]: 24 : } } // end of namespace sdext::presenter
117 : :
118 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|