1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_forms.hxx" 26 27 28 #include "FixedText.hxx" 29 #include "services.hxx" 30 #ifndef _FRM_PROPERTY_HRC_ 31 #include "property.hrc" 32 #endif 33 #include "property.hxx" 34 #include <tools/debug.hxx> 35 36 //......................................................................... 37 namespace frm 38 { 39 using namespace ::com::sun::star::uno; 40 using namespace ::com::sun::star::sdb; 41 using namespace ::com::sun::star::sdbc; 42 using namespace ::com::sun::star::sdbcx; 43 using namespace ::com::sun::star::beans; 44 using namespace ::com::sun::star::container; 45 using namespace ::com::sun::star::form; 46 using namespace ::com::sun::star::awt; 47 using namespace ::com::sun::star::io; 48 using namespace ::com::sun::star::lang; 49 using namespace ::com::sun::star::util; 50 51 //------------------------------------------------------------------------------ 52 InterfaceRef SAL_CALL OFixedTextModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) 53 { 54 return *(new OFixedTextModel(_rxFactory)); 55 } 56 57 //------------------------------------------------------------------ 58 DBG_NAME( OFixedTextModel ) 59 //------------------------------------------------------------------ 60 OFixedTextModel::OFixedTextModel( const Reference<XMultiServiceFactory>& _rxFactory ) 61 :OControlModel(_rxFactory, VCL_CONTROLMODEL_FIXEDTEXT) 62 63 { 64 DBG_CTOR( OFixedTextModel, NULL ); 65 m_nClassId = FormComponentType::FIXEDTEXT; 66 } 67 68 //------------------------------------------------------------------ 69 OFixedTextModel::OFixedTextModel( const OFixedTextModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) 70 :OControlModel( _pOriginal, _rxFactory ) 71 72 { 73 DBG_CTOR( OFixedTextModel, NULL ); 74 } 75 76 //------------------------------------------------------------------ 77 OFixedTextModel::~OFixedTextModel( ) 78 { 79 DBG_DTOR( OFixedTextModel, NULL ); 80 } 81 82 //------------------------------------------------------------------------------ 83 IMPLEMENT_DEFAULT_CLONING( OFixedTextModel ) 84 85 //------------------------------------------------------------------------------ 86 StringSequence SAL_CALL OFixedTextModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) 87 { 88 StringSequence aSupported = OControlModel::getSupportedServiceNames(); 89 aSupported.realloc(aSupported.getLength() + 1); 90 91 ::rtl::OUString* pArray = aSupported.getArray(); 92 pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_FIXEDTEXT; 93 return aSupported; 94 } 95 96 //------------------------------------------------------------------------------ 97 void OFixedTextModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const 98 { 99 OControlModel::describeAggregateProperties( _rAggregateProps ); 100 RemoveProperty( _rAggregateProps, PROPERTY_TABSTOP ); 101 } 102 103 //------------------------------------------------------------------------------ 104 ::rtl::OUString SAL_CALL OFixedTextModel::getServiceName() throw(RuntimeException) 105 { 106 return FRM_COMPONENT_FIXEDTEXT; // old (non-sun) name for compatibility ! 107 } 108 109 //------------------------------------------------------------------------------ 110 void SAL_CALL OFixedTextModel::write(const Reference<XObjectOutputStream>& _rxOutStream) 111 throw(IOException, RuntimeException) 112 { 113 OControlModel::write(_rxOutStream); 114 115 // Version 116 _rxOutStream->writeShort(0x0002); 117 writeHelpTextCompatibly(_rxOutStream); 118 } 119 120 //------------------------------------------------------------------------------ 121 void SAL_CALL OFixedTextModel::read(const Reference<XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException) 122 { 123 OControlModel::read(_rxInStream); 124 125 // Version 126 sal_Int16 nVersion = _rxInStream->readShort(); 127 if (nVersion > 1) 128 readHelpTextCompatibly(_rxInStream); 129 } 130 131 //......................................................................... 132 } 133 //......................................................................... 134 135