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