bump product version to 7.6.3.2-android
[LibreOffice.git] / reportdesign / source / core / api / FixedText.cxx
blobf8c7bef51c4e3bdb8c64f0fa49bf6181ea81d75c
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 .
19 #include <FixedText.hxx>
20 #include <strings.hxx>
21 #include <strings.hrc>
22 #include <core_resource.hxx>
23 #include <Tools.hxx>
24 #include <tools/color.hxx>
25 #include <cppuhelper/supportsservice.hxx>
26 #include <FormatCondition.hxx>
27 #include <ReportHelperImpl.hxx>
29 namespace reportdesign
32 using namespace com::sun::star;
34 static uno::Sequence< OUString > lcl_getFixedTextOptionals()
36 OUString pProps[] = { OUString(PROPERTY_DATAFIELD),OUString(PROPERTY_MASTERFIELDS),OUString(PROPERTY_DETAILFIELDS) };
37 return uno::Sequence< OUString >(pProps,SAL_N_ELEMENTS(pProps));
40 OFixedText::OFixedText(uno::Reference< uno::XComponentContext > const & _xContext)
41 :FixedTextBase(m_aMutex)
42 ,FixedTextPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getFixedTextOptionals())
43 ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
45 m_aProps.aComponent.m_sName = RptResId(RID_STR_FIXEDTEXT);
46 m_aProps.aComponent.m_nBorder = 0; // no border
49 OFixedText::OFixedText(uno::Reference< uno::XComponentContext > const & _xContext
50 ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
51 ,uno::Reference< drawing::XShape >& _xShape)
52 :FixedTextBase(m_aMutex)
53 ,FixedTextPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getFixedTextOptionals())
54 ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
56 m_aProps.aComponent.m_sName = RptResId(RID_STR_FIXEDTEXT);
57 m_aProps.aComponent.m_nBorder = 0; // no border
58 m_aProps.aComponent.m_xFactory = _xFactory;
59 osl_atomic_increment( &m_refCount );
61 m_aProps.aComponent.setShape(_xShape,this,m_refCount);
63 osl_atomic_decrement( &m_refCount );
66 OFixedText::~OFixedText()
70 IMPLEMENT_FORWARD_REFCOUNT( OFixedText, FixedTextBase )
72 uno::Any SAL_CALL OFixedText::queryInterface( const uno::Type& _rType )
74 uno::Any aReturn = FixedTextBase::queryInterface(_rType);
75 if ( !aReturn.hasValue() )
76 aReturn = FixedTextPropertySet::queryInterface(_rType);
77 if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
78 return aReturn;
80 return aReturn.hasValue() ? aReturn : (m_aProps.aComponent.m_xProxy.is() ? m_aProps.aComponent.m_xProxy->queryAggregation(_rType) : aReturn);
84 void SAL_CALL OFixedText::dispose()
86 FixedTextPropertySet::dispose();
87 cppu::WeakComponentImplHelperBase::dispose();
88 uno::Reference< report::XFixedText> xHoldAlive = this;
91 OUString OFixedText::getImplementationName_Static( )
93 return "com.sun.star.comp.report.OFixedText";
97 OUString SAL_CALL OFixedText::getImplementationName( )
99 return getImplementationName_Static();
102 uno::Sequence< OUString > OFixedText::getSupportedServiceNames_Static( )
104 uno::Sequence< OUString > aServices { SERVICE_FIXEDTEXT };
106 return aServices;
109 uno::Reference< uno::XInterface > OFixedText::create(uno::Reference< uno::XComponentContext > const & xContext)
111 return *(new OFixedText(xContext));
115 uno::Sequence< OUString > SAL_CALL OFixedText::getSupportedServiceNames( )
117 return getSupportedServiceNames_Static();
120 sal_Bool SAL_CALL OFixedText::supportsService(const OUString& ServiceName)
122 return cppu::supportsService(this, ServiceName);
125 // XReportComponent
126 REPORTCOMPONENT_IMPL(OFixedText,m_aProps.aComponent)
127 REPORTCOMPONENT_IMPL2(OFixedText,m_aProps.aComponent)
128 REPORTCOMPONENT_NOMASTERDETAIL(OFixedText)
129 REPORTCONTROLFORMAT_IMPL(OFixedText,m_aProps.aFormatProperties)
131 uno::Reference< beans::XPropertySetInfo > SAL_CALL OFixedText::getPropertySetInfo( )
133 return FixedTextPropertySet::getPropertySetInfo();
136 void SAL_CALL OFixedText::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
138 FixedTextPropertySet::setPropertyValue( aPropertyName, aValue );
141 uno::Any SAL_CALL OFixedText::getPropertyValue( const OUString& PropertyName )
143 return FixedTextPropertySet::getPropertyValue( PropertyName);
146 void SAL_CALL OFixedText::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
148 FixedTextPropertySet::addPropertyChangeListener( aPropertyName, xListener );
151 void SAL_CALL OFixedText::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
153 FixedTextPropertySet::removePropertyChangeListener( aPropertyName, aListener );
156 void SAL_CALL OFixedText::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
158 FixedTextPropertySet::addVetoableChangeListener( PropertyName, aListener );
161 void SAL_CALL OFixedText::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
163 FixedTextPropertySet::removeVetoableChangeListener( PropertyName, aListener );
166 // XReportControlModel
167 OUString SAL_CALL OFixedText::getDataField()
169 throw beans::UnknownPropertyException();
172 void SAL_CALL OFixedText::setDataField( const OUString& /*_datafield*/ )
174 throw beans::UnknownPropertyException();
178 sal_Bool SAL_CALL OFixedText::getPrintWhenGroupChange()
180 ::osl::MutexGuard aGuard(m_aMutex);
181 return m_aProps.bPrintWhenGroupChange;
184 void SAL_CALL OFixedText::setPrintWhenGroupChange( sal_Bool _printwhengroupchange )
186 set(PROPERTY_PRINTWHENGROUPCHANGE,_printwhengroupchange,m_aProps.bPrintWhenGroupChange);
189 OUString SAL_CALL OFixedText::getConditionalPrintExpression()
191 ::osl::MutexGuard aGuard(m_aMutex);
192 return m_aProps.aConditionalPrintExpression;
195 void SAL_CALL OFixedText::setConditionalPrintExpression( const OUString& _conditionalprintexpression )
197 set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_aProps.aConditionalPrintExpression);
201 // XCloneable
202 uno::Reference< util::XCloneable > SAL_CALL OFixedText::createClone( )
204 uno::Reference< report::XReportComponent> xSource = this;
205 uno::Reference< report::XFixedText> xSet(cloneObject(xSource,m_aProps.aComponent.m_xFactory,SERVICE_FIXEDTEXT),uno::UNO_QUERY_THROW);
206 return xSet;
210 // XFixedText
211 OUString SAL_CALL OFixedText::getLabel()
213 ::osl::MutexGuard aGuard(m_aMutex);
214 return m_sLabel;
217 void SAL_CALL OFixedText::setLabel( const OUString& _label )
219 set(PROPERTY_LABEL,_label,m_sLabel);
222 // XChild
223 uno::Reference< uno::XInterface > SAL_CALL OFixedText::getParent( )
225 return OShapeHelper::getParent(this);
228 void SAL_CALL OFixedText::setParent( const uno::Reference< uno::XInterface >& Parent )
230 OShapeHelper::setParent(Parent,this);
233 uno::Reference< report::XFormatCondition > SAL_CALL OFixedText::createFormatCondition( )
235 return new OFormatCondition(m_aProps.aComponent.m_xContext);
238 // XContainer
239 void SAL_CALL OFixedText::addContainerListener( const uno::Reference< container::XContainerListener >& xListener )
241 m_aProps.addContainerListener(xListener);
244 void SAL_CALL OFixedText::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener )
246 m_aProps.removeContainerListener(xListener);
249 // XElementAccess
250 uno::Type SAL_CALL OFixedText::getElementType( )
252 return cppu::UnoType<report::XFormatCondition>::get();
255 sal_Bool SAL_CALL OFixedText::hasElements( )
257 return m_aProps.hasElements();
260 // XIndexContainer
261 void SAL_CALL OFixedText::insertByIndex( ::sal_Int32 Index, const uno::Any& Element )
263 m_aProps.insertByIndex(Index,Element);
266 void SAL_CALL OFixedText::removeByIndex( ::sal_Int32 Index )
268 m_aProps.removeByIndex(Index);
271 // XIndexReplace
272 void SAL_CALL OFixedText::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element )
274 m_aProps.replaceByIndex(Index,Element);
277 // XIndexAccess
278 ::sal_Int32 SAL_CALL OFixedText::getCount( )
280 return m_aProps.getCount();
283 uno::Any SAL_CALL OFixedText::getByIndex( ::sal_Int32 Index )
285 return m_aProps.getByIndex( Index );
288 // XShape
289 awt::Point SAL_CALL OFixedText::getPosition( )
291 return OShapeHelper::getPosition(this);
294 void SAL_CALL OFixedText::setPosition( const awt::Point& aPosition )
296 OShapeHelper::setPosition(aPosition,this);
299 awt::Size SAL_CALL OFixedText::getSize( )
301 return OShapeHelper::getSize(this);
304 void SAL_CALL OFixedText::setSize( const awt::Size& aSize )
306 OShapeHelper::setSize(aSize,this);
310 // XShapeDescriptor
311 OUString SAL_CALL OFixedText::getShapeType( )
313 ::osl::MutexGuard aGuard(m_aMutex);
314 if ( m_aProps.aComponent.m_xShape.is() )
315 return m_aProps.aComponent.m_xShape->getShapeType();
316 return "com.sun.star.drawing.ControlShape";
320 } // namespace reportdesign
323 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */