1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "ColumnModel.hxx"
31 #include <com/sun/star/awt/FontRelief.hpp>
32 #include <com/sun/star/awt/FontEmphasisMark.hpp>
33 #include <com/sun/star/beans/PropertyAttribute.hpp>
35 #include <cppuhelper/queryinterface.hxx>
36 #include <comphelper/extract.hxx>
37 #include "dbustrings.hrc"
38 #include "dbu_reghelper.hxx"
39 #include <toolkit/helper/vclunohelper.hxx>
40 #include <comphelper/property.hxx>
42 extern "C" void SAL_CALL
createRegistryInfo_OColumnControlModel()
44 static ::dbaui::OMultiInstanceAutoRegistration
< ::dbaui::OColumnControlModel
> aAutoRegistration
;
47 //.........................................................................
50 //.........................................................................
51 using namespace ::com::sun::star
;
52 using namespace ::com::sun::star::uno
;
53 using namespace ::com::sun::star::beans
;
54 using namespace ::com::sun::star::container
;
55 using namespace ::com::sun::star::awt
;
56 using namespace ::com::sun::star::io
;
57 using namespace ::com::sun::star::lang
;
58 using namespace ::com::sun::star::util
;
61 DBG_NAME(OColumnControlModel
)
62 //------------------------------------------------------------------
63 OColumnControlModel::OColumnControlModel(const Reference
<XMultiServiceFactory
>& _rxFactory
)
64 :OPropertyContainer(m_aBHelper
)
65 ,OColumnControlModel_BASE(m_aMutex
)
67 ,m_sDefaultControl(SERVICE_CONTROLDEFAULT
)
72 DBG_CTOR(OColumnControlModel
,NULL
);
75 // -----------------------------------------------------------------------------
76 OColumnControlModel::OColumnControlModel(const OColumnControlModel
* _pSource
,const Reference
<XMultiServiceFactory
>& _rxFactory
)
77 :OPropertyContainer(m_aBHelper
)
78 ,OColumnControlModel_BASE(m_aMutex
)
80 ,m_sDefaultControl(_pSource
->m_sDefaultControl
)
81 ,m_aTabStop(_pSource
->m_aTabStop
)
82 ,m_bEnable(_pSource
->m_bEnable
)
83 ,m_nBorder(_pSource
->m_nBorder
)
86 DBG_CTOR(OColumnControlModel
,NULL
);
89 // -----------------------------------------------------------------------------
90 OColumnControlModel::~OColumnControlModel()
92 DBG_DTOR(OColumnControlModel
,NULL
);
93 if ( !OColumnControlModel_BASE::rBHelper
.bDisposed
&& !OColumnControlModel_BASE::rBHelper
.bInDispose
)
99 // -----------------------------------------------------------------------------
100 void OColumnControlModel::registerProperties()
102 registerProperty( PROPERTY_ACTIVE_CONNECTION
, PROPERTY_ID_ACTIVE_CONNECTION
, PropertyAttribute::TRANSIENT
| PropertyAttribute::BOUND
,
103 &m_xConnection
, ::getCppuType( &m_xConnection
) );
106 registerProperty( PROPERTY_COLUMN
, PROPERTY_ID_COLUMN
, PropertyAttribute::TRANSIENT
| PropertyAttribute::BOUND
,
107 &m_xColumn
, ::getCppuType( &m_xColumn
) );
109 registerMayBeVoidProperty( PROPERTY_TABSTOP
, PROPERTY_ID_TABSTOP
, PropertyAttribute::BOUND
| PropertyAttribute::MAYBEVOID
,
110 &m_aTabStop
, ::getCppuType( static_cast<sal_Int16
*>(NULL
) ) );
111 registerProperty( PROPERTY_DEFAULTCONTROL
, PROPERTY_ID_DEFAULTCONTROL
, PropertyAttribute::BOUND
,
112 &m_sDefaultControl
, ::getCppuType( &m_sDefaultControl
) );
113 registerProperty( PROPERTY_ENABLED
, PROPERTY_ID_ENABLED
, PropertyAttribute::BOUND
,
114 &m_bEnable
, ::getCppuType( &m_bEnable
) );
115 registerProperty( PROPERTY_BORDER
, PROPERTY_ID_BORDER
, PropertyAttribute::BOUND
,
116 &m_nBorder
, ::getCppuType( &m_nBorder
) );
117 registerProperty( PROPERTY_EDIT_WIDTH
, PROPERTY_ID_EDIT_WIDTH
, PropertyAttribute::BOUND
,
118 &m_nWidth
, ::getCppuType( &m_nWidth
) );
121 //------------------------------------------------------------------------------
122 Reference
< XCloneable
> SAL_CALL
OColumnControlModel::createClone( ) throw (RuntimeException
)
124 return new OColumnControlModel( this, getORB() );
126 //------------------------------------------------------------------------------
127 IMPLEMENT_TYPEPROVIDER2(OColumnControlModel
,OColumnControlModel_BASE
,comphelper::OPropertyContainer
)
128 IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OColumnControlModel
)
129 IMPLEMENT_SERVICE_INFO2_STATIC(OColumnControlModel
,"com.sun.star.comp.dbu.OColumnControlModel","com.sun.star.awt.UnoControlModel","com.sun.star.sdb.ColumnDescriptorControlModel")
130 IMPLEMENT_FORWARD_REFCOUNT( OColumnControlModel
, OColumnControlModel_BASE
)
131 //------------------------------------------------------------------------------
132 Any SAL_CALL
OColumnControlModel::queryInterface( const Type
& _rType
) throw (RuntimeException
)
134 return OColumnControlModel_BASE::queryInterface( _rType
);
136 // -----------------------------------------------------------------------------
137 // com::sun::star::XAggregation
138 Any SAL_CALL
OColumnControlModel::queryAggregation( const Type
& rType
) throw(RuntimeException
)
140 Any
aRet(OColumnControlModel_BASE::queryAggregation(rType
));
141 if (!aRet
.hasValue())
142 aRet
= comphelper::OPropertyContainer::queryInterface(rType
);
145 //------------------------------------------------------------------------------
146 ::rtl::OUString SAL_CALL
OColumnControlModel::getServiceName() throw ( RuntimeException
)
148 return ::rtl::OUString();
150 //------------------------------------------------------------------------------
151 void OColumnControlModel::write(const Reference
<XObjectOutputStream
>& /*_rxOutStream*/) throw ( ::com::sun::star::io::IOException
, RuntimeException
)
156 //------------------------------------------------------------------------------
157 void OColumnControlModel::read(const Reference
<XObjectInputStream
>& /*_rxInStream*/) throw ( ::com::sun::star::io::IOException
, RuntimeException
)
162 //.........................................................................
164 //.........................................................................
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */