Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include "ColumnModel.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>
25 :
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>
32 :
33 0 : extern "C" void SAL_CALL createRegistryInfo_OColumnControlModel()
34 : {
35 0 : static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OColumnControlModel> aAutoRegistration;
36 0 : }
37 :
38 : //.........................................................................
39 : namespace dbaui
40 : {
41 : //.........................................................................
42 : using namespace ::com::sun::star;
43 : using namespace ::com::sun::star::uno;
44 : using namespace ::com::sun::star::beans;
45 : using namespace ::com::sun::star::container;
46 : using namespace ::com::sun::star::awt;
47 : using namespace ::com::sun::star::io;
48 : using namespace ::com::sun::star::lang;
49 : using namespace ::com::sun::star::util;
50 :
51 :
52 : DBG_NAME(OColumnControlModel)
53 : //------------------------------------------------------------------
54 0 : OColumnControlModel::OColumnControlModel(const Reference<XMultiServiceFactory>& _rxFactory)
55 : :OPropertyContainer(m_aBHelper)
56 : ,OColumnControlModel_BASE(m_aMutex)
57 : ,m_xORB(_rxFactory)
58 : ,m_sDefaultControl(SERVICE_CONTROLDEFAULT)
59 : ,m_bEnable(sal_True)
60 : ,m_nBorder(0)
61 0 : ,m_nWidth(50)
62 : {
63 : DBG_CTOR(OColumnControlModel,NULL);
64 0 : registerProperties();
65 0 : }
66 : // -----------------------------------------------------------------------------
67 0 : OColumnControlModel::OColumnControlModel(const OColumnControlModel* _pSource,const Reference<XMultiServiceFactory>& _rxFactory)
68 : :OPropertyContainer(m_aBHelper)
69 : ,OColumnControlModel_BASE(m_aMutex)
70 : ,m_xORB(_rxFactory)
71 : ,m_sDefaultControl(_pSource->m_sDefaultControl)
72 : ,m_aTabStop(_pSource->m_aTabStop)
73 : ,m_bEnable(_pSource->m_bEnable)
74 : ,m_nBorder(_pSource->m_nBorder)
75 0 : ,m_nWidth(50)
76 : {
77 : DBG_CTOR(OColumnControlModel,NULL);
78 0 : registerProperties();
79 0 : }
80 : // -----------------------------------------------------------------------------
81 0 : OColumnControlModel::~OColumnControlModel()
82 : {
83 : DBG_DTOR(OColumnControlModel,NULL);
84 0 : if ( !OColumnControlModel_BASE::rBHelper.bDisposed && !OColumnControlModel_BASE::rBHelper.bInDispose )
85 : {
86 0 : acquire();
87 0 : dispose();
88 : }
89 0 : }
90 : // -----------------------------------------------------------------------------
91 0 : void OColumnControlModel::registerProperties()
92 : {
93 : registerProperty( PROPERTY_ACTIVE_CONNECTION, PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
94 0 : &m_xConnection, ::getCppuType( &m_xConnection ) );
95 0 : Any a;
96 0 : a <<= m_xColumn;
97 : registerProperty( PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
98 0 : &m_xColumn, ::getCppuType( &m_xColumn ) );
99 :
100 : registerMayBeVoidProperty( PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
101 0 : &m_aTabStop, ::getCppuType( static_cast<sal_Int16*>(NULL) ) );
102 : registerProperty( PROPERTY_DEFAULTCONTROL, PROPERTY_ID_DEFAULTCONTROL, PropertyAttribute::BOUND,
103 0 : &m_sDefaultControl, ::getCppuType( &m_sDefaultControl ) );
104 : registerProperty( PROPERTY_ENABLED, PROPERTY_ID_ENABLED, PropertyAttribute::BOUND,
105 0 : &m_bEnable, ::getCppuType( &m_bEnable ) );
106 : registerProperty( PROPERTY_BORDER, PROPERTY_ID_BORDER, PropertyAttribute::BOUND,
107 0 : &m_nBorder, ::getCppuType( &m_nBorder ) );
108 : registerProperty( PROPERTY_EDIT_WIDTH, PROPERTY_ID_EDIT_WIDTH, PropertyAttribute::BOUND,
109 0 : &m_nWidth, ::getCppuType( &m_nWidth ) );
110 0 : }
111 : // XCloneable
112 : //------------------------------------------------------------------------------
113 0 : Reference< XCloneable > SAL_CALL OColumnControlModel::createClone( ) throw (RuntimeException)
114 : {
115 0 : return new OColumnControlModel( this, getORB() );
116 : }
117 : //------------------------------------------------------------------------------
118 0 : IMPLEMENT_TYPEPROVIDER2(OColumnControlModel,OColumnControlModel_BASE,comphelper::OPropertyContainer)
119 0 : IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OColumnControlModel)
120 0 : IMPLEMENT_SERVICE_INFO2_STATIC(OColumnControlModel,"com.sun.star.comp.dbu.OColumnControlModel","com.sun.star.awt.UnoControlModel","com.sun.star.sdb.ColumnDescriptorControlModel")
121 0 : IMPLEMENT_FORWARD_REFCOUNT( OColumnControlModel, OColumnControlModel_BASE )
122 : //------------------------------------------------------------------------------
123 0 : Any SAL_CALL OColumnControlModel::queryInterface( const Type& _rType ) throw (RuntimeException)
124 : {
125 0 : return OColumnControlModel_BASE::queryInterface( _rType );
126 : }
127 : // -----------------------------------------------------------------------------
128 : // com::sun::star::XAggregation
129 0 : Any SAL_CALL OColumnControlModel::queryAggregation( const Type& rType ) throw(RuntimeException)
130 : {
131 0 : Any aRet(OColumnControlModel_BASE::queryAggregation(rType));
132 0 : if (!aRet.hasValue())
133 0 : aRet = comphelper::OPropertyContainer::queryInterface(rType);
134 0 : return aRet;
135 : }
136 : //------------------------------------------------------------------------------
137 0 : ::rtl::OUString SAL_CALL OColumnControlModel::getServiceName() throw ( RuntimeException)
138 : {
139 0 : return ::rtl::OUString();
140 : }
141 : //------------------------------------------------------------------------------
142 0 : void OColumnControlModel::write(const Reference<XObjectOutputStream>& /*_rxOutStream*/) throw ( ::com::sun::star::io::IOException, RuntimeException)
143 : {
144 : // TODO
145 0 : }
146 :
147 : //------------------------------------------------------------------------------
148 0 : void OColumnControlModel::read(const Reference<XObjectInputStream>& /*_rxInStream*/) throw ( ::com::sun::star::io::IOException, RuntimeException)
149 : {
150 : // TODO
151 0 : }
152 :
153 : //.........................................................................
154 : } // namespace dbaui
155 : //.........................................................................
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|