chart2/source/controller/dialogs/tp_Scale.cxx | 7 +++++++ include/sfx2/dialoghelper.hxx | 5 +++-- sc/source/ui/miscdlgs/sharedocdlg.cxx | 6 +++--- sfx2/source/dialog/dialoghelper.cxx | 8 ++++---- sfx2/source/dialog/versdlg.cxx | 8 ++++---- 5 files changed, 21 insertions(+), 13 deletions(-)
New commits: commit c15fceae5e70483daf8355a9b7d53215b7643c2b Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Apr 13 16:49:27 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Apr 14 09:54:37 2022 +0200 Resolves: tdf#141625 give enough space to see full date+time Change-Id: I31193783231f27494ed1507faa143697e8facc30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132977 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx index 5c60dce0872d..7147dfa84a31 100644 --- a/chart2/source/controller/dialogs/tp_Scale.cxx +++ b/chart2/source/controller/dialogs/tp_Scale.cxx @@ -26,6 +26,7 @@ #include <svx/svxids.hrc> #include <osl/diagnose.h> +#include <sfx2/dialoghelper.hxx> #include <svx/chrtitem.hxx> #include <svl/eitem.hxx> #include <svl/intitem.hxx> @@ -557,6 +558,12 @@ void ScaleTabPage::SetNumFormat() nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::TIME, pFormat->GetLanguage() ); else nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::TIME ); + + // tdf#141625 give enough space to see full date+time + int nWidestTime(m_xFmtFldMin->get_pixel_size(getWidestDateTime(Application::GetSettings().GetLocaleDataWrapper(), true)).Width()); + int nWidthChars = std::ceil(nWidestTime / m_xFmtFldMin->get_approximate_digit_width()) + 1; + m_xFmtFldMin->set_width_chars(nWidthChars); + m_xFmtFldMax->set_width_chars(nWidthChars); } if( m_nAxisType == chart2::AxisType::DATE && ( eType != SvNumFormatType::DATE && eType != SvNumFormatType::DATETIME) ) diff --git a/include/sfx2/dialoghelper.hxx b/include/sfx2/dialoghelper.hxx index e76304ac6808..a853d5d9de5c 100644 --- a/include/sfx2/dialoghelper.hxx +++ b/include/sfx2/dialoghelper.hxx @@ -31,9 +31,10 @@ Size SFX2_DLLPUBLIC getPreviewStripSize(const OutputDevice& rReference); Size SFX2_DLLPUBLIC getPreviewOptionsSize(const OutputDevice& rReference); -OUString SFX2_DLLPUBLIC getWidestTime(const LocaleDataWrapper& rWrapper); +OUString SFX2_DLLPUBLIC getWidestDateTime(const LocaleDataWrapper& rWrapper, bool bWithSec); -OUString SFX2_DLLPUBLIC formatTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper); +OUString SFX2_DLLPUBLIC formatDateTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper, + bool bWithSec); #endif diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index 4fd2137b519c..66904fe65fdb 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -40,7 +40,7 @@ using namespace ::com::sun::star; IMPL_LINK(ScShareDocumentDlg, SizeAllocated, const Size&, rSize, void) { - OUString sWidestAccessString = getWidestTime(ScGlobal::getLocaleData()); + OUString sWidestAccessString = getWidestDateTime(ScGlobal::getLocaleData(), false); const int nAccessWidth = m_xLbUsers->get_pixel_size(sWidestAccessString).Width() * 2; std::vector<int> aWidths { @@ -152,7 +152,7 @@ void ScShareDocumentDlg::UpdateView() tools::Time aTime( nHours, nMinutes ); DateTime aDateTime( aDate, aTime ); - OUString aString = formatTime(aDateTime, ScGlobal::getLocaleData()); + OUString aString = formatDateTime(aDateTime, ScGlobal::getLocaleData(), false); m_xLbUsers->append_text(aUser); m_xLbUsers->set_text(m_xLbUsers->n_children() - 1, aString, 1); @@ -202,7 +202,7 @@ void ScShareDocumentDlg::UpdateView() util::DateTime uDT(xDocProps->getModificationDate()); DateTime aDateTime(uDT); - OUString aString = formatTime(aDateTime, ScGlobal::getLocaleData()) + " " + + OUString aString = formatDateTime(aDateTime, ScGlobal::getLocaleData(), false) + " " + ScGlobal::getLocaleData().getTime( aDateTime, false ); m_xLbUsers->append_text(aUser); diff --git a/sfx2/source/dialog/dialoghelper.cxx b/sfx2/source/dialog/dialoghelper.cxx index 93e697b29517..9585c8baac80 100644 --- a/sfx2/source/dialog/dialoghelper.cxx +++ b/sfx2/source/dialog/dialoghelper.cxx @@ -32,17 +32,17 @@ Size getPreviewOptionsSize(const OutputDevice& rReference) return rReference.LogicToPixel(Size(70, 27), MapMode(MapUnit::MapAppFont)); } -OUString getWidestTime(const LocaleDataWrapper& rWrapper) +OUString getWidestDateTime(const LocaleDataWrapper& rWrapper, bool bWithSec) { Date aDate(22, 12, 2000); tools::Time aTime(22, 59, 59); DateTime aDateTime(aDate, aTime); - return formatTime(aDateTime, rWrapper); + return formatDateTime(aDateTime, rWrapper, bWithSec); } -OUString formatTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper) +OUString formatDateTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper, bool bWithSec) { - return rWrapper.getDate(rDateTime) + " " + rWrapper.getTime(rDateTime, false); + return rWrapper.getDate(rDateTime) + " " + rWrapper.getTime(rDateTime, bWithSec); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index 4b0a05d40eae..90e704ab7ef1 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -115,7 +115,7 @@ namespace void setColSizes(weld::TreeView& rVersionBox) { // recalculate the datetime column width - int nWidestTime(rVersionBox.get_pixel_size(getWidestTime(Application::GetSettings().GetLocaleDataWrapper())).Width()); + int nWidestTime(rVersionBox.get_pixel_size(getWidestDateTime(Application::GetSettings().GetLocaleDataWrapper(), false)).Width()); int nW1 = rVersionBox.get_pixel_size(rVersionBox.get_column_title(1)).Width(); int nMax = std::max(nWidestTime, nW1) + 12; // max width + a little offset @@ -217,7 +217,7 @@ void SfxVersionDialog::Init_Impl() for (size_t n = 0; n < m_pTable->size(); ++n) { SfxVersionInfo *pInfo = m_pTable->at( n ); - OUString aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper()); + OUString aEntry = formatDateTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper(), false); m_xVersionBox->append(weld::toId(pInfo), aEntry); auto nLastRow = m_xVersionBox->n_children() - 1; m_xVersionBox->set_text(nLastRow, pInfo->aAuthor, 1); @@ -394,7 +394,7 @@ SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl(weld::Window *pParent, SfxV OUString sAuthor = rInfo.aAuthor.isEmpty() ? SfxResId(STR_NO_NAME_SET) : rInfo.aAuthor; const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); - m_xDateTimeText->set_label(m_xDateTimeText->get_label() + formatTime(rInfo.aCreationDate, rLocaleWrapper)); + m_xDateTimeText->set_label(m_xDateTimeText->get_label() + formatDateTime(rInfo.aCreationDate, rLocaleWrapper, false)); m_xSavedByText->set_label(m_xSavedByText->get_label() + sAuthor); m_xEdit->set_text(rInfo.aComment); m_xEdit->set_size_request(40 * m_xEdit->get_approximate_digit_width(), @@ -459,7 +459,7 @@ void SfxCmisVersionsDialog::LoadVersions() for (size_t n = 0; n < m_pTable->size(); ++n) { SfxVersionInfo *pInfo = m_pTable->at( n ); - OUString aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper()); + OUString aEntry = formatDateTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper(), false); m_xVersionBox->append(weld::toId(pInfo), aEntry); auto nLastRow = m_xVersionBox->n_children() - 1; m_xVersionBox->set_text(nLastRow, pInfo->aAuthor, 1);