Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ui / uno / ColumnModel.cxx
blobce72c992b1f52b99cf0bb11e0e652443cfb10767
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 "uiservices.hxx"
22 #include <com/sun/star/awt/FontRelief.hpp>
23 #include <com/sun/star/awt/FontEmphasisMark.hpp>
24 #include <com/sun/star/beans/PropertyAttribute.hpp>
26 #include <cppuhelper/queryinterface.hxx>
27 #include <comphelper/extract.hxx>
28 #include "dbustrings.hrc"
29 #include "dbu_reghelper.hxx"
30 #include <toolkit/helper/vclunohelper.hxx>
31 #include <comphelper/property.hxx>
33 extern "C" void SAL_CALL createRegistryInfo_OColumnControlModel()
35 static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OColumnControlModel> aAutoRegistration;
38 namespace dbaui
40 using namespace ::com::sun::star;
41 using namespace ::com::sun::star::uno;
42 using namespace ::com::sun::star::beans;
43 using namespace ::com::sun::star::container;
44 using namespace ::com::sun::star::awt;
45 using namespace ::com::sun::star::io;
46 using namespace ::com::sun::star::lang;
47 using namespace ::com::sun::star::util;
49 OColumnControlModel::OColumnControlModel(const Reference<XMultiServiceFactory>& _rxFactory)
50 :OPropertyContainer(m_aBHelper)
51 ,OColumnControlModel_BASE(m_aMutex)
52 ,m_xORB(_rxFactory)
53 ,m_sDefaultControl(SERVICE_CONTROLDEFAULT)
54 ,m_bEnable(true)
55 ,m_nBorder(0)
56 ,m_nWidth(50)
58 registerProperties();
61 OColumnControlModel::OColumnControlModel(const OColumnControlModel* _pSource,const Reference<XMultiServiceFactory>& _rxFactory)
62 :OPropertyContainer(m_aBHelper)
63 ,OColumnControlModel_BASE(m_aMutex)
64 ,m_xORB(_rxFactory)
65 ,m_sDefaultControl(_pSource->m_sDefaultControl)
66 ,m_aTabStop(_pSource->m_aTabStop)
67 ,m_bEnable(_pSource->m_bEnable)
68 ,m_nBorder(_pSource->m_nBorder)
69 ,m_nWidth(50)
71 registerProperties();
74 OColumnControlModel::~OColumnControlModel()
76 if ( !OColumnControlModel_BASE::rBHelper.bDisposed && !OColumnControlModel_BASE::rBHelper.bInDispose )
78 acquire();
79 dispose();
83 void OColumnControlModel::registerProperties()
85 registerProperty( PROPERTY_ACTIVE_CONNECTION, PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
86 &m_xConnection, cppu::UnoType<decltype(m_xConnection)>::get() );
87 Any a;
88 a <<= m_xColumn;
89 registerProperty( PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
90 &m_xColumn, cppu::UnoType<decltype(m_xColumn)>::get() );
92 registerMayBeVoidProperty( PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
93 &m_aTabStop, ::cppu::UnoType<sal_Int16>::get() );
94 registerProperty( PROPERTY_DEFAULTCONTROL, PROPERTY_ID_DEFAULTCONTROL, PropertyAttribute::BOUND,
95 &m_sDefaultControl, cppu::UnoType<decltype(m_sDefaultControl)>::get() );
96 registerProperty( PROPERTY_ENABLED, PROPERTY_ID_ENABLED, PropertyAttribute::BOUND,
97 &m_bEnable, cppu::UnoType<decltype(m_bEnable)>::get() );
98 registerProperty( PROPERTY_BORDER, PROPERTY_ID_BORDER, PropertyAttribute::BOUND,
99 &m_nBorder, cppu::UnoType<decltype(m_nBorder)>::get() );
100 registerProperty( PROPERTY_EDIT_WIDTH, PROPERTY_ID_EDIT_WIDTH, PropertyAttribute::BOUND,
101 &m_nWidth, cppu::UnoType<decltype(m_nWidth)>::get() );
104 // XCloneable
105 Reference< XCloneable > SAL_CALL OColumnControlModel::createClone( ) throw (RuntimeException, std::exception)
107 return new OColumnControlModel( this, getORB() );
110 css::uno::Sequence<sal_Int8> OColumnControlModel::getImplementationId()
111 throw (css::uno::RuntimeException, std::exception)
113 return css::uno::Sequence<sal_Int8>();
116 IMPLEMENT_GETTYPES2(OColumnControlModel,OColumnControlModel_BASE,comphelper::OPropertyContainer)
117 IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OColumnControlModel)
118 IMPLEMENT_SERVICE_INFO2_STATIC(OColumnControlModel,"com.sun.star.comp.dbu.OColumnControlModel","com.sun.star.awt.UnoControlModel","com.sun.star.sdb.ColumnDescriptorControlModel")
119 IMPLEMENT_FORWARD_REFCOUNT( OColumnControlModel, OColumnControlModel_BASE )
120 Any SAL_CALL OColumnControlModel::queryInterface( const Type& _rType ) throw (RuntimeException, std::exception)
122 return OColumnControlModel_BASE::queryInterface( _rType );
125 // com::sun::star::XAggregation
126 Any SAL_CALL OColumnControlModel::queryAggregation( const Type& rType ) throw(RuntimeException, std::exception)
128 Any aRet(OColumnControlModel_BASE::queryAggregation(rType));
129 if (!aRet.hasValue())
130 aRet = comphelper::OPropertyContainer::queryInterface(rType);
131 return aRet;
134 OUString SAL_CALL OColumnControlModel::getServiceName() throw ( RuntimeException, std::exception)
136 return OUString();
139 void OColumnControlModel::write(const Reference<XObjectOutputStream>& /*_rxOutStream*/) throw ( ::com::sun::star::io::IOException, RuntimeException, std::exception)
141 // TODO
144 void OColumnControlModel::read(const Reference<XObjectInputStream>& /*_rxInStream*/) throw ( ::com::sun::star::io::IOException, RuntimeException, std::exception)
146 // TODO
149 } // namespace dbaui
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */