LibreOffice Module forms (master) 1
FixedText.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "FixedText.hxx"
21#include <frm_strings.hxx>
22#include <services.hxx>
23
24#include <com/sun/star/form/FormComponentType.hpp>
25
27
28
29namespace frm
30{
31using namespace ::com::sun::star::uno;
32using namespace ::com::sun::star::sdb;
33using namespace ::com::sun::star::sdbc;
34using namespace ::com::sun::star::beans;
35using namespace ::com::sun::star::container;
36using namespace ::com::sun::star::form;
37using namespace ::com::sun::star::awt;
38using namespace ::com::sun::star::io;
39using namespace ::com::sun::star::lang;
40using namespace ::com::sun::star::util;
41using namespace comphelper;
42
43OFixedTextModel::OFixedTextModel( const Reference<XComponentContext>& _rxFactory )
44 :OControlModel(_rxFactory, VCL_CONTROLMODEL_FIXEDTEXT)
45
46{
47 m_nClassId = FormComponentType::FIXEDTEXT;
48}
49
50
51OFixedTextModel::OFixedTextModel( const OFixedTextModel* _pOriginal, const Reference<XComponentContext>& _rxFactory )
52 :OControlModel( _pOriginal, _rxFactory )
53
54{
55}
56
57
58OFixedTextModel::~OFixedTextModel( )
59{
60}
61
62
63css::uno::Reference< css::util::XCloneable > SAL_CALL OFixedTextModel::createClone()
64{
65 rtl::Reference<OFixedTextModel> pClone = new OFixedTextModel(this, getContext());
66 pClone->clonedFrom(this);
67 return pClone;
68}
69
70
71css::uno::Sequence<OUString> SAL_CALL OFixedTextModel::getSupportedServiceNames()
72{
73 css::uno::Sequence<OUString> aSupported = OControlModel::getSupportedServiceNames();
74 aSupported.realloc(aSupported.getLength() + 2);
75
76 OUString* pArray = aSupported.getArray();
77 pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_FIXEDTEXT;
78 pArray[aSupported.getLength()-1] = FRM_COMPONENT_FIXEDTEXT;
79 return aSupported;
80}
81
82
83void OFixedTextModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
84{
85 OControlModel::describeAggregateProperties( _rAggregateProps );
86 RemoveProperty( _rAggregateProps, PROPERTY_TABSTOP );
87}
88
89
90OUString SAL_CALL OFixedTextModel::getServiceName()
91{
92 return FRM_COMPONENT_FIXEDTEXT; // old (non-sun) name for compatibility !
93}
94
95
96void SAL_CALL OFixedTextModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
97{
98 OControlModel::write(_rxOutStream);
99
100 // Version
101 _rxOutStream->writeShort(0x0002);
102 writeHelpTextCompatibly(_rxOutStream);
103}
104
105
106void SAL_CALL OFixedTextModel::read(const Reference<XObjectInputStream>& _rxInStream)
107{
108 OControlModel::read(_rxInStream);
109
110 // Version
111 sal_Int16 nVersion = _rxInStream->readShort();
112 if (nVersion > 1)
113 readHelpTextCompatibly(_rxInStream);
114}
115
116}
117
118extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
119com_sun_star_form_OFixedTextModel_get_implementation(css::uno::XComponentContext* component,
120 css::uno::Sequence<css::uno::Any> const &)
121{
122 return cppu::acquire(new frm::OFixedTextModel(component));
123}
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_form_OFixedTextModel_get_implementation(css::uno::XComponentContext *component, css::uno::Sequence< css::uno::Any > const &)
Definition: FixedText.cxx:119
OFixedTextModel(const css::uno::Reference< css::uno::XComponentContext > &_rxFactory)
sal_Int16 nVersion
constexpr OUStringLiteral PROPERTY_TABSTOP
void RemoveProperty(Sequence< Property > &_rProps, const OUString &_rPropName)
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25
constexpr OUStringLiteral VCL_CONTROLMODEL_FIXEDTEXT
Definition: services.hxx:44
constexpr OUStringLiteral FRM_COMPONENT_FIXEDTEXT
Definition: services.hxx:71
constexpr OUStringLiteral FRM_SUN_COMPONENT_FIXEDTEXT
Definition: services.hxx:118