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 .
20 #ifndef INCLUDED_FORMS_SOURCE_COMPONENT_GRID_HXX
21 #define INCLUDED_FORMS_SOURCE_COMPONENT_GRID_HXX
23 #include "errorbroadcaster.hxx"
24 #include "FormComponent.hxx"
25 #include "formcontrolfont.hxx"
26 #include "InterfaceContainer.hxx"
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>
34 #include <comphelper/proparrhlp.hxx>
35 #include <cppuhelper/implbase7.hxx>
43 struct ColumnDescription
: public ElementDescription
46 OGridColumn
* pColumn
; // not owned by this instance! only to prevent duplicate XUnoTunnel usage
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
;
61 class OGridControlModel
:public OControlModel
62 ,public OInterfaceContainer
63 ,public OErrorBroadcaster
64 ,public FontControlModel
65 ,public OGridControlModel_BASE
67 ::cppu::OInterfaceContainerHelper m_aSelectListeners
,
69 m_aRowSetChangeListeners
;
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
;
81 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> m_xSelection
;
84 OUString m_sHelpURL
; // URL
86 sal_Int16 m_nWritingMode
;
87 sal_Int16 m_nContextWritingMode
;
88 bool m_bEnableVisible
: 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
101 DECLARE_DEFAULT_LEAF_XTOR( OGridControlModel
);
104 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
;
108 virtual void SAL_CALL
setParent(const InterfaceRef
& Parent
) throw(::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 OUString SAL_CALL
getImplementationName()
112 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
113 { return OUString("com.sun.star.form.OGridControlModel"); }
115 virtual StringSequence SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
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
;
121 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
124 virtual void SAL_CALL
disposing(const ::com::sun::star::lang::EventObject
& _rSource
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
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
;
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
;
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
;
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
;
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
;
154 virtual ::com::sun::star::uno::Any
getPropertyDefaultByHandle( sal_Int32 nHandle
) const SAL_OVERRIDE
;
157 virtual void SAL_CALL
errorOccured( const ::com::sun::star::sdb::SQLErrorEvent
& _rEvent
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
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
;
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
;
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
;
172 // prevent method hiding
173 using OControlModel::disposing
;
174 using OControlModel::getFastPropertyValue
;
177 virtual css::uno::Reference
< css::util::XCloneable
> SAL_CALL
createClone( ) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
180 virtual void approveNewElement(
181 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxObject
,
182 ElementDescription
* _pElement
185 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> createColumn(sal_Int32 nTypeId
) const;
187 static OGridColumn
* getColumnImplementation(const InterfaceRef
& _rxIFace
);
189 virtual ElementDescription
* createElementMetaData( ) SAL_OVERRIDE
;
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
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
);
202 void cloneColumns( const OGridControlModel
* _pOriginalContainer
);
210 #endif // INCLUDED_FORMS_SOURCE_COMPONENT_GRID_HXX
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */