summaryrefslogtreecommitdiff
path: root/oox/source/drawingml/textfield.cxx
diff options
context:
space:
mode:
authorRosemary Sebastian <rosemaryseb8@gmail.com>2016-01-25 12:40:35 +0530
committerKatarina Behrens <Katarina.Behrens@cib.de>2016-01-27 22:41:58 +0000
commit2b0669eec0d86e973a7d8def8744c522bbf8af8b (patch)
tree16f619b45f28da40ad83bfdc0bce326ecbe33715 /oox/source/drawingml/textfield.cxx
parent678ce97d38167c886697d5e842eeace6bc25ca15 (diff)
Format the datetime fields properly on import
Make sure that, after export, the datetime fields in impress are imported with the correct number format. Change-Id: I5565fef69b3a62e7dd59ea0d39cde151fb0af976 Reviewed-on: https://gerrit.libreoffice.org/21610 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'oox/source/drawingml/textfield.cxx')
-rw-r--r--oox/source/drawingml/textfield.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx
index 135ef3140bf7..7c5fba03b1c2 100644
--- a/oox/source/drawingml/textfield.cxx
+++ b/oox/source/drawingml/textfield.cxx
@@ -60,7 +60,6 @@ void lclCreateTextFields( std::list< Reference< XTextField > > & aFields,
{
Reference< XInterface > xIface;
Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW );
-
if( sType.startsWith("datetime"))
{
OString s = OUStringToOString( sType, RTL_TEXTENCODING_UTF8);
@@ -69,6 +68,7 @@ void lclCreateTextFields( std::list< Reference< XTextField > > & aFields,
{
bool bIsDate = true;
int idx = p.toInt32();
+ sal_uInt16 nNumFmt;
// OSL_TRACE( "OOX: p = %s, %d", p.pData->buffer, idx );
xIface = xFactory->createInstance( "com.sun.star.text.TextField.DateTime" );
aFields.push_back( Reference< XTextField > ( xIface, UNO_QUERY ) );
@@ -79,10 +79,14 @@ void lclCreateTextFields( std::list< Reference< XTextField > > & aFields,
{
case 1: // Date dd/mm/yyyy
// this is the default format...
+ nNumFmt = 5;
+ xProps->setPropertyValue("NumberFormat", makeAny(nNumFmt));
break;
case 2: // Date Day, Month dd, yyyy
break;
case 3: // Date dd Month yyyy
+ nNumFmt = 3;
+ xProps->setPropertyValue("NumberFormat", makeAny(nNumFmt));
break;
case 4: // Date Month dd, yyyy
break;
@@ -100,17 +104,28 @@ void lclCreateTextFields( std::list< Reference< XTextField > > & aFields,
break;
case 10: // Time H:MM
bIsDate = false;
+ nNumFmt = 3;
+ xProps->setPropertyValue("NumberFormat", makeAny(nNumFmt));
break;
case 11: // Time H:MM:SS
bIsDate = false;
// this is the default format
+ nNumFmt = 2;
+ xProps->setPropertyValue("NumberFormat", makeAny(nNumFmt));
break;
case 12: // Time H:MM PM
bIsDate = false;
+ nNumFmt = 6;
+ xProps->setPropertyValue("NumberFormat", makeAny(nNumFmt));
break;
case 13: // Time H:MM:SS PM
bIsDate = false;
+ nNumFmt = 7;
+ xProps->setPropertyValue("NumberFormat", makeAny(nNumFmt));
break;
+ default:
+ nNumFmt = 2;
+ xProps->setPropertyValue("NumberFormat", makeAny(nNumFmt));
}
xProps->setPropertyValue( "IsDate", makeAny( bIsDate ) );
xProps->setPropertyValue( "IsFixed", makeAny( false ) );
@@ -190,4 +205,4 @@ sal_Int32 TextField::insertAt(
} }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file