20 #include <com/sun/star/beans/XPropertySet.hpp>
21 #include <rptui_slotid.hrc>
26 #include <strings.hxx>
28 #include <com/sun/star/util/NumberFormat.hpp>
29 #include <com/sun/star/util/XNumberFormatPreviewer.hpp>
40 OReportController* _pController)
41 : GenericDialogController(_pParent,
"modules/dbreport/ui/datetimedialog.ui",
"DateTimeDialog")
43 , m_pController(_pController)
44 , m_xHoldAlive(_xHoldAlive)
45 , m_xDate(m_xBuilder->weld_check_button(
"date"))
46 , m_xFTDateFormat(m_xBuilder->weld_label(
"datelistbox_label"))
47 , m_xDateListBox(m_xBuilder->weld_combo_box(
"datelistbox"))
48 , m_xTime(m_xBuilder->weld_check_button(
"time"))
49 , m_xFTTimeFormat(m_xBuilder->weld_label(
"timelistbox_label"))
50 , m_xTimeListBox(m_xBuilder->weld_combo_box(
"timelistbox"))
51 , m_xPB_OK(m_xBuilder->weld_button(
"ok"))
58 InsertEntry(util::NumberFormat::DATE);
59 InsertEntry(util::NumberFormat::TIME);
61 catch (
const uno::Exception&)
65 m_xDateListBox->set_active(0);
66 m_xTimeListBox->set_active(0);
76 const bool bTime = util::NumberFormat::TIME == _nNumberFormatId;
82 const uno::Reference< util::XNumberFormats> xFormats = xNumberFormatter->getNumberFormatsSupplier()->getNumberFormats();
83 const uno::Sequence<sal_Int32> aFormatKeys = xFormats->queryKeys(_nNumberFormatId,
m_nLocale,
true);
84 for (
const sal_Int32 nFormatKey : aFormatKeys)
92 short nRet = GenericDialogController::run();
98 uno::Sequence<beans::PropertyValue> aValues( 6 );
99 auto pValues = aValues.getArray();
116 sal_Int32 nWidth = 0;
133 pValues[nLength++].Value <<= nWidth;
138 catch (
const uno::Exception&)
148 uno::Reference< beans::XPropertySet> xFormSet = _xFormats->getByKey(_nNumberFormatKey);
149 OSL_ENSURE(xFormSet.is(),
"XPropertySet is null!");
151 xFormSet->getPropertyValue(
"FormatString") >>= sFormat;
162 static css::util::Date STANDARD_DB_DATE(30,12,1899);
167 OSL_ENSURE(xPreviewer.is(),
"XNumberFormatPreviewer is null!");
168 return xPreviewer->convertNumberToPreviewString(sFormat,nValue,
m_nLocale,
true);
173 const bool bDate = m_xDate->get_active();
174 m_xFTDateFormat->set_sensitive(bDate);
175 m_xDateListBox->set_sensitive(bDate);
177 const bool bTime = m_xTime->get_active();
178 m_xFTTimeFormat->set_sensitive(bTime);
179 m_xTimeListBox->set_sensitive(bTime);
181 if (!bDate && !bTime)
183 m_xPB_OK->set_sensitive(
false);
187 m_xPB_OK->set_sensitive(
true);
193 sal_Int32 nFormatKey;
#define LINK(Instance, Class, Member)
#define PROPERTY_TIME_STATE
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
const MapMode & GetMapMode() const
void append(const OUString &rId, const OUString &rStr)
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
static OutputDevice * GetDefaultDevice()
tools::Long GetCtrlTextWidth(const OUString &rStr, const SalLayoutGlyphs *pLayoutCache=nullptr) const
sal_Int32 GetDate() const
virtual void connect_toggled(const Link< Toggleable &, void > &rLink)
IMPL_LINK_NOARG(OAddFieldWindow, FocusChangeHdl, weld::Container &, void)
#define PROPERTY_FORMATKEYDATE
MapUnit GetMapUnit() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
const PropertyValue * pValues
#define PROPERTY_FORMATKEYTIME
const css::uno::Reference< css::util::XNumberFormatter > & getReportNumberFormatter() const
returns the number formatter
#define PROPERTY_DATE_STATE
const LanguageTag & GetLanguageTag() const