Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _TOOLKIT_CONTROLS_STDTABCONTROLLERMODEL_HXX_
30 : : #define _TOOLKIT_CONTROLS_STDTABCONTROLLERMODEL_HXX_
31 : :
32 : :
33 : : #include <com/sun/star/lang/XServiceInfo.hpp>
34 : : #include <com/sun/star/io/XPersistObject.hpp>
35 : : #include <com/sun/star/awt/XTabControllerModel.hpp>
36 : : #include <com/sun/star/awt/XWindow.hpp>
37 : : #include <com/sun/star/lang/XTypeProvider.hpp>
38 : : #include <com/sun/star/lang/XUnoTunnel.hpp>
39 : : #include <cppuhelper/weakagg.hxx>
40 : : #include <toolkit/helper/macros.hxx>
41 : : #include <toolkit/helper/servicenames.hxx>
42 : : #include <osl/mutex.hxx>
43 : :
44 : : #include <tools/gen.hxx>
45 : : #include <vector>
46 : :
47 : : struct UnoControlModelEntry;
48 : : typedef ::std::vector< UnoControlModelEntry* > UnoControlModelEntryListBase;
49 : :
50 : : class UnoControlModelEntryList
51 : : {
52 : : private:
53 : : UnoControlModelEntryListBase maList;
54 : : ::rtl::OUString maGroupName;
55 : :
56 : : public:
57 : : UnoControlModelEntryList();
58 : : ~UnoControlModelEntryList();
59 : :
60 : 0 : const ::rtl::OUString& GetName() const { return maGroupName; }
61 : 0 : void SetName( const ::rtl::OUString& rName ) { maGroupName = rName; }
62 : :
63 : : void Reset();
64 : : void DestroyEntry( size_t nEntry );
65 : : size_t size() const;
66 : : UnoControlModelEntry* operator[]( size_t i ) const;
67 : : void push_back( UnoControlModelEntry* item );
68 : : void insert( size_t i, UnoControlModelEntry* item );
69 : : };
70 : :
71 : : struct UnoControlModelEntry
72 : : {
73 : : sal_Bool bGroup;
74 : : union
75 : : {
76 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >* pxControl;
77 : : UnoControlModelEntryList* pGroup;
78 : : };
79 : : };
80 : :
81 : 2 : struct ComponentEntry
82 : : {
83 : : ::com::sun::star::awt::XWindow* pComponent;
84 : : Point aPos;
85 : : };
86 : :
87 : : typedef ::std::vector< ComponentEntry* > ComponentEntryList;
88 : :
89 : : #define CONTROLPOS_NOTFOUND 0xFFFFFFFF
90 : :
91 : : class StdTabControllerModel : public ::com::sun::star::awt::XTabControllerModel,
92 : : public ::com::sun::star::lang::XServiceInfo,
93 : : public ::com::sun::star::io::XPersistObject,
94 : : public ::com::sun::star::lang::XTypeProvider,
95 : : public ::cppu::OWeakAggObject
96 : : {
97 : : private:
98 : : ::osl::Mutex maMutex;
99 : : UnoControlModelEntryList maControls;
100 : : sal_Bool mbGroupControl;
101 : :
102 : : protected:
103 : 0 : ::osl::Mutex& GetMutex() { return maMutex; }
104 : : sal_uInt32 ImplGetControlCount( const UnoControlModelEntryList& rList ) const;
105 : : void ImplGetControlModels( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ** pRefs, const UnoControlModelEntryList& rList ) const;
106 : : void ImplSetControlModels( UnoControlModelEntryList& rList, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) const;
107 : : sal_uInt32 ImplGetControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCtrl, const UnoControlModelEntryList& rList ) const;
108 : :
109 : : public:
110 : : StdTabControllerModel();
111 : : ~StdTabControllerModel();
112 : :
113 : : // ::com::sun::star::uno::XInterface
114 : 10 : ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); }
115 : 28 : void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
116 : 28 : void SAL_CALL release() throw() { OWeakAggObject::release(); }
117 : :
118 : : ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
119 : :
120 : : // ::com::sun::star::lang::XTypeProvider
121 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
122 : : ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
123 : :
124 : : // ::com::sun::star::awt::XTabControllerModel
125 : : sal_Bool SAL_CALL getGroupControl( ) throw(::com::sun::star::uno::RuntimeException);
126 : : void SAL_CALL setGroupControl( sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException);
127 : : void SAL_CALL setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw(::com::sun::star::uno::RuntimeException);
128 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels( ) throw(::com::sun::star::uno::RuntimeException);
129 : : void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw(::com::sun::star::uno::RuntimeException);
130 : : sal_Int32 SAL_CALL getGroupCount( ) throw(::com::sun::star::uno::RuntimeException);
131 : : void SAL_CALL getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, ::rtl::OUString& Name ) throw(::com::sun::star::uno::RuntimeException);
132 : : void SAL_CALL getGroupByName( const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group ) throw(::com::sun::star::uno::RuntimeException);
133 : :
134 : : // ::com::sun::star::io::XPersistObject
135 : : ::rtl::OUString SAL_CALL getServiceName( ) throw(::com::sun::star::uno::RuntimeException);
136 : : void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
137 : : void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
138 : :
139 : : // XServiceInfo
140 [ # # ][ # # ]: 2 : DECLIMPL_SERVICEINFO( StdTabControllerModel, szServiceName2_TabControllerModel )
[ # # ][ # # ]
[ # # ]
141 : : };
142 : :
143 : :
144 : :
145 : : #endif // _TOOLKIT_HELPER_STDTABCONTROLLERMODEL_HXX_
146 : :
147 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|