Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_FORMS_SOURCE_COMPONENT_GRID_HXX
21 : #define INCLUDED_FORMS_SOURCE_COMPONENT_GRID_HXX
22 :
23 : #include "errorbroadcaster.hxx"
24 : #include "FormComponent.hxx"
25 : #include "formcontrolfont.hxx"
26 : #include "InterfaceContainer.hxx"
27 :
28 : #include <com/sun/star/form/XGridColumnFactory.hpp>
29 : #include <com/sun/star/form/XLoadable.hpp>
30 : #include <com/sun/star/sdb/XRowSetSupplier.hpp>
31 : #include <com/sun/star/sdb/XRowSetChangeBroadcaster.hpp>
32 : #include <com/sun/star/view/XSelectionSupplier.hpp>
33 :
34 : #include <comphelper/proparrhlp.hxx>
35 : #include <cppuhelper/implbase7.hxx>
36 :
37 :
38 : namespace frm
39 : {
40 :
41 : class OGridColumn;
42 :
43 348 : struct ColumnDescription : public ElementDescription
44 : {
45 : public:
46 : OGridColumn* pColumn; // not owned by this instance! only to prevent duplicate XUnoTunnel usage
47 : };
48 :
49 :
50 : // OGridControlModel
51 :
52 : typedef ::cppu::ImplHelper7 < ::com::sun::star::awt::XControlModel
53 : , ::com::sun::star::form::XGridColumnFactory
54 : , ::com::sun::star::form::XReset
55 : , ::com::sun::star::view::XSelectionSupplier
56 : , ::com::sun::star::sdb::XSQLErrorListener
57 : , ::com::sun::star::sdb::XRowSetSupplier
58 : , ::com::sun::star::sdb::XRowSetChangeBroadcaster
59 : > OGridControlModel_BASE;
60 :
61 : class OGridControlModel :public OControlModel
62 : ,public OInterfaceContainer
63 : ,public OErrorBroadcaster
64 : ,public FontControlModel
65 : ,public OGridControlModel_BASE
66 : {
67 : ::cppu::OInterfaceContainerHelper m_aSelectListeners,
68 : m_aResetListeners,
69 : m_aRowSetChangeListeners;
70 :
71 : // [properties]
72 : ::com::sun::star::uno::Any m_aRowHeight; // Row height
73 : ::com::sun::star::uno::Any m_aTabStop;
74 : ::com::sun::star::uno::Any m_aBackgroundColor;
75 : ::com::sun::star::uno::Any m_aCursorColor; // transient
76 : ::com::sun::star::uno::Any m_aBorderColor;
77 : OUString m_aDefaultControl;
78 : OUString m_sHelpText;
79 : // [properties]
80 :
81 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSelection;
82 :
83 : // [properties]
84 : OUString m_sHelpURL; // URL
85 : sal_Int16 m_nBorder;
86 : sal_Int16 m_nWritingMode;
87 : sal_Int16 m_nContextWritingMode;
88 : bool m_bEnableVisible : 1;
89 : bool m_bEnable : 1;
90 : bool m_bNavigation : 1;
91 : bool m_bRecordMarker : 1;
92 : bool m_bPrintable : 1;
93 : bool m_bAlwaysShowCursor : 1; // transient
94 : bool m_bDisplaySynchron : 1; // transient
95 : // [properties]
96 :
97 : protected:
98 : void _reset();
99 :
100 : public:
101 : DECLARE_DEFAULT_LEAF_XTOR( OGridControlModel );
102 :
103 : // UNO Binding
104 54160 : DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OControlModel)
105 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 :
107 : // XChild
108 : virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 :
110 : // XServiceInfo
111 14 : IMPLEMENTATION_NAME(OGridControlModel);
112 : virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 :
114 : // XTypeProvider
115 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 :
117 : // OComponentHelper
118 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
119 :
120 : // XEventListener
121 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 :
123 : // XReset
124 : virtual void SAL_CALL reset() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 : virtual void SAL_CALL addResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 : virtual void SAL_CALL removeResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 :
128 : // XSelectionSupplier
129 : virtual sal_Bool SAL_CALL select(const ::com::sun::star::uno::Any& aElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 : virtual ::com::sun::star::uno::Any SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 : virtual void SAL_CALL addSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 : virtual void SAL_CALL removeSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 :
134 : // XGridColumnFactory
135 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> SAL_CALL createColumn(const OUString& ColumnType) throw ( :: com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
136 : virtual StringSequence SAL_CALL getColumnTypes() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 :
138 : // XPersistObject
139 : virtual OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
140 : virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
141 : virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 :
143 : // XPropertySet
144 : virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
145 : virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
146 : sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
147 : throw(::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
148 : virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
149 :
150 : // XPropertyState
151 : virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const SAL_OVERRIDE;
152 :
153 : // XSQLErrorListener
154 : virtual void SAL_CALL errorOccured( const ::com::sun::star::sdb::SQLErrorEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 :
156 : // XRowSetSupplier
157 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > SAL_CALL getRowSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
158 : virtual void SAL_CALL setRowSet( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xDataSource ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 :
160 : // XRowSetChangeBroadcaster
161 : virtual void SAL_CALL addRowSetChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetChangeListener >& i_Listener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
162 : virtual void SAL_CALL removeRowSetChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetChangeListener >& i_Listener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 :
164 : // OControlModel's property handling
165 : virtual void describeFixedProperties(
166 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
167 : ) const SAL_OVERRIDE;
168 :
169 : // prevent method hiding
170 : using OControlModel::disposing;
171 : using OControlModel::getFastPropertyValue;
172 :
173 : protected:
174 : virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
175 :
176 : protected:
177 : virtual void approveNewElement(
178 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject,
179 : ElementDescription* _pElement
180 : ) SAL_OVERRIDE;
181 :
182 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> createColumn(sal_Int32 nTypeId) const;
183 :
184 : OGridColumn* getColumnImplementation(const InterfaceRef& _rxIFace) const;
185 :
186 : virtual ElementDescription* createElementMetaData( ) SAL_OVERRIDE;
187 :
188 : protected:
189 : virtual void implRemoved(const InterfaceRef& _rxObject) SAL_OVERRIDE;
190 : virtual void implInserted( const ElementDescription* _pElement ) SAL_OVERRIDE;
191 : virtual void impl_replacedElement(
192 : const ::com::sun::star::container::ContainerEvent& _rEvent,
193 : ::osl::ClearableMutexGuard& _rInstanceLock
194 : ) SAL_OVERRIDE;
195 :
196 : void gotColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
197 : void lostColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
198 :
199 : void cloneColumns( const OGridControlModel* _pOriginalContainer );
200 : };
201 :
202 :
203 : } // namespace frm
204 :
205 :
206 :
207 : #endif // INCLUDED_FORMS_SOURCE_COMPONENT_GRID_HXX
208 :
209 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|