LibreOffice Module forms (master) 1
FormattedField.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#include "FormattedField.hxx"
20#include <services.hxx>
21#include <property.hxx>
22#include <propertybaghelper.hxx>
26#include <comphelper/types.hxx>
29#include <o3tl/any.hxx>
30#include <svl/numformat.hxx>
31#include <svl/numuno.hxx>
32#include <vcl/keycodes.hxx>
33#include <vcl/svapp.hxx>
34#include <vcl/settings.hxx>
35#include <tools/debug.hxx>
37#include <com/sun/star/beans/PropertyAttribute.hpp>
38#include <com/sun/star/sdbc/DataType.hpp>
39#include <com/sun/star/util/NumberFormat.hpp>
40#include <com/sun/star/util/Date.hpp>
41#include <com/sun/star/util/Time.hpp>
42#include <com/sun/star/awt/MouseEvent.hpp>
43#include <com/sun/star/form/XSubmit.hpp>
44#include <com/sun/star/awt/XWindow.hpp>
45#include <com/sun/star/form/FormComponentType.hpp>
46#include <com/sun/star/util/XNumberFormatTypes.hpp>
47#include <com/sun/star/form/XForm.hpp>
48#include <com/sun/star/container/XIndexAccess.hpp>
49#include <osl/mutex.hxx>
50// needed as long as we use the SolarMutex
54#include <vector>
55#include <algorithm>
56
57
58using namespace dbtools;
59using namespace css::uno;
60using namespace css::sdb;
61using namespace css::sdbc;
62using namespace css::sdbcx;
63using namespace css::beans;
64using namespace css::container;
65using namespace css::form;
66using namespace css::awt;
67using namespace css::io;
68using namespace css::lang;
69using namespace css::util;
70using namespace css::form::binding;
71
72namespace frm
73{
74namespace {
75
76class StandardFormatsSupplier : public SvNumberFormatsSupplierObj, public ::utl::ITerminationListener
77{
78protected:
79 std::unique_ptr<SvNumberFormatter> m_pMyPrivateFormatter;
80 static WeakReference< XNumberFormatsSupplier > s_xDefaultFormatsSupplier;
81public:
82 static Reference< XNumberFormatsSupplier > get( const Reference< XComponentContext >& _rxORB );
83protected:
84 StandardFormatsSupplier(const Reference< XComponentContext >& _rxFactory,LanguageType _eSysLanguage);
85 virtual ~StandardFormatsSupplier() override;
86protected:
87 virtual bool queryTermination() const override;
88 virtual void notifyTermination() override;
89};
90
91}
92
93WeakReference< XNumberFormatsSupplier > StandardFormatsSupplier::s_xDefaultFormatsSupplier;
94StandardFormatsSupplier::StandardFormatsSupplier(const Reference< XComponentContext > & _rxContext,LanguageType _eSysLanguage)
95 :m_pMyPrivateFormatter(new SvNumberFormatter(_rxContext, _eSysLanguage))
96{
97 SetNumberFormatter(m_pMyPrivateFormatter.get());
98 // #i29147#
99 ::utl::DesktopTerminationObserver::registerTerminationListener( this );
100}
101StandardFormatsSupplier::~StandardFormatsSupplier()
102{
103 ::utl::DesktopTerminationObserver::revokeTerminationListener( this );
104}
105Reference< XNumberFormatsSupplier > StandardFormatsSupplier::get( const Reference< XComponentContext >& _rxORB )
106{
107 LanguageType eSysLanguage = LANGUAGE_SYSTEM;
108 {
109 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
110 Reference< XNumberFormatsSupplier > xSupplier = s_xDefaultFormatsSupplier;
111 if ( xSupplier.is() )
112 return xSupplier;
113 // get the Office's locale
114 eSysLanguage = SvtSysLocale().GetLanguageTag().getLanguageType( false);
115 }
116 rtl::Reference<StandardFormatsSupplier> pSupplier = new StandardFormatsSupplier( _rxORB, eSysLanguage );
117 {
118 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
119 Reference< XNumberFormatsSupplier > xSupplier = s_xDefaultFormatsSupplier;
120 if ( xSupplier.is() )
121 // somebody used the small time frame where the mutex was not locked to create and set
122 // the supplier
123 return xSupplier;
124 s_xDefaultFormatsSupplier = css::uno::Reference<css::uno::XWeak>(pSupplier);
125 }
126 return pSupplier;
127}
128bool StandardFormatsSupplier::queryTermination() const
129{
130 return true;
131}
132void StandardFormatsSupplier::notifyTermination()
133{
134 Reference< XNumberFormatsSupplier > xKeepAlive = this;
135 // when the application is terminating, release our static reference so that we are cleared/destructed
136 // earlier than upon unloading the library
137 // #i29147#
138 s_xDefaultFormatsSupplier = WeakReference< XNumberFormatsSupplier >( );
139 SetNumberFormatter( nullptr );
140 m_pMyPrivateFormatter.reset();
141}
142Sequence<Type> OFormattedControl::_getTypes()
143{
144 return ::comphelper::concatSequences(
145 OFormattedControl_BASE::getTypes(),
146 OBoundControl::_getTypes()
147 );
148}
149Any SAL_CALL OFormattedControl::queryAggregation(const Type& _rType)
150{
151 Any aReturn = OBoundControl::queryAggregation(_rType);
152 if (!aReturn.hasValue())
153 aReturn = OFormattedControl_BASE::queryInterface(_rType);
154 return aReturn;
155}
156OFormattedControl::OFormattedControl(const Reference<XComponentContext>& _rxFactory)
158 ,m_nKeyEvent(nullptr)
159{
160 osl_atomic_increment(&m_refCount);
161 {
162 Reference<XWindow> xComp;
164 {
165 xComp->addKeyListener(this);
166 }
167 }
168 osl_atomic_decrement(&m_refCount);
169}
171{
172 if( m_nKeyEvent )
174 if (!OComponentHelper::rBHelper.bDisposed)
175 {
176 acquire();
177 dispose();
178 }
179}
180
181// XKeyListener
182void OFormattedControl::disposing(const EventObject& _rSource)
183{
184 OBoundControl::disposing(_rSource);
185}
186void OFormattedControl::keyPressed(const css::awt::KeyEvent& e)
187{
188 if( e.KeyCode != KEY_RETURN || e.Modifiers != 0 )
189 return;
190 // Is the control located in a form with a Submit URL?
191 Reference<css::beans::XPropertySet> xSet(getModel(), UNO_QUERY);
192 if( !xSet.is() )
193 return;
194 Reference<XFormComponent> xFComp(xSet, UNO_QUERY);
195 css::uno::Reference<css::uno::XInterface> xParent = xFComp->getParent();
196 if( !xParent.is() )
197 return;
198 Reference<css::beans::XPropertySet> xFormSet(xParent, UNO_QUERY);
199 if( !xFormSet.is() )
200 return;
201 Any aTmp(xFormSet->getPropertyValue( PROPERTY_TARGET_URL ));
202 if (!aTmp.has<OUString>() ||
203 getString(aTmp).isEmpty() )
204 return;
205 Reference<XIndexAccess> xElements(xParent, UNO_QUERY);
206 sal_Int32 nCount = xElements->getCount();
207 if( nCount > 1 )
208 {
209 Reference<css::beans::XPropertySet> xFCSet;
210 for( sal_Int32 nIndex=0; nIndex < nCount; nIndex++ )
211 {
212 // Any aElement(xElements->getByIndex(nIndex));
213 xElements->getByIndex(nIndex) >>= xFCSet;
214 if (hasProperty(PROPERTY_CLASSID, xFCSet) &&
215 getINT16(xFCSet->getPropertyValue(PROPERTY_CLASSID)) == FormComponentType::TEXTFIELD)
216 {
217 // Found another Edit -> Do not submit then
218 if (xFCSet != xSet)
219 return;
220 }
221 }
222 }
223 // Because we're still in the Handler, execute submit asynchronously
224 if( m_nKeyEvent )
227 OnKeyPressed) );
228}
229
230void OFormattedControl::keyReleased(const css::awt::KeyEvent& /*e*/)
231{
232}
233
234IMPL_LINK_NOARG(OFormattedControl, OnKeyPressed, void*, void)
235{
236 m_nKeyEvent = nullptr;
237 Reference<XFormComponent> xFComp(getModel(), UNO_QUERY);
238 css::uno::Reference<css::uno::XInterface> xParent = xFComp->getParent();
239 Reference<XSubmit> xSubmit(xParent, UNO_QUERY);
240 if (xSubmit.is())
241 xSubmit->submit( Reference<XControl> (), css::awt::MouseEvent() );
242}
243
245{
246 css::uno::Sequence<OUString> aSupported = OBoundControl::getSupportedServiceNames();
247 aSupported.realloc(aSupported.getLength() + 2);
248 OUString*pArray = aSupported.getArray();
249 pArray[aSupported.getLength()-2] = FRM_SUN_CONTROL_FORMATTEDFIELD;
250 pArray[aSupported.getLength()-1] = STARDIV_ONE_FORM_CONTROL_FORMATTEDFIELD;
251 return aSupported;
252}
253
255{
256 // members
257 m_bOriginalNumeric = false;
258 m_bNumeric = false;
259 m_xOriginalFormatter = nullptr;
260 m_nKeyType = NumberFormat::UNDEFINED;
261 m_aNullDate = DBTypeConversion::getStandardDate();
262 // default our formats supplier
263 osl_atomic_increment(&m_refCount);
265 osl_atomic_decrement(&m_refCount);
268}
269OFormattedModel::OFormattedModel(const Reference<XComponentContext>& _rxFactory)
271 // use the old control name for compytibility reasons
272 ,OErrorBroadcaster( OComponentHelper::rBHelper )
273{
275 m_nClassId = FormComponentType::TEXTFIELD;
277}
278OFormattedModel::OFormattedModel( const OFormattedModel* _pOriginal, const Reference< XComponentContext >& _rxFactory )
279 :OEditBaseModel( _pOriginal, _rxFactory )
280 ,OErrorBroadcaster( OComponentHelper::rBHelper )
281{
283}
284
286{
287}
288
289// XCloneable
290css::uno::Reference< css::util::XCloneable > SAL_CALL OFormattedModel::createClone()
291{
293 pClone->clonedFrom(this);
294 return pClone;
295}
296
298{
301}
302
303// XServiceInfo
304css::uno::Sequence<OUString> OFormattedModel::getSupportedServiceNames()
305{
306 css::uno::Sequence<OUString> aSupported = OEditBaseModel::getSupportedServiceNames();
307 sal_Int32 nOldLen = aSupported.getLength();
308 aSupported.realloc( nOldLen + 9 );
309 OUString* pStoreTo = aSupported.getArray() + nOldLen;
310 *pStoreTo++ = BINDABLE_CONTROL_MODEL;
311 *pStoreTo++ = DATA_AWARE_CONTROL_MODEL;
312 *pStoreTo++ = VALIDATABLE_CONTROL_MODEL;
318 *pStoreTo++ = FRM_COMPONENT_FORMATTEDFIELD;
319 return aSupported;
320}
321
322// XAggregation
324{
325 Any aReturn = OEditBaseModel::queryAggregation( _rType );
326 return aReturn.hasValue() ? aReturn : OErrorBroadcaster::queryInterface( _rType );
327}
328
329// XTypeProvider
331{
332 return ::comphelper::concatSequences(
335 );
336}
337
338// XPersistObject
340{
341 return FRM_COMPONENT_EDIT;
342}
343
344// XPropertySet
345void OFormattedModel::describeFixedProperties( Sequence< Property >& _rProps ) const
346{
348 sal_Int32 nOldCount = _rProps.getLength();
349 _rProps.realloc( nOldCount + 3);
350 css::beans::Property* pProperties = _rProps.getArray() + nOldCount;
351 *pProperties++ = css::beans::Property(PROPERTY_EMPTY_IS_NULL, PROPERTY_ID_EMPTY_IS_NULL, cppu::UnoType<bool>::get(),
352 css::beans::PropertyAttribute::BOUND);
353 *pProperties++ = css::beans::Property(PROPERTY_TABINDEX, PROPERTY_ID_TABINDEX, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::BOUND);
354 *pProperties++ = css::beans::Property(PROPERTY_FILTERPROPOSAL, PROPERTY_ID_FILTERPROPOSAL, cppu::UnoType<bool>::get(),
355 css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT);
356 DBG_ASSERT( pProperties == _rProps.getArray() + _rProps.getLength(), "<...>::describeFixedProperties/getInfoHelper: forgot to adjust the count ?");
357}
358
359void OFormattedModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
360{
362 // TreatAsNumeric is not transient: we want to attach it to the UI
363 // This is necessary to make EffectiveDefault (which may be text or a number) meaningful
364 ModifyPropertyAttributes(_rAggregateProps, PROPERTY_TREATASNUMERIC, 0, PropertyAttribute::TRANSIENT);
365 // Same for FormatKey
366 // (though the paragraph above for the TreatAsNumeric does not hold anymore - we do not have an UI for this.
367 // But we have for the format key ...)
368 ModifyPropertyAttributes(_rAggregateProps, PROPERTY_FORMATKEY, 0, PropertyAttribute::TRANSIENT);
369 RemoveProperty(_rAggregateProps, PROPERTY_STRICTFORMAT);
370 // no strict format property for formatted fields: it does not make sense, 'cause
371 // there is no general way to decide which characters/sub strings are allowed during the input of an
372 // arbitrary formatted control
373}
374
376{
378 {
379 Reference<XNumberFormatsSupplier> xSupplier = calcDefaultFormatsSupplier();
380 DBG_ASSERT(m_xAggregateSet.is(), "OFormattedModel::setPropertyToDefaultByHandle(FORMATSSUPPLIER) : have no aggregate !");
381 if (m_xAggregateSet.is())
382 m_xAggregateSet->setPropertyValue(PROPERTY_FORMATSSUPPLIER, Any(xSupplier));
383 }
384 else
386}
387
388void OFormattedModel::setPropertyToDefault(const OUString& aPropertyName)
389{
391 sal_Int32 nHandle = rPH.getHandleByName( aPropertyName );
394 else
395 OEditBaseModel::setPropertyToDefault(aPropertyName);
396}
397
399{
401 {
402 Reference<XNumberFormatsSupplier> xSupplier = calcDefaultFormatsSupplier();
403 return Any(xSupplier);
404 }
405 else
407}
408
409Any SAL_CALL OFormattedModel::getPropertyDefault( const OUString& aPropertyName )
410{
412 sal_Int32 nHandle = rPH.getHandleByName( aPropertyName );
415 else
416 return OEditBaseModel::getPropertyDefault(aPropertyName);
417}
418
419void OFormattedModel::_propertyChanged( const css::beans::PropertyChangeEvent& evt )
420{
421 // TODO: check how this works with external bindings
422 OSL_ENSURE( evt.Source == m_xAggregateSet, "OFormattedModel::_propertyChanged: where did this come from?" );
423 if ( evt.Source != m_xAggregateSet )
424 return;
425
426 if ( evt.PropertyName == PROPERTY_FORMATKEY )
427 {
428 if ( evt.NewValue.getValueType().getTypeClass() == TypeClass_LONG )
429 {
430 try
431 {
432 ::osl::MutexGuard aGuard( m_aMutex );
433 Reference<XNumberFormatsSupplier> xSupplier( calcFormatsSupplier() );
434 m_nKeyType = getNumberFormatType(xSupplier->getNumberFormats(), getINT32( evt.NewValue ) );
435 // as m_aSaveValue (which is used by commitControlValueToDbColumn) is format dependent we have
436 // to recalc it, which is done by translateDbColumnToControlValue
437 if ( m_xColumn.is() && m_xAggregateFastSet.is() && !m_xCursor->isBeforeFirst() && !m_xCursor->isAfterLast())
438 {
440 }
441 // if we're connected to an external value binding, then re-calculate the type
442 // used to exchange the value - it depends on the format, too
444 {
446 }
447 }
448 catch(const Exception&)
449 {
450 }
451 }
452 return;
453 }
454 if ( evt.PropertyName == PROPERTY_FORMATSSUPPLIER )
455 {
457 return;
458 }
460}
461
463{
464 // calc the current NULL date
465 Reference< XNumberFormatsSupplier > xSupplier( calcFormatsSupplier() );
466 if ( xSupplier.is() )
467 xSupplier->getNumberFormatSettings()->getPropertyValue("NullDate") >>= m_aNullDate;
468}
469
470Reference< XNumberFormatsSupplier > OFormattedModel::calcFormatsSupplier() const
471{
472 Reference<XNumberFormatsSupplier> xSupplier;
473 DBG_ASSERT(m_xAggregateSet.is(), "OFormattedModel::calcFormatsSupplier : have no aggregate !");
474 // Does my aggregate model have a FormatSupplier?
475 if( m_xAggregateSet.is() )
476 m_xAggregateSet->getPropertyValue(PROPERTY_FORMATSSUPPLIER) >>= xSupplier;
477 if (!xSupplier.is())
478 // check if my parent form has a supplier
479 xSupplier = calcFormFormatsSupplier();
480 if (!xSupplier.is())
481 xSupplier = calcDefaultFormatsSupplier();
482 DBG_ASSERT(xSupplier.is(), "OFormattedModel::calcFormatsSupplier : no supplier !");
483 // We should have one by now
484 return xSupplier;
485}
486
487Reference<XNumberFormatsSupplier> OFormattedModel::calcFormFormatsSupplier() const
488{
489 Reference<XChild> xMe(const_cast<OFormattedModel*>(this));
490 // By this we make sure that we get the right object even when aggregating
491 DBG_ASSERT(xMe.is(), "OFormattedModel::calcFormFormatsSupplier : I should have a content interface !");
492 // Iterate through until we reach a StartForm (starting with an own Parent)
493 Reference<XChild> xParent(xMe->getParent(), UNO_QUERY);
494 Reference<XForm> xNextParentForm(xParent, UNO_QUERY);
495 while (!xNextParentForm.is() && xParent.is())
496 {
497 xParent.set(xParent->getParent(), css::uno::UNO_QUERY);
498 xNextParentForm.set(xParent, css::uno::UNO_QUERY);
499 }
500 if (!xNextParentForm.is())
501 {
502 OSL_FAIL("OFormattedModel::calcFormFormatsSupplier : have no ancestor which is a form !");
503 return nullptr;
504 }
505 // The FormatSupplier of my ancestor (if it has one)
506 Reference< XRowSet > xRowSet( xNextParentForm, UNO_QUERY );
507 Reference< XNumberFormatsSupplier > xSupplier;
508 if (xRowSet.is())
509 xSupplier = getNumberFormats( getConnection(xRowSet), true, getContext() );
510 return xSupplier;
511}
512
513Reference< XNumberFormatsSupplier > OFormattedModel::calcDefaultFormatsSupplier() const
514{
515 return StandardFormatsSupplier::get( getContext() );
516}
517
518// XBoundComponent
519void OFormattedModel::loaded(const EventObject& rEvent)
520{
521 // HACK: our onConnectedDbColumn accesses our NumberFormatter which locks the solar mutex (as it doesn't have
522 // an own one). To prevent deadlocks with other threads which may request a property from us in an
523 // UI-triggered action (e.g. a tooltip) we lock the solar mutex _here_ before our base class locks
524 // its own mutex (which is used for property requests)
525 // alternative a): we use two mutexes, one which is passed to the OPropertysetHelper and used for
526 // property requests and one for our own code. This would need a lot of code rewriting
527 // alternative b): The NumberFormatter has to be really threadsafe (with an own mutex), which is
528 // the only "clean" solution for me.
529 SolarMutexGuard aGuard;
531}
532
533void OFormattedModel::onConnectedDbColumn( const Reference< XInterface >& _rxForm )
534{
535 m_xOriginalFormatter = nullptr;
536 // get some properties of the field
537 Reference<XPropertySet> xField = getField();
538 sal_Int32 nFormatKey = 0;
539 DBG_ASSERT(m_xAggregateSet.is(), "OFormattedModel::onConnectedDbColumn : have no aggregate !");
540 if (m_xAggregateSet.is())
541 { // all the following doesn't make any sense if we have no aggregate ...
542 Any aSupplier = m_xAggregateSet->getPropertyValue(PROPERTY_FORMATSSUPPLIER);
543 DBG_ASSERT( aSupplier.hasValue(), "OFormattedModel::onConnectedDbColumn : invalid property value !" );
544 // This should've been set to the correct value in the ctor or in the read
545 Any aFmtKey = m_xAggregateSet->getPropertyValue(PROPERTY_FORMATKEY);
546 if ( !(aFmtKey >>= nFormatKey ) )
547 { // nobody gave us a format to use. So we examine the field we're bound to for a
548 // format key, and use it ourself, too
549 sal_Int32 nType = DataType::VARCHAR;
550 if (xField.is())
551 {
552 aFmtKey = xField->getPropertyValue(PROPERTY_FORMATKEY);
553 xField->getPropertyValue(PROPERTY_FIELDTYPE) >>= nType ;
554 }
555 Reference<XNumberFormatsSupplier> xSupplier = calcFormFormatsSupplier();
556 DBG_ASSERT(xSupplier.is(), "OFormattedModel::onConnectedDbColumn : bound to a field but no parent with a formatter ? how this ?");
557 if (xSupplier.is())
558 {
560 if (!aFmtKey.hasValue())
561 { // we aren't bound to a field (or this field's format is invalid)
562 // -> determine the standard text (or numeric) format of the supplier
563 Reference<XNumberFormatTypes> xTypes(xSupplier->getNumberFormats(), UNO_QUERY);
564 if (xTypes.is())
565 {
568 aFmtKey <<= xTypes->getStandardFormat(NumberFormat::NUMBER, aApplicationLocale);
569 else
570 aFmtKey <<= xTypes->getStandardFormat(NumberFormat::TEXT, aApplicationLocale);
571 }
572 }
573 aSupplier >>= m_xOriginalFormatter;
574 m_xAggregateSet->setPropertyValue(PROPERTY_FORMATSSUPPLIER, Any(xSupplier));
575 m_xAggregateSet->setPropertyValue(PROPERTY_FORMATKEY, aFmtKey);
576 // Adapt the NumericFalg to my bound field
577 if (xField.is())
578 {
579 m_bNumeric = false;
580 switch (nType)
581 {
582 case DataType::BIT:
583 case DataType::BOOLEAN:
584 case DataType::TINYINT:
585 case DataType::SMALLINT:
586 case DataType::INTEGER:
587 case DataType::BIGINT:
588 case DataType::FLOAT:
589 case DataType::REAL:
590 case DataType::DOUBLE:
591 case DataType::NUMERIC:
592 case DataType::DECIMAL:
593 case DataType::DATE:
594 case DataType::TIME:
595 case DataType::TIMESTAMP:
596 m_bNumeric = true;
597 break;
598 }
599 }
600 else
603 OSL_VERIFY( aFmtKey >>= nFormatKey );
604 }
605 }
606 }
607 Reference<XNumberFormatsSupplier> xSupplier = calcFormatsSupplier();
609 m_nKeyType = getNumberFormatType( xSupplier->getNumberFormats(), nFormatKey );
610 xSupplier->getNumberFormatSettings()->getPropertyValue("NullDate") >>= m_aNullDate;
612}
613
615{
617 if (m_xOriginalFormatter.is())
618 { // Our aggregated model does not hold any Format information
619 m_xAggregateSet->setPropertyValue(PROPERTY_FORMATSSUPPLIER, Any(m_xOriginalFormatter));
620 m_xAggregateSet->setPropertyValue(PROPERTY_FORMATKEY, Any());
622 m_xOriginalFormatter = nullptr;
623 }
624 m_nKeyType = NumberFormat::UNDEFINED;
625 m_aNullDate = DBTypeConversion::getStandardDate();
626}
627
628void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
629{
630 OEditBaseModel::write(_rxOutStream);
631 _rxOutStream->writeShort(0x0003);
632 DBG_ASSERT(m_xAggregateSet.is(), "OFormattedModel::write : have no aggregate !");
633 // Bring my Format (may be void) to a persistent Format.
634 // The Supplier together with the Key is already persistent, but that doesn't mean
635 // we have to save the Supplier (which would be quite some overhead)
636 Reference<XNumberFormatsSupplier> xSupplier;
637 Any aFmtKey;
638 bool bVoidKey = true;
639 if (m_xAggregateSet.is())
640 {
641 Any aSupplier = m_xAggregateSet->getPropertyValue(PROPERTY_FORMATSSUPPLIER);
642 if (aSupplier.getValueType().getTypeClass() != TypeClass_VOID)
643 {
644 OSL_VERIFY( aSupplier >>= xSupplier );
645 }
646 aFmtKey = m_xAggregateSet->getPropertyValue(PROPERTY_FORMATKEY);
647 bVoidKey = (!xSupplier.is() || !aFmtKey.hasValue()) || (isLoaded() && m_xOriginalFormatter.is());
648 // (no Format and/or Key) OR (loaded and faked Formatter)
649 }
650 _rxOutStream->writeBoolean(!bVoidKey);
651 if (!bVoidKey)
652 {
653 // Create persistent values from the FormatKey and the Formatter
654 Any aKey = m_xAggregateSet->getPropertyValue(PROPERTY_FORMATKEY);
655 sal_Int32 nKey = aKey.hasValue() ? getINT32(aKey) : 0;
656 Reference<XNumberFormats> xFormats = xSupplier->getNumberFormats();
657 OUString sFormatDescription;
658 LanguageType eFormatLanguage = LANGUAGE_DONTKNOW;
659 static constexpr OUStringLiteral s_aLocaleProp = u"Locale";
660 Reference<css::beans::XPropertySet> xFormat = xFormats->getByKey(nKey);
661 if (hasProperty(s_aLocaleProp, xFormat))
662 {
663 Any aLocale = xFormat->getPropertyValue(s_aLocaleProp);
664 DBG_ASSERT(aLocale.has<Locale>(), "OFormattedModel::write : invalid language property !");
665 if (auto pLocale = o3tl::tryAccess<Locale>(aLocale))
666 {
667 eFormatLanguage = LanguageTag::convertToLanguageType( *pLocale, false);
668 }
669 }
670 static constexpr OUStringLiteral s_aFormatStringProp = u"FormatString";
671 if (hasProperty(s_aFormatStringProp, xFormat))
672 xFormat->getPropertyValue(s_aFormatStringProp) >>= sFormatDescription;
673 _rxOutStream->writeUTF(sFormatDescription);
674 _rxOutStream->writeLong(static_cast<sal_uInt16>(eFormatLanguage));
675 }
676 // version 2 : write the properties common to all OEditBaseModels
677 writeCommonEditProperties(_rxOutStream);
678 // version 3 : write the effective value property of the aggregate
679 // Due to a bug within the UnoControlFormattedFieldModel implementation (our default aggregate)
680 // this props value isn't correctly read and this can't be corrected without being incompatible.
681 // so we have our own handling.
682 // and to be a little bit more compatible we make the following section skippable
683 {
684 OStreamSection aDownCompat(_rxOutStream);
685 // a sub version within the skippable block
686 _rxOutStream->writeShort(0x0000);
687 // version 0: the effective value of the aggregate
688 Any aEffectiveValue;
689 if (m_xAggregateSet.is())
690 {
691 try { aEffectiveValue = m_xAggregateSet->getPropertyValue(PROPERTY_EFFECTIVE_VALUE); } catch(const Exception&) { }
692 }
693 {
694 OStreamSection aDownCompat2(_rxOutStream);
695 switch (aEffectiveValue.getValueType().getTypeClass())
696 {
697 case TypeClass_STRING:
698 _rxOutStream->writeShort(0x0000);
699 _rxOutStream->writeUTF(::comphelper::getString(aEffectiveValue));
700 break;
701 case TypeClass_DOUBLE:
702 _rxOutStream->writeShort(0x0001);
703 _rxOutStream->writeDouble(::comphelper::getDouble(aEffectiveValue));
704 break;
705 default: // void and all unknown states
706 DBG_ASSERT(!aEffectiveValue.hasValue(), "FmXFormattedModel::write : unknown property value type !");
707 _rxOutStream->writeShort(0x0002);
708 break;
709 }
710 }
711 }
712}
713
714void OFormattedModel::read(const Reference<XObjectInputStream>& _rxInStream)
715{
716 OEditBaseModel::read(_rxInStream);
717 sal_uInt16 nVersion = _rxInStream->readShort();
718 Reference<XNumberFormatsSupplier> xSupplier;
719 sal_Int32 nKey = -1;
720 switch (nVersion)
721 {
722 case 0x0001 :
723 case 0x0002 :
724 case 0x0003 :
725 {
726 bool bNonVoidKey = _rxInStream->readBoolean();
727 if (bNonVoidKey)
728 {
729 // read string and language...
730 OUString sFormatDescription = _rxInStream->readUTF();
731 LanguageType eDescriptionLanguage(_rxInStream->readLong());
732 // and let a formatter roll dice based on that to create a key...
733 xSupplier = calcFormatsSupplier();
734 // calcFormatsSupplier first takes the one from the model, then one from the starform, then a new one...
735 Reference<XNumberFormats> xFormats = xSupplier->getNumberFormats();
736 if (xFormats.is())
737 {
738 Locale aDescriptionLanguage( LanguageTag::convertToLocale(eDescriptionLanguage));
739 nKey = xFormats->queryKey(sFormatDescription, aDescriptionLanguage, false);
740 if (nKey == sal_Int32(-1))
741 { // does not yet exist in my formatter...
742 nKey = xFormats->addNew(sFormatDescription, aDescriptionLanguage);
743 }
744 }
745 }
746 if ((nVersion == 0x0002) || (nVersion == 0x0003))
747 readCommonEditProperties(_rxInStream);
748 if (nVersion == 0x0003)
749 { // since version 3 there is a "skippable" block at this position
750 OStreamSection aDownCompat(_rxInStream);
751 _rxInStream->readShort(); // sub-version
752 // version 0 and higher: the "effective value" property
753 Any aEffectiveValue;
754 {
755 OStreamSection aDownCompat2(_rxInStream);
756 switch (_rxInStream->readShort())
757 {
758 case 0: // String
759 aEffectiveValue <<= _rxInStream->readUTF();
760 break;
761 case 1: // double
762 aEffectiveValue <<= _rxInStream->readDouble();
763 break;
764 case 2:
765 break;
766 case 3:
767 OSL_FAIL("FmXFormattedModel::read : unknown effective value type!");
768 }
769 }
770 // this property is only to be set if we have no control source: in all other cases the base class made a
771 // reset after it's read and this set the effective value to a default value
772 if ( m_xAggregateSet.is() && getControlSource().isEmpty() )
773 {
774 try
775 {
776 m_xAggregateSet->setPropertyValue(PROPERTY_EFFECTIVE_VALUE, aEffectiveValue);
777 }
778 catch(const Exception&)
779 {
780 }
781 }
782 }
783 }
784 break;
785 default :
786 OSL_FAIL("OFormattedModel::read : unknown version !");
787 // then the format of the aggregated set stay like it was during creation: void
789 break;
790 }
791 if ((nKey != -1) && m_xAggregateSet.is())
792 {
793 m_xAggregateSet->setPropertyValue(PROPERTY_FORMATSSUPPLIER, Any(xSupplier));
794 m_xAggregateSet->setPropertyValue(PROPERTY_FORMATKEY, Any(nKey));
795 }
796 else
797 {
800 }
801}
802
804{
806 // a) we do our own call to writeCommonEditProperties
807}
808
810{
811 Any aControlValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
812 if ( aControlValue == m_aSaveValue )
813 return true;
814
815 // empty string + EmptyIsNull = void
816 if ( !aControlValue.hasValue()
817 || ( ( aControlValue.getValueType().getTypeClass() == TypeClass_STRING )
818 && getString( aControlValue ).isEmpty()
820 )
821 )
822 m_xColumnUpdate->updateNull();
823 else
824 {
825 try
826 {
827 double f = 0.0;
828 if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE || (aControlValue >>= f)) // #i110323
829 {
830 DBTypeConversion::setValue( m_xColumnUpdate, m_aNullDate, getDouble( aControlValue ), m_nKeyType );
831 }
832 else
833 {
834 DBG_ASSERT( aControlValue.getValueType().getTypeClass() == TypeClass_STRING, "OFormattedModel::commitControlValueToDbColumn: invalid value type!" );
835 m_xColumnUpdate->updateString( getString( aControlValue ) );
836 }
837 }
838 catch(const Exception&)
839 {
840 return false;
841 }
842 }
843 m_aSaveValue = aControlValue;
844 return true;
845}
846
848{
851}
852
854{
855 Any aControlValue;
856 switch( _rExternalValue.getValueTypeClass() )
857 {
858 case TypeClass_VOID:
859 break;
860 case TypeClass_STRING:
861 aControlValue = _rExternalValue;
862 break;
863 case TypeClass_BOOLEAN:
864 {
865 bool bExternalValue = false;
866 _rExternalValue >>= bExternalValue;
867 aControlValue <<= static_cast<double>( bExternalValue ? 1 : 0 );
868 }
869 break;
870 default:
871 {
872 if ( _rExternalValue.getValueType().equals( cppu::UnoType< css::util::Date >::get() ) )
873 {
874 css::util::Date aDate;
875 _rExternalValue >>= aDate;
876 aControlValue <<= DBTypeConversion::toDouble( aDate, m_aNullDate );
877 }
878 else if ( _rExternalValue.getValueType().equals( cppu::UnoType< css::util::Time >::get() ) )
879 {
880 css::util::Time aTime;
881 _rExternalValue >>= aTime;
882 aControlValue <<= DBTypeConversion::toDouble( aTime );
883 }
884 else if ( _rExternalValue.getValueType().equals( cppu::UnoType< css::util::DateTime >::get() ) )
885 {
886 css::util::DateTime aDateTime;
887 _rExternalValue >>= aDateTime;
888 aControlValue <<= DBTypeConversion::toDouble( aDateTime, m_aNullDate );
889 }
890 else
891 {
892 OSL_ENSURE( _rExternalValue.getValueTypeClass() == TypeClass_DOUBLE,
893 "OFormattedModel::translateExternalValueToControlValue: don't know how to translate this type!" );
894 double fValue = 0;
895 OSL_VERIFY( _rExternalValue >>= fValue );
896 aControlValue <<= fValue;
897 }
898 }
899 }
900 return aControlValue;
901}
902
904{
905 OSL_PRECOND( hasExternalValueBinding(),
906 "OFormattedModel::translateControlValueToExternalValue: precondition not met!" );
907 Any aControlValue( getControlValue() );
908 if ( !aControlValue.hasValue() )
909 return aControlValue;
910 Any aExternalValue;
911 // translate into the external value type
912 Type aExternalValueType( getExternalValueType() );
913 switch ( aExternalValueType.getTypeClass() )
914 {
915 case TypeClass_STRING:
916 {
917 OUString sString;
918 if ( aControlValue >>= sString )
919 {
920 aExternalValue <<= sString;
921 break;
922 }
923 [[fallthrough]];
924 }
925 case TypeClass_BOOLEAN:
926 {
927 double fValue = 0;
928 OSL_VERIFY( aControlValue >>= fValue );
929 // if this asserts ... well, the somebody set the TreatAsNumeric property to false,
930 // and the control value is a string. This implies some weird misconfiguration
931 // of the FormattedModel, so we won't care for it for the moment.
932 aExternalValue <<= fValue != 0.0;
933 }
934 break;
935 default:
936 {
937 double fValue = 0;
938 OSL_VERIFY( aControlValue >>= fValue );
939 // if this asserts ... well, the somebody set the TreatAsNumeric property to false,
940 // and the control value is a string. This implies some weird misconfiguration
941 // of the FormattedModel, so we won't care for it for the moment.
942 if ( aExternalValueType.equals( cppu::UnoType< css::util::Date >::get() ) )
943 {
944 aExternalValue <<= DBTypeConversion::toDate( fValue, m_aNullDate );
945 }
946 else if ( aExternalValueType.equals( cppu::UnoType< css::util::Time >::get() ) )
947 {
948 aExternalValue <<= DBTypeConversion::toTime( fValue );
949 }
950 else if ( aExternalValueType.equals( cppu::UnoType< css::util::DateTime >::get() ) )
951 {
952 aExternalValue <<= DBTypeConversion::toDateTime( fValue, m_aNullDate );
953 }
954 else
955 {
956 OSL_ENSURE( aExternalValueType.equals( cppu::UnoType< double >::get() ),
957 "OFormattedModel::translateControlValueToExternalValue: don't know how to translate this type!" );
958 aExternalValue <<= fValue;
959 }
960 }
961 break;
962 }
963 return aExternalValue;
964}
965
967{
968 if ( m_bNumeric )
969 m_aSaveValue <<= DBTypeConversion::getValue( m_xColumn, m_aNullDate ); // #100056# OJ
970 else
971 m_aSaveValue <<= m_xColumn->getString();
972 if ( m_xColumn->wasNull() )
973 m_aSaveValue.clear();
974 return m_aSaveValue;
975}
976
978{
979 ::std::vector< Type > aTypes;
980 switch ( m_nKeyType & ~NumberFormat::DEFINED )
981 {
982 case NumberFormat::DATE:
984 break;
985 case NumberFormat::TIME:
987 break;
988 case NumberFormat::DATETIME:
990 break;
991 case NumberFormat::TEXT:
993 break;
994 case NumberFormat::LOGICAL:
996 break;
997 }
1000}
1001
1003{
1004 return m_xAggregateSet->getPropertyValue( PROPERTY_EFFECTIVE_DEFAULT );
1005}
1006
1008{
1010 m_aSaveValue.clear();
1011}
1012
1013}
1014
1015extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1016com_sun_star_form_OFormattedControl_get_implementation(css::uno::XComponentContext* component,
1017 css::uno::Sequence<css::uno::Any> const &)
1018{
1019 return cppu::acquire(new frm::OFormattedControl(component));
1020}
1021
1022/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define PF_HANDLE_COMMON_PROPS
Definition: EditBase.hxx:25
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_form_OFormattedControl_get_implementation(css::uno::XComponentContext *component, css::uno::Sequence< css::uno::Any > const &)
static WeakReference< XNumberFormatsSupplier > s_xDefaultFormatsSupplier
std::unique_ptr< SvNumberFormatter > m_pMyPrivateFormatter
const LanguageTag & GetUILanguageTag() const
static const AllSettings & GetSettings()
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
LanguageType getLanguageType(bool bResolveSystem=true) const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
const LanguageTag & GetLanguageTag() const
virtual sal_Int32 SAL_CALL getHandleByName(const OUString &_rPropertyName) override
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
oslInterlockedCount m_refCount
sal_Int32 getValuePropertyAggHandle() const
bool hasExternalValueBinding() const
checks whether we currently have an external value binding in place
virtual void onConnectedDbColumn(const css::uno::Reference< css::uno::XInterface > &_rxForm)
called whenever a connection to a database column has been established
const css::uno::Type & getExternalValueType() const
returns the type which should be used to exchange data with our external value binding
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &_rType) override
virtual void onConnectedExternalValue()
called whenever a connection to an external supplier of values (XValueBinding) has been established
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void setControlValue(const css::uno::Any &_rValue, ValueChangeInstigator _eInstigator)
sets the given value as new current value for the control
virtual void SAL_CALL disposing() override
void initValueProperty(const OUString &_rValuePropertyName, sal_Int32 _nValuePropertyExternalHandle)
initializes the part of the class which is related to the control value.
css::uno::Reference< css::sdb::XColumn > m_xColumn
virtual void describeFixedProperties(css::uno::Sequence< css::beans::Property > &_rProps) const override
describes the properties provided by this class, or its respective derived class
virtual void resetNoBroadcast()
called to reset the control to some kind of default.
const OUString & getControlSource() const
virtual css::uno::Sequence< css::uno::Type > _getTypes() override
void calculateExternalValueType()
calculates the type which is to be used to communicate with the current external binding,...
virtual void SAL_CALL loaded(const css::lang::EventObject &aEvent) override
css::uno::Reference< css::sdbc::XRowSet > m_xCursor
const css::uno::Reference< css::beans::XPropertySet > & getField() const
css::uno::Reference< css::sdb::XColumnUpdate > m_xColumnUpdate
void startAggregatePropertyListening(const OUString &_rPropertyName)
starts listening at the aggregate, for changes in the given property
virtual void onDisconnectedDbColumn()
called whenever a connection to a database column has been suspended
virtual css::uno::Any getControlValue() const
retrieves the current value of the control
virtual void _propertyChanged(const css::beans::PropertyChangeEvent &_rEvt) override
virtual void SAL_CALL disposing() override
PropertyBagHelper m_aPropertyBagHelper
::osl::Mutex m_aMutex
const css::uno::Reference< css::uno::XComponentContext > & getContext() const
virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle) override
virtual void describeAggregateProperties(css::uno::Sequence< css::beans::Property > &_rAggregateProps) const
describes the properties of our aggregate
css::uno::Reference< css::uno::XAggregation > m_xAggregate
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override
virtual void SAL_CALL dispose() override
virtual sal_uInt16 getPersistenceFlags() const
Definition: EditBase.cxx:153
virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream) override
Definition: EditBase.cxx:159
virtual css::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const override
Definition: EditBase.cxx:356
void defaultCommonEditProperties()
Definition: EditBase.cxx:217
void readCommonEditProperties(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream)
Definition: EditBase.cxx:224
virtual void SAL_CALL write(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream) override
Definition: EditBase.cxx:85
void writeCommonEditProperties(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream)
Definition: EditBase.cxx:244
virtual void SAL_CALL keyReleased(const css::awt::KeyEvent &e) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL disposing() override
virtual ~OFormattedControl() override
virtual void SAL_CALL keyPressed(const css::awt::KeyEvent &e) override
virtual void onConnectedDbColumn(const css::uno::Reference< css::uno::XInterface > &_rxForm) override
called whenever a connection to a database column has been established
virtual void resetNoBroadcast() override
called to reset the control to some kind of default.
css::uno::Reference< css::util::XNumberFormatsSupplier > calcDefaultFormatsSupplier() const
virtual css::uno::Any getDefaultForReset() const override
returns the default which should be used when resetting the control
css::util::Date m_aNullDate
css::uno::Reference< css::util::XNumberFormatsSupplier > m_xOriginalFormatter
OFormattedModel(const css::uno::Reference< css::uno::XComponentContext > &_rxFactory)
css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
virtual void SAL_CALL loaded(const css::lang::EventObject &rEvent) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Any translateDbColumnToControlValue() override
translates a db column value into a control value.
css::uno::Reference< css::util::XNumberFormatsSupplier > calcFormFormatsSupplier() const
virtual void describeFixedProperties(css::uno::Sequence< css::beans::Property > &_rProps) const override
describes the properties provided by this class, or its respective derived class
virtual OUString SAL_CALL getServiceName() override
void setPropertyToDefaultByHandle(sal_Int32 nHandle) override
virtual css::uno::Sequence< css::uno::Type > getSupportedBindingTypes() override
returns the data types which the control could use to exchange data with an external value binding
void SAL_CALL setPropertyToDefault(const OUString &aPropertyName) override
css::uno::Reference< css::util::XNumberFormatsSupplier > calcFormatsSupplier() const
virtual void onConnectedExternalValue() override
called whenever a connection to an external supplier of values (XValueBinding) has been established
virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream) override
virtual css::uno::Sequence< css::uno::Type > _getTypes() override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual bool commitControlValueToDbColumn(bool _bPostReset) override
commits the current control value to the database column we're bound to @precond we're properly bound...
virtual sal_uInt16 getPersistenceFlags() const override
virtual ~OFormattedModel() override
css::uno::Any m_aSaveValue
virtual void onDisconnectedDbColumn() override
called whenever a connection to a database column has been suspended
virtual void SAL_CALL disposing() override
virtual css::uno::Any translateControlValueToExternalValue() const override
commits the current control value to our external value binding
virtual css::uno::Any translateExternalValueToControlValue(const css::uno::Any &_rExternalValue) const override
translates the given value, which was obtained from the current external value binding,...
virtual void describeAggregateProperties(css::uno::Sequence< css::beans::Property > &_rAggregateProps) const override
describes the properties of our aggregate
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &_rType) override
virtual void _propertyChanged(const css::beans::PropertyChangeEvent &evt) override
virtual void SAL_CALL write(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream) override
css::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const override
inline ::comphelper::OPropertyArrayAggregationHelper & getInfoHelper() const
int nCount
#define DBG_ASSERT(sCon, aError)
float u
sal_Int16 nVersion
constexpr OUStringLiteral PROPERTY_TREATASNUMERIC
constexpr OUStringLiteral PROPERTY_TABINDEX
Definition: frm_strings.hxx:26
constexpr OUStringLiteral PROPERTY_FILTERPROPOSAL
constexpr OUStringLiteral PROPERTY_EFFECTIVE_DEFAULT
constexpr OUStringLiteral PROPERTY_TARGET_URL
Definition: frm_strings.hxx:49
constexpr OUStringLiteral PROPERTY_EFFECTIVE_VALUE
constexpr OUStringLiteral PROPERTY_EMPTY_IS_NULL
Definition: frm_strings.hxx:75
constexpr OUStringLiteral PROPERTY_STRICTFORMAT
Definition: frm_strings.hxx:96
constexpr OUStringLiteral PROPERTY_CLASSID
Definition: frm_strings.hxx:30
constexpr OUStringLiteral PROPERTY_FIELDTYPE
Definition: frm_strings.hxx:90
constexpr OUStringLiteral PROPERTY_FORMATKEY
Definition: frm_strings.hxx:66
constexpr OUStringLiteral PROPERTY_FORMATSSUPPLIER
Definition: frm_strings.hxx:67
sal_Int32 nIndex
constexpr sal_uInt16 KEY_RETURN
#define LANGUAGE_SYSTEM
#define LANGUAGE_DONTKNOW
const char * pLocale
@ Exception
bool hasProperty(const OUString &_rName, const Reference< XPropertySet > &_rxSet)
bool getBOOL(const Any &_rAny)
bool query_aggregation(const css::uno::Reference< css::uno::XAggregation > &_rxAggregate, css::uno::Reference< iface > &_rxOut)
sal_Int16 getINT16(const Any &_rAny)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
double getDouble(const Any &_rAny)
sal_Int32 getINT32(const Any &_rAny)
void ModifyPropertyAttributes(Sequence< Property > &seqProps, const OUString &sPropName, sal_Int16 nAddAttrib, sal_Int16 nRemoveAttrib)
OUString getString(const Any &_rAny)
void RemoveProperty(Sequence< Property > &_rProps, const OUString &_rPropName)
sal_Int16 getNumberFormatType(const css::uno::Reference< css::util::XNumberFormats > &xFormats, sal_Int32 nKey)
Type
Reference< XConnection > getConnection(const Reference< XRowSet > &_rxRowSet)
Reference< XNumberFormatsSupplier > getNumberFormats(const Reference< XConnection > &_rxConn, bool _bAlloweDefault, const Reference< XComponentContext > &_rxContext)
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25
IMPL_LINK_NOARG(OButtonControl, OnClick, void *, void)
Definition: Button.cxx:440
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
#define PROPERTY_ID_FILTERPROPOSAL
Definition: property.hxx:197
#define PROPERTY_ID_EFFECTIVE_VALUE
Definition: property.hxx:192
#define PROPERTY_ID_EMPTY_IS_NULL
Definition: property.hxx:161
#define PROPERTY_ID_FORMATSSUPPLIER
Definition: property.hxx:190
#define PROPERTY_ID_TABINDEX
Definition: property.hxx:41
QPRO_FUNC_TYPE nType
sal_Int32 nHandle
constexpr OUStringLiteral FRM_SUN_COMPONENT_FORMATTEDFIELD
Definition: services.hxx:130
constexpr OUStringLiteral VALIDATABLE_BINDABLE_CONTROL_MODEL
Definition: services.hxx:184
constexpr OUStringLiteral BINDABLE_DATA_AWARE_CONTROL_MODEL
Definition: services.hxx:181
constexpr OUStringLiteral STARDIV_ONE_FORM_CONTROL_FORMATTEDFIELD
Definition: services.hxx:105
constexpr OUStringLiteral DATA_AWARE_CONTROL_MODEL
Definition: services.hxx:182
constexpr OUStringLiteral VCL_CONTROL_FORMATTEDFIELD
Definition: services.hxx:36
constexpr OUStringLiteral FRM_SUN_COMPONENT_DATABASE_FORMATTEDFIELD
Definition: services.hxx:142
constexpr OUStringLiteral VALIDATABLE_CONTROL_MODEL
Definition: services.hxx:183
constexpr OUStringLiteral VCL_CONTROLMODEL_FORMATTEDFIELD
Definition: services.hxx:54
constexpr OUStringLiteral FRM_SUN_CONTROL_FORMATTEDFIELD
Definition: services.hxx:165
constexpr OUStringLiteral FRM_COMPONENT_FORMATTEDFIELD
Definition: services.hxx:86
constexpr OUStringLiteral FRM_COMPONENT_EDIT
Definition: services.hxx:65
constexpr OUStringLiteral BINDABLE_CONTROL_MODEL
Definition: services.hxx:179
constexpr OUStringLiteral BINDABLE_DATABASE_FORMATTED_FIELD
Definition: services.hxx:171
const SvXMLTokenMapEntry aTypes[]