23#include <com/sun/star/beans/IllegalTypeException.hpp>
24#include <com/sun/star/lang/IllegalArgumentException.hpp>
25#include <com/sun/star/util/DateTime.hpp>
26#include <com/sun/star/util/Date.hpp>
27#include <com/sun/star/util/Time.hpp>
28#include <com/sun/star/util/Color.hpp>
29#include <com/sun/star/util/MeasureUnit.hpp>
30#include <com/sun/star/inspection/PropertyControlType.hpp>
37#include <svx/svxids.hrc>
39#include <tools/datetime.hxx>
59 , m_xFormatter(new
weld::TimeFormatter(*getTypedControlWindow()))
61 m_xFormatter->SetExtFormat(ExtTimeFieldFormat::LongDuration);
67 if ( !( _rValue >>= aUNOTime ) )
90 return ::cppu::UnoType<util::Time>::get();
96 , m_xEntry(m_xBuilder->weld_entry(
"entry"))
97 , m_xCalendarBox(
std::make_unique<
SvtCalendarBox>(m_xBuilder->weld_menu_button(
"button"), false))
124 if ( !( _rValue >>= aUNODate ) )
130 ::Date aDate( aUNODate.Day, aUNODate.Month, aUNODate.Year );
137 m_xEntryFormatter->SetDate(m_xCalendarBox->get_date());
139 m_xEntry->grab_focus();
144 if (!rToggle.get_active())
152 m_xCalendarBox->set_date(aDate);
158 if (!
m_xEntry->get_text().isEmpty())
168 return ::cppu::UnoType<util::Date>::get();
178 pWidget->set_sensitive(
true);
182 pWidget->set_max_length( 1 );
210 if ( !sText.isEmpty() )
211 aPropValue <<= static_cast<sal_Int16>(sText[0]);
214 aPropValue <<= sText;
236 for ( sal_uInt16
d = 0;
d < nDigits; ++
d )
239 return o3tl::saturating_cast<sal_Int64>(
n);
245 for ( sal_uInt16
d = 0;
d < nDigits; ++
d )
252 , m_xDate(
std::make_unique<
SvtCalendarBox>(m_xBuilder->weld_menu_button(
"datefield")))
253 , m_xTime(m_xBuilder->weld_formatted_spin_button(
"timefield"))
254 , m_xFormatter(new
weld::TimeFormatter(*m_xTime))
256 m_xFormatter->SetExtFormat(ExtTimeFieldFormat::LongDuration);
261 if ( !_rValue.hasValue() )
269 util::DateTime aUNODateTime;
270 OSL_VERIFY( _rValue >>= aUNODateTime );
273 ::utl::typeConvert( aUNODateTime, aDateTime );
283 if (!
m_xTime->get_text().isEmpty())
287 util::DateTime aUNODateTime;
288 ::utl::typeConvert( aDateTime, aUNODateTime );
290 aPropValue <<= aUNODateTime;
297 return ::cppu::UnoType<util::DateTime>::get();
303 , m_xEntry(m_xBuilder->weld_entry(
"entry"))
304 , m_xButton(m_xBuilder->weld_button(
"button"))
308 pWidget->set_sensitive(
true);
316 OUString sText =
m_xEntry->get_text();
329 return ::cppu::UnoType<OUString>::get();
349 EventObject
aEvent( *
this );
355 ActionEvent
aEvent( *
this,
"clicked" );
356 m_aActionListeners.forEach< XActionListener >(
357 [&
aEvent] (uno::Reference<awt::XActionListener>
const& xListener)
358 {
return xListener->actionPerformed(
aEvent); });
365 , m_nFieldToUNOValueFactor( 1 )
388 Optional< double > aReturn(
true, 0 );
391 if ( minValue == std::numeric_limits<sal_Int64>::min() )
392 aReturn.IsPresent =
false;
394 aReturn.Value =
static_cast<double>(minValue);
401 if ( !_minvalue.IsPresent )
409 Optional< double > aReturn(
true, 0 );
412 if ( maxValue == std::numeric_limits<sal_Int64>::max() )
413 aReturn.IsPresent =
false;
415 aReturn.Value =
static_cast<double>(maxValue);
422 if ( !_maxvalue.IsPresent )
435 if ( ( _displayunit < MeasureUnit::MM_100TH ) || ( _displayunit > MeasureUnit::PERCENT ) )
436 throw IllegalArgumentException();
437 if ( ( _displayunit == MeasureUnit::MM_100TH )
438 || ( _displayunit == MeasureUnit::MM_10TH )
439 || ( _displayunit == MeasureUnit::INCH_1000TH )
440 || ( _displayunit == MeasureUnit::INCH_100TH )
441 || ( _displayunit == MeasureUnit::INCH_10TH )
442 || ( _displayunit == MeasureUnit::PERCENT )
444 throw IllegalArgumentException();
446 sal_Int16 nDummyFactor = 1;
448 if ( nDummyFactor != 1 )
462 if ( ( _valueunit < MeasureUnit::MM_100TH ) || ( _valueunit > MeasureUnit::PERCENT ) )
463 throw IllegalArgumentException();
469 if ( !_rValue.hasValue() )
476 OSL_VERIFY( _rValue >>=
nValue );
510 return ::cppu::UnoType<double>::get();
523 if (_rValue.hasValue())
534 aPropValue <<= aRgbCol;
540 return ::cppu::UnoType<sal_Int32>::get();
562 if ( !sControlValue.isEmpty() )
563 aPropValue <<= sControlValue;
569 return ::cppu::UnoType<OUString>::get();
574 if ( !_rValue.hasValue() )
579 _rValue >>= sSelection;
607 Sequence< OUString > aRet(
nCount);
608 OUString* pIter = aRet.getArray();
609 for (sal_Int32
i = 0;
i <
nCount ; ++
i,++pIter)
647 return ::cppu::UnoType<OUString>::get();
668 Sequence< OUString > aRet(
nCount);
669 OUString* pIter = aRet.getArray();
670 for (sal_Int32
i = 0;
i <
nCount ; ++
i,++pIter)
679 notifyModifiedValue();
685 StlSyntaxSequence< OUString > lcl_convertMultiLineToList( std::u16string_view _rCompsedTextWithLineBreaks )
688 StlSyntaxSequence< OUString > aStrings( nLines );
695 *stringItem =
o3tl::getToken(_rCompsedTextWithLineBreaks, 0,
'\n', nIdx );
703 OUString lcl_convertListToMultiLine(
const StlSyntaxSequence< OUString >& _rStrings )
705 OUStringBuffer sMultiLineText;
707 item != _rStrings.end();
710 sMultiLineText.append(*item);
711 if ( ++item != _rStrings.end() )
712 sMultiLineText.append(
"\n");
714 return sMultiLineText.makeStringAndClear();
718 OUString lcl_convertListToDisplayText(
const StlSyntaxSequence< OUString >& _rStrings )
720 OUStringBuffer aComposed;
722 strings != _rStrings.end();
726 if ( strings != _rStrings.begin() )
727 aComposed.append(
';' );
728 aComposed.append(
"\"" + *strings +
"\"" );
730 return aComposed.makeStringAndClear();
743 m_xEntry->set_text(lcl_convertListToDisplayText(rStrings));
744 m_xTextView->set_text(lcl_convertListToMultiLine(rStrings));
750 return lcl_convertMultiLineToList(
m_xTextView->get_text());
772 , m_nOperationMode(
eMode)
773 , m_xEntry(m_xBuilder->weld_entry(
"entry"))
774 , m_xButton(m_xBuilder->weld_menu_button(
"button"))
775 , m_xPopover(m_xBuilder->weld_widget(
"popover"))
776 , m_xTextView(m_xBuilder->weld_text_view(
"textview"))
777 , m_xOk(m_xBuilder->weld_button(
"ok"))
790 OUString sText = m_xTextView->get_text();
791 auto aSeq = lcl_convertMultiLineToList(sText);
792 if (
aSeq.getLength() > 1)
793 m_xEntry->set_text(lcl_convertListToDisplayText(
aSeq));
795 m_xEntry->set_text(sText);
796 CheckEntryTextViewMisMatch();
809 m_xButton->set_active(
false);
810 notifyModifiedValue();
822 if ( !( _rValue >>= sText ) && _rValue.hasValue() )
823 throw IllegalTypeException();
829 Sequence< OUString > aStringLines;
830 if ( !( _rValue >>= aStringLines ) && _rValue.hasValue() )
831 throw IllegalTypeException();
858 return ::cppu::UnoType<OUString>::get();
sal_Int32 GetDate() const
css::util::Date GetUNODate() const
static sal_Int16 ConvertToMeasurementUnit(FieldUnit _nFieldUnit, sal_Int16 _rFieldToUNOValueFactor)
static FieldUnit ConvertToFieldUnit(sal_Int16 _nMeasurementUnit, sal_Int16 &_rFieldToUNOValueFactor)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
sal_Int32 addInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
css::uno::Type const & get()
virtual void setModified()
implements a base class for <type scope="css::inspection">XPropertyControl</type> implementations
virtual void SAL_CALL notifyModifiedValue() override
TControlWindow * getTypedControlWindow()
void impl_checkDisposed_throw()
checks whether the instance is already disposed
virtual void SAL_CALL disposing() override
virtual void setModified() override
virtual css::uno::Type SAL_CALL getValueType() override
virtual void SAL_CALL setValue(const css::uno::Any &_value) override
virtual css::uno::Any SAL_CALL getValue() override
OColorControl(std::unique_ptr< ColorListBox > xWidget, std::unique_ptr< weld::Builder > xBuilder, bool bReadOnly)
virtual void SAL_CALL appendListEntry(const OUString &NewEntry) override
virtual css::uno::Type SAL_CALL getValueType() override
virtual void SAL_CALL clearList() override
virtual css::uno::Any SAL_CALL getValue() override
virtual void SAL_CALL prependListEntry(const OUString &NewEntry) override
virtual css::uno::Sequence< OUString > SAL_CALL getListEntries() override
OComboboxControl(std::unique_ptr< weld::ComboBox > xWidget, std::unique_ptr< weld::Builder > xBuilder, bool bReadOnly)
virtual void SAL_CALL setValue(const css::uno::Any &_value) override
std::unique_ptr< weld::Entry > m_xEntry
std::unique_ptr< weld::DateFormatter > m_xEntryFormatter
ODateControl(std::unique_ptr< weld::Container > xWidget, std::unique_ptr< weld::Builder > xBuilder, bool bReadOnly)
virtual css::uno::Type SAL_CALL getValueType() override
virtual void SAL_CALL disposing() override
virtual css::uno::Any SAL_CALL getValue() override
std::unique_ptr< SvtCalendarBox > m_xCalendarBox
virtual void SAL_CALL setValue(const css::uno::Any &_value) override
std::unique_ptr< SvtCalendarBox > m_xDate
virtual void SAL_CALL setValue(const css::uno::Any &_value) override
std::unique_ptr< weld::FormattedSpinButton > m_xTime
virtual css::uno::Any SAL_CALL getValue() override
std::unique_ptr< weld::TimeFormatter > m_xFormatter
ODateTimeControl(std::unique_ptr< weld::Container > xWidget, std::unique_ptr< weld::Builder > xBuilder, bool bReadOnly)
virtual css::uno::Type SAL_CALL getValueType() override
virtual void setModified() override
virtual void SAL_CALL setValue(const css::uno::Any &_value) override
virtual css::uno::Any SAL_CALL getValue() override
OEditControl(std::unique_ptr< weld::Entry > xWidget, std::unique_ptr< weld::Builder > xBuilder, bool bPassWord, bool bReadOnly)
virtual css::uno::Type SAL_CALL getValueType() override
virtual void SAL_CALL setValue(const css::uno::Any &_value) override
virtual css::uno::Type SAL_CALL getValueType() override
OHyperlinkControl(std::unique_ptr< weld::Container > xWidget, std::unique_ptr< weld::Builder > xBuilder, bool bReadOnly)
virtual void SAL_CALL addActionListener(const css::uno::Reference< css::awt::XActionListener > &listener) override
virtual css::uno::Any SAL_CALL getValue() override
virtual void SAL_CALL removeActionListener(const css::uno::Reference< css::awt::XActionListener > &listener) override
std::unique_ptr< weld::Button > m_xButton
virtual void SAL_CALL disposing() override
std::unique_ptr< weld::Entry > m_xEntry
::comphelper::OInterfaceContainerHelper2 m_aActionListeners
OListboxControl(std::unique_ptr< weld::ComboBox > xWidget, std::unique_ptr< weld::Builder > xBuilder, bool bReadOnly)
virtual css::uno::Type SAL_CALL getValueType() override
virtual void SAL_CALL appendListEntry(const OUString &NewEntry) override
virtual css::uno::Any SAL_CALL getValue() override
virtual void setModified() override
virtual css::uno::Sequence< OUString > SAL_CALL getListEntries() override
virtual void SAL_CALL prependListEntry(const OUString &NewEntry) override
virtual void SAL_CALL setValue(const css::uno::Any &_value) override
virtual void SAL_CALL clearList() override
std::unique_ptr< weld::Entry > m_xEntry
virtual void SAL_CALL setValue(const css::uno::Any &_value) override
virtual css::uno::Any SAL_CALL getValue() override
StlSyntaxSequence< OUString > GetStringListValue() const
std::unique_ptr< weld::Button > m_xOk
void CheckEntryTextViewMisMatch()
MultiLineOperationMode m_nOperationMode
std::unique_ptr< weld::MenuButton > m_xButton
OUString GetTextValue() const
std::unique_ptr< weld::TextView > m_xTextView
virtual void editChanged() override
void SetTextValue(const OUString &rText)
std::unique_ptr< weld::Widget > m_xPopover
OMultilineEditControl(std::unique_ptr< weld::Container > xWidget, std::unique_ptr< weld::Builder > xBuilder, MultiLineOperationMode eMode, bool bReadOnly)
void SetStringListValue(const StlSyntaxSequence< OUString > &_rStrings)
virtual css::uno::Type SAL_CALL getValueType() override
ONumericControl(std::unique_ptr< weld::MetricSpinButton > xWidget, std::unique_ptr< weld::Builder > xBuilder, bool bReadOnly)
virtual void SAL_CALL setDisplayUnit(::sal_Int16 _displayunit) override
virtual css::uno::Type SAL_CALL getValueType() override
sal_Int64 impl_apiValueToFieldValue_nothrow(double nApiValue) const
converts an API value (double, as passed into set[Max|Min|]Value) into a int value which can be passe...
virtual void SAL_CALL setValue(const css::uno::Any &_value) override
virtual void SAL_CALL setValueUnit(::sal_Int16 _valueunit) override
virtual void SAL_CALL setDecimalDigits(::sal_Int16 _decimaldigits) override
double impl_fieldValueToApiValue_nothrow(sal_Int64 nFieldValue) const
converts a control value, as obtained from our Numeric field, into a value which can passed to outer ...
virtual css::uno::Any SAL_CALL getValue() override
virtual ::sal_Int16 SAL_CALL getDecimalDigits() override
virtual css::beans::Optional< double > SAL_CALL getMaxValue() override
virtual ::sal_Int16 SAL_CALL getDisplayUnit() override
virtual ::sal_Int16 SAL_CALL getValueUnit() override
sal_Int16 m_nFieldToUNOValueFactor
virtual css::beans::Optional< double > SAL_CALL getMinValue() override
virtual void SAL_CALL setMaxValue(const css::beans::Optional< double > &_maxvalue) override
virtual void SAL_CALL setMinValue(const css::beans::Optional< double > &_minvalue) override
OTimeControl(std::unique_ptr< weld::FormattedSpinButton > xWidget, std::unique_ptr< weld::Builder > xBuilder, bool bReadOnly)
virtual void SAL_CALL setValue(const css::uno::Any &_value) override
virtual css::uno::Any SAL_CALL getValue() override
virtual css::uno::Type SAL_CALL getValueType() override
std::unique_ptr< weld::TimeFormatter > m_xFormatter
const ELEMENT * const_iterator
virtual OUString get_active_text() const=0
virtual void set_entry_text(const OUString &rStr)=0
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define LINK(Instance, Class, Member)
Sequence< sal_Int8 > aSeq
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
a property handler for any virtual string properties
static sal_Int64 ImplCalcLongValue(double nValue, sal_uInt16 nDigits)
IMPL_LINK(OBrowserLine, OnButtonClicked, weld::Button &, rButton, void)
static double ImplCalcDoubleValue(sal_Int64 nValue, sal_uInt16 nDigits)
IMPL_LINK_NOARG(OBrowserLine, OnButtonFocus, weld::Widget &, void)