19#include <FormattedField.hxx>
20#include <com/sun/star/sdbc/XDataSource.hpp>
23#include <core_resource.hxx>
58OFormattedField::OFormattedField(uno::Reference< uno::XComponentContext >
const & _xContext
59 ,
const uno::Reference< lang::XMultiServiceFactory>& _xFactory
60 ,uno::Reference< drawing::XShape >& _xShape)
67 m_aProps.aComponent.m_xFactory = _xFactory;
68 osl_atomic_increment( &m_refCount );
70 m_aProps.aComponent.setShape(_xShape,
this,m_refCount);
72 osl_atomic_decrement( &m_refCount );
75OFormattedField::~OFormattedField()
83 uno::Any aReturn = FormattedFieldBase::queryInterface(_rType);
85 aReturn = FormattedFieldPropertySet::queryInterface(_rType);
86 if ( !aReturn.
hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
89 return aReturn.
hasValue() ? aReturn : (
m_aProps.aComponent.m_xProxy.is() ?
m_aProps.aComponent.m_xProxy->queryAggregation(_rType) : aReturn);
93void SAL_CALL OFormattedField::dispose()
95 FormattedFieldPropertySet::dispose();
96 cppu::WeakComponentImplHelperBase::dispose();
97 m_xFormatsSupplier.clear();
100OUString OFormattedField::getImplementationName_Static( )
102 return "com.sun.star.comp.report.OFormattedField";
106OUString SAL_CALL OFormattedField::getImplementationName( )
108 return getImplementationName_Static();
111uno::Sequence< OUString > OFormattedField::getSupportedServiceNames_Static( )
116uno::Sequence< OUString > SAL_CALL OFormattedField::getSupportedServiceNames( )
118 return getSupportedServiceNames_Static();
121sal_Bool SAL_CALL OFormattedField::supportsService(
const OUString& ServiceName)
135 return FormattedFieldPropertySet::getPropertySetInfo();
138void SAL_CALL OFormattedField::setPropertyValue(
const OUString& aPropertyName,
const uno::Any& aValue )
144 FormattedFieldPropertySet::setPropertyValue( aPropertyName, aValue );
147uno::Any SAL_CALL OFormattedField::getPropertyValue(
const OUString& PropertyName )
149 return FormattedFieldPropertySet::getPropertyValue( PropertyName);
152void SAL_CALL OFormattedField::addPropertyChangeListener(
const OUString& aPropertyName,
const uno::Reference< beans::XPropertyChangeListener >& xListener )
154 FormattedFieldPropertySet::addPropertyChangeListener( aPropertyName, xListener );
157void SAL_CALL OFormattedField::removePropertyChangeListener(
const OUString& aPropertyName,
const uno::Reference< beans::XPropertyChangeListener >& aListener )
159 FormattedFieldPropertySet::removePropertyChangeListener( aPropertyName, aListener );
162void SAL_CALL OFormattedField::addVetoableChangeListener(
const OUString& PropertyName,
const uno::Reference< beans::XVetoableChangeListener >& aListener )
164 FormattedFieldPropertySet::addVetoableChangeListener( PropertyName, aListener );
167void SAL_CALL OFormattedField::removeVetoableChangeListener(
const OUString& PropertyName,
const uno::Reference< beans::XVetoableChangeListener >& aListener )
169 FormattedFieldPropertySet::removeVetoableChangeListener( PropertyName, aListener );
173OUString SAL_CALL OFormattedField::getDataField()
175 ::osl::MutexGuard aGuard(m_aMutex);
179void SAL_CALL OFormattedField::setDataField(
const OUString& _datafield )
184sal_Bool SAL_CALL OFormattedField::getPrintWhenGroupChange()
186 ::osl::MutexGuard aGuard(m_aMutex);
187 return m_aProps.bPrintWhenGroupChange;
190void SAL_CALL OFormattedField::setPrintWhenGroupChange(
sal_Bool _printwhengroupchange )
195OUString SAL_CALL OFormattedField::getConditionalPrintExpression()
197 ::osl::MutexGuard aGuard(m_aMutex);
198 return m_aProps.aConditionalPrintExpression;
201void SAL_CALL OFormattedField::setConditionalPrintExpression(
const OUString& _conditionalprintexpression )
208uno::Reference< util::XCloneable > SAL_CALL OFormattedField::createClone( )
210 uno::Reference< report::XReportComponent> xSource =
this;
214 for (
const auto& rxFormatCondition :
m_aProps.m_aFormatConditions)
216 uno::Reference< report::XFormatCondition > xCond = xSet->createFormatCondition();
217 ::comphelper::copyProperties(rxFormatCondition, xCond);
226::sal_Int32 SAL_CALL OFormattedField::getFormatKey()
232void SAL_CALL OFormattedField::setFormatKey(::sal_Int32 _formatkey)
237uno::Reference< util::XNumberFormatsSupplier > SAL_CALL OFormattedField::getFormatsSupplier()
240 if ( !m_xFormatsSupplier.is() )
242 uno::Reference< report::XSection> xSection = getSection();
244 m_xFormatsSupplier.set(xSection->getReportDefinition(),uno::UNO_QUERY);
245 if ( !m_xFormatsSupplier.is() )
247 uno::Reference< beans::XPropertySet> xProp(::dbtools::findDataSource(getParent()),uno::UNO_QUERY);
249 m_xFormatsSupplier.set(xProp->getPropertyValue(
"NumberFormatsSupplier"),uno::UNO_QUERY);
252 return m_xFormatsSupplier;
255void SAL_CALL OFormattedField::setFormatsSupplier(
const uno::Reference< util::XNumberFormatsSupplier >& _formatssupplier )
261uno::Reference< uno::XInterface > SAL_CALL OFormattedField::getParent( )
263 return OShapeHelper::getParent(
this);
266void SAL_CALL OFormattedField::setParent(
const uno::Reference< uno::XInterface >& Parent )
268 OShapeHelper::setParent(
Parent,
this);
271uno::Reference< report::XFormatCondition > SAL_CALL OFormattedField::createFormatCondition( )
277void SAL_CALL OFormattedField::addContainerListener(
const uno::Reference< container::XContainerListener >& xListener )
279 m_aProps.addContainerListener(xListener);
282void SAL_CALL OFormattedField::removeContainerListener(
const uno::Reference< container::XContainerListener >& xListener )
284 m_aProps.removeContainerListener(xListener);
299void SAL_CALL OFormattedField::insertByIndex( ::sal_Int32
Index,
const uno::Any& Element )
304void SAL_CALL OFormattedField::removeByIndex( ::sal_Int32
Index )
310void SAL_CALL OFormattedField::replaceByIndex( ::sal_Int32
Index,
const uno::Any& Element )
316::sal_Int32 SAL_CALL OFormattedField::getCount( )
327awt::Point SAL_CALL OFormattedField::getPosition( )
329 return OShapeHelper::getPosition(
this);
332void SAL_CALL OFormattedField::setPosition(
const awt::Point& aPosition )
334 OShapeHelper::setPosition(aPosition,
this);
337awt::Size SAL_CALL OFormattedField::getSize( )
339 return OShapeHelper::getSize(
this);
342void SAL_CALL OFormattedField::setSize(
const awt::Size& aSize )
344 OShapeHelper::setSize(aSize,
this);
349OUString SAL_CALL OFormattedField::getShapeType( )
352 if (
m_aProps.aComponent.m_xShape.is() )
353 return m_aProps.aComponent.m_xShape->getShapeType();
354 return "com.sun.star.drawing.ControlShape";
#define REPORTCONTROLFORMAT_IMPL(clazz, varName)
#define REPORTCOMPONENT_IMPL2(clazz, arg)
#define REPORTCOMPONENT_NOMASTERDETAIL(clazz)
#define REPORTCOMPONENT_IMPL(clazz, arg)
css::uno::Type const & get()
OUString RptResId(TranslateId aId)
#define SAL_N_ELEMENTS(arr)
void set(css::uno::UnoInterfaceReference const &value)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
static uno::Sequence< OUString > lcl_getFormattedFieldOptionals()
uno::Reference< util::XCloneable > cloneObject(const uno::Reference< report::XReportComponent > &_xReportComponent, const uno::Reference< lang::XMultiServiceFactory > &_xFactory, const OUString &_sServiceName)
::cppu::WeakComponentImplHelper< css::report::XFormattedField,css::lang::XServiceInfo > FormattedFieldBase
::cppu::PropertySetMixin< css::report::XFormattedField > FormattedFieldPropertySet
uno::Sequence< beans::Property > m_aProps
constexpr OUStringLiteral PROPERTY_DATAFIELD
constexpr OUStringLiteral PROPERTY_DETAILFIELDS
constexpr OUStringLiteral SERVICE_FORMATTEDFIELD
constexpr OUStringLiteral PROPERTY_MASTERFIELDS
constexpr OUStringLiteral PROPERTY_FORMATKEY
constexpr OUStringLiteral PROPERTY_PRINTWHENGROUPCHANGE
constexpr OUStringLiteral PROPERTY_CONDITIONALPRINTEXPRESSION
constexpr OUStringLiteral PROPERTY_FORMATSSUPPLIER
#define IMPLEMENT_FORWARD_REFCOUNT(classname, refcountbase)
Reference< XComponentContext > _xContext