1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_dbaccess.hxx"
26 
27 #ifndef DBAUI_COLUMNMODEL_HXX
28 #include "ColumnModel.hxx"
29 #endif
30 #ifndef _COM_SUN_STAR_AWT_FONTRELIEF_HPP_
31 #include <com/sun/star/awt/FontRelief.hpp>
32 #endif
33 #ifndef _COM_SUN_STAR_AWT_FONTEMPHASISMARK_HPP_
34 #include <com/sun/star/awt/FontEmphasisMark.hpp>
35 #endif
36 #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
37 #include <com/sun/star/beans/PropertyAttribute.hpp>
38 #endif
39 
40 #ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
41 #include <cppuhelper/queryinterface.hxx>
42 #endif
43 #ifndef _COMPHELPER_EXTRACT_HXX_
44 #include <comphelper/extract.hxx>
45 #endif
46 #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
47 #include "dbustrings.hrc"
48 #endif
49 #ifndef _DBU_REGHELPER_HXX_
50 #include "dbu_reghelper.hxx"
51 #endif
52 #ifndef _TOOLKIT_UNOHLP_HXX
53 #include <toolkit/helper/vclunohelper.hxx>
54 #endif
55 #ifndef _COMPHELPER_PROPERTY_HXX_
56 #include <comphelper/property.hxx>
57 #endif
58 
createRegistryInfo_OColumnControlModel()59 extern "C" void SAL_CALL createRegistryInfo_OColumnControlModel()
60 {
61 	static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OColumnControlModel> aAutoRegistration;
62 }
63 
64 //.........................................................................
65 namespace dbaui
66 {
67 //.........................................................................
68 using namespace ::com::sun::star;
69 using namespace ::com::sun::star::uno;
70 using namespace ::com::sun::star::beans;
71 using namespace ::com::sun::star::container;
72 using namespace ::com::sun::star::awt;
73 using namespace ::com::sun::star::io;
74 using namespace ::com::sun::star::lang;
75 using namespace ::com::sun::star::util;
76 
77 
DBG_NAME(OColumnControlModel)78 DBG_NAME(OColumnControlModel)
79 //------------------------------------------------------------------
80 OColumnControlModel::OColumnControlModel(const Reference<XMultiServiceFactory>& _rxFactory)
81     :OPropertyContainer(m_aBHelper)
82     ,OColumnControlModel_BASE(m_aMutex)
83     ,m_xORB(_rxFactory)
84     ,m_sDefaultControl(SERVICE_CONTROLDEFAULT)
85     ,m_bEnable(sal_True)
86     ,m_nBorder(0)
87     ,m_nWidth(50)
88 {
89 	DBG_CTOR(OColumnControlModel,NULL);
90 	registerProperties();
91 }
92 // -----------------------------------------------------------------------------
OColumnControlModel(const OColumnControlModel * _pSource,const Reference<XMultiServiceFactory> & _rxFactory)93 OColumnControlModel::OColumnControlModel(const OColumnControlModel* _pSource,const Reference<XMultiServiceFactory>& _rxFactory)
94     :OPropertyContainer(m_aBHelper)
95     ,OColumnControlModel_BASE(m_aMutex)
96     ,m_xORB(_rxFactory)
97     ,m_sDefaultControl(_pSource->m_sDefaultControl)
98     ,m_aTabStop(_pSource->m_aTabStop)
99     ,m_bEnable(_pSource->m_bEnable)
100     ,m_nBorder(_pSource->m_nBorder)
101     ,m_nWidth(50)
102 {
103 	DBG_CTOR(OColumnControlModel,NULL);
104 	registerProperties();
105 }
106 // -----------------------------------------------------------------------------
~OColumnControlModel()107 OColumnControlModel::~OColumnControlModel()
108 {
109 	DBG_DTOR(OColumnControlModel,NULL);
110 	if ( !OColumnControlModel_BASE::rBHelper.bDisposed && !OColumnControlModel_BASE::rBHelper.bInDispose )
111 	{
112 		acquire();
113 		dispose();
114 	}
115 }
116 // -----------------------------------------------------------------------------
registerProperties()117 void OColumnControlModel::registerProperties()
118 {
119 	registerProperty( PROPERTY_ACTIVE_CONNECTION, PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
120 		&m_xConnection, ::getCppuType( &m_xConnection ) );
121 	Any a;
122 	a <<= m_xColumn;
123 //	registerMayBeVoidProperty( PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND| PropertyAttribute::MAYBEVOID,
124 //			&a, ::getCppuType( &m_xColumn ) );
125 	registerProperty( PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
126 			&m_xColumn, ::getCppuType( &m_xColumn ) );
127 
128 	registerMayBeVoidProperty( PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
129 			&m_aTabStop, ::getCppuType( static_cast<sal_Int16*>(NULL) ) );
130 	registerProperty( PROPERTY_DEFAULTCONTROL, PROPERTY_ID_DEFAULTCONTROL, PropertyAttribute::BOUND,
131 			&m_sDefaultControl, ::getCppuType( &m_sDefaultControl ) );
132 	registerProperty( PROPERTY_ENABLED, PROPERTY_ID_ENABLED, PropertyAttribute::BOUND,
133 			&m_bEnable, ::getCppuType( &m_bEnable ) );
134 	registerProperty( PROPERTY_BORDER, PROPERTY_ID_BORDER, PropertyAttribute::BOUND,
135 		&m_nBorder, ::getCppuType( &m_nBorder ) );
136 	registerProperty( PROPERTY_EDIT_WIDTH, PROPERTY_ID_EDIT_WIDTH, PropertyAttribute::BOUND,
137 		&m_nWidth, ::getCppuType( &m_nWidth ) );
138 }
139 // XCloneable
140 //------------------------------------------------------------------------------
createClone()141 Reference< XCloneable > SAL_CALL OColumnControlModel::createClone( ) throw (RuntimeException)
142 {
143     return new OColumnControlModel( this, getORB() );
144 }
145 //------------------------------------------------------------------------------
IMPLEMENT_TYPEPROVIDER2(OColumnControlModel,OColumnControlModel_BASE,comphelper::OPropertyContainer)146 IMPLEMENT_TYPEPROVIDER2(OColumnControlModel,OColumnControlModel_BASE,comphelper::OPropertyContainer)
147 IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OColumnControlModel)
148 IMPLEMENT_SERVICE_INFO2_STATIC(OColumnControlModel,"com.sun.star.comp.dbu.OColumnControlModel","com.sun.star.awt.UnoControlModel","com.sun.star.sdb.ColumnDescriptorControlModel")
149 IMPLEMENT_FORWARD_REFCOUNT( OColumnControlModel, OColumnControlModel_BASE )
150 //------------------------------------------------------------------------------
151 Any SAL_CALL OColumnControlModel::queryInterface( const Type& _rType ) throw (RuntimeException)
152 {
153 	return OColumnControlModel_BASE::queryInterface( _rType );
154 }
155 // -----------------------------------------------------------------------------
156 // com::sun::star::XAggregation
queryAggregation(const Type & rType)157 Any SAL_CALL OColumnControlModel::queryAggregation( const Type& rType ) throw(RuntimeException)
158 {
159 	Any aRet(OColumnControlModel_BASE::queryAggregation(rType));
160 	if (!aRet.hasValue())
161 		aRet = comphelper::OPropertyContainer::queryInterface(rType);
162 	return aRet;
163 }
164 //------------------------------------------------------------------------------
getServiceName()165 ::rtl::OUString SAL_CALL OColumnControlModel::getServiceName() throw ( RuntimeException)
166 {
167 	return ::rtl::OUString();
168 }
169 //------------------------------------------------------------------------------
write(const Reference<XObjectOutputStream> &)170 void OColumnControlModel::write(const Reference<XObjectOutputStream>& /*_rxOutStream*/) throw ( ::com::sun::star::io::IOException, RuntimeException)
171 {
172 	// TODO
173 }
174 
175 //------------------------------------------------------------------------------
read(const Reference<XObjectInputStream> &)176 void OColumnControlModel::read(const Reference<XObjectInputStream>& /*_rxInStream*/) throw ( ::com::sun::star::io::IOException, RuntimeException)
177 {
178 	// TODO
179 }
180 
181 //.........................................................................
182 }	// namespace dbaui
183 //.........................................................................
184 
185