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")
26 m_pRedlineParams
= RedlineParamsPtr( new RedlineParams() );
27 m_pRedlineParams
->m_nToken
= nToken
;
31 TrackChangesHandler::~TrackChangesHandler()
36 void TrackChangesHandler::lcl_attribute(Id rName
, Value
& rVal
)
38 sal_Int32 nIntValue
= rVal
.getInt();
39 OUString sStringValue
= rVal
.getString();
43 case NS_ooxml::LN_CT_TrackChange_author
:
45 m_pRedlineParams
->m_sAuthor
= sStringValue
;
48 case NS_ooxml::LN_CT_TrackChange_date
:
50 m_pRedlineParams
->m_sDate
= sStringValue
;
53 case NS_ooxml::LN_CT_Markup_id
:
55 m_pRedlineParams
->m_nId
= nIntValue
;
59 OSL_FAIL( "unknown attribute");
63 uno::Sequence
<beans::PropertyValue
> TrackChangesHandler::getRedlineProperties() const
65 uno::Sequence
< beans::PropertyValue
> aRedlineProperties(3);
66 beans::PropertyValue
* pRedlineProperties
= aRedlineProperties
.getArray();
68 PropertyNameSupplier
& rPropNameSupplier
= PropertyNameSupplier::GetPropertyNameSupplier();
71 switch ( m_pRedlineParams
->m_nToken
& 0xffff )
73 case XML_tableRowInsert
:
74 sType
= rPropNameSupplier
.GetName( PROP_TABLE_ROW_INSERT
);
76 case XML_tableRowDelete
:
77 sType
= rPropNameSupplier
.GetName( PROP_TABLE_ROW_DELETE
);
79 case XML_tableCellInsert
:
80 sType
= rPropNameSupplier
.GetName( PROP_TABLE_CELL_INSERT
);
82 case XML_tableCellDelete
:
83 sType
= rPropNameSupplier
.GetName( PROP_TABLE_CELL_DELETE
);
87 pRedlineProperties
[0].Name
= rPropNameSupplier
.GetName( PROP_REDLINE_TYPE
);
88 pRedlineProperties
[0].Value
<<= sType
;
89 pRedlineProperties
[1].Name
= rPropNameSupplier
.GetName( PROP_REDLINE_AUTHOR
);
90 pRedlineProperties
[1].Value
<<= m_pRedlineParams
->m_sAuthor
;
91 pRedlineProperties
[2].Name
= rPropNameSupplier
.GetName( PROP_REDLINE_DATE_TIME
);
92 pRedlineProperties
[2].Value
<<= ConversionHelper::ConvertDateStringToDateTime( m_pRedlineParams
->m_sDate
);
93 //pRedlineProperties[3].Name = rPropNameSupplier.GetName( PROP_REDLINE_REVERT_PROPERTIES );
94 //pRedlineProperties[3].Value <<= pRedline->m_aRevertProperties;
96 return aRedlineProperties
;
99 void TrackChangesHandler::lcl_sprm(Sprm
& rSprm
)
104 } //namespace dmapper
105 } //namespace writerfilter
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */