oox/source/token/tokens.txt                       |    1 
 writerfilter/source/dmapper/DomainMapper.cxx      |   28 ++++++++++++++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    6 +++-
 writerfilter/source/dmapper/PropertyIds.cxx       |    1 
 writerfilter/source/dmapper/PropertyIds.hxx       |    1 
 5 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit ae7f8bed4bc4d7490a158c14d077c5323bd50466
Author: Adam Co <rattles2...@gmail.com>
Date:   Sun Dec 8 16:56:21 2013 +0200

    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 <vmik...@collabora.co.uk>
    Tested-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index fbdd2fc..ca7f69e 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -280,6 +280,7 @@ Override
 Page
 Pages
 ParagraphAlign
+ParagraphFormat
 Paragraphs
 PartName
 PasswordChar
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index ff90bc5..5b38153 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 07d7df2..f726ed0 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 52d34c4..09d8710 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 5d92480..55b8a48 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
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to