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 174 : 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 27112 : 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 8 : OUString SAL_CALL getImplementationName()
112 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
113 8 : { return OUString("com.sun.star.form.OGridControlModel"); }
114 :
115 : virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 :
117 : // XTypeProvider
118 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
119 :
120 : // OComponentHelper
121 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
122 :
123 : // XEventListener
124 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 :
126 : // XReset
127 : virtual void SAL_CALL reset() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 : 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;
129 : 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;
130 :
131 : // XSelectionSupplier
132 : 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;
133 : virtual ::com::sun::star::uno::Any SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 : 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;
135 : 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;
136 :
137 : // XGridColumnFactory
138 : 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;
139 : virtual StringSequence SAL_CALL getColumnTypes() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
140 :
141 : // XPersistObject
142 : virtual OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
143 : 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;
144 : 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;
145 :
146 : // XPropertySet
147 : virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
148 : virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
149 : sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
150 : throw(::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
151 : 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;
152 :
153 : // XPropertyState
154 : virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const SAL_OVERRIDE;
155 :
156 : // XSQLErrorListener
157 : virtual void SAL_CALL errorOccured( const ::com::sun::star::sdb::SQLErrorEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
158 :
159 : // XRowSetSupplier
160 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > SAL_CALL getRowSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 : 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;
162 :
163 : // XRowSetChangeBroadcaster
164 : 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;
165 : 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;
166 :
167 : // OControlModel's property handling
168 : virtual void describeFixedProperties(
169 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
170 : ) const SAL_OVERRIDE;
171 :
172 : // prevent method hiding
173 : using OControlModel::disposing;
174 : using OControlModel::getFastPropertyValue;
175 :
176 : protected:
177 : virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
178 :
179 : protected:
180 : virtual void approveNewElement(
181 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject,
182 : ElementDescription* _pElement
183 : ) SAL_OVERRIDE;
184 :
185 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> createColumn(sal_Int32 nTypeId) const;
186 :
187 : static OGridColumn* getColumnImplementation(const InterfaceRef& _rxIFace);
188 :
189 : virtual ElementDescription* createElementMetaData( ) SAL_OVERRIDE;
190 :
191 : protected:
192 : virtual void implRemoved(const InterfaceRef& _rxObject) SAL_OVERRIDE;
193 : virtual void implInserted( const ElementDescription* _pElement ) SAL_OVERRIDE;
194 : virtual void impl_replacedElement(
195 : const ::com::sun::star::container::ContainerEvent& _rEvent,
196 : ::osl::ClearableMutexGuard& _rInstanceLock
197 : ) SAL_OVERRIDE;
198 :
199 : void gotColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
200 : void lostColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
201 :
202 : void cloneColumns( const OGridControlModel* _pOriginalContainer );
203 : };
204 :
205 :
206 : } // namespace frm
207 :
208 :
209 :
210 : #endif // INCLUDED_FORMS_SOURCE_COMPONENT_GRID_HXX
211 :
212 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|