Line data Source code
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 "services.hxx"
22 : #include "property.hrc"
23 : #include "property.hxx"
24 : #include <comphelper/processfactory.hxx>
25 :
26 : namespace frm
27 : {
28 : using namespace ::com::sun::star::uno;
29 : using namespace ::com::sun::star::sdb;
30 : using namespace ::com::sun::star::sdbc;
31 : using namespace ::com::sun::star::sdbcx;
32 : using namespace ::com::sun::star::beans;
33 : using namespace ::com::sun::star::container;
34 : using namespace ::com::sun::star::form;
35 : using namespace ::com::sun::star::awt;
36 : using namespace ::com::sun::star::io;
37 : using namespace ::com::sun::star::lang;
38 : using namespace ::com::sun::star::util;
39 :
40 :
41 130 : InterfaceRef SAL_CALL OFixedTextModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory)
42 : {
43 130 : return *(new OFixedTextModel( comphelper::getComponentContext(_rxFactory) ));
44 : }
45 :
46 :
47 :
48 130 : OFixedTextModel::OFixedTextModel( const Reference<XComponentContext>& _rxFactory )
49 130 : :OControlModel(_rxFactory, VCL_CONTROLMODEL_FIXEDTEXT)
50 :
51 : {
52 130 : m_nClassId = FormComponentType::FIXEDTEXT;
53 130 : }
54 :
55 :
56 2 : OFixedTextModel::OFixedTextModel( const OFixedTextModel* _pOriginal, const Reference<XComponentContext>& _rxFactory )
57 2 : :OControlModel( _pOriginal, _rxFactory )
58 :
59 : {
60 2 : }
61 :
62 :
63 264 : OFixedTextModel::~OFixedTextModel( )
64 : {
65 264 : }
66 :
67 :
68 2 : IMPLEMENT_DEFAULT_CLONING( OFixedTextModel )
69 :
70 :
71 8 : StringSequence SAL_CALL OFixedTextModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception)
72 : {
73 8 : StringSequence aSupported = OControlModel::getSupportedServiceNames();
74 8 : aSupported.realloc(aSupported.getLength() + 1);
75 :
76 8 : OUString* pArray = aSupported.getArray();
77 8 : pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_FIXEDTEXT;
78 8 : return aSupported;
79 : }
80 :
81 :
82 132 : void OFixedTextModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
83 : {
84 132 : OControlModel::describeAggregateProperties( _rAggregateProps );
85 132 : RemoveProperty( _rAggregateProps, PROPERTY_TABSTOP );
86 132 : }
87 :
88 :
89 2 : OUString SAL_CALL OFixedTextModel::getServiceName() throw(RuntimeException, std::exception)
90 : {
91 2 : return OUString(FRM_COMPONENT_FIXEDTEXT); // old (non-sun) name for compatibility !
92 : }
93 :
94 :
95 2 : void SAL_CALL OFixedTextModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
96 : throw(IOException, RuntimeException, std::exception)
97 : {
98 2 : OControlModel::write(_rxOutStream);
99 :
100 : // Version
101 2 : _rxOutStream->writeShort(0x0002);
102 2 : writeHelpTextCompatibly(_rxOutStream);
103 2 : }
104 :
105 :
106 2 : void SAL_CALL OFixedTextModel::read(const Reference<XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException, std::exception)
107 : {
108 2 : OControlModel::read(_rxInStream);
109 :
110 : // Version
111 2 : sal_Int16 nVersion = _rxInStream->readShort();
112 2 : if (nVersion > 1)
113 2 : readHelpTextCompatibly(_rxInStream);
114 2 : }
115 :
116 :
117 : }
118 :
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|