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

YogeshBharate yogesh.bharate at synerzip.com
Fri Jan 10 09:16:19 PST 2014


 sw/inc/tox.hxx                                          |    1 +
 sw/inc/unomap.hxx                                       |    1 +
 sw/inc/unoprnms.hxx                                     |    1 +
 sw/qa/extras/ooxmlexport/data/preserve_Z_field_TOC.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                |   16 +++++++++++++++-
 sw/source/core/unocore/unoidx.cxx                       |    3 +++
 sw/source/core/unocore/unomap.cxx                       |    2 ++
 sw/source/filter/ww8/docxattributeoutput.cxx            |    6 ++++++
 sw/source/filter/ww8/wrtww8.hxx                         |    1 +
 sw/source/filter/ww8/ww8atr.cxx                         |    7 ++++++-
 sw/source/ui/index/cntex.cxx                            |    1 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx       |   12 +++++++++---
 writerfilter/source/dmapper/PropertyIds.cxx             |    1 +
 writerfilter/source/dmapper/PropertyIds.hxx             |    1 +
 14 files changed, 48 insertions(+), 5 deletions(-)

New commits:
commit ec5903ddb6165f0882aa1ffe4f3ff3e1c1127910
Author: YogeshBharate <yogesh.bharate at synerzip.com>
Date:   Fri Dec 27 17:09:14 2013 +0530

    fdo#69613: Code changes for TOC with flag '\z' should get preserved after RT.
    
    Issue :
    	TOC field flag '\z' was not getting preserved after RT.
    
    Implementation :
    	Provided import & export support for TOC field flag '\z'.
    
    XML file difference :
            In document.xml,
            Before - <w:instrText>
    		     TOC
    		 </w:instrText>
    	After -  <w:instrText>
                         TOC \z \o "1-3" \o "1-3" \h
                     </w:instrText>
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    	writerfilter/source/dmapper/PropertyIds.cxx
    	writerfilter/source/dmapper/PropertyIds.hxx
    Reviewed on:
    	https://gerrit.libreoffice.org/7217
    
    Change-Id: I84f90a722c7afbdf626db2cc60c4e73580891d36

diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 4272755..3f54ad9 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -398,6 +398,7 @@ namespace nsSwTOXElement
     const SwTOXElement TOX_GRAPHIC          = 32;
     const SwTOXElement TOX_FRAME            = 64;
     const SwTOXElement TOX_SEQUENCE         = 128;
+    const SwTOXElement TOX_TABLEADER        = 256;
 }
 
 typedef sal_uInt16 SwTOIOptions;
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index 208592a..d3c983a 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -178,6 +178,7 @@
 #define WID_USE_LEVEL_FROM_SOURCE               1020
 #define WID_LEVEL_FORMAT                        1021
 #define WID_LEVEL_PARAGRAPH_STYLES              1022
+#define WID_HIDE_TABLEADER_PAGENUMBERS          1023
 #define WID_MAIN_ENTRY_CHARACTER_STYLE_NAME     1025
 #define WID_CREATE_FROM_TABLES                  1026
 #define WID_CREATE_FROM_TEXT_FRAMES             1027
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index bc70536..674d984 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -121,6 +121,7 @@
 #define UNO_NAME_CHAR_DIFF_HEIGHT_COMPLEX "CharDiffHeightComplex"
 #define UNO_NAME_CHAR_ESCAPEMENT_HEIGHT "CharEscapementHeight"
 #define UNO_NAME_CHAR_COLOR "CharColor"
+#define UNO_NAME_HIDE_TAB_LEADER_AND_PAGE_NUMBERS "HideTabLeaderAndPageNumber"
 
 #define UNO_NAME_CHAR_FLASH "CharFlash"
 #define UNO_NAME_CHAR_KERNING "CharKerning"
diff --git a/sw/qa/extras/ooxmlexport/data/preserve_Z_field_TOC.docx b/sw/qa/extras/ooxmlexport/data/preserve_Z_field_TOC.docx
new file mode 100644
index 0000000..63ae402
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/preserve_Z_field_TOC.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a3850cb..e570ff1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2315,7 +2315,7 @@ DECLARE_OOXMLEXPORT_TEST(testFieldFlagO,"TOC_field_f.docx")
     xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc,"/w:document/w:body/w:p[2]/w:r[2]/w:instrText");
     xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
     OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content));
-    CPPUNIT_ASSERT(contents.match(" TOC \\f \\o \"1-3\" \\h"));
+    CPPUNIT_ASSERT(contents.match(" TOC \\z \\f \\o \"1-3\" \\h"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTOCFlag_f, "toc_doc.docx")
@@ -2336,6 +2336,20 @@ DECLARE_OOXMLEXPORT_TEST(testTOCFlag_f, "toc_doc.docx")
     OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content));
     CPPUNIT_ASSERT(contents.endsWith("\\h"));
 }
+
+DECLARE_OOXMLEXPORT_TEST(testPreserveZfield,"preserve_Z_field_TOC.docx")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    // FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed
+    // not to insert an empty paragraph before TOC.
+    xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc,"/w:document/w:body/w:p[2]/w:r[2]/w:instrText");
+    xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
+    OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content));
+    CPPUNIT_ASSERT(contents.match(" TOC \\z \\f \\o \"1-3\" \\h"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 3ecbe75..d9c1c17 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -657,6 +657,9 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
         break;
 //          case WID_PARAGRAPH_STYLE_NAMES             :OSL_FAIL("not implemented")
 //          break;
+        case WID_HIDE_TABLEADER_PAGENUMBERS:
+              lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_TABLEADER);
+        break ;
         case WID_CREATE_FROM_CHAPTER:
             rTOXBase.SetFromChapter(lcl_AnyToBool(rValue));
         break;
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 9fe946c..d6c2f52 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1413,6 +1413,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                     _BASE_INDEX_PROPERTIES_
                     { OUString(UNO_NAME_LEVEL), WID_LEVEL                               ,  cppu::UnoType<sal_Int16>::get()  , PROPERTY_NONE,     0},
                     { OUString(UNO_NAME_CREATE_FROM_MARKS), WID_CREATE_FROM_MARKS                   ,  cppu::UnoType<bool>::get()  , PROPERTY_NONE,     0},
+                    { OUString(UNO_NAME_HIDE_TAB_LEADER_AND_PAGE_NUMBERS), WID_HIDE_TABLEADER_PAGENUMBERS                   ,  cppu::UnoType<bool>::get()  , PROPERTY_NONE,     0},
                     { OUString(UNO_NAME_CREATE_FROM_OUTLINE), WID_CREATE_FROM_OUTLINE                 ,  cppu::UnoType<bool>::get()  , PROPERTY_NONE,     0},
                     { OUString(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER                 ,  cppu::UnoType<bool>::get()  , PROPERTY_NONE,     0},
                     { OUString(UNO_NAME_IS_PROTECTED), WID_PROTECTED                           ,  cppu::UnoType<bool>::get()  , PROPERTY_NONE,     0},
@@ -1449,6 +1450,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                 {
                     _BASE_INDEX_PROPERTIES_
                     { OUString(UNO_NAME_CREATE_FROM_MARKS), WID_CREATE_FROM_MARKS                   ,  cppu::UnoType<bool>::get()  , PROPERTY_NONE,     0},
+                    { OUString(UNO_NAME_HIDE_TAB_LEADER_AND_PAGE_NUMBERS), WID_HIDE_TABLEADER_PAGENUMBERS                   ,  cppu::UnoType<bool>::get()  , PROPERTY_NONE,     0},
                     { OUString(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER                 ,  cppu::UnoType<bool>::get()  , PROPERTY_NONE,     0},
                     { OUString(UNO_NAME_IS_PROTECTED), WID_PROTECTED                           ,  cppu::UnoType<bool>::get()  , PROPERTY_NONE,     0},
                     { OUString(UNO_NAME_USE_LEVEL_FROM_SOURCE), WID_USE_LEVEL_FROM_SOURCE               ,  cppu::UnoType<bool>::get()  , PROPERTY_NONE,     0},
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 26a7507..4ad9c9b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -34,6 +34,8 @@
 #include "unocoll.hxx"
 #include "unoframe.hxx"
 
+#include "wrtww8.hxx"
+
 #include <comphelper/string.hxx>
 #include <oox/token/tokens.hxx>
 #include <oox/export/utils.hxx>
@@ -1114,6 +1116,10 @@ void DocxAttributeOutput::StartRunProperties()
 
     m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
 
+    if(GetExport().bHideTabLeaderAndPageNumbers && m_pHyperlinkAttrList )
+    {
+        m_pSerializer->singleElementNS( XML_w, XML_webHidden, FSEND );
+    }
     InitCollectedRunProperties();
 
     OSL_ASSERT( m_postponedGraphic == NULL );
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index c40f00c..816f36e 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -537,6 +537,7 @@ public:
     sal_uInt8 bHasFtr : 1;
     sal_uInt8 bSubstituteBullets : 1; // true: SubstituteBullet() gets called
 
+    sal_uInt8 bHideTabLeaderAndPageNumbers : 1 ; // true: the 'z' field of TOC is set.
     bool mbExportModeRTF;
     bool mbOutOutlineOnly;   // export outline nodes, only (send outline to clipboard/presentation)
 
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index b04d7d4..853f886 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2039,7 +2039,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
         static const sal_Char sEntryEnd[] = "\" ";
 
         ww::eField eCode = ww::eTOC;
-        OUString sStr = pTOX->GetMSTOCExpression();
+        OUString sStr = pTOX ->GetMSTOCExpression();
         if ( sStr.isEmpty() )
         {
             switch (pTOX->GetType())
@@ -2110,6 +2110,11 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
                     if( !nTOXLvl )
                         ++nTOXLvl;
 
+                    if(nsSwTOXElement::TOX_TABLEADER & pTOX->GetCreateType())
+                    {
+                        sStr +="\\z " ;
+                        GetExport( ).bHideTabLeaderAndPageNumbers = true ;
+                    }
                     if( nsSwTOXElement::TOX_MARK & pTOX->GetCreateType() )
                     {
                         sStr += "\\f ";
diff --git a/sw/source/ui/index/cntex.cxx b/sw/source/ui/index/cntex.cxx
index 624c589..5d1fe72 100644
--- a/sw/source/ui/index/cntex.cxx
+++ b/sw/source/ui/index/cntex.cxx
@@ -242,6 +242,7 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample(
             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_GRAPHIC_OBJECTS, 0!=(nContentOptions&nsSwTOXElement::TOX_GRAPHIC        ));
             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_TEXT_FRAMES,     0!=(nContentOptions&nsSwTOXElement::TOX_FRAME          ));
             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_LABELS,          0!=(nContentOptions&nsSwTOXElement::TOX_SEQUENCE       ));
+            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_HIDE_TAB_LEADER_AND_PAGE_NUMBERS,          0!=(nContentOptions&nsSwTOXElement::TOX_TABLEADER       ));
 
             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_CHAPTER, rDesc.IsFromChapter());
             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_PROTECTED, rDesc.IsReadonly());
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3ece355..a5047a9 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2695,10 +2695,13 @@ void DomainMapper_Impl::handleToc
     bool bHyperlinks = false;
     bool bFromOutline = false;
     bool bFromEntries = false;
+    bool bHideTabLeaderPageNumbers = false ;
+
     sal_Int16 nMaxLevel = 10;
     OUString sTemplate;
     OUString sChapterNoSeparator;
     OUString sFigureSequence;
+    uno::Reference< beans::XPropertySet > xTOC;
 
 //                  \a Builds a table of figures but does not include the captions's label and number
     if( lcl_FindInCommand( pContext->GetCommand(), 'a', sValue ))
@@ -2788,14 +2791,16 @@ void DomainMapper_Impl::handleToc
                         //todo: unsupported
 //                    }
 //                  \z Hides page numbers within the table of contens when shown in Web Layout View
-//                    if( lcl_FindInCommand( pContext->GetCommand(), 'z', sValue ))
-//                    { //todo: unsupported feature  }
+                    if( lcl_FindInCommand( pContext->GetCommand(), 'z', sValue ))
+                    {
+                        bHideTabLeaderPageNumbers = true ;
+                    }
 
                     //if there's no option then it should be created from outline
     if( !bFromOutline && !bFromEntries && sTemplate.isEmpty()  )
         bFromOutline = true;
 
-    uno::Reference< beans::XPropertySet > xTOC;
+
     if (m_xTextFactory.is())
         xTOC.set(
                 m_xTextFactory->createInstance
@@ -2810,6 +2815,7 @@ void DomainMapper_Impl::handleToc
         xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_LEVEL ), uno::makeAny( nMaxLevel ) );
         xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_CREATE_FROM_OUTLINE ), uno::makeAny( bFromOutline ));
         xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_CREATE_FROM_MARKS ), uno::makeAny( bFromEntries ));
+        xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_HIDE_TAB_LEADER_AND_PAGE_NUMBERS ), uno::makeAny( bHideTabLeaderPageNumbers ));
         if( !sTemplate.isEmpty() )
         {
                             //the string contains comma separated the names and related levels
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 1cce816..dfe4369 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -360,6 +360,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
             case PROP_CHAR_THEME_COLOR_SHADE        :   sName = "CharThemeColorShade"; break;
             case PROP_CHAR_THEME_FILL               :   sName = "CharThemeFill"; break;
             case PROP_HORIZONTAL_MERGE: sName = "HorizontalMerge"; break;
+            case PROP_HIDE_TAB_LEADER_AND_PAGE_NUMBERS      :    sName = "HideTabLeaderAndPageNumber" ; break ;
         }
         ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
                 m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index 2a9c1ee..4f73caa 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -331,6 +331,7 @@ enum PropertyIds
         ,PROP_CHAR_THEME_COLOR_SHADE
         ,PROP_CHAR_THEME_FILL
         ,PROP_HORIZONTAL_MERGE
+        ,PROP_HIDE_TAB_LEADER_AND_PAGE_NUMBERS
     };
 struct PropertyNameSupplier_Impl;
 class PropertyNameSupplier


More information about the Libreoffice-commits mailing list