LibreOffice Module dbaccess (master) 1
ColumnModel.cxx
Go to the documentation of this file.
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#include "ColumnModel.hxx"
21#include <com/sun/star/beans/PropertyAttribute.hpp>
22
23#include <stringconstants.hxx>
24#include <strings.hxx>
25
26extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
28 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& )
29{
30 return cppu::acquire(new ::dbaui::OColumnControlModel());
31}
32
33namespace dbaui
34{
35using namespace ::com::sun::star;
36using namespace ::com::sun::star::uno;
37using namespace ::com::sun::star::beans;
38using namespace ::com::sun::star::container;
39using namespace ::com::sun::star::awt;
40using namespace ::com::sun::star::io;
41using namespace ::com::sun::star::lang;
42using namespace ::com::sun::star::util;
43
45 :OPropertyContainer(m_aBHelper)
47 ,m_sDefaultControl(SERVICE_CONTROLDEFAULT)
48 ,m_bEnable(true)
49 ,m_nBorder(0)
50 ,m_nWidth(50)
51{
53}
54
56 :OPropertyContainer(m_aBHelper)
58 ,m_sDefaultControl(_pSource->m_sDefaultControl)
59 ,m_aTabStop(_pSource->m_aTabStop)
60 ,m_bEnable(_pSource->m_bEnable)
61 ,m_nBorder(_pSource->m_nBorder)
62 ,m_nWidth(50)
63{
65}
66
68{
69 if ( !OColumnControlModel_BASE::rBHelper.bDisposed && !OColumnControlModel_BASE::rBHelper.bInDispose )
70 {
71 acquire();
72 dispose();
73 }
74}
75
77{
78 registerProperty( PROPERTY_ACTIVE_CONNECTION, PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
79 &m_xConnection, cppu::UnoType<decltype(m_xConnection)>::get() );
80 Any a;
81 a <<= m_xColumn;
82 registerProperty( PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
83 &m_xColumn, cppu::UnoType<decltype(m_xColumn)>::get() );
84
85 registerMayBeVoidProperty( PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
89 registerProperty( PROPERTY_ENABLED, PROPERTY_ID_ENABLED, PropertyAttribute::BOUND,
90 &m_bEnable, cppu::UnoType<decltype(m_bEnable)>::get() );
91 registerProperty( PROPERTY_BORDER, PROPERTY_ID_BORDER, PropertyAttribute::BOUND,
92 &m_nBorder, cppu::UnoType<decltype(m_nBorder)>::get() );
94 &m_nWidth, cppu::UnoType<decltype(m_nWidth)>::get() );
95}
96
97// XCloneable
99{
100 return new OColumnControlModel( this );
101}
102
103css::uno::Sequence<sal_Int8> OColumnControlModel::getImplementationId()
104{
105 return css::uno::Sequence<sal_Int8>();
106}
107
108css::uno::Sequence< css::uno::Type > OColumnControlModel::getTypes()
109{
110 return ::comphelper::concatSequences(
112 OPropertyContainer::getTypes( )
113 );
114}
115css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OColumnControlModel::getPropertySetInfo()
116{
117 Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
118 return xInfo;
119}
121{
123}
125{
126 css::uno::Sequence< css::beans::Property > aProps;
127 describeProperties(aProps);
128 return new ::cppu::OPropertyArrayHelper(aProps);
129}
130
131OUString SAL_CALL OColumnControlModel::getImplementationName()
132{
133 return "com.sun.star.comp.dbu.OColumnControlModel";
134}
135sal_Bool SAL_CALL OColumnControlModel::supportsService(const OUString& _rServiceName)
136 {
137 const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
138 for (const OUString& s : aSupported)
139 if (s == _rServiceName)
140 return true;
141
142 return false;
143 }
144css::uno::Sequence< OUString > SAL_CALL OColumnControlModel::getSupportedServiceNames()
145{
146 return { "com.sun.star.awt.UnoControlModel","com.sun.star.sdb.ColumnDescriptorControlModel" };
147}
149Any SAL_CALL OColumnControlModel::queryInterface( const Type& _rType )
150{
152}
153
154// css::XAggregation
156{
158 if (!aRet.hasValue())
159 aRet = comphelper::OPropertyContainer::queryInterface(rType);
160 return aRet;
161}
162
164{
165 return OUString();
166}
167
169{
170 // TODO
171}
172
174{
175 // TODO
176}
177
178} // namespace dbaui
179
180/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_dbu_OColumnControlModel_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: ColumnModel.cxx:27
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
void registerProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void *_pPointerToMember, const css::uno::Type &_rMemberType)
void registerMayBeVoidProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, css::uno::Any *_pPointerToMember, const css::uno::Type &_rExpectedType)
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
virtual css::uno::Any SAL_CALL queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual ~OColumnControlModel() override
Definition: ColumnModel.cxx:67
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void SAL_CALL write(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream) override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
css::uno::Reference< css::beans::XPropertySet > m_xColumn
Definition: ColumnModel.hxx:53
virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &aType) override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
Definition: ColumnModel.cxx:98
css::uno::Reference< css::sdbc::XConnection > m_xConnection
Definition: ColumnModel.hxx:52
virtual OUString SAL_CALL getServiceName() override
std::mutex m_aMutex
uno_Any a
css::uno::Sequence< OUString > getSupportedServiceNames()
Type
::cppu::WeakAggComponentImplHelper4< css::awt::XControlModel, css::lang::XServiceInfo, css::util::XCloneable, css::io::XPersistObject > OColumnControlModel_BASE
Definition: ColumnModel.hxx:41
void dispose()
#define PROPERTY_ID_ACTIVE_CONNECTION
#define PROPERTY_ID_COLUMN
#define PROPERTY_ID_ENABLED
#define PROPERTY_ID_EDIT_WIDTH
#define PROPERTY_ID_TABSTOP
#define PROPERTY_ID_DEFAULTCONTROL
#define PROPERTY_ID_BORDER
constexpr OUStringLiteral PROPERTY_ENABLED(u"Enabled")
constexpr OUStringLiteral PROPERTY_COLUMN(u"Column")
constexpr OUStringLiteral SERVICE_CONTROLDEFAULT
Definition: strings.hxx:257
constexpr OUStringLiteral PROPERTY_BORDER(u"Border")
constexpr OUStringLiteral PROPERTY_ACTIVE_CONNECTION(u"ActiveConnection")
constexpr OUStringLiteral PROPERTY_EDIT_WIDTH(u"EditWidth")
constexpr OUStringLiteral PROPERTY_DEFAULTCONTROL(u"DefaultControl")
constexpr OUStringLiteral PROPERTY_TABSTOP(u"TabStop")
unsigned char sal_Bool
#define IMPLEMENT_FORWARD_REFCOUNT(classname, refcountbase)