Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / writerfilter / source / dmapper / TrackChangesHandler.cxx
blob71629000ed49aba337bdda2ee19636f896bc7055
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 "TrackChangesHandler.hxx"
10 #include "PropertyMap.hxx"
11 #include "ConversionHelper.hxx"
12 #include <ooxml/resourceids.hxx>
13 #include <oox/token/tokens.hxx>
14 #include <osl/diagnose.h>
16 namespace writerfilter {
17 namespace 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 uno::Sequence< beans::PropertyValue > aRedlineProperties(3);
61 beans::PropertyValue* pRedlineProperties = aRedlineProperties.getArray();
63 OUString sType;
64 switch ( m_pRedlineParams->m_nToken & 0xffff )
66 case XML_tableRowInsert:
67 sType = getPropertyName( PROP_TABLE_ROW_INSERT );
68 break;
69 case XML_tableRowDelete:
70 sType = getPropertyName( PROP_TABLE_ROW_DELETE );
71 break;
72 case XML_tableCellInsert:
73 sType = getPropertyName( PROP_TABLE_CELL_INSERT );
74 break;
75 case XML_tableCellDelete:
76 sType = getPropertyName( PROP_TABLE_CELL_DELETE );
77 break;
80 pRedlineProperties[0].Name = getPropertyName( PROP_REDLINE_TYPE );
81 pRedlineProperties[0].Value <<= sType;
82 pRedlineProperties[1].Name = getPropertyName( PROP_REDLINE_AUTHOR );
83 pRedlineProperties[1].Value <<= m_pRedlineParams->m_sAuthor;
84 pRedlineProperties[2].Name = getPropertyName( PROP_REDLINE_DATE_TIME );
85 pRedlineProperties[2].Value <<= ConversionHelper::ConvertDateStringToDateTime( m_pRedlineParams->m_sDate );
86 //pRedlineProperties[3].Name = getPropertyName( PROP_REDLINE_REVERT_PROPERTIES );
87 //pRedlineProperties[3].Value <<= pRedline->m_aRevertProperties;
89 return aRedlineProperties;
92 void TrackChangesHandler::lcl_sprm(Sprm &) {}
94 } //namespace dmapper
95 } //namespace writerfilter
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */