[Libreoffice-commits] core.git: sw/qa writerfilter/source

Vinaya Mandke vinaya.mandke at synerzip.com
Wed Mar 5 02:07:48 PST 2014


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx          |    2 +
 writerfilter/source/dmapper/DomainMapper.cxx      |   23 ++++++++++++++++++++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    6 ++++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    1 
 4 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 7691532a89a94120c220f77e8cc6c42615e3d7c4
Author: Vinaya Mandke <vinaya.mandke at synerzip.com>
Date:   Mon Mar 3 16:31:00 2014 +0530

    fdo#73596 [DOCX] Index:distance between columns
    
    Import the "w:space" or the distance between multiple
    columns of an Index
    Modifies existing UT for the same
    
    Reviewed on:
    	https://gerrit.libreoffice.org/8444
    
    Change-Id: I6d38e106208524cb22d0b98b0071360865e64bc0

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4c1ba4f..920f33a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2755,6 +2755,8 @@ DECLARE_OOXMLEXPORT_TEST(testAlphabeticalIndex_MultipleColumns,"alphabeticalInde
     // check for section breaks after and before the Index Section
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:sectPr/w:type","val","continuous");
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[9]/w:pPr/w:sectPr/w:type","val","continuous");
+    // check for "w:space" attribute for the columns in Section Properties
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[9]/w:pPr/w:sectPr/w:cols/w:col[1]","space","720");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testPageref, "testPageref.docx")
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index ccc6a85..6e0f4e3 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -57,6 +57,7 @@
 #include <com/sun/star/text/WritingMode.hpp>
 #include <com/sun/star/text/WritingMode2.hpp>
 #include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/text/XTextColumns.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <comphelper/types.hxx>
 #include <comphelper/storagehelper.hxx>
@@ -1912,6 +1913,24 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
                     pSectionContext->SetSeparatorLine( pSectHdl->IsSeparator() );
                 }
             }
+
+            else if ( pSectionContext )
+            {
+                FieldContextPtr pContext = m_pImpl->GetTopFieldContext();
+                uno::Reference< beans::XPropertySet > xTOC = pContext->GetTOC();
+                if( xTOC.is() )
+                {
+                    uno::Reference<text::XTextColumns> xTextColumns;
+                    xTOC->getPropertyValue(rPropNameSupplier.GetName( PROP_TEXT_COLUMNS )) >>= xTextColumns;
+                    if (xTextColumns.is())
+                    {
+                        uno::Reference< beans::XPropertySet > xColumnPropSet( xTextColumns, uno::UNO_QUERY_THROW );
+                        if ( xColumnPropSet.is() )
+                            xColumnPropSet->setPropertyValue( rPropNameSupplier.GetName( PROP_AUTOMATIC_DISTANCE ), uno::makeAny( pSectHdl->GetSpace() ));
+                        xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xTextColumns ) );
+                    }
+                }
+            }
         }
     }
     break;
@@ -2405,7 +2424,7 @@ void DomainMapper::data(const sal_uInt8* /*buf*/, size_t /*len*/,
 
 void DomainMapper::lcl_startSectionGroup()
 {
-    if (!m_pImpl->isInIndexContext() || !m_pImpl->isInBibliographyContext())
+    if (!m_pImpl->isInIndexContext() && !m_pImpl->isInBibliographyContext())
     {
         m_pImpl->PushProperties(CONTEXT_SECTION);
     }
@@ -2413,7 +2432,7 @@ void DomainMapper::lcl_startSectionGroup()
 
 void DomainMapper::lcl_endSectionGroup()
 {
-    if (!m_pImpl->isInIndexContext() || !m_pImpl->isInBibliographyContext())
+    if (!m_pImpl->isInIndexContext() && !m_pImpl->isInBibliographyContext())
     {
         m_pImpl->CheckUnregisteredFrameConversion();
         m_pImpl->ExecuteFrameConversion();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3501098..0d08a38 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -464,7 +464,11 @@ uno::Reference< text::XTextAppend >  DomainMapper_Impl::GetTopTextAppend()
     return m_aTextAppendStack.top().xTextAppend;
 }
 
-
+FieldContextPtr  DomainMapper_Impl::GetTopFieldContext()
+{
+    SAL_WARN_IF(m_aFieldStack.empty(), "writerfilter", "Field stack is empty");
+    return m_aFieldStack.top();
+}
 
 void DomainMapper_Impl::InitTabStopFromStyle( const uno::Sequence< style::TabStop >& rInitTabStops )
 {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index ddd7775..6c7cac5 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -487,6 +487,7 @@ public:
     PropertyMapPtr GetTopContextOfType(ContextType eId);
 
     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend >  GetTopTextAppend();
+    FieldContextPtr GetTopFieldContext();
 
     FontTablePtr GetFontTable()
     {


More information about the Libreoffice-commits mailing list