Update ooo320-m1
[ooovba.git] / dbaccess / source / ui / uno / ColumnModel.cxx
blob34f3066202f12b5753caad5adcb8dab53983bf2b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ColumnModel.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #ifndef DBAUI_COLUMNMODEL_HXX
35 #include "ColumnModel.hxx"
36 #endif
37 #ifndef _COM_SUN_STAR_AWT_FONTRELIEF_HPP_
38 #include <com/sun/star/awt/FontRelief.hpp>
39 #endif
40 #ifndef _COM_SUN_STAR_AWT_FONTEMPHASISMARK_HPP_
41 #include <com/sun/star/awt/FontEmphasisMark.hpp>
42 #endif
43 #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
44 #include <com/sun/star/beans/PropertyAttribute.hpp>
45 #endif
47 #ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
48 #include <cppuhelper/queryinterface.hxx>
49 #endif
50 #ifndef _COMPHELPER_EXTRACT_HXX_
51 #include <comphelper/extract.hxx>
52 #endif
53 #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
54 #include "dbustrings.hrc"
55 #endif
56 #ifndef _DBU_REGHELPER_HXX_
57 #include "dbu_reghelper.hxx"
58 #endif
59 #ifndef _TOOLKIT_UNOHLP_HXX
60 #include <toolkit/helper/vclunohelper.hxx>
61 #endif
62 #ifndef _COMPHELPER_PROPERTY_HXX_
63 #include <comphelper/property.hxx>
64 #endif
66 extern "C" void SAL_CALL createRegistryInfo_OColumnControlModel()
68 static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OColumnControlModel> aAutoRegistration;
71 //.........................................................................
72 namespace dbaui
74 //.........................................................................
75 using namespace ::com::sun::star;
76 using namespace ::com::sun::star::uno;
77 using namespace ::com::sun::star::beans;
78 using namespace ::com::sun::star::container;
79 using namespace ::com::sun::star::awt;
80 using namespace ::com::sun::star::io;
81 using namespace ::com::sun::star::lang;
82 using namespace ::com::sun::star::util;
85 DBG_NAME(OColumnControlModel)
86 //------------------------------------------------------------------
87 OColumnControlModel::OColumnControlModel(const Reference<XMultiServiceFactory>& _rxFactory)
88 :OPropertyContainer(m_aBHelper)
89 ,OColumnControlModel_BASE(m_aMutex)
90 ,m_xORB(_rxFactory)
91 ,m_sDefaultControl(SERVICE_CONTROLDEFAULT)
92 ,m_bEnable(sal_True)
93 ,m_nBorder(0)
94 ,m_nWidth(50)
96 DBG_CTOR(OColumnControlModel,NULL);
97 registerProperties();
99 // -----------------------------------------------------------------------------
100 OColumnControlModel::OColumnControlModel(const OColumnControlModel* _pSource,const Reference<XMultiServiceFactory>& _rxFactory)
101 :OPropertyContainer(m_aBHelper)
102 ,OColumnControlModel_BASE(m_aMutex)
103 ,m_xORB(_rxFactory)
104 ,m_sDefaultControl(_pSource->m_sDefaultControl)
105 ,m_aTabStop(_pSource->m_aTabStop)
106 ,m_bEnable(_pSource->m_bEnable)
107 ,m_nBorder(_pSource->m_nBorder)
108 ,m_nWidth(50)
110 DBG_CTOR(OColumnControlModel,NULL);
111 registerProperties();
113 // -----------------------------------------------------------------------------
114 OColumnControlModel::~OColumnControlModel()
116 DBG_DTOR(OColumnControlModel,NULL);
117 if ( !OColumnControlModel_BASE::rBHelper.bDisposed && !OColumnControlModel_BASE::rBHelper.bInDispose )
119 acquire();
120 dispose();
123 // -----------------------------------------------------------------------------
124 void OColumnControlModel::registerProperties()
126 registerProperty( PROPERTY_ACTIVE_CONNECTION, PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
127 &m_xConnection, ::getCppuType( &m_xConnection ) );
128 Any a;
129 a <<= m_xColumn;
130 // registerMayBeVoidProperty( PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND| PropertyAttribute::MAYBEVOID,
131 // &a, ::getCppuType( &m_xColumn ) );
132 registerProperty( PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
133 &m_xColumn, ::getCppuType( &m_xColumn ) );
135 registerMayBeVoidProperty( PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
136 &m_aTabStop, ::getCppuType( static_cast<sal_Int16*>(NULL) ) );
137 registerProperty( PROPERTY_DEFAULTCONTROL, PROPERTY_ID_DEFAULTCONTROL, PropertyAttribute::BOUND,
138 &m_sDefaultControl, ::getCppuType( &m_sDefaultControl ) );
139 registerProperty( PROPERTY_ENABLED, PROPERTY_ID_ENABLED, PropertyAttribute::BOUND,
140 &m_bEnable, ::getCppuType( &m_bEnable ) );
141 registerProperty( PROPERTY_BORDER, PROPERTY_ID_BORDER, PropertyAttribute::BOUND,
142 &m_nBorder, ::getCppuType( &m_nBorder ) );
143 registerProperty( PROPERTY_EDIT_WIDTH, PROPERTY_ID_EDIT_WIDTH, PropertyAttribute::BOUND,
144 &m_nWidth, ::getCppuType( &m_nWidth ) );
146 // XCloneable
147 //------------------------------------------------------------------------------
148 Reference< XCloneable > SAL_CALL OColumnControlModel::createClone( ) throw (RuntimeException)
150 return new OColumnControlModel( this, getORB() );
152 //------------------------------------------------------------------------------
153 IMPLEMENT_TYPEPROVIDER2(OColumnControlModel,OColumnControlModel_BASE,comphelper::OPropertyContainer)
154 IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OColumnControlModel)
155 IMPLEMENT_SERVICE_INFO2_STATIC(OColumnControlModel,"com.sun.star.comp.dbu.OColumnControlModel","com.sun.star.awt.UnoControlModel","com.sun.star.sdb.ColumnDescriptorControlModel")
156 IMPLEMENT_FORWARD_REFCOUNT( OColumnControlModel, OColumnControlModel_BASE )
157 //------------------------------------------------------------------------------
158 Any SAL_CALL OColumnControlModel::queryInterface( const Type& _rType ) throw (RuntimeException)
160 return OColumnControlModel_BASE::queryInterface( _rType );
162 // -----------------------------------------------------------------------------
163 // com::sun::star::XAggregation
164 Any SAL_CALL OColumnControlModel::queryAggregation( const Type& rType ) throw(RuntimeException)
166 Any aRet(OColumnControlModel_BASE::queryAggregation(rType));
167 if (!aRet.hasValue())
168 aRet = comphelper::OPropertyContainer::queryInterface(rType);
169 return aRet;
171 //------------------------------------------------------------------------------
172 ::rtl::OUString SAL_CALL OColumnControlModel::getServiceName() throw ( RuntimeException)
174 return ::rtl::OUString();
176 //------------------------------------------------------------------------------
177 void OColumnControlModel::write(const Reference<XObjectOutputStream>& /*_rxOutStream*/) throw ( ::com::sun::star::io::IOException, RuntimeException)
179 // TODO
182 //------------------------------------------------------------------------------
183 void OColumnControlModel::read(const Reference<XObjectInputStream>& /*_rxInStream*/) throw ( ::com::sun::star::io::IOException, RuntimeException)
185 // TODO
188 //.........................................................................
189 } // namespace dbaui
190 //.........................................................................