merge the formfield patch from ooo-build
[ooovba.git] / forms / source / component / FixedText.cxx
blob9617421145c0c2b802a43ca1adab64ac425a866a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: FixedText.cxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_forms.hxx"
35 #include "FixedText.hxx"
36 #include "services.hxx"
37 #ifndef _FRM_PROPERTY_HRC_
38 #include "property.hrc"
39 #endif
40 #include "property.hxx"
41 #include <tools/debug.hxx>
43 //.........................................................................
44 namespace frm
46 using namespace ::com::sun::star::uno;
47 using namespace ::com::sun::star::sdb;
48 using namespace ::com::sun::star::sdbc;
49 using namespace ::com::sun::star::sdbcx;
50 using namespace ::com::sun::star::beans;
51 using namespace ::com::sun::star::container;
52 using namespace ::com::sun::star::form;
53 using namespace ::com::sun::star::awt;
54 using namespace ::com::sun::star::io;
55 using namespace ::com::sun::star::lang;
56 using namespace ::com::sun::star::util;
58 //------------------------------------------------------------------------------
59 InterfaceRef SAL_CALL OFixedTextModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
61 return *(new OFixedTextModel(_rxFactory));
64 //------------------------------------------------------------------
65 DBG_NAME( OFixedTextModel )
66 //------------------------------------------------------------------
67 OFixedTextModel::OFixedTextModel( const Reference<XMultiServiceFactory>& _rxFactory )
68 :OControlModel(_rxFactory, VCL_CONTROLMODEL_FIXEDTEXT)
71 DBG_CTOR( OFixedTextModel, NULL );
72 m_nClassId = FormComponentType::FIXEDTEXT;
75 //------------------------------------------------------------------
76 OFixedTextModel::OFixedTextModel( const OFixedTextModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory )
77 :OControlModel( _pOriginal, _rxFactory )
80 DBG_CTOR( OFixedTextModel, NULL );
83 //------------------------------------------------------------------
84 OFixedTextModel::~OFixedTextModel( )
86 DBG_DTOR( OFixedTextModel, NULL );
89 //------------------------------------------------------------------------------
90 IMPLEMENT_DEFAULT_CLONING( OFixedTextModel )
92 //------------------------------------------------------------------------------
93 StringSequence SAL_CALL OFixedTextModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
95 StringSequence aSupported = OControlModel::getSupportedServiceNames();
96 aSupported.realloc(aSupported.getLength() + 1);
98 ::rtl::OUString* pArray = aSupported.getArray();
99 pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_FIXEDTEXT;
100 return aSupported;
103 //------------------------------------------------------------------------------
104 void OFixedTextModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
106 OControlModel::describeAggregateProperties( _rAggregateProps );
107 RemoveProperty( _rAggregateProps, PROPERTY_TABSTOP );
110 //------------------------------------------------------------------------------
111 ::rtl::OUString SAL_CALL OFixedTextModel::getServiceName() throw(RuntimeException)
113 return FRM_COMPONENT_FIXEDTEXT; // old (non-sun) name for compatibility !
116 //------------------------------------------------------------------------------
117 void SAL_CALL OFixedTextModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
118 throw(IOException, RuntimeException)
120 OControlModel::write(_rxOutStream);
122 // Version
123 _rxOutStream->writeShort(0x0002);
124 writeHelpTextCompatibly(_rxOutStream);
127 //------------------------------------------------------------------------------
128 void SAL_CALL OFixedTextModel::read(const Reference<XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException)
130 OControlModel::read(_rxInStream);
132 // Version
133 sal_Int16 nVersion = _rxInStream->readShort();
134 if (nVersion > 1)
135 readHelpTextCompatibly(_rxInStream);
138 //.........................................................................
140 //.........................................................................