Avoid potential negative array index access to cached text.
[LibreOffice.git] / writerfilter / source / dmapper / TrackChangesHandler.cxx
blob47a52d6df69580e79c7be066c8fbfe538888f989
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9 #include <comphelper/propertyvalue.hxx>
10 #include "TrackChangesHandler.hxx"
11 #include "PropertyMap.hxx"
12 #include "ConversionHelper.hxx"
13 #include <ooxml/resourceids.hxx>
14 #include <oox/token/tokens.hxx>
15 #include <osl/diagnose.h>
17 namespace writerfilter::dmapper {
19 using namespace ::com::sun::star;
20 using namespace oox;
23 TrackChangesHandler::TrackChangesHandler( sal_Int32 nToken ) :
24 LoggedProperties("TrackChangesHandler"),
25 m_pRedlineParams(new RedlineParams)
27 m_pRedlineParams->m_nToken = nToken;
31 TrackChangesHandler::~TrackChangesHandler()
36 void TrackChangesHandler::lcl_attribute(Id rName, Value & rVal)
38 OUString sStringValue = rVal.getString();
39 switch( rName )
41 case NS_ooxml::LN_CT_TrackChange_author:
43 m_pRedlineParams->m_sAuthor = sStringValue;
45 break;
46 case NS_ooxml::LN_CT_TrackChange_date:
48 m_pRedlineParams->m_sDate = sStringValue;
50 break;
51 case NS_ooxml::LN_CT_Markup_id:
52 break;
53 default:
54 OSL_FAIL( "unknown attribute");
58 uno::Sequence<beans::PropertyValue> TrackChangesHandler::getRedlineProperties() const
60 OUString sType;
61 switch ( m_pRedlineParams->m_nToken & 0xffff )
63 case XML_tableRowInsert:
64 sType = getPropertyName( PROP_TABLE_ROW_INSERT );
65 break;
66 case XML_tableRowDelete:
67 sType = getPropertyName( PROP_TABLE_ROW_DELETE );
68 break;
69 case XML_tableCellInsert:
70 sType = getPropertyName( PROP_TABLE_CELL_INSERT );
71 break;
72 case XML_tableCellDelete:
73 sType = getPropertyName( PROP_TABLE_CELL_DELETE );
74 break;
76 return {
77 comphelper::makePropertyValue(getPropertyName(PROP_REDLINE_TYPE ), uno::Any(sType)),
78 comphelper::makePropertyValue(getPropertyName(PROP_REDLINE_AUTHOR), uno::Any(m_pRedlineParams->m_sAuthor)),
79 comphelper::makePropertyValue(getPropertyName(PROP_REDLINE_DATE_TIME), uno::Any(ConversionHelper::ConvertDateStringToDateTime( m_pRedlineParams->m_sDate )))
80 //comphelper::makePropertyValue(getPropertyName(PROP_REDLINE_REVERT_PROPERTIES), uno::Any(pRedline->m_aRevertProperties))
84 void TrackChangesHandler::lcl_sprm(Sprm &) {}
86 } //namespace writerfilter::dmapper
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */