tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / forms / source / component / FixedText.cxx
blob012ba04493db9afca40c19cc834e9168c9b4bd85
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "FixedText.hxx"
21 #include <frm_strings.hxx>
22 #include <services.hxx>
24 #include <com/sun/star/form/FormComponentType.hpp>
26 #include <comphelper/property.hxx>
29 namespace frm
31 using namespace ::com::sun::star::uno;
32 using namespace ::com::sun::star::sdb;
33 using namespace ::com::sun::star::sdbc;
34 using namespace ::com::sun::star::beans;
35 using namespace ::com::sun::star::form;
36 using namespace ::com::sun::star::io;
37 using namespace ::com::sun::star::util;
38 using namespace comphelper;
40 OFixedTextModel::OFixedTextModel( const Reference<XComponentContext>& _rxFactory )
41 :OControlModel(_rxFactory, VCL_CONTROLMODEL_FIXEDTEXT)
44 m_nClassId = FormComponentType::FIXEDTEXT;
48 OFixedTextModel::OFixedTextModel( const OFixedTextModel* _pOriginal, const Reference<XComponentContext>& _rxFactory )
49 :OControlModel( _pOriginal, _rxFactory )
55 OFixedTextModel::~OFixedTextModel( )
60 css::uno::Reference< css::util::XCloneable > SAL_CALL OFixedTextModel::createClone()
62 rtl::Reference<OFixedTextModel> pClone = new OFixedTextModel(this, getContext());
63 pClone->clonedFrom(this);
64 return pClone;
68 css::uno::Sequence<OUString> SAL_CALL OFixedTextModel::getSupportedServiceNames()
70 css::uno::Sequence<OUString> aSupported = OControlModel::getSupportedServiceNames();
71 aSupported.realloc(aSupported.getLength() + 2);
73 OUString* pArray = aSupported.getArray();
74 pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_FIXEDTEXT;
75 pArray[aSupported.getLength()-1] = FRM_COMPONENT_FIXEDTEXT;
76 return aSupported;
80 void OFixedTextModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
82 OControlModel::describeAggregateProperties( _rAggregateProps );
83 RemoveProperty( _rAggregateProps, PROPERTY_TABSTOP );
87 OUString SAL_CALL OFixedTextModel::getServiceName()
89 return FRM_COMPONENT_FIXEDTEXT; // old (non-sun) name for compatibility !
93 void SAL_CALL OFixedTextModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
95 OControlModel::write(_rxOutStream);
97 // Version
98 _rxOutStream->writeShort(0x0002);
99 writeHelpTextCompatibly(_rxOutStream);
103 void SAL_CALL OFixedTextModel::read(const Reference<XObjectInputStream>& _rxInStream)
105 OControlModel::read(_rxInStream);
107 // Version
108 sal_Int16 nVersion = _rxInStream->readShort();
109 if (nVersion > 1)
110 readHelpTextCompatibly(_rxInStream);
115 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
116 com_sun_star_form_OFixedTextModel_get_implementation(css::uno::XComponentContext* component,
117 css::uno::Sequence<css::uno::Any> const &)
119 return cppu::acquire(new frm::OFixedTextModel(component));
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */