summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir@collabora.com>2021-10-24 01:38:57 +0300
committerMiklos Vajna <vmiklos@collabora.com>2021-11-22 14:05:53 +0100
commitd3651f96d45405d6d142bf97084c377e395945c3 (patch)
treef7ed1a8218bbbd0fe33f25a89c6479d37389f625
parent23a6b9bd988fabeceb58c5367bbb0b11bac1cb9a (diff)
tdf#143316: fix datetime footer regression on mso2010
Exports language in run properties of the datetime footer. And also overrides the placeholder "Date" text with formatted datetime text if the datetime footer is a nonfixed one. Fixes regression from: 166671f4aa19deec47c10a220ae1d29fa57faa93 (tdf#59323: pptx import: import footer fields as properties) Change-Id: Ib888e5cf51ea7e14fb13278e96610051e1e5fe5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124123 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx22
1 files changed, 19 insertions, 3 deletions
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index fbf7525217ff..ec7a16e045e9 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -33,6 +33,7 @@
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <tools/UnitConversion.hxx>
+#include <tools/datetime.hxx>
#include <com/sun/star/animations/TransitionType.hpp>
#include <com/sun/star/animations/TransitionSubType.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
@@ -58,10 +59,16 @@
#include "pptx-animations.hxx"
#include "../ppt/pptanimations.hxx"
+#include <i18nlangtag/languagetag.hxx>
+#include <svl/languageoptions.hxx>
#include <svx/svdpage.hxx>
#include <svx/unoapi.hxx>
+#include <sdmod.hxx>
#include <sdpage.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/settings.hxx>
+
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <utility>
@@ -1188,7 +1195,7 @@ bool PowerPointExport::WriteComments(sal_uInt32 nPageNum)
do
{
Reference< XAnnotation > xAnnotation(xAnnotationEnumeration->nextElement());
- DateTime aDateTime(xAnnotation->getDateTime());
+ util::DateTime aDateTime(xAnnotation->getDateTime());
RealPoint2D aRealPoint2D(xAnnotation->getPosition());
Reference< XText > xText(xAnnotation->getTextRange());
sal_Int32 nLastIndex;
@@ -1756,9 +1763,8 @@ ShapeExport& PowerPointShapeExport::WritePlaceholderReferenceTextBody(
bool bIsDateTimeFixed = false;
xPagePropSet->getPropertyValue("IsDateTimeFixed") >>= bIsDateTimeFixed;
- // Ideally "Date" should be replaced with the formatted date text
- // but since variable datetime overrides the text, this seems fine for now.
OUString aDateTimeText = "Date";
+ const LanguageTag& rLanguageTag = Application::GetSettings().GetLanguageTag();
if(ePageType != LAYOUT && !bIsDateTimeFixed)
{
@@ -1773,6 +1779,13 @@ ShapeExport& PowerPointShapeExport::WritePlaceholderReferenceTextBody(
if (aDateTimeType == "datetime")
aDateTimeType = "datetime1";
+
+ ::DateTime aDateTime( ::DateTime::SYSTEM );
+
+ aDateTimeText = SvxDateTimeField::GetFormatted(
+ aDateTime, aDateTime, eDate,
+ eTime, *(SD_MOD()->GetNumberFormatter()),
+ rLanguageTag.getLanguageType());
}
if(!bIsDateTimeFixed)
@@ -1786,6 +1799,9 @@ ShapeExport& PowerPointShapeExport::WritePlaceholderReferenceTextBody(
mpFS->startElementNS(XML_a, XML_r);
}
+ mpFS->startElementNS(XML_a, XML_rPr, XML_lang, rLanguageTag.getBcp47MS());
+ mpFS->endElementNS(XML_a, XML_rPr);
+
mpFS->startElementNS(XML_a, XML_t);
mpFS->writeEscaped(aDateTimeText);
mpFS->endElementNS(XML_a, XML_t);