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 <com/sun/star/container/XContainer.hpp>
27 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
28 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
29 #include <com/sun/star/container/XIndexContainer.hpp>
30 #include <com/sun/star/container/XContainerListener.hpp>
31 #include <com/sun/star/awt/XItemListener.hpp>
32 #include <com/sun/star/awt/XItemEventBroadcaster.hpp>
33 #include <cppuhelper/implbase2.hxx>
34 #include <cppuhelper/implbase3.hxx>
35 #include <cppuhelper/implbase4.hxx>
38 #include <comphelper/uno3.hxx>
45 typedef GraphicControlModel UnoControlRoadmapModel_Base
;
48 typedef ::cppu::ImplHelper3
< css::lang::XSingleServiceFactory
49 , css::container::XContainer
50 , css::container::XIndexContainer
51 > UnoControlRoadmapModel_IBase
;
54 typedef UnoControlBase UnoControlRoadmap_Base
;
55 typedef ::cppu::ImplHelper4
< css::awt::XItemEventBroadcaster
56 , css::container::XContainerListener
57 , css::awt::XItemListener
58 , css::beans::XPropertyChangeListener
59 > UnoControlRoadmap_IBase
;
62 typedef ::cppu::ImplHelper2
< css::container::XContainerListener
,
63 css::awt::XItemEventBroadcaster
> SVTXRoadmap_Base
;
66 // = UnoControlRoadmapModel
68 class UnoControlRoadmapModel
: public UnoControlRoadmapModel_Base
,
69 public UnoControlRoadmapModel_IBase
73 // PropertyChangeListenerMultiplexer maPropertyListeners;
75 typedef ::std::vector
< css::uno::Reference
< XInterface
> > RoadmapItemHolderList
;
77 ContainerListenerMultiplexer maContainerListeners
;
78 RoadmapItemHolderList maRoadmapItems
;
80 void MakeRMItemValidation( sal_Int32 Index
, const css::uno::Reference
< XInterface
>& xRoadmapItem
);
81 css::container::ContainerEvent
GetContainerEvent(sal_Int32 Index
, const css::uno::Reference
< XInterface
>& );
82 void SetRMItemDefaultProperties( const css::uno::Reference
< XInterface
>& );
83 static sal_Int16
GetCurrentItemID( const css::uno::Reference
< css::beans::XPropertySet
>& xPropertySet
);
84 sal_Int32
GetUniqueID();
88 css::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const override
;
89 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
92 UnoControlRoadmapModel( const css::uno::Reference
< css::uno::XComponentContext
>& i_factory
);
93 UnoControlRoadmapModel( const UnoControlRoadmapModel
& rModel
) :
94 UnoControlRoadmapModel_Base( rModel
),
95 UnoControlRoadmapModel_IBase( rModel
),
96 maContainerListeners( *this ) {}
97 rtl::Reference
<UnoControlModel
> Clone() const override
{ return new UnoControlRoadmapModel( *this ); }
101 DECLARE_XTYPEPROVIDER( )
104 // css::io::XPersistObject
105 OUString SAL_CALL
getServiceName() override
;
107 // css::lang::XServiceInfo
108 OUString SAL_CALL
getImplementationName() override
;
110 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
112 sal_Int32 SAL_CALL
getCount() override
;
113 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
115 virtual void SAL_CALL
insertByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
116 virtual void SAL_CALL
removeByIndex( sal_Int32 Index
) override
;
117 virtual void SAL_CALL
replaceByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
119 virtual void SAL_CALL
addContainerListener( const css::uno::Reference
< css::container::XContainerListener
>& xListener
) override
;
120 virtual void SAL_CALL
removeContainerListener( const css::uno::Reference
< css::container::XContainerListener
>& xListener
) override
;
122 css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
{ return UnoControlRoadmapModel_Base::queryInterface(rType
); }
123 css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& rType
) override
;
124 void SAL_CALL
acquire() throw() override
{ UnoControlRoadmapModel_Base::acquire(); }
125 void SAL_CALL
release() throw() override
{ UnoControlRoadmapModel_Base::release(); }
128 // css::beans::XPropertySet
129 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
132 virtual css::uno::Reference
< XInterface
> SAL_CALL
createInstance( ) override
;
133 virtual css::uno::Reference
< XInterface
> SAL_CALL
createInstanceWithArguments( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
135 virtual css::uno::Type SAL_CALL
getElementType() override
;
137 virtual sal_Bool SAL_CALL
hasElements() override
;
142 // = UnoRoadmapControl
144 class UnoRoadmapControl
: public UnoControlRoadmap_Base
,
145 public UnoControlRoadmap_IBase
148 ItemListenerMultiplexer maItemListeners
;
151 OUString
GetComponentServiceName() override
;
153 void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
{ UnoControlBase::disposing( Source
); }
155 void SAL_CALL
dispose( ) override
;
158 sal_Bool SAL_CALL
setModel(const css::uno::Reference
< css::awt::XControlModel
>& Model
) override
;
160 void SAL_CALL
elementInserted( const css::container::ContainerEvent
& rEvent
) override
;
161 void SAL_CALL
elementRemoved( const css::container::ContainerEvent
& rEvent
) override
;
162 void SAL_CALL
elementReplaced( const css::container::ContainerEvent
& rEvent
) override
;
164 virtual void SAL_CALL
addItemListener( const css::uno::Reference
< css::awt::XItemListener
>& l
) override
;
165 virtual void SAL_CALL
removeItemListener( const css::uno::Reference
< css::awt::XItemListener
>& l
) override
;
168 virtual void SAL_CALL
itemStateChanged( const css::awt::ItemEvent
& rEvent
) override
;
170 virtual void SAL_CALL
propertyChange( const css::beans::PropertyChangeEvent
& evt
) override
;
173 DECLARE_XTYPEPROVIDER( )
176 // css::lang::XServiceInfo
177 OUString SAL_CALL
getImplementationName() override
;
179 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
186 #endif // _ INCLUDED_TOOLKIT_CONTROLS_ROADMAPCONTROL_HXX
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */