1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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
{
19 using namespace ::com::sun::star
;
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();
41 case NS_ooxml::LN_CT_TrackChange_author
:
43 m_pRedlineParams
->m_sAuthor
= sStringValue
;
46 case NS_ooxml::LN_CT_TrackChange_date
:
48 m_pRedlineParams
->m_sDate
= sStringValue
;
51 case NS_ooxml::LN_CT_Markup_id
:
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();
64 switch ( m_pRedlineParams
->m_nToken
& 0xffff )
66 case XML_tableRowInsert
:
67 sType
= getPropertyName( PROP_TABLE_ROW_INSERT
);
69 case XML_tableRowDelete
:
70 sType
= getPropertyName( PROP_TABLE_ROW_DELETE
);
72 case XML_tableCellInsert
:
73 sType
= getPropertyName( PROP_TABLE_CELL_INSERT
);
75 case XML_tableCellDelete
:
76 sType
= getPropertyName( PROP_TABLE_CELL_DELETE
);
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
&) {}
95 } //namespace writerfilter
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */