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 : #include "ColumnModel.hxx"
21 : #include <com/sun/star/awt/FontRelief.hpp>
22 : #include <com/sun/star/awt/FontEmphasisMark.hpp>
23 : #include <com/sun/star/beans/PropertyAttribute.hpp>
24 :
25 : #include <cppuhelper/queryinterface.hxx>
26 : #include <comphelper/extract.hxx>
27 : #include "dbustrings.hrc"
28 : #include "dbu_reghelper.hxx"
29 : #include <toolkit/helper/vclunohelper.hxx>
30 : #include <comphelper/property.hxx>
31 :
32 0 : extern "C" void SAL_CALL createRegistryInfo_OColumnControlModel()
33 : {
34 0 : static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OColumnControlModel> aAutoRegistration;
35 0 : }
36 :
37 : namespace dbaui
38 : {
39 : using namespace ::com::sun::star;
40 : using namespace ::com::sun::star::uno;
41 : using namespace ::com::sun::star::beans;
42 : using namespace ::com::sun::star::container;
43 : using namespace ::com::sun::star::awt;
44 : using namespace ::com::sun::star::io;
45 : using namespace ::com::sun::star::lang;
46 : using namespace ::com::sun::star::util;
47 :
48 0 : OColumnControlModel::OColumnControlModel(const Reference<XMultiServiceFactory>& _rxFactory)
49 : :OPropertyContainer(m_aBHelper)
50 : ,OColumnControlModel_BASE(m_aMutex)
51 : ,m_xORB(_rxFactory)
52 : ,m_sDefaultControl(SERVICE_CONTROLDEFAULT)
53 : ,m_bEnable(sal_True)
54 : ,m_nBorder(0)
55 0 : ,m_nWidth(50)
56 : {
57 0 : registerProperties();
58 0 : }
59 :
60 0 : OColumnControlModel::OColumnControlModel(const OColumnControlModel* _pSource,const Reference<XMultiServiceFactory>& _rxFactory)
61 : :OPropertyContainer(m_aBHelper)
62 : ,OColumnControlModel_BASE(m_aMutex)
63 : ,m_xORB(_rxFactory)
64 : ,m_sDefaultControl(_pSource->m_sDefaultControl)
65 : ,m_aTabStop(_pSource->m_aTabStop)
66 : ,m_bEnable(_pSource->m_bEnable)
67 : ,m_nBorder(_pSource->m_nBorder)
68 0 : ,m_nWidth(50)
69 : {
70 0 : registerProperties();
71 0 : }
72 :
73 0 : OColumnControlModel::~OColumnControlModel()
74 : {
75 0 : if ( !OColumnControlModel_BASE::rBHelper.bDisposed && !OColumnControlModel_BASE::rBHelper.bInDispose )
76 : {
77 0 : acquire();
78 0 : dispose();
79 : }
80 0 : }
81 :
82 0 : void OColumnControlModel::registerProperties()
83 : {
84 : registerProperty( PROPERTY_ACTIVE_CONNECTION, PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
85 0 : &m_xConnection, ::getCppuType( &m_xConnection ) );
86 0 : Any a;
87 0 : a <<= m_xColumn;
88 : registerProperty( PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
89 0 : &m_xColumn, ::getCppuType( &m_xColumn ) );
90 :
91 : registerMayBeVoidProperty( PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
92 0 : &m_aTabStop, ::getCppuType( static_cast<sal_Int16*>(NULL) ) );
93 : registerProperty( PROPERTY_DEFAULTCONTROL, PROPERTY_ID_DEFAULTCONTROL, PropertyAttribute::BOUND,
94 0 : &m_sDefaultControl, ::getCppuType( &m_sDefaultControl ) );
95 : registerProperty( PROPERTY_ENABLED, PROPERTY_ID_ENABLED, PropertyAttribute::BOUND,
96 0 : &m_bEnable, ::getCppuType( &m_bEnable ) );
97 : registerProperty( PROPERTY_BORDER, PROPERTY_ID_BORDER, PropertyAttribute::BOUND,
98 0 : &m_nBorder, ::getCppuType( &m_nBorder ) );
99 : registerProperty( PROPERTY_EDIT_WIDTH, PROPERTY_ID_EDIT_WIDTH, PropertyAttribute::BOUND,
100 0 : &m_nWidth, ::getCppuType( &m_nWidth ) );
101 0 : }
102 :
103 : // XCloneable
104 0 : Reference< XCloneable > SAL_CALL OColumnControlModel::createClone( ) throw (RuntimeException, std::exception)
105 : {
106 0 : return new OColumnControlModel( this, getORB() );
107 : }
108 :
109 0 : css::uno::Sequence<sal_Int8> OColumnControlModel::getImplementationId()
110 : throw (css::uno::RuntimeException, std::exception)
111 : {
112 0 : return css::uno::Sequence<sal_Int8>();
113 : }
114 :
115 0 : IMPLEMENT_GETTYPES2(OColumnControlModel,OColumnControlModel_BASE,comphelper::OPropertyContainer)
116 0 : IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OColumnControlModel)
117 0 : IMPLEMENT_SERVICE_INFO2_STATIC(OColumnControlModel,"com.sun.star.comp.dbu.OColumnControlModel","com.sun.star.awt.UnoControlModel","com.sun.star.sdb.ColumnDescriptorControlModel")
118 0 : IMPLEMENT_FORWARD_REFCOUNT( OColumnControlModel, OColumnControlModel_BASE )
119 0 : Any SAL_CALL OColumnControlModel::queryInterface( const Type& _rType ) throw (RuntimeException, std::exception)
120 : {
121 0 : return OColumnControlModel_BASE::queryInterface( _rType );
122 : }
123 :
124 : // com::sun::star::XAggregation
125 0 : Any SAL_CALL OColumnControlModel::queryAggregation( const Type& rType ) throw(RuntimeException, std::exception)
126 : {
127 0 : Any aRet(OColumnControlModel_BASE::queryAggregation(rType));
128 0 : if (!aRet.hasValue())
129 0 : aRet = comphelper::OPropertyContainer::queryInterface(rType);
130 0 : return aRet;
131 : }
132 :
133 0 : OUString SAL_CALL OColumnControlModel::getServiceName() throw ( RuntimeException, std::exception)
134 : {
135 0 : return OUString();
136 : }
137 :
138 0 : void OColumnControlModel::write(const Reference<XObjectOutputStream>& /*_rxOutStream*/) throw ( ::com::sun::star::io::IOException, RuntimeException, std::exception)
139 : {
140 : // TODO
141 0 : }
142 :
143 0 : void OColumnControlModel::read(const Reference<XObjectInputStream>& /*_rxInStream*/) throw ( ::com::sun::star::io::IOException, RuntimeException, std::exception)
144 : {
145 : // TODO
146 0 : }
147 :
148 : } // namespace dbaui
149 :
150 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|