writerfilter/source/dmapper/DomainMapper.cxx | 18 ++++++++++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 10 +++++++++- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 4 ++++ writerfilter/source/dmapper/PropertyIds.cxx | 1 + writerfilter/source/dmapper/PropertyIds.hxx | 1 + 5 files changed, 33 insertions(+), 1 deletion(-)
New commits: commit 75236ba0aa6089dd6bad42cfee627a997a0a4238 Author: Adam Co <rattles2...@gmail.com> Date: Tue Dec 3 12:27:28 2013 +0200 DOCX Import of 'run formatting track changes' This patch adds support for the import of 'run formatting track changes' in the DOCX filter. It detects the 'rPrChange'->'rPr' node and stores all the properties that it processes in the redline object. Reviewed on: https://gerrit.libreoffice.org/6908 Change-Id: Ia60d7c2c4cbbad1afb8fd33cfdbd61b2c9433e09 diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 26dfa11..4633ced 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3475,6 +3475,24 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType m_pImpl->RemoveCurrentRedline( ); break; case NS_ooxml::LN_CT_RPrChange_rPr: + // Push all the current 'Character' properties to the stack, so that we don't store them + // as 'tracked changes' by mistake + m_pImpl->PushProperties(CONTEXT_CHARACTER); + + // Resolve all the properties that are under the 'rPrChange'->'rPr' XML node + resolveSprmProps(*this, rSprm ); + + if (m_pImpl->GetTopContext()) + { + // Get all the properties that were processed in the 'rPrChange'->'rPr' XML node + uno::Sequence< beans::PropertyValue > currentRedlineRevertProperties = m_pImpl->GetTopContext()->GetPropertyValues(); + + // Store these properties in the current redline object + m_pImpl->SetCurrentRedlineRevertProperties( currentRedlineRevertProperties ); + } + + // Pop back out the character properties that were on the run + m_pImpl->PopProperties(CONTEXT_CHARACTER); break; case NS_ooxml::LN_object: { diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 1e4bdf4..502cae5 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1566,12 +1566,14 @@ void DomainMapper_Impl::CreateRedline( uno::Reference< text::XTextRange > xRange break; } uno::Reference < text::XRedline > xRedline( xRange, uno::UNO_QUERY_THROW ); - beans::PropertyValues aRedlineProperties( 2 ); + beans::PropertyValues aRedlineProperties( 3 ); beans::PropertyValue * pRedlineProperties = aRedlineProperties.getArray( ); pRedlineProperties[0].Name = rPropNameSupplier.GetName( PROP_REDLINE_AUTHOR ); pRedlineProperties[0].Value <<= pRedline->m_sAuthor; pRedlineProperties[1].Name = rPropNameSupplier.GetName( PROP_REDLINE_DATE_TIME ); pRedlineProperties[1].Value <<= lcl_DateStringToDateTime( pRedline->m_sDate ); + pRedlineProperties[2].Name = rPropNameSupplier.GetName( PROP_REDLINE_REVERT_PROPERTIES ); + pRedlineProperties[2].Value <<= pRedline->m_aRevertProperties; xRedline->makeRedline( sType, aRedlineProperties ); } @@ -3934,6 +3936,12 @@ void DomainMapper_Impl::SetCurrentRedlineToken( sal_Int32 nToken ) pCurrent->m_nToken = nToken; } +void DomainMapper_Impl::SetCurrentRedlineRevertProperties( uno::Sequence<beans::PropertyValue> aProperties ) +{ + RedlineParamsPtr pCurrent( GetTopRedline( ) ); + if ( pCurrent.get( ) ) + pCurrent->m_aRevertProperties = aProperties; +} void DomainMapper_Impl::RemoveCurrentRedline( ) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index b13924b..10943c4 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -259,6 +259,9 @@ struct RedlineParams OUString m_sDate; sal_Int32 m_nId; sal_Int32 m_nToken; + + /// This can hold properties of runs that had formatted 'track changes' properties + uno::Sequence<beans::PropertyValue> m_aRevertProperties; }; typedef boost::shared_ptr< RedlineParams > RedlineParamsPtr; @@ -675,6 +678,7 @@ public: void SetCurrentRedlineDate( OUString sDate ); void SetCurrentRedlineId( sal_Int32 nId ); void SetCurrentRedlineToken( sal_Int32 nToken ); + void SetCurrentRedlineRevertProperties( uno::Sequence<beans::PropertyValue> aProperties ); void RemoveCurrentRedline( ); void ResetParaRedline( ); void SetCurrentRedlineInitials( OUString sInitials ); diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index 94568ae..52d34c4 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -274,6 +274,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_REDLINE_DATE_TIME : sName = "RedlineDateTime"; break; case PROP_REDLINE_COMMENT : sName = "RedlineComment"; break; case PROP_REDLINE_TYPE : sName = "RedlineType"; break; + case PROP_REDLINE_REVERT_PROPERTIES: sName = "RedlineRevertProperties"; break; case PROP_REDLINE_SUCCESSOR_DATA: sName = "RedlineSuccessorData"; break; case PROP_REDLINE_IDENTIFIER : sName = "RedlineIdentifier"; break; case PROP_SIZE_PROTECTED : sName = "SizeProtected"; break; diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index cb6eff0..5d92480 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -243,6 +243,7 @@ enum PropertyIds ,PROP_REDLINE_IDENTIFIER ,PROP_REDLINE_SUCCESSOR_DATA ,PROP_REDLINE_TYPE + ,PROP_REDLINE_REVERT_PROPERTIES ,PROP_REFERENCE_FIELD_PART ,PROP_REFERENCE_FIELD_SOURCE ,PROP_RESTART_AT_EACH_PAGE _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits