summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorAdam Co <rattles2013@gmail.com>2013-12-08 16:56:21 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-12-16 09:59:15 +0000
commitae7f8bed4bc4d7490a158c14d077c5323bd50466 (patch)
tree83c5b7febca5b50e34b896b48e0b6148f85a0c71 /writerfilter
parentf02abd7182493e786377fe324c97572af39c0a9f (diff)
DOCX Import of 'paragraph formatting track changes'
This patch adds support for the import of 'paragraph formatting track changes' in the DOCX filter. It detects the 'pPrChange'->'pPr' node and stores all the properties that it processes in the redline object. Change-Id: I3cce83dad4d46c2216ca36393b6572f0fc9d2ed7 Reviewed-on: https://gerrit.libreoffice.org/6992 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx28
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx6
-rw-r--r--writerfilter/source/dmapper/PropertyIds.cxx1
-rw-r--r--writerfilter/source/dmapper/PropertyIds.hxx1
4 files changed, 35 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index ff90bc55927d..5b38153e22c9 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3454,10 +3454,17 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
break;
case NS_ooxml::LN_paratrackchange:
m_pImpl->StartParaMarkerChange( );
+ case NS_ooxml::LN_CT_PPr_pPrChange:
case NS_ooxml::LN_trackchange:
case NS_ooxml::LN_EG_RPrContent_rPrChange:
{
m_pImpl->AddNewRedline( );
+
+ if (nSprmId == NS_ooxml::LN_CT_PPr_pPrChange)
+ {
+ m_pImpl->SetCurrentRedlineToken( ooxml::OOXML_ParagraphFormat );
+ }
+
resolveSprmProps(*this, rSprm );
// now the properties author, date and id should be available
sal_Int32 nToken = m_pImpl->GetCurrentRedlineToken();
@@ -3466,6 +3473,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
case ooxml::OOXML_mod :
case ooxml::OOXML_ins :
case ooxml::OOXML_del :
+ case ooxml::OOXML_ParagraphFormat :
break;
default: OSL_FAIL( "redline token other than mod, ins or del" );
}
@@ -3495,6 +3503,26 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
// Pop back out the character properties that were on the run
m_pImpl->PopProperties(CONTEXT_CHARACTER);
break;
+ case NS_ooxml::LN_CT_PPrChange_pPr:
+ // Push all the current 'Paragraph' properties to the stack, so that we don't store them
+ // as 'tracked changes' by mistake
+ m_pImpl->PushProperties(CONTEXT_PARAGRAPH);
+
+ // Resolve all the properties that are under the 'pPrChange'->'pPr' XML node
+ resolveSprmProps(*this, rSprm );
+
+ if (m_pImpl->GetTopContext())
+ {
+ // Get all the properties that were processed in the 'pPrChange'->'pPr' 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_PARAGRAPH);
+ break;
case NS_ooxml::LN_object:
{
writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 07d7df2e1093..f726ed0d4aed 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1564,6 +1564,9 @@ void DomainMapper_Impl::CreateRedline( uno::Reference< text::XTextRange > xRange
case ooxml::OOXML_del:
sType = rPropNameSupplier.GetName( PROP_DELETE );
break;
+ case ooxml::OOXML_ParagraphFormat:
+ sType = rPropNameSupplier.GetName( PROP_PARAGRAPH_FORMAT );
+ break;
}
uno::Reference < text::XRedline > xRedline( xRange, uno::UNO_QUERY_THROW );
beans::PropertyValues aRedlineProperties( 3 );
@@ -1602,8 +1605,9 @@ void DomainMapper_Impl::CheckRedline( uno::Reference< text::XTextRange > xRange
CreateRedline( xRange, *pIt );
// Adding the non-mod redlines to the temporary vector
- if ( pIt->get( ) && ( ( *pIt )->m_nToken & 0xffff ) != ooxml::OOXML_mod )
+ if ( pIt->get( ) )
{
+ if ( ( ( *pIt )->m_nToken & 0xffff ) != ooxml::OOXML_mod && ( ( *pIt )->m_nToken & 0xffff ) != ooxml::OOXML_ParagraphFormat)
aCleaned.push_back( *pIt );
}
}
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 52d34c4c3a96..09d8710b575b 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -313,6 +313,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_FORMAT : sName = "Format"; break;
case PROP_INSERT : sName = "Insert"; break;
case PROP_DELETE : sName = "Delete"; break;
+ case PROP_PARAGRAPH_FORMAT : sName = "ParagraphFormat"; break;
case PROP_STREAM_NAME: sName = "StreamName"; break;
case PROP_BITMAP : sName = "Bitmap"; break;
case PROP_IS_DATE : sName = "IsDate"; break;
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index 5d92480d8bbd..55b8a48c2bf6 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -210,6 +210,7 @@ enum PropertyIds
,PROP_PAGE_DESC_NAME
,PROP_PAGE_NUMBER_OFFSET
,PROP_PAGE_TOGGLE
+ ,PROP_PARAGRAPH_FORMAT
,PROP_PARAGRAPH_STYLES
,PROP_PARAGRAPH_STYLE_NAME
,PROP_PARA_ADJUST