attributelist.cxx (ca5ec200) attributelist.cxx (f42644c3)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 8 unchanged lines hidden (view full) ---

17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24#include "oox/helper/attributelist.hxx"
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 8 unchanged lines hidden (view full) ---

17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24#include "oox/helper/attributelist.hxx"
25#include "oox/helper/datetimehelper.hxx"
25
26#include <osl/diagnose.h>
27#include <rtl/ustrbuf.hxx>
28#include "oox/token/tokenmap.hxx"
29
30namespace oox {
31
32// ============================================================================

--- 195 unchanged lines hidden (view full) ---

228 OptValue< sal_Int32 > onValue = getInteger( nAttrToken );
229 return OptValue< bool >( onValue.has(), onValue.get() != 0 );
230}
231
232OptValue< DateTime > AttributeList::getDateTime( sal_Int32 nAttrToken ) const
233{
234 OUString aValue = mxAttribs->getOptionalValue( nAttrToken );
235 DateTime aDateTime;
26
27#include <osl/diagnose.h>
28#include <rtl/ustrbuf.hxx>
29#include "oox/token/tokenmap.hxx"
30
31namespace oox {
32
33// ============================================================================

--- 195 unchanged lines hidden (view full) ---

229 OptValue< sal_Int32 > onValue = getInteger( nAttrToken );
230 return OptValue< bool >( onValue.has(), onValue.get() != 0 );
231}
232
233OptValue< DateTime > AttributeList::getDateTime( sal_Int32 nAttrToken ) const
234{
235 OUString aValue = mxAttribs->getOptionalValue( nAttrToken );
236 DateTime aDateTime;
236 bool bValid = (aValue.getLength() == 19) && (aValue[ 4 ] == '-') && (aValue[ 7 ] == '-') &&
237 (aValue[ 10 ] == 'T') && (aValue[ 13 ] == ':') && (aValue[ 16 ] == ':');
238 if( bValid )
239 {
240 aDateTime.Year = static_cast< sal_uInt16 >( aValue.copy( 0, 4 ).toInt32() );
241 aDateTime.Month = static_cast< sal_uInt16 >( aValue.copy( 5, 2 ).toInt32() );
242 aDateTime.Day = static_cast< sal_uInt16 >( aValue.copy( 8, 2 ).toInt32() );
243 aDateTime.Hours = static_cast< sal_uInt16 >( aValue.copy( 11, 2 ).toInt32() );
244 aDateTime.Minutes = static_cast< sal_uInt16 >( aValue.copy( 14, 2 ).toInt32() );
245 aDateTime.Seconds = static_cast< sal_uInt16 >( aValue.copy( 17, 2 ).toInt32() );
246 }
237 bool bValid = parseISO8601DateTime( aValue, aDateTime );
247 return OptValue< DateTime >( bValid, aDateTime );
248}
249
250// defaulted return values ----------------------------------------------------
251
252sal_Int32 AttributeList::getToken( sal_Int32 nAttrToken, sal_Int32 nDefault ) const
253{
254 return mxAttribs->getOptionalValueToken( nAttrToken, nDefault );

--- 67 unchanged lines hidden ---
238 return OptValue< DateTime >( bValid, aDateTime );
239}
240
241// defaulted return values ----------------------------------------------------
242
243sal_Int32 AttributeList::getToken( sal_Int32 nAttrToken, sal_Int32 nDefault ) const
244{
245 return mxAttribs->getOptionalValueToken( nAttrToken, nDefault );

--- 67 unchanged lines hidden ---