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 12 : extern "C" void SAL_CALL createRegistryInfo_OColumnControlModel()
34 : {
35 12 : static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OColumnControlModel> aAutoRegistration;
36 12 : }
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 1 : 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 1 : ,m_nWidth(50)
57 : {
58 1 : registerProperties();
59 1 : }
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 3 : OColumnControlModel::~OColumnControlModel()
75 : {
76 1 : if ( !OColumnControlModel_BASE::rBHelper.bDisposed && !OColumnControlModel_BASE::rBHelper.bInDispose )
77 : {
78 0 : acquire();
79 0 : dispose();
80 : }
81 2 : }
82 :
83 1 : void OColumnControlModel::registerProperties()
84 : {
85 : registerProperty( PROPERTY_ACTIVE_CONNECTION, PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
86 1 : &m_xConnection, cppu::UnoType<decltype(m_xConnection)>::get() );
87 1 : Any a;
88 1 : a <<= m_xColumn;
89 : registerProperty( PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
90 1 : &m_xColumn, cppu::UnoType<decltype(m_xColumn)>::get() );
91 :
92 : registerMayBeVoidProperty( PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
93 1 : &m_aTabStop, ::cppu::UnoType<sal_Int16>::get() );
94 : registerProperty( PROPERTY_DEFAULTCONTROL, PROPERTY_ID_DEFAULTCONTROL, PropertyAttribute::BOUND,
95 1 : &m_sDefaultControl, cppu::UnoType<decltype(m_sDefaultControl)>::get() );
96 : registerProperty( PROPERTY_ENABLED, PROPERTY_ID_ENABLED, PropertyAttribute::BOUND,
97 1 : &m_bEnable, cppu::UnoType<decltype(m_bEnable)>::get() );
98 : registerProperty( PROPERTY_BORDER, PROPERTY_ID_BORDER, PropertyAttribute::BOUND,
99 1 : &m_nBorder, cppu::UnoType<decltype(m_nBorder)>::get() );
100 : registerProperty( PROPERTY_EDIT_WIDTH, PROPERTY_ID_EDIT_WIDTH, PropertyAttribute::BOUND,
101 1 : &m_nWidth, cppu::UnoType<decltype(m_nWidth)>::get() );
102 1 : }
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 41 : IMPLEMENT_SERVICE_INFO2_STATIC(OColumnControlModel,"com.sun.star.comp.dbu.OColumnControlModel","com.sun.star.awt.UnoControlModel","com.sun.star.sdb.ColumnDescriptorControlModel")
119 24 : IMPLEMENT_FORWARD_REFCOUNT( OColumnControlModel, OColumnControlModel_BASE )
120 2 : Any SAL_CALL OColumnControlModel::queryInterface( const Type& _rType ) throw (RuntimeException, std::exception)
121 : {
122 2 : return OColumnControlModel_BASE::queryInterface( _rType );
123 : }
124 :
125 : // com::sun::star::XAggregation
126 2 : Any SAL_CALL OColumnControlModel::queryAggregation( const Type& rType ) throw(RuntimeException, std::exception)
127 : {
128 2 : Any aRet(OColumnControlModel_BASE::queryAggregation(rType));
129 2 : if (!aRet.hasValue())
130 0 : aRet = comphelper::OPropertyContainer::queryInterface(rType);
131 2 : 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 : } // namespace dbaui
150 :
151 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|