1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_TOOLKIT_CONTROLS_ROADMAPCONTROL_HXX
21 #define INCLUDED_TOOLKIT_CONTROLS_ROADMAPCONTROL_HXX
24 #include <toolkit/controls/unocontrols.hxx>
25 #include <toolkit/controls/unocontrolmodel.hxx>
26 #include <toolkit/helper/servicenames.hxx>
27 #include <toolkit/controls/roadmapentry.hxx>
28 #include <com/sun/star/container/XContainer.hpp>
29 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
30 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
31 #include <com/sun/star/container/XIndexContainer.hpp>
32 #include <com/sun/star/container/XContainerListener.hpp>
33 #include <com/sun/star/awt/XItemListener.hpp>
34 #include <com/sun/star/awt/XItemEventBroadcaster.hpp>
35 #include <cppuhelper/implbase2.hxx>
36 #include <cppuhelper/implbase3.hxx>
37 #include <cppuhelper/implbase4.hxx>
40 #include <comphelper/uno3.hxx>
47 typedef GraphicControlModel UnoControlRoadmapModel_Base
;
50 typedef ::cppu::ImplHelper3
< css::lang::XSingleServiceFactory
51 , css::container::XContainer
52 , css::container::XIndexContainer
53 > UnoControlRoadmapModel_IBase
;
57 typedef UnoControlBase UnoControlRoadmap_Base
;
58 typedef ::cppu::ImplHelper4
< css::awt::XItemEventBroadcaster
59 , css::container::XContainerListener
60 , css::awt::XItemListener
61 , css::beans::XPropertyChangeListener
62 > UnoControlRoadmap_IBase
;
67 typedef ::cppu::ImplHelper2
< css::container::XContainerListener
,
68 css::awt::XItemEventBroadcaster
> SVTXRoadmap_Base
;
72 // = UnoControlRoadmapModel
74 class UnoControlRoadmapModel
: public UnoControlRoadmapModel_Base
,
75 public UnoControlRoadmapModel_IBase
79 // PropertyChangeListenerMultiplexer maPropertyListeners;
81 typedef ::std::vector
< css::uno::Reference
< XInterface
> > RoadmapItemHolderList
;
83 ContainerListenerMultiplexer maContainerListeners
;
84 RoadmapItemHolderList maRoadmapItems
;
86 void MakeRMItemValidation( sal_Int32 Index
, css::uno::Reference
< XInterface
> xRoadmapItem
);
87 css::container::ContainerEvent
GetContainerEvent(sal_Int32 Index
, css::uno::Reference
< XInterface
> );
88 void SetRMItemDefaultProperties( const sal_Int32 _Index
, css::uno::Reference
< XInterface
> );
89 static sal_Int16
GetCurrentItemID( css::uno::Reference
< css::beans::XPropertySet
> xPropertySet
);
90 sal_Int32
GetUniqueID();
94 css::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const SAL_OVERRIDE
;
95 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
;
98 UnoControlRoadmapModel( const css::uno::Reference
< css::uno::XComponentContext
>& i_factory
);
99 UnoControlRoadmapModel( const UnoControlRoadmapModel
& rModel
) :
100 UnoControlRoadmapModel_Base( rModel
),
101 UnoControlRoadmapModel_IBase( rModel
),
102 maContainerListeners( *this ) {}
103 UnoControlModel
* Clone() const SAL_OVERRIDE
{ return new UnoControlRoadmapModel( *this ); }
107 DECLARE_XTYPEPROVIDER( )
110 // ::com::sun::star::io::XPersistObject
111 OUString SAL_CALL
getServiceName() throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
113 // ::com::sun::star::lang::XServiceInfo
114 OUString SAL_CALL
getImplementationName()
115 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
117 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames()
118 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
120 sal_Int32 SAL_CALL
getCount() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
121 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) throw (css::lang::IndexOutOfBoundsException
, css::lang::WrappedTargetException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
123 virtual void SAL_CALL
insertByIndex( sal_Int32 Index
, const css::uno::Any
& _Element
) throw (css::lang::IllegalArgumentException
, css::lang::IndexOutOfBoundsException
, css::lang::WrappedTargetException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
124 virtual void SAL_CALL
removeByIndex( sal_Int32 Index
) throw (css::lang::IndexOutOfBoundsException
, css::lang::WrappedTargetException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
125 virtual void SAL_CALL
replaceByIndex( sal_Int32 Index
, const css::uno::Any
& _Element
) throw (css::lang::IllegalArgumentException
, css::lang::IndexOutOfBoundsException
, css::lang::WrappedTargetException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 virtual void SAL_CALL
addContainerListener( const css::uno::Reference
< css::container::XContainerListener
>& xListener
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
128 virtual void SAL_CALL
removeContainerListener( const css::uno::Reference
< css::container::XContainerListener
>& xListener
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
{ return UnoControlRoadmapModel_Base::queryInterface(rType
); }
131 css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& rType
) throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
132 void SAL_CALL
acquire() throw() SAL_OVERRIDE
{ UnoControlRoadmapModel_Base::acquire(); }
133 void SAL_CALL
release() throw() SAL_OVERRIDE
{ UnoControlRoadmapModel_Base::release(); }
136 // ::com::sun::star::beans::XPropertySet
137 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
140 virtual css::uno::Reference
< XInterface
> SAL_CALL
createInstance( ) throw (css::uno::Exception
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
141 virtual css::uno::Reference
< XInterface
> SAL_CALL
createInstanceWithArguments( const css::uno::Sequence
< css::uno::Any
>& aArguments
) throw (css::uno::Exception
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
143 virtual css::uno::Type SAL_CALL
getElementType() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
145 virtual sal_Bool SAL_CALL
hasElements() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
151 // = UnoRoadmapControl
153 class UnoRoadmapControl
: public UnoControlRoadmap_Base
,
154 public UnoControlRoadmap_IBase
157 ItemListenerMultiplexer maItemListeners
;
160 OUString
GetComponentServiceName() SAL_OVERRIDE
;
162 void SAL_CALL
disposing( const css::lang::EventObject
& Source
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
{ UnoControlBase::disposing( Source
); }
164 void SAL_CALL
dispose( ) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
167 sal_Bool SAL_CALL
setModel(const css::uno::Reference
< css::awt::XControlModel
>& Model
) throw ( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
169 void SAL_CALL
elementInserted( const css::container::ContainerEvent
& rEvent
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
170 void SAL_CALL
elementRemoved( const css::container::ContainerEvent
& rEvent
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
171 void SAL_CALL
elementReplaced( const css::container::ContainerEvent
& rEvent
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
173 virtual void SAL_CALL
addItemListener( const css::uno::Reference
< css::awt::XItemListener
>& l
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
174 virtual void SAL_CALL
removeItemListener( const css::uno::Reference
< css::awt::XItemListener
>& l
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
177 virtual void SAL_CALL
itemStateChanged( const css::awt::ItemEvent
& rEvent
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
179 virtual void SAL_CALL
propertyChange( const css::beans::PropertyChangeEvent
& evt
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
182 DECLARE_XTYPEPROVIDER( )
185 // ::com::sun::star::lang::XServiceInfo
186 OUString SAL_CALL
getImplementationName()
187 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
189 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames()
190 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
199 #endif // _ INCLUDED_TOOLKIT_CONTROLS_ROADMAPCONTROL_HXX
201 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */