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 <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/io/XPersistObject.hpp>
25 #include <com/sun/star/awt/XTabControllerModel.hpp>
26 #include <com/sun/star/lang/XTypeProvider.hpp>
27 #include <cppuhelper/weakagg.hxx>
28 #include <osl/mutex.hxx>
32 struct UnoControlModelEntry
;
33 typedef ::std::vector
< UnoControlModelEntry
* > UnoControlModelEntryListBase
;
35 class UnoControlModelEntryList
38 UnoControlModelEntryListBase maList
;
42 UnoControlModelEntryList();
43 ~UnoControlModelEntryList();
45 const OUString
& GetName() const { return maGroupName
; }
46 void SetName( const OUString
& rName
) { maGroupName
= rName
; }
49 void DestroyEntry( size_t nEntry
);
51 UnoControlModelEntry
* operator[]( size_t i
) const;
52 void push_back( UnoControlModelEntry
* item
);
53 void insert( size_t i
, UnoControlModelEntry
* item
);
56 struct UnoControlModelEntry
61 css::uno::Reference
< css::awt::XControlModel
>* pxControl
;
62 UnoControlModelEntryList
* pGroup
;
66 #define CONTROLPOS_NOTFOUND 0xFFFFFFFF
68 class StdTabControllerModel final
: public css::awt::XTabControllerModel
,
69 public css::lang::XServiceInfo
,
70 public css::io::XPersistObject
,
71 public css::lang::XTypeProvider
,
72 public ::cppu::OWeakAggObject
75 UnoControlModelEntryList maControls
;
78 ::osl::Mutex
& GetMutex() { return maMutex
; }
79 sal_uInt32
ImplGetControlCount( const UnoControlModelEntryList
& rList
) const;
80 void ImplGetControlModels( css::uno::Reference
< css::awt::XControlModel
> ** pRefs
, const UnoControlModelEntryList
& rList
) const;
81 static void ImplSetControlModels( UnoControlModelEntryList
& rList
, const css::uno::Sequence
< css::uno::Reference
< css::awt::XControlModel
> >& Controls
);
82 static sal_uInt32
ImplGetControlPos( const css::uno::Reference
< css::awt::XControlModel
>& rCtrl
, const UnoControlModelEntryList
& rList
);
85 StdTabControllerModel();
86 virtual ~StdTabControllerModel() override
;
88 // css::uno::XInterface
89 css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
{ return OWeakAggObject::queryInterface(rType
); }
90 void SAL_CALL
acquire() noexcept override
{ OWeakAggObject::acquire(); }
91 void SAL_CALL
release() noexcept override
{ OWeakAggObject::release(); }
93 css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& rType
) override
;
95 // css::lang::XTypeProvider
96 css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() override
;
97 css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() override
;
99 // css::awt::XTabControllerModel
100 sal_Bool SAL_CALL
getGroupControl( ) override
;
101 void SAL_CALL
setGroupControl( sal_Bool GroupControl
) override
;
102 void SAL_CALL
setControlModels( const css::uno::Sequence
< css::uno::Reference
< css::awt::XControlModel
> >& Controls
) override
;
103 css::uno::Sequence
< css::uno::Reference
< css::awt::XControlModel
> > SAL_CALL
getControlModels( ) override
;
104 void SAL_CALL
setGroup( const css::uno::Sequence
< css::uno::Reference
< css::awt::XControlModel
> >& Group
, const OUString
& GroupName
) override
;
105 sal_Int32 SAL_CALL
getGroupCount( ) override
;
106 void SAL_CALL
getGroup( sal_Int32 nGroup
, css::uno::Sequence
< css::uno::Reference
< css::awt::XControlModel
> >& Group
, OUString
& Name
) override
;
107 void SAL_CALL
getGroupByName( const OUString
& Name
, css::uno::Sequence
< css::uno::Reference
< css::awt::XControlModel
> >& Group
) override
;
109 // css::io::XPersistObject
110 OUString SAL_CALL
getServiceName( ) override
;
111 void SAL_CALL
write( const css::uno::Reference
< css::io::XObjectOutputStream
>& OutStream
) override
;
112 void SAL_CALL
read( const css::uno::Reference
< css::io::XObjectInputStream
>& InStream
) override
;
115 OUString SAL_CALL
getImplementationName() override
;
117 sal_Bool SAL_CALL
supportsService(OUString
const & ServiceName
) override
;
119 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */