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 .
23 #include <toolkit/controls/unocontrols.hxx>
24 #include <toolkit/controls/unocontrolmodel.hxx>
25 #include <com/sun/star/container/XContainer.hpp>
26 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
27 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
28 #include <com/sun/star/container/XIndexContainer.hpp>
29 #include <com/sun/star/container/XContainerListener.hpp>
30 #include <com/sun/star/awt/XItemListener.hpp>
31 #include <com/sun/star/awt/XItemEventBroadcaster.hpp>
32 #include <cppuhelper/implbase2.hxx>
33 #include <cppuhelper/implbase3.hxx>
34 #include <cppuhelper/implbase4.hxx>
37 #include <comphelper/uno3.hxx>
44 typedef GraphicControlModel UnoControlRoadmapModel_Base
;
47 typedef ::cppu::ImplHelper3
< css::lang::XSingleServiceFactory
48 , css::container::XContainer
49 , css::container::XIndexContainer
50 > UnoControlRoadmapModel_IBase
;
53 typedef UnoControlBase UnoControlRoadmap_Base
;
54 typedef ::cppu::ImplHelper4
< css::awt::XItemEventBroadcaster
55 , css::container::XContainerListener
56 , css::awt::XItemListener
57 , css::beans::XPropertyChangeListener
58 > UnoControlRoadmap_IBase
;
61 typedef ::cppu::ImplHelper2
< css::container::XContainerListener
,
62 css::awt::XItemEventBroadcaster
> SVTXRoadmap_Base
;
65 // = UnoControlRoadmapModel
67 class UnoControlRoadmapModel final
: public UnoControlRoadmapModel_Base
,
68 public UnoControlRoadmapModel_IBase
72 // PropertyChangeListenerMultiplexer maPropertyListeners;
74 typedef ::std::vector
< css::uno::Reference
< XInterface
> > RoadmapItemHolderList
;
76 ContainerListenerMultiplexer maContainerListeners
;
77 RoadmapItemHolderList maRoadmapItems
;
79 void MakeRMItemValidation( sal_Int32 Index
, const css::uno::Reference
< XInterface
>& xRoadmapItem
);
80 css::container::ContainerEvent
GetContainerEvent(sal_Int32 Index
, const css::uno::Reference
< XInterface
>& );
81 void SetRMItemDefaultProperties( const css::uno::Reference
< XInterface
>& );
82 static sal_Int16
GetCurrentItemID( const css::uno::Reference
< css::beans::XPropertySet
>& xPropertySet
);
83 sal_Int32
GetUniqueID();
85 css::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const override
;
86 ::cppu::IPropertyArrayHelper
& getInfoHelper() override
;
89 UnoControlRoadmapModel( const css::uno::Reference
< css::uno::XComponentContext
>& i_factory
);
90 UnoControlRoadmapModel( const UnoControlRoadmapModel
& rModel
) :
91 UnoControlRoadmapModel_Base( rModel
),
92 UnoControlRoadmapModel_IBase( rModel
),
93 maContainerListeners( *this ) {}
94 rtl::Reference
<UnoControlModel
> Clone() const override
{ return new UnoControlRoadmapModel( *this ); }
98 DECLARE_XTYPEPROVIDER( )
101 // css::io::XPersistObject
102 OUString SAL_CALL
getServiceName() override
;
104 // css::lang::XServiceInfo
105 OUString SAL_CALL
getImplementationName() override
;
107 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
109 sal_Int32 SAL_CALL
getCount() override
;
110 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
112 virtual void SAL_CALL
insertByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
113 virtual void SAL_CALL
removeByIndex( sal_Int32 Index
) override
;
114 virtual void SAL_CALL
replaceByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
116 virtual void SAL_CALL
addContainerListener( const css::uno::Reference
< css::container::XContainerListener
>& xListener
) override
;
117 virtual void SAL_CALL
removeContainerListener( const css::uno::Reference
< css::container::XContainerListener
>& xListener
) override
;
119 css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
{ return UnoControlRoadmapModel_Base::queryInterface(rType
); }
120 css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& rType
) override
;
121 void SAL_CALL
acquire() noexcept override
{ UnoControlRoadmapModel_Base::acquire(); }
122 void SAL_CALL
release() noexcept override
{ UnoControlRoadmapModel_Base::release(); }
125 // css::beans::XPropertySet
126 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
129 virtual css::uno::Reference
< XInterface
> SAL_CALL
createInstance( ) override
;
130 virtual css::uno::Reference
< XInterface
> SAL_CALL
createInstanceWithArguments( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
132 virtual css::uno::Type SAL_CALL
getElementType() override
;
134 virtual sal_Bool SAL_CALL
hasElements() override
;
139 // = UnoRoadmapControl
141 class UnoRoadmapControl final
: public UnoControlRoadmap_Base
,
142 public UnoControlRoadmap_IBase
145 ItemListenerMultiplexer maItemListeners
;
148 OUString
GetComponentServiceName() const override
;
150 void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
{ UnoControlBase::disposing( Source
); }
152 void SAL_CALL
dispose( ) override
;
155 sal_Bool SAL_CALL
setModel(const css::uno::Reference
< css::awt::XControlModel
>& Model
) override
;
157 void SAL_CALL
elementInserted( const css::container::ContainerEvent
& rEvent
) override
;
158 void SAL_CALL
elementRemoved( const css::container::ContainerEvent
& rEvent
) override
;
159 void SAL_CALL
elementReplaced( const css::container::ContainerEvent
& rEvent
) override
;
161 virtual void SAL_CALL
addItemListener( const css::uno::Reference
< css::awt::XItemListener
>& l
) override
;
162 virtual void SAL_CALL
removeItemListener( const css::uno::Reference
< css::awt::XItemListener
>& l
) override
;
165 virtual void SAL_CALL
itemStateChanged( const css::awt::ItemEvent
& rEvent
) override
;
167 virtual void SAL_CALL
propertyChange( const css::beans::PropertyChangeEvent
& evt
) override
;
170 DECLARE_XTYPEPROVIDER( )
171 DECLARE_UNO3_AGG_DEFAULTS(UnoRoadmapControl
, UnoControlRoadmap_Base
)
173 css::uno::Any SAL_CALL
queryAggregation(css::uno::Type
const & aType
) override
;
175 // css::lang::XServiceInfo
176 OUString SAL_CALL
getImplementationName() override
;
178 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */