31#include <com/sun/star/io/XMarkableStream.hpp>
47OFormattedFieldWrapper::OFormattedFieldWrapper(
const Reference<XComponentContext>& _rxFactory,
48 OUString
const & implementationName)
66 pRef->m_xAggregate = pModel;
67 OSL_ENSURE(pRef->m_xAggregate.is(),
"the OFormattedModel didn't have an XAggregation interface !");
70 pRef->m_xFormattedPart = pModel;
71 pRef->m_pEditPart.set(
new OEditModel(pRef->m_xContext));
74 if (pRef->m_xAggregate.is())
76 pRef->m_xAggregate->setDelegator(
static_cast<XWeak*
>(pRef.get()));
79 css::uno::Reference<css::uno::XInterface> xRef(*pRef);
91 Reference< XCloneable > xCloneAccess;
95 if ( xCloneAccess.is() )
97 Reference< XCloneable > xClone = xCloneAccess->createClone();
98 xRef->m_xAggregate.set(xClone, UNO_QUERY);
99 OSL_ENSURE(xRef->m_xAggregate.is(),
"invalid aggregate cloned !");
101 xRef->m_xFormattedPart.set(
102 Reference< XInterface >(xClone), css::uno::UNO_QUERY);
113 if ( xRef->m_xAggregate.is() )
115 xRef->m_xAggregate->setDelegator(
static_cast< XWeak*
>(xRef.get()));
125 m_xAggregate->setDelegator(css::uno::Reference<css::uno::XInterface> ());
141 if (!aReturn.hasValue())
151 if (!aReturn.hasValue())
153 aReturn = ::cppu::queryInterface( _rType,
154 static_cast< XPersistObject*
>(
this ),
155 static_cast< XCloneable*
>(
this )
158 if (!aReturn.hasValue())
191 DBG_ASSERT(
m_xAggregate.is(),
"OFormattedFieldWrapper::getSupportedServiceNames: should never have made it 'til here without an aggregate!");
192 Reference< XServiceInfo > xSI;
194 return xSI->getSupportedServiceNames();
205 Reference<XPersistObject> xAggregatePersistence;
207 DBG_ASSERT(xAggregatePersistence.is(),
"OFormattedFieldWrapper::write : don't know how to handle this : can't write !");
209 if (xAggregatePersistence.is())
210 xAggregatePersistence->write(_rxOutStream);
215 OSL_ENSURE(
m_pEditPart.is(),
"OFormattedFieldWrapper::write : formatted part without edit part ?");
217 throw RuntimeException( OUString(), *
this );
250 Reference<XMarkableStream> xInMarkable(_rxInStream, UNO_QUERY);
251 DBG_ASSERT(xInMarkable.is(),
"OFormattedFieldWrapper::read : can only work with markable streams !");
252 sal_Int32 nBeforeEditPart = xInMarkable->createMark();
259 xInMarkable->jumpToMark(nBeforeEditPart);
261 xInMarkable->deleteMark(nBeforeEditPart);
264 Reference<XPersistObject> xAggregatePersistence;
266 DBG_ASSERT(xAggregatePersistence.is(),
"OFormattedFieldWrapper::read : don't know how to handle this : can't read !");
269 if (xAggregatePersistence.is())
270 xAggregatePersistence->read(_rxInStream);
280 pBasicReader->read(_rxInStream);
283 if (!pBasicReader->lastReadWasFormattedFake())
316 if (!xEditModel.is())
320 xEditModel.set(
static_cast<XWeak*
>(pModel.get()), css::uno::UNO_QUERY);
324 DBG_ASSERT(
m_xAggregate.is(),
"OFormattedFieldWrapper::ensureAggregate : the OEditModel didn't have an XAggregation interface !");
330 OSL_FAIL(
"OFormattedFieldWrapper::ensureAggregate: the aggregate has no XServiceInfo!");
344extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
346 css::uno::Sequence<css::uno::Any>
const &)
348 css::uno::Reference<css::uno::XInterface> inst(
350 component,
false,
"com.sun.star.form.OFormattedFieldWrapper"));
355extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
357 css::uno::Sequence<css::uno::Any>
const &)
359 css::uno::Reference<css::uno::XInterface> inst(
361 component,
true,
"com.sun.star.comp.forms.OFormattedFieldWrapper_ForcedFormatted"));
Reference< XComponentContext > m_xContext
const LanguageTag & GetUILanguageTag() const
static const AllSettings & GetSettings()
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
oslInterlockedCount m_refCount
virtual css::uno::Any SAL_CALL queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
#define DBG_ASSERT(sCon, aError)
bool query_aggregation(const css::uno::Reference< css::uno::XAggregation > &_rxAggregate, css::uno::Reference< iface > &_rxOut)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
ListBox is a bit confusing / different from other form components, so here are a few notes:
constexpr OUStringLiteral implementationName
constexpr OUStringLiteral FRM_SUN_COMPONENT_TEXTFIELD
constexpr OUStringLiteral FRM_COMPONENT_EDIT