[Libreoffice-commits] core.git: sw/inc sw/qa sw/source writerfilter/source
YogeshBharate
yogesh.bharate at synerzip.com
Mon Jan 13 08:08:25 PST 2014
sw/inc/tox.hxx | 1 +
sw/inc/unomap.hxx | 1 +
sw/inc/unoprnms.hxx | 1 +
sw/qa/extras/ooxmlexport/data/PreserveXfieldTOC.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 ++++++++++
sw/source/core/unocore/unoidx.cxx | 3 +++
sw/source/core/unocore/unomap.cxx | 2 ++
sw/source/filter/ww8/ww8atr.cxx | 4 ++++
sw/source/ui/index/cntex.cxx | 2 ++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 10 ++++++----
writerfilter/source/dmapper/PropertyIds.cxx | 1 +
writerfilter/source/dmapper/PropertyIds.hxx | 1 +
12 files changed, 32 insertions(+), 4 deletions(-)
New commits:
commit dbd42432c7b8f8149080bb13b103b35f2532eee8
Author: YogeshBharate <yogesh.bharate at synerzip.com>
Date: Thu Jan 2 15:03:02 2014 +0530
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
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 4ded582..d8bab6e 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 f0b7259..060d0ae 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 f4fc116..85e478c 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
new file mode 100644
index 0000000..adf7fd9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/PreserveXfieldTOC.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4fe902d..7727bc1 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 06a695d..7aa85ff 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 e3f9d1e..da26adc 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 d2c9dac..24d4a18 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 28ff7f9..ec6945f 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 d42137c..57255088 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 a6bda94..776e263 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 c6cf976..33690bc 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
More information about the Libreoffice-commits
mailing list