diff options
author | YogeshBharate <yogesh.bharate@synerzip.com> | 2014-01-02 15:03:02 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-13 17:08:01 +0100 |
commit | dbd42432c7b8f8149080bb13b103b35f2532eee8 (patch) | |
tree | 1e3ddcc768c184ce40392417b1c34c0b9a7c75ac | |
parent | 1b00be2ed1f911aec07ab2ef9432168cfa333c6d (diff) |
fdo#69613: Code changes for TOC with flag '\x' should get preserved after RT.
Issue :
TOC field flag '\x' was not getting preserved after RT.
Implementation :
Provided import & export support for TOC field flag '\x'.
XML file difference :
In document.xml,
Before:
‒<w:r w:rsidR="00A9725D">
‒<w:instrText xml:space="preserve">
TOC \o "1-3"
</w:instrText>
</w:r>
‒<w:r w:rsidR="008A34F6">
‒<w:instrText>
\h
</w:instrText>
</w:r>
‒<w:r w:rsidR="00A9725D">
‒<w:instrText xml:space="preserve">
\x
</w:instrText>
After:
‒<w:instrText>
TOC \x \o "1-3" \h
</w:instrText>
Conflicts:
sw/inc/tox.hxx
sw/inc/unoprnms.hxx
sw/source/core/unocore/unoidx.cxx
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/7257
Change-Id: I8f196446a3beb8deea6b7ddde50e16c9cea73cd9
-rw-r--r-- | sw/inc/tox.hxx | 1 | ||||
-rw-r--r-- | sw/inc/unomap.hxx | 1 | ||||
-rw-r--r-- | sw/inc/unoprnms.hxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/PreserveXfieldTOC.docx | bin | 0 -> 18620 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/unocore/unoidx.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/index/cntex.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.cxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.hxx | 1 |
12 files changed, 32 insertions, 4 deletions
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx index 4ded582d456c..d8bab6e882aa 100644 --- a/sw/inc/tox.hxx +++ b/sw/inc/tox.hxx @@ -404,6 +404,7 @@ namespace nsSwTOXElement const SwTOXElement TOX_TABLEADER = 256; const SwTOXElement TOX_TAB_IN_TOC = 512; const SwTOXElement TOX_BOOKMARK = 1024; + const SwTOXElement TOX_NEWLINE = 2048; } typedef sal_uInt16 SwTOIOptions; diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx index f0b72598e59b..060d0ae95038 100644 --- a/sw/inc/unomap.hxx +++ b/sw/inc/unomap.hxx @@ -219,6 +219,7 @@ #define WID_PRIMARY_KEY_READING 1059 #define WID_SECONDARY_KEY_READING 1060 #define WID_TOC_BOOKMARK 1061 +#define WID_TOC_NEWLINE 1062 // Text document #define WID_DOC_CHAR_COUNT 1000 diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index f4fc116db19f..85e478c59f09 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -124,6 +124,7 @@ #define UNO_NAME_HIDE_TAB_LEADER_AND_PAGE_NUMBERS "HideTabLeaderAndPageNumber" #define UNO_NAME_TAB_IN_TOC "TabInTOC" #define UNO_NAME_TOC_BOOKMARK "TOCBookmark" +#define UNO_NAME_TOC_NEWLINE "TOCNewLine" #define UNO_NAME_CHAR_FLASH "CharFlash" #define UNO_NAME_CHAR_KERNING "CharKerning" diff --git a/sw/qa/extras/ooxmlexport/data/PreserveXfieldTOC.docx b/sw/qa/extras/ooxmlexport/data/PreserveXfieldTOC.docx Binary files differnew file mode 100644 index 000000000000..adf7fd92494d --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/PreserveXfieldTOC.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 4fe902d0fd7a..7727bc1a5e26 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2384,6 +2384,16 @@ DECLARE_OOXMLEXPORT_TEST(testFieldFlagB,"TOC_field_b.docx") CPPUNIT_ASSERT(contents.match(" TOC \\b \"bookmark111\" \\o \"1-9\" \\h")); } +DECLARE_OOXMLEXPORT_TEST(testPreserveXfieldTOC, "PreserveXfieldTOC.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 \\x \\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 06a695d68472..7aa85ffcdf52 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -665,6 +665,9 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, case WID_TAB_IN_TOC: lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_TAB_IN_TOC); break; + case WID_TOC_NEWLINE: + lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_NEWLINE); + 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 e3f9d1e626af..da26adcddd0f 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -1416,6 +1416,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { 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_TOC_BOOKMARK), WID_TOC_BOOKMARK, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, + { OUString(UNO_NAME_TOC_NEWLINE), WID_TOC_NEWLINE, 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}, @@ -1455,6 +1456,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { 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_TOC_BOOKMARK), WID_TOC_BOOKMARK, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, + { OUString(UNO_NAME_TOC_NEWLINE), WID_TOC_NEWLINE, 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/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index d2c9dace2ad6..24d4a18e3553 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2120,6 +2120,10 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) sStr +="\\w " ; GetExport( ).bTabInTOC = true ; } + if(nsSwTOXElement::TOX_NEWLINE & pTOX->GetCreateType()) + { + sStr +="\\x " ; + } 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 28ff7f92ff0e..ec6945f5782e 100644 --- a/sw/source/ui/index/cntex.cxx +++ b/sw/source/ui/index/cntex.cxx @@ -244,6 +244,8 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample( 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_TOC_NEWLINE, 0!=(nContentOptions&nsSwTOXElement::TOX_NEWLINE)); + 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 d42137cc7e9c..57255088763c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2697,6 +2697,7 @@ void DomainMapper_Impl::handleToc bool bFromEntries = false; bool bHideTabLeaderPageNumbers = false ; bool bIsTabEntry = false ; + bool bNewLine = false ; sal_Int16 nMaxLevel = 10; OUString sTemplate; @@ -2789,10 +2790,10 @@ void DomainMapper_Impl::handleToc bIsTabEntry = true ; } // \x Preserve newline characters within table entries -// if( lcl_FindInCommand( pContext->GetCommand(), 'x', sValue )) -// { - //todo: unsupported -// } + if( lcl_FindInCommand( pContext->GetCommand(), 'x', sValue )) + { + bNewLine = true ; + } // \z Hides page numbers within the table of contens when shown in Web Layout View if( lcl_FindInCommand( pContext->GetCommand(), 'z', sValue )) { @@ -2822,6 +2823,7 @@ void DomainMapper_Impl::handleToc 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 )); + xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_TOC_NEW_LINE ), uno::makeAny( bNewLine )); 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 a6bda94dcf15..776e263e0510 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -363,6 +363,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_HIDE_TAB_LEADER_AND_PAGE_NUMBERS : sName = "HideTabLeaderAndPageNumber" ; break ; case PROP_TAB_IN_TOC : sName = "TabInTOC"; break ; case PROP_TOC_BOOKMARK: sName = "TOCBookmark"; break; + case PROP_TOC_NEW_LINE: sName = "TOCNewLine"; 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 c6cf976ae249..33690bcaa612 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -334,6 +334,7 @@ enum PropertyIds ,PROP_HIDE_TAB_LEADER_AND_PAGE_NUMBERS ,PROP_TAB_IN_TOC ,PROP_TOC_BOOKMARK + ,PROP_TOC_NEW_LINE }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier |