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
This commit is contained in:
parent
1b00be2ed1
commit
dbd42432c7
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
BIN
sw/qa/extras/ooxmlexport/data/PreserveXfieldTOC.docx
Normal file
BIN
sw/qa/extras/ooxmlexport/data/PreserveXfieldTOC.docx
Normal file
Binary file not shown.
@ -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();
|
||||
|
@ -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:
|
||||
|
@ -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},
|
||||
|
@ -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 ";
|
||||
|
@ -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());
|
||||
|
@ -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
|
||||
|
@ -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 ));
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user