1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_forms.hxx"
30 
31 
32 #include "FixedText.hxx"
33 #include "services.hxx"
34 #ifndef _FRM_PROPERTY_HRC_
35 #include "property.hrc"
36 #endif
37 #include "property.hxx"
38 #include <tools/debug.hxx>
39 
40 //.........................................................................
41 namespace frm
42 {
43 using namespace ::com::sun::star::uno;
44 using namespace ::com::sun::star::sdb;
45 using namespace ::com::sun::star::sdbc;
46 using namespace ::com::sun::star::sdbcx;
47 using namespace ::com::sun::star::beans;
48 using namespace ::com::sun::star::container;
49 using namespace ::com::sun::star::form;
50 using namespace ::com::sun::star::awt;
51 using namespace ::com::sun::star::io;
52 using namespace ::com::sun::star::lang;
53 using namespace ::com::sun::star::util;
54 
55 //------------------------------------------------------------------------------
56 InterfaceRef SAL_CALL OFixedTextModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
57 {
58 	return *(new OFixedTextModel(_rxFactory));
59 }
60 
61 //------------------------------------------------------------------
62 DBG_NAME( OFixedTextModel )
63 //------------------------------------------------------------------
64 OFixedTextModel::OFixedTextModel( const Reference<XMultiServiceFactory>& _rxFactory )
65 		:OControlModel(_rxFactory, VCL_CONTROLMODEL_FIXEDTEXT)
66 
67 {
68 	DBG_CTOR( OFixedTextModel, NULL );
69 	m_nClassId = FormComponentType::FIXEDTEXT;
70 }
71 
72 //------------------------------------------------------------------
73 OFixedTextModel::OFixedTextModel( const OFixedTextModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory )
74 	:OControlModel( _pOriginal, _rxFactory )
75 
76 {
77 	DBG_CTOR( OFixedTextModel, NULL );
78 }
79 
80 //------------------------------------------------------------------
81 OFixedTextModel::~OFixedTextModel( )
82 {
83 	DBG_DTOR( OFixedTextModel, NULL );
84 }
85 
86 //------------------------------------------------------------------------------
87 IMPLEMENT_DEFAULT_CLONING( OFixedTextModel )
88 
89 //------------------------------------------------------------------------------
90 StringSequence SAL_CALL OFixedTextModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
91 {
92 	StringSequence aSupported = OControlModel::getSupportedServiceNames();
93 	aSupported.realloc(aSupported.getLength() + 1);
94 
95 	::rtl::OUString* pArray = aSupported.getArray();
96 	pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_FIXEDTEXT;
97 	return aSupported;
98 }
99 
100 //------------------------------------------------------------------------------
101 void OFixedTextModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
102 {
103     OControlModel::describeAggregateProperties( _rAggregateProps );
104 	RemoveProperty( _rAggregateProps, PROPERTY_TABSTOP );
105 }
106 
107 //------------------------------------------------------------------------------
108 ::rtl::OUString SAL_CALL OFixedTextModel::getServiceName() throw(RuntimeException)
109 {
110 	return FRM_COMPONENT_FIXEDTEXT;	// old (non-sun) name for compatibility !
111 }
112 
113 //------------------------------------------------------------------------------
114 void SAL_CALL OFixedTextModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
115 	throw(IOException, RuntimeException)
116 {
117 	OControlModel::write(_rxOutStream);
118 
119 	// Version
120 	_rxOutStream->writeShort(0x0002);
121 	writeHelpTextCompatibly(_rxOutStream);
122 }
123 
124 //------------------------------------------------------------------------------
125 void SAL_CALL OFixedTextModel::read(const Reference<XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException)
126 {
127 	OControlModel::read(_rxInStream);
128 
129 	// Version
130 	sal_Int16 nVersion = _rxInStream->readShort();
131 	if (nVersion > 1)
132 		readHelpTextCompatibly(_rxInStream);
133 }
134 
135 //.........................................................................
136 }
137 //.........................................................................
138 
139