summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-04-13 16:49:27 +0100
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2022-04-14 11:12:44 +0200
commit5d9ba65897d2ba2998e43e97b25dbb9a560a16a1 (patch)
treeba2864d56be56d59f73a85db6a31b37a75581157
parent7fc871299080427587307932c505d3ae93d6a357 (diff)
Resolves: tdf#141625 give enough space to see full date+time
Change-Id: I31193783231f27494ed1507faa143697e8facc30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132987 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.cxx7
-rw-r--r--include/sfx2/dialoghelper.hxx5
-rw-r--r--sc/source/ui/miscdlgs/sharedocdlg.cxx6
-rw-r--r--sfx2/source/dialog/dialoghelper.cxx8
-rw-r--r--sfx2/source/dialog/versdlg.cxx8
5 files changed, 21 insertions, 13 deletions
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
index 6c7effde6707..3bb247a7075b 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>
@@ -558,6 +559,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 ec019fb70655..294a69e93c2b 100644
--- a/sc/source/ui/miscdlgs/sharedocdlg.cxx
+++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx
@@ -39,7 +39,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
{
@@ -151,7 +151,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);
@@ -201,7 +201,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 6de0d866c30b..53ea62b0eccd 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(OUString::number(reinterpret_cast<sal_Int64>(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(OUString::number(reinterpret_cast<sal_Int64>(pInfo)), aEntry);
auto nLastRow = m_xVersionBox->n_children() - 1;
m_xVersionBox->set_text(nLastRow, pInfo->aAuthor, 1);