Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
914a00a1
Kaydet (Commit)
914a00a1
authored
Ara 19, 2013
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Clean up macro madness
Change-Id: I353a161fdc274a3da5ac965df12379c0d65681a4
üst
efb0412e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
107 deletions
+86
-107
registercontrols.cxx
UnoControls/source/base/registercontrols.cxx
+86
-107
No files found.
UnoControls/source/base/registercontrols.cxx
Dosyayı görüntüle @
914a00a1
...
...
@@ -17,126 +17,105 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <
comphelper/processfactory.hxx
>
#include <cppuhelper/factory.hxx>
#include <
sal/config.h
>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/container/XSet.hpp>
#include <stdio.h>
//=============================================================================
// Add new include line to use new services.
//=============================================================================
#include "framecontrol.hxx"
#include "progressbar.hxx"
#include "progressmonitor.hxx"
#include "statusindicator.hxx"
//=============================================================================
//______________________________________________________________________________________________________________
// namespaces
//______________________________________________________________________________________________________________
using
namespace
::
rtl
;
using
namespace
::
cppu
;
using
namespace
::
unocontrols
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
container
;
using
namespace
::
com
::
sun
::
star
::
lang
;
using
namespace
::
com
::
sun
::
star
::
registry
;
#include <comphelper/processfactory.hxx>
#include <cppuhelper/factory.hxx>
//______________________________________________________________________________________________________________
// macros
//______________________________________________________________________________________________________________
#include <framecontrol.hxx>
#include <progressbar.hxx>
#include <progressmonitor.hxx>
#include <statusindicator.hxx>
//******************************************************************************************************************************
#define CREATEINSTANCE(CLASS) \
\
static Reference< XInterface > SAL_CALL CLASS##_createInstance ( const Reference< XMultiServiceFactory >& rServiceManager ) throw ( Exception ) \
{ \
return Reference< XInterface >( *(OWeakObject*)(new CLASS( comphelper::getComponentContext(rServiceManager) )) ); \
}
namespace
{
//******************************************************************************************************************************
#define CREATEFACTORY_SINGLE(CLASS) \
\
/* Create right factory ... */
\
xFactory = Reference< XSingleServiceFactory > \
( \
cppu::createSingleFactory ( xServiceManager , \
CLASS::impl_getStaticImplementationName () , \
CLASS##_createInstance , \
CLASS::impl_getStaticSupportedServiceNames () ) \
) ; \
css
::
uno
::
Reference
<
css
::
uno
::
XInterface
>
SAL_CALL
FrameControl_createInstance
(
css
::
uno
::
Reference
<
css
::
lang
::
XMultiServiceFactory
>
const
&
rServiceManager
)
throw
(
css
::
uno
::
Exception
)
{
return
static_cast
<
cppu
::
OWeakObject
*>
(
new
unocontrols
::
FrameControl
(
comphelper
::
getComponentContext
(
rServiceManager
)));
}
//******************************************************************************************************************************
#define IF_NAME_CREATECOMPONENTFACTORY_SINGLE(CLASS) \
\
if ( CLASS::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \
{ \
CREATEFACTORY_SINGLE ( CLASS ) \
}
css
::
uno
::
Reference
<
css
::
uno
::
XInterface
>
SAL_CALL
ProgressBar_createInstance
(
css
::
uno
::
Reference
<
css
::
lang
::
XMultiServiceFactory
>
const
&
rServiceManager
)
throw
(
css
::
uno
::
Exception
)
{
return
static_cast
<
cppu
::
OWeakObject
*>
(
new
unocontrols
::
ProgressBar
(
comphelper
::
getComponentContext
(
rServiceManager
)));
}
//______________________________________________________________________________________________________________
// declare functions to create a new instance of service
//______________________________________________________________________________________________________________
css
::
uno
::
Reference
<
css
::
uno
::
XInterface
>
SAL_CALL
ProgressMonitor_createInstance
(
css
::
uno
::
Reference
<
css
::
lang
::
XMultiServiceFactory
>
const
&
rServiceManager
)
throw
(
css
::
uno
::
Exception
)
{
return
static_cast
<
cppu
::
OWeakObject
*>
(
new
unocontrols
::
ProgressMonitor
(
comphelper
::
getComponentContext
(
rServiceManager
)));
}
//=============================================================================
// Add new macro line to use new services.
//
// !!! ATTENTION !!!
// Write no ";" at end of line! (see macro)
//=============================================================================
CREATEINSTANCE
(
FrameControl
)
CREATEINSTANCE
(
ProgressBar
)
CREATEINSTANCE
(
ProgressMonitor
)
CREATEINSTANCE
(
StatusIndicator
)
//=============================================================================
css
::
uno
::
Reference
<
css
::
uno
::
XInterface
>
SAL_CALL
StatusIndicator_createInstance
(
css
::
uno
::
Reference
<
css
::
lang
::
XMultiServiceFactory
>
const
&
rServiceManager
)
throw
(
css
::
uno
::
Exception
)
{
return
static_cast
<
cppu
::
OWeakObject
*>
(
new
unocontrols
::
StatusIndicator
(
comphelper
::
getComponentContext
(
rServiceManager
)));
}
//______________________________________________________________________________________________________________
// create right component factory
//______________________________________________________________________________________________________________
}
extern
"C"
SAL_DLLPUBLIC_EXPORT
void
*
SAL_CALL
ctl_component_getFactory
(
const
sal_Char
*
pImplementationName
,
void
*
pServiceManager
,
void
*
/*pRegistryKey*/
)
extern
"C"
SAL_DLLPUBLIC_EXPORT
void
*
SAL_CALL
ctl_component_getFactory
(
char
const
*
pImplName
,
void
*
pServiceManager
,
SAL_UNUSED_PARAMETER
void
*
)
{
// Set default return value for this operation - if it failed.
void
*
pReturn
=
NULL
;
if
(
(
pImplementationName
!=
NULL
)
&&
(
pServiceManager
!=
NULL
)
)
css
::
uno
::
Reference
<
css
::
lang
::
XMultiServiceFactory
>
smgr
(
static_cast
<
css
::
lang
::
XMultiServiceFactory
*>
(
pServiceManager
));
css
::
uno
::
Reference
<
css
::
lang
::
XSingleServiceFactory
>
fac
;
if
(
unocontrols
::
FrameControl
::
impl_getStaticImplementationName
()
.
equalsAscii
(
pImplName
))
{
// Define variables which are used in following macros.
Reference
<
XSingleServiceFactory
>
xFactory
;
Reference
<
XMultiServiceFactory
>
xServiceManager
(
reinterpret_cast
<
XMultiServiceFactory
*
>
(
pServiceManager
)
)
;
//=============================================================================
// Add new macro line to handle new service.
//
// !!! ATTENTION !!!
// Write no ";" at end of line and dont forget "else" ! (see macro)
//=============================================================================
IF_NAME_CREATECOMPONENTFACTORY_SINGLE
(
FrameControl
)
else
IF_NAME_CREATECOMPONENTFACTORY_SINGLE
(
ProgressBar
)
else
IF_NAME_CREATECOMPONENTFACTORY_SINGLE
(
ProgressMonitor
)
else
IF_NAME_CREATECOMPONENTFACTORY_SINGLE
(
StatusIndicator
)
//=============================================================================
// Factory is valid - service was found.
if
(
xFactory
.
is
()
)
{
xFactory
->
acquire
();
pReturn
=
xFactory
.
get
();
}
fac
=
cppu
::
createSingleFactory
(
smgr
,
unocontrols
::
FrameControl
::
impl_getStaticImplementationName
(),
&
FrameControl_createInstance
,
unocontrols
::
FrameControl
::
impl_getStaticSupportedServiceNames
());
}
else
if
(
unocontrols
::
ProgressBar
::
impl_getStaticImplementationName
()
.
equalsAscii
(
pImplName
))
{
fac
=
cppu
::
createSingleFactory
(
smgr
,
unocontrols
::
ProgressBar
::
impl_getStaticImplementationName
(),
&
ProgressBar_createInstance
,
unocontrols
::
ProgressBar
::
impl_getStaticSupportedServiceNames
());
}
else
if
(
unocontrols
::
ProgressMonitor
::
impl_getStaticImplementationName
()
.
equalsAscii
(
pImplName
))
{
fac
=
cppu
::
createSingleFactory
(
smgr
,
unocontrols
::
ProgressMonitor
::
impl_getStaticImplementationName
(),
&
ProgressMonitor_createInstance
,
unocontrols
::
ProgressMonitor
::
impl_getStaticSupportedServiceNames
());
}
else
if
(
unocontrols
::
StatusIndicator
::
impl_getStaticImplementationName
()
.
equalsAscii
(
pImplName
))
{
fac
=
cppu
::
createSingleFactory
(
smgr
,
unocontrols
::
StatusIndicator
::
impl_getStaticImplementationName
(),
&
StatusIndicator_createInstance
,
unocontrols
::
StatusIndicator
::
impl_getStaticSupportedServiceNames
());
}
// Return with result of this operation.
return
pReturn
;
if
(
fac
.
is
())
{
fac
->
acquire
();
}
return
fac
.
get
();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment