Kaydet (Commit) 88fbcba0 authored tarafından Adam Co's avatar Adam Co Kaydeden (comit) Miklos Vajna

Add 'Track Changes Handler' for 'Extra' redlines

This handler will process 'track changes' information for 'extra' redline
objects (such as 'table row insert\delete' redlines)

Reviewed on:
	https://gerrit.libreoffice.org/7802

Change-Id: I8dd0bd70dbdcb3cb7eae76595957817de08c66fc
üst 94429caa
......@@ -107,6 +107,7 @@ $(eval $(call gb_Library_add_exception_objects,writerfilter,\
writerfilter/source/dmapper/GraphicImport \
writerfilter/source/dmapper/LatentStyleHandler \
writerfilter/source/dmapper/MeasureHandler \
writerfilter/source/dmapper/TrackChangesHandler \
writerfilter/source/dmapper/ModelEventListener \
writerfilter/source/dmapper/NumberingManager \
writerfilter/source/dmapper/OLEHandler \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <TrackChangesHandler.hxx>
#include <PropertyMap.hxx>
#include <ConversionHelper.hxx>
#include <ooxml/resourceids.hxx>
#include <ooxml/OOXMLFastTokens.hxx>
#include "dmapperLoggers.hxx"
namespace writerfilter {
namespace dmapper {
using namespace ::com::sun::star;
TrackChangesHandler::TrackChangesHandler( sal_Int32 nToken ) :
LoggedProperties(dmapper_logger, "TrackChangesHandler")
{
m_pRedlineParams = RedlineParamsPtr( new RedlineParams() );
m_pRedlineParams->m_nToken = nToken;
}
TrackChangesHandler::~TrackChangesHandler()
{
}
void TrackChangesHandler::lcl_attribute(Id rName, Value & rVal)
{
sal_Int32 nIntValue = rVal.getInt();
OUString sStringValue = rVal.getString();
(void)rName;
switch( rName )
{
case NS_ooxml::LN_CT_TrackChange_author:
{
m_pRedlineParams->m_sAuthor = sStringValue;
}
break;
case NS_ooxml::LN_CT_TrackChange_date:
{
m_pRedlineParams->m_sDate = sStringValue;
}
break;
case NS_ooxml::LN_CT_Markup_id:
{
m_pRedlineParams->m_nId = nIntValue;
}
break;
default:
OSL_FAIL( "unknown attribute");
}
}
uno::Sequence<beans::PropertyValue> TrackChangesHandler::getRedlineProperties() const
{
uno::Sequence< beans::PropertyValue > aRedlineProperties(3);
beans::PropertyValue* pRedlineProperties = aRedlineProperties.getArray();
PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
OUString sType;
switch ( m_pRedlineParams->m_nToken & 0xffff )
{
case ooxml::OOXML_tableRowInsert:
sType = rPropNameSupplier.GetName( PROP_TABLE_ROW_INSERT );
break;
case ooxml::OOXML_tableRowDelete:
sType = rPropNameSupplier.GetName( PROP_TABLE_ROW_DELETE );
break;
}
pRedlineProperties[0].Name = rPropNameSupplier.GetName( PROP_REDLINE_TYPE );
pRedlineProperties[0].Value <<= sType;
pRedlineProperties[1].Name = rPropNameSupplier.GetName( PROP_REDLINE_AUTHOR );
pRedlineProperties[1].Value <<= m_pRedlineParams->m_sAuthor;
pRedlineProperties[2].Name = rPropNameSupplier.GetName( PROP_REDLINE_DATE_TIME );
pRedlineProperties[2].Value <<= ConversionHelper::ConvertDateStringToDateTime( m_pRedlineParams->m_sDate );
//pRedlineProperties[3].Name = rPropNameSupplier.GetName( PROP_REDLINE_REVERT_PROPERTIES );
//pRedlineProperties[3].Value <<= pRedline->m_aRevertProperties;
return aRedlineProperties;
}
void TrackChangesHandler::lcl_sprm(Sprm & rSprm)
{
(void)rSprm;
}
} //namespace dmapper
} //namespace writerfilter
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_TRACKCHANGESHANDLER_HXX
#define INCLUDED_TRACKCHANGESHANDLER_HXX
#include <WriterFilterDllApi.hxx>
#include <resourcemodel/LoggedResources.hxx>
#include <boost/shared_ptr.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <DomainMapper_Impl.hxx>
namespace writerfilter {
namespace dmapper
{
/** Handler for sprms that contain 'track changes' attributes
- Author
- Date
- ID
(This class is based on work done in 'MeasureHandler')
*/
class TrackChangesHandler : public LoggedProperties
{
RedlineParamsPtr m_pRedlineParams;
// Properties
virtual void lcl_attribute(Id Name, Value & val);
virtual void lcl_sprm(Sprm & sprm);
public:
TrackChangesHandler( sal_Int32 nToken );
virtual ~TrackChangesHandler();
// Compute the UNO properties for the track changes object based on the received tokens.
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> getRedlineProperties() const;
};
typedef boost::shared_ptr
< TrackChangesHandler > TrackChangesHandlerPtr;
}}
#endif //
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment