/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
/** instantiate the textfields. Because of semantics difference between * OpenXML and OpenOffice, some OpenXML field might cause two fields to be created. * @param aFields the created fields. The list is empty if no field has been created. * @param xModel the model * @param sType the OpenXML field type.
*/ void lclCreateTextFields( std::vector< Reference< XTextField > > & aFields, const Reference< XModel > & xModel, std::u16string_view sType )
{
Reference< XInterface > xIface;
Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW ); if( o3tl::starts_with(sType, u"datetime"))
{ auto p = sType.substr(8); try
{ if (o3tl::starts_with(p, u"'"))
{
xIface = xFactory->createInstance( u"com.sun.star.text.TextField.Custom"_ustr );
aFields.emplace_back( xIface, UNO_QUERY ); return;
}
switch( nDateTimeNum )
{ case 1: // Date dd/mm/yyyy case 8: // DateTime dd/mm/yyyy H:MM PM case 9: // DateTime dd/mm/yyyy H:MM:SS PM return SvxDateFormat::B; case 2: // Date Day, Month dd, yyyy return SvxDateFormat::StdBig; case 3: // Date dd Month yyyy case 4: // Date Month dd, yyyy - no exact map case 6: // Date Month yy - no exact map return SvxDateFormat::D; case 5: // Date dd-Mon-yy - no exact map case 7: // Date Mon-yy - no exact map return SvxDateFormat::C; case 10: // Time H:MM - not a date format case 11: // Time H:MM:SS - not a date format case 12: // Time H:MM PM - not a date format case 13: // Time H:MM:SS PM - not a date format default: return SvxDateFormat::AppDefault;
}
}
SvxTimeFormat TextField::getLOTimeFormat(std::u16string_view rDateTimeType)
{ auto aDateTimeNum = rDateTimeType.substr(8); int nDateTimeNum = o3tl::toInt32(aDateTimeNum);
switch( nDateTimeNum )
{ case 8: // DateTime dd/mm/yyyy H:MM PM case 12: // Time H:MM PM return SvxTimeFormat::HH12_MM; case 9: // DateTime dd/mm/yyyy H:MM:SS PM case 13: // Time H:MM:SS PM return SvxTimeFormat::HH12_MM_SS; case 10: // Time H:MM return SvxTimeFormat::HH24_MM; case 11: // Time H:MM:SS return SvxTimeFormat::Standard; case 1: // Date dd/mm/yyyy case 2: // Date Day, Month dd, yyyy case 3: // Date dd Month yyyy case 4: // Date Month dd, yyyy case 5: // Date dd-Mon-yy case 6: // Date Month yy case 7: // Date Mon-yy default: return SvxTimeFormat::AppDefault;
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.