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

YogeshBharate yogesh.bharate at synerzip.com
Mon Jan 13 05:46:54 PST 2014


 sw/inc/tox.hxx                                       |    1 +
 sw/inc/unomap.hxx                                    |    1 +
 sw/inc/unoprnms.hxx                                  |    1 +
 sw/qa/extras/ooxmlexport/data/PreserveWfieldTOC.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx             |   11 +++++++++++
 sw/source/core/unocore/unoidx.cxx                    |    3 +++
 sw/source/core/unocore/unomap.cxx                    |    2 ++
 sw/source/filter/ww8/docxattributeoutput.cxx         |    5 +++++
 sw/source/filter/ww8/wrtww8.hxx                      |    1 +
 sw/source/filter/ww8/ww8atr.cxx                      |    5 +++++
 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, 40 insertions(+), 5 deletions(-)

New commits:
commit 8e634d0d557bcad6bf56adb30d202e88675f17d1
Author: YogeshBharate <yogesh.bharate at synerzip.com>
Date:   Tue Dec 31 12:58:21 2013 +0530

    fdo#69613: Code changes for TOC with flag '\w' should get preserved after RT.
    
    Issue :
    	TOC field flag '\w' was not getting preserved after RT.
    
    Implementation :
    	Provided import & export support for TOC field flag '\w'.
    
    XML file difference :
    In document.xml,
    
    Before - <w:instrText>
    		TOC \o "1-3" \h \z \w
    	</w:instrText>
    
    After - <w:instrText>
    		TOC \w \o "1-3" \o "1-3" \h
    	</w:instrText>
    
    Conflicts:
    	sw/inc/tox.hxx
    	sw/inc/unomap.hxx
    	sw/inc/unoprnms.hxx
    	sw/source/core/unocore/unomap.cxx
    	sw/source/filter/ww8/ww8atr.cxx
    	sw/source/ui/index/cntex.cxx
    	writerfilter/source/dmapper/DomainMapper_Impl.cxx
    	writerfilter/source/dmapper/PropertyIds.cxx
    	writerfilter/source/dmapper/PropertyIds.hxx
    Reviewed on:
    	https://gerrit.libreoffice.org/7238
    
    Change-Id: Ia5d602c6db0b59933d325058ce2d8111e4f03df5

diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 3f54ad9..c4252a1 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -399,6 +399,7 @@ namespace nsSwTOXElement
     const SwTOXElement TOX_FRAME            = 64;
     const SwTOXElement TOX_SEQUENCE         = 128;
     const SwTOXElement TOX_TABLEADER        = 256;
+    const SwTOXElement TOX_TAB_IN_TOC       = 512;
 }
 
 typedef sal_uInt16 SwTOIOptions;
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index d3c983a..e9e63a7 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -179,6 +179,7 @@
 #define WID_LEVEL_FORMAT                        1021
 #define WID_LEVEL_PARAGRAPH_STYLES              1022
 #define WID_HIDE_TABLEADER_PAGENUMBERS          1023
+#define WID_TAB_IN_TOC                          1024
 #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 674d984..da63af3 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -122,6 +122,7 @@
 #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_TAB_IN_TOC "TabInTOC"
 
 #define UNO_NAME_CHAR_FLASH "CharFlash"
 #define UNO_NAME_CHAR_KERNING "CharKerning"
diff --git a/sw/qa/extras/ooxmlexport/data/PreserveWfieldTOC.docx b/sw/qa/extras/ooxmlexport/data/PreserveWfieldTOC.docx
new file mode 100644
index 0000000..ac294fd
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/PreserveWfieldTOC.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index fb09a20..6dd2669 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2359,6 +2359,17 @@ DECLARE_OOXMLEXPORT_TEST(testPreserveZfield,"preserve_Z_field_TOC.docx")
     CPPUNIT_ASSERT(contents.match(" TOC \\z \\f \\o \"1-3\" \\h"));
 }
 
+ DECLARE_OOXMLEXPORT_TEST(testPreserveWfieldTOC, "PreserveWfieldTOC.docx")
+{
+     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    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 \\w \\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 d9c1c17..33942aa 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -655,6 +655,9 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
         case WID_CREATE_FROM_OUTLINE:
             lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_OUTLINELEVEL);
         break;
+        case WID_TAB_IN_TOC:
+             lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_TAB_IN_TOC);
+        break;
 //          case WID_PARAGRAPH_STYLE_NAMES             :OSL_FAIL("not implemented")
 //          break;
         case WID_HIDE_TABLEADER_PAGENUMBERS:
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index d6c2f52..cb371d3 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1414,6 +1414,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                     { 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_TAB_IN_TOC), WID_TAB_IN_TOC, 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},
@@ -1451,6 +1452,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_TAB_IN_TOC), WID_TAB_IN_TOC, 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 0b04ccb..a94cd68 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -33,6 +33,7 @@
 #include "redline.hxx"
 #include "unocoll.hxx"
 #include "unoframe.hxx"
+#include "wrtww8.hxx"
 
 #include "wrtww8.hxx"
 
@@ -756,6 +757,10 @@ void DocxAttributeOutput::EndRun()
     DoWriteAnnotationMarks( );
 
     m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+    if(GetExport().bTabInTOC && m_pHyperlinkAttrList)
+    {
+        RunText(OUString("\t")) ;
+    }
     m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND ); // merges with "postponed run start", see above
 
     // write the run start + the run content
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 816f36e..28d9d69 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -536,6 +536,7 @@ public:
     sal_uInt8 bHasHdr : 1;
     sal_uInt8 bHasFtr : 1;
     sal_uInt8 bSubstituteBullets : 1; // true: SubstituteBullet() gets called
+    sal_uInt8 bTabInTOC : 1; //true for TOC field flag 'w'
 
     sal_uInt8 bHideTabLeaderAndPageNumbers : 1 ; // true: the 'z' field of TOC is set.
     bool mbExportModeRTF;
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 853f886..b5ad57e 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2115,6 +2115,11 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
                         sStr +="\\z " ;
                         GetExport( ).bHideTabLeaderAndPageNumbers = true ;
                     }
+                    if(nsSwTOXElement::TOX_TAB_IN_TOC & pTOX->GetCreateType())
+                    {
+                        sStr +="\\w " ;
+                        GetExport( ).bTabInTOC = 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 5d1fe72..28ff7f9 100644
--- a/sw/source/ui/index/cntex.cxx
+++ b/sw/source/ui/index/cntex.cxx
@@ -243,6 +243,7 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample(
             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_TAB_IN_TOC,                  0!=(nContentOptions&nsSwTOXElement::TOX_TAB_IN_TOC       ));
 
             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 a5047a9..3b9b526 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2696,6 +2696,7 @@ void DomainMapper_Impl::handleToc
     bool bFromOutline = false;
     bool bFromEntries = false;
     bool bHideTabLeaderPageNumbers = false ;
+    bool bIsTabEntry = false ;
 
     sal_Int16 nMaxLevel = 10;
     OUString sTemplate;
@@ -2780,11 +2781,11 @@ void DomainMapper_Impl::handleToc
         bFromOutline = true;
                         //todo: what doesn 'the applied paragraph outline level' refer to?
     }
-//                  \w Preserve tab characters within table entries
-//                    if( lcl_FindInCommand( pContext->GetCommand(), 'w', sValue ))
-//                    {
-                        //todo: not supported
-//                    }
+//    \w Preserve tab characters within table entries
+     if( lcl_FindInCommand( pContext->GetCommand(), 'w', sValue ))
+     {
+         bIsTabEntry = true ;
+     }
 //                  \x Preserve newline characters within table entries
 //                    if( lcl_FindInCommand( pContext->GetCommand(), 'x', sValue ))
 //                    {
@@ -2816,6 +2817,7 @@ void DomainMapper_Impl::handleToc
         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 ));
+        xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_TAB_IN_TOC ), uno::makeAny( bIsTabEntry ));
         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 dfe4369..669ae07 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -361,6 +361,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
             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 ;
+            case PROP_TAB_IN_TOC : sName = "TabInTOC"; 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 4f73caa..b8e6ae5 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -332,6 +332,7 @@ enum PropertyIds
         ,PROP_CHAR_THEME_FILL
         ,PROP_HORIZONTAL_MERGE
         ,PROP_HIDE_TAB_LEADER_AND_PAGE_NUMBERS
+        ,PROP_TAB_IN_TOC
     };
 struct PropertyNameSupplier_Impl;
 class PropertyNameSupplier


More information about the Libreoffice-commits mailing list