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 .
22 #include "errorbroadcaster.hxx"
23 #include <FormComponent.hxx>
24 #include <formcontrolfont.hxx>
25 #include <InterfaceContainer.hxx>
27 #include <com/sun/star/form/XGridColumnFactory.hpp>
28 #include <com/sun/star/sdb/XRowSetSupplier.hpp>
29 #include <com/sun/star/sdb/XRowSetChangeBroadcaster.hpp>
30 #include <com/sun/star/view/XSelectionSupplier.hpp>
32 #include <comphelper/interfacecontainer3.hxx>
33 #include <cppuhelper/implbase7.hxx>
43 typedef ::cppu::ImplHelper7
< css::awt::XControlModel
44 , css::form::XGridColumnFactory
46 , css::view::XSelectionSupplier
47 , css::sdb::XSQLErrorListener
48 , css::sdb::XRowSetSupplier
49 , css::sdb::XRowSetChangeBroadcaster
50 > OGridControlModel_BASE
;
52 class OGridControlModel final
:public OControlModel
53 ,public OInterfaceContainer
54 ,public OErrorBroadcaster
55 ,public FontControlModel
56 ,public OGridControlModel_BASE
58 ::comphelper::OInterfaceContainerHelper3
<css::view::XSelectionChangeListener
> m_aSelectListeners
;
59 ::comphelper::OInterfaceContainerHelper3
<css::form::XResetListener
> m_aResetListeners
;
60 ::comphelper::OInterfaceContainerHelper3
<css::sdb::XRowSetChangeListener
> m_aRowSetChangeListeners
;
63 css::uno::Any m_aRowHeight
; // Row height
64 css::uno::Any m_aTabStop
;
65 css::uno::Any m_aBackgroundColor
;
66 css::uno::Any m_aCursorColor
; // transient
67 css::uno::Any m_aBorderColor
;
68 OUString m_aDefaultControl
;
72 css::uno::Reference
< css::beans::XPropertySet
> m_xSelection
;
75 OUString m_sHelpURL
; // URL
77 sal_Int16 m_nWritingMode
;
78 sal_Int16 m_nContextWritingMode
;
79 bool m_bEnableVisible
: 1;
81 bool m_bNavigation
: 1;
82 bool m_bRecordMarker
: 1;
83 bool m_bPrintable
: 1;
84 bool m_bAlwaysShowCursor
: 1; // transient
85 bool m_bDisplaySynchron
: 1; // transient
92 const css::uno::Reference
< css::uno::XComponentContext
>& _rxFactory
95 const OGridControlModel
* _pOriginal
,
96 const css::uno::Reference
< css::uno::XComponentContext
>& _rxFactory
98 virtual ~OGridControlModel() override
;
101 DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel
, OControlModel
)
102 virtual css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& _rType
) override
;
105 virtual void SAL_CALL
setParent(const css::uno::Reference
<css::uno::XInterface
>& Parent
) override
;
108 OUString SAL_CALL
getImplementationName() override
109 { return "com.sun.star.form.OGridControlModel"; }
111 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
114 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes( ) override
;
117 virtual void SAL_CALL
disposing() override
;
120 virtual void SAL_CALL
disposing(const css::lang::EventObject
& _rSource
) override
;
123 virtual void SAL_CALL
reset() override
;
124 virtual void SAL_CALL
addResetListener(const css::uno::Reference
< css::form::XResetListener
>& _rxListener
) override
;
125 virtual void SAL_CALL
removeResetListener(const css::uno::Reference
< css::form::XResetListener
>& _rxListener
) override
;
127 // XSelectionSupplier
128 virtual sal_Bool SAL_CALL
select(const css::uno::Any
& aElement
) override
;
129 virtual css::uno::Any SAL_CALL
getSelection() override
;
130 virtual void SAL_CALL
addSelectionChangeListener(const css::uno::Reference
< css::view::XSelectionChangeListener
>& xListener
) override
;
131 virtual void SAL_CALL
removeSelectionChangeListener(const css::uno::Reference
< css::view::XSelectionChangeListener
>& xListener
) override
;
133 // XGridColumnFactory
134 virtual css::uno::Reference
< css::beans::XPropertySet
> SAL_CALL
createColumn(const OUString
& ColumnType
) override
;
135 virtual css::uno::Sequence
<OUString
> SAL_CALL
getColumnTypes() override
;
138 virtual OUString SAL_CALL
getServiceName() override
;
139 virtual void SAL_CALL
write(const css::uno::Reference
< css::io::XObjectOutputStream
>& _rxOutStream
) override
;
140 virtual void SAL_CALL
read(const css::uno::Reference
< css::io::XObjectInputStream
>& _rxInStream
) override
;
143 virtual void SAL_CALL
getFastPropertyValue(css::uno::Any
& rValue
, sal_Int32 nHandle
) const override
;
144 virtual sal_Bool SAL_CALL
convertFastPropertyValue(css::uno::Any
& rConvertedValue
, css::uno::Any
& rOldValue
,
145 sal_Int32 nHandle
, const css::uno::Any
& rValue
) override
;
146 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle
, const css::uno::Any
& rValue
) override
;
149 virtual css::uno::Any
getPropertyDefaultByHandle( sal_Int32 nHandle
) const override
;
152 virtual void SAL_CALL
errorOccured( const css::sdb::SQLErrorEvent
& _rEvent
) override
;
155 virtual css::uno::Reference
< css::sdbc::XRowSet
> SAL_CALL
getRowSet( ) override
;
156 virtual void SAL_CALL
setRowSet( const css::uno::Reference
< css::sdbc::XRowSet
>& xDataSource
) override
;
158 // XRowSetChangeBroadcaster
159 virtual void SAL_CALL
addRowSetChangeListener( const css::uno::Reference
< css::sdb::XRowSetChangeListener
>& i_Listener
) override
;
160 virtual void SAL_CALL
removeRowSetChangeListener( const css::uno::Reference
< css::sdb::XRowSetChangeListener
>& i_Listener
) override
;
162 // OControlModel's property handling
163 virtual void describeFixedProperties(
164 css::uno::Sequence
< css::beans::Property
>& /* [out] */ _rProps
167 // prevent method hiding
168 using OControlModel::disposing
;
169 using OControlModel::getFastPropertyValue
;
172 virtual css::uno::Reference
< css::util::XCloneable
> SAL_CALL
createClone( ) override
;
174 virtual void approveNewElement(
175 const css::uno::Reference
< css::beans::XPropertySet
>& _rxObject
,
176 ElementDescription
* _pElement
179 css::uno::Reference
< css::beans::XPropertySet
> createColumnById(sal_Int32 nTypeId
) const;
181 virtual ElementDescription
* createElementMetaData( ) override
;
183 virtual void implRemoved(const css::uno::Reference
<css::uno::XInterface
>& _rxObject
) override
;
184 virtual void implInserted( const ElementDescription
* _pElement
) override
;
185 virtual void impl_replacedElement(
186 const css::container::ContainerEvent
& _rEvent
,
187 ::osl::ClearableMutexGuard
& _rInstanceLock
190 void gotColumn(const css::uno::Reference
< css::uno::XInterface
>& _rxColumn
);
191 void lostColumn(const css::uno::Reference
< css::uno::XInterface
>& _rxColumn
);
193 void cloneColumns( const OGridControlModel
* _pOriginalContainer
);
200 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */