android: Update app icon to new startcenter icon
[LibreOffice.git] / dbaccess / source / ui / uno / ColumnModel.cxx
blobde83b6176dd60221e6c5189288b94f8e7538ffcf
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #include "ColumnModel.hxx"
21 #include <com/sun/star/beans/PropertyAttribute.hpp>
23 #include <stringconstants.hxx>
24 #include <strings.hxx>
26 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
27 com_sun_star_comp_dbu_OColumnControlModel_get_implementation(
28 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& )
30 return cppu::acquire(new ::dbaui::OColumnControlModel());
33 namespace dbaui
35 using namespace ::com::sun::star;
36 using namespace ::com::sun::star::uno;
37 using namespace ::com::sun::star::beans;
38 using namespace ::com::sun::star::container;
39 using namespace ::com::sun::star::awt;
40 using namespace ::com::sun::star::io;
41 using namespace ::com::sun::star::lang;
42 using namespace ::com::sun::star::util;
44 OColumnControlModel::OColumnControlModel()
45 :OPropertyContainer(m_aBHelper)
46 ,OColumnControlModel_BASE(m_aMutex)
47 ,m_sDefaultControl(SERVICE_CONTROLDEFAULT)
48 ,m_bEnable(true)
49 ,m_nBorder(0)
50 ,m_nWidth(50)
52 registerProperties();
55 OColumnControlModel::OColumnControlModel(const OColumnControlModel* _pSource)
56 :OPropertyContainer(m_aBHelper)
57 ,OColumnControlModel_BASE(m_aMutex)
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)
64 registerProperties();
67 OColumnControlModel::~OColumnControlModel()
69 if ( !OColumnControlModel_BASE::rBHelper.bDisposed && !OColumnControlModel_BASE::rBHelper.bInDispose )
71 acquire();
72 dispose();
76 void OColumnControlModel::registerProperties()
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() );
85 registerMayBeVoidProperty( PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
86 &m_aTabStop, ::cppu::UnoType<sal_Int16>::get() );
87 registerProperty( PROPERTY_DEFAULTCONTROL, PROPERTY_ID_DEFAULTCONTROL, PropertyAttribute::BOUND,
88 &m_sDefaultControl, cppu::UnoType<decltype(m_sDefaultControl)>::get() );
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() );
93 registerProperty( PROPERTY_EDIT_WIDTH, PROPERTY_ID_EDIT_WIDTH, PropertyAttribute::BOUND,
94 &m_nWidth, cppu::UnoType<decltype(m_nWidth)>::get() );
97 // XCloneable
98 Reference< XCloneable > SAL_CALL OColumnControlModel::createClone( )
100 return new OColumnControlModel( this );
103 css::uno::Sequence<sal_Int8> OColumnControlModel::getImplementationId()
105 return css::uno::Sequence<sal_Int8>();
108 css::uno::Sequence< css::uno::Type > OColumnControlModel::getTypes()
110 return ::comphelper::concatSequences(
111 OColumnControlModel_BASE::getTypes( ),
112 OPropertyContainer::getTypes( )
115 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OColumnControlModel::getPropertySetInfo()
117 Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
118 return xInfo;
120 ::cppu::IPropertyArrayHelper& OColumnControlModel::getInfoHelper()
122 return *OColumnControlModel::getArrayHelper();
124 ::cppu::IPropertyArrayHelper* OColumnControlModel::createArrayHelper( ) const
126 css::uno::Sequence< css::beans::Property > aProps;
127 describeProperties(aProps);
128 return new ::cppu::OPropertyArrayHelper(aProps);
131 OUString SAL_CALL OColumnControlModel::getImplementationName()
133 return "com.sun.star.comp.dbu.OColumnControlModel";
135 sal_Bool SAL_CALL OColumnControlModel::supportsService(const OUString& _rServiceName)
137 const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
138 for (const OUString& s : aSupported)
139 if (s == _rServiceName)
140 return true;
142 return false;
144 css::uno::Sequence< OUString > SAL_CALL OColumnControlModel::getSupportedServiceNames()
146 return { "com.sun.star.awt.UnoControlModel","com.sun.star.sdb.ColumnDescriptorControlModel" };
148 IMPLEMENT_FORWARD_REFCOUNT( OColumnControlModel, OColumnControlModel_BASE )
149 Any SAL_CALL OColumnControlModel::queryInterface( const Type& _rType )
151 return OColumnControlModel_BASE::queryInterface( _rType );
154 // css::XAggregation
155 Any SAL_CALL OColumnControlModel::queryAggregation( const Type& rType )
157 Any aRet(OColumnControlModel_BASE::queryAggregation(rType));
158 if (!aRet.hasValue())
159 aRet = comphelper::OPropertyContainer::queryInterface(rType);
160 return aRet;
163 OUString SAL_CALL OColumnControlModel::getServiceName()
165 return OUString();
168 void OColumnControlModel::write(const Reference<XObjectOutputStream>& /*_rxOutStream*/)
170 // TODO
173 void OColumnControlModel::read(const Reference<XObjectInputStream>& /*_rxInStream*/)
175 // TODO
178 } // namespace dbaui
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */