1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterComponent.cxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_sdext.hxx"
35 #include "PresenterComponent.hxx"
36 #include "cppuhelper/factory.hxx"
37 #include "cppuhelper/implementationentry.hxx"
38 #include <com/sun/star/deployment/DeploymentException.hpp>
39 #include <com/sun/star/deployment/XPackageInformationProvider.hpp>
41 #include "PresenterExtensionIdentifier.hxx"
42 #include "PresenterProtocolHandler.hxx"
43 #include "PresenterScreen.hxx"
45 using namespace ::com::sun::star
;
46 using namespace ::com::sun::star::uno
;
49 using ::rtl::OUString
;
53 namespace sdext
{ namespace presenter
{
55 static OUString gsBasePath
;
57 ::rtl::OUString
PresenterComponent::GetBasePath (
58 const Reference
<XComponentContext
>& rxComponentContext
)
60 return GetBasePath(rxComponentContext
, gsExtensionIdentifier
);
66 ::rtl::OUString
PresenterComponent::GetBasePath (
67 const Reference
<XComponentContext
>& rxComponentContext
,
68 const OUString
& rsExtensionIdentifier
)
70 if (gsBasePath
.getLength() == 0)
72 // Determine the base path of the bitmaps.
73 Reference
<deployment::XPackageInformationProvider
> xInformationProvider (
74 rxComponentContext
->getValueByName(
75 OUString(RTL_CONSTASCII_USTRINGPARAM(
76 "/singletons/com.sun.star.deployment.PackageInformationProvider"))),
78 if (xInformationProvider
.is())
82 gsBasePath
= xInformationProvider
->getPackageLocation(rsExtensionIdentifier
)
83 + OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
85 catch(deployment::DeploymentException
&)
96 rtl_StandardModuleCount g_moduleCount
= MODULE_COUNT_INIT
;
98 static struct ImplementationEntry gServiceEntries
[] =
101 PresenterProtocolHandler::Create
,
102 PresenterProtocolHandler::getImplementationName_static
,
103 PresenterProtocolHandler::getSupportedServiceNames_static
,
104 createSingleComponentFactory
, &g_moduleCount
.modCnt
, 0
107 PresenterScreenJob::Create
,
108 PresenterScreenJob::getImplementationName_static
,
109 PresenterScreenJob::getSupportedServiceNames_static
,
110 createSingleComponentFactory
, 0, 0
120 sal_Bool SAL_CALL
component_canUnload( TimeValue
*pTime
)
122 return g_moduleCount
.canUnload( &g_moduleCount
, pTime
);
128 void SAL_CALL
component_getImplementationEnvironment(
129 const sal_Char
** ppEnvTypeName
, uno_Environment
** )
131 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
137 sal_Bool SAL_CALL
component_writeInfo(
138 void * pServiceManager
, void * pRegistryKey
)
140 return component_writeInfoHelper(pServiceManager
, pRegistryKey
, gServiceEntries
);
146 void * SAL_CALL
component_getFactory(
147 const sal_Char
* pImplName
, void * pServiceManager
, void * pRegistryKey
)
149 return component_getFactoryHelper( pImplName
, pServiceManager
, pRegistryKey
, gServiceEntries
);
154 } } // end of namespace sdext::presenter