summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorYogeshBharate <yogesh.bharate@synerzip.com>2013-12-31 12:58:21 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-01-13 14:46:30 +0100
commit8e634d0d557bcad6bf56adb30d202e88675f17d1 (patch)
tree89ad02366336b3fe81f7c4437f5f0f4bbefcaeac /sw
parenta401dc5dcf2a5a4e8f427d3077d473be72ebbcf2 (diff)
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
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/tox.hxx1
-rw-r--r--sw/inc/unomap.hxx1
-rw-r--r--sw/inc/unoprnms.hxx1
-rw-r--r--sw/qa/extras/ooxmlexport/data/PreserveWfieldTOC.docxbin0 -> 18485 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx11
-rw-r--r--sw/source/core/unocore/unoidx.cxx3
-rw-r--r--sw/source/core/unocore/unomap.cxx2
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx5
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx1
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx5
-rw-r--r--sw/source/ui/index/cntex.cxx1
11 files changed, 31 insertions, 0 deletions
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 3f54ad9ebb89..c4252a1c84dc 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 d3c983a56573..e9e63a78218d 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 674d984cf9b9..da63af3c1d96 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 000000000000..ac294fd0fe94
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/PreserveWfieldTOC.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index fb09a2097c1d..6dd2669cceef 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 d9c1c17f097d..33942aab9d67 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 d6c2f522ef3d..cb371d30cc6f 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 0b04ccb30aba..a94cd68adfa3 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 816f36eb73a0..28d9d695cd1f 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 853f886f3a64..b5ad57edfdd9 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 5d1fe725da8b..28ff7f92ff0e 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());