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