summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorYogeshBharate <yogesh.bharate@synerzip.com>2013-12-27 17:09:14 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-01-10 18:15:54 +0100
commitec5903ddb6165f0882aa1ffe4f3ff3e1c1127910 (patch)
tree94d75bb0ec899332e909162fefb32da6879c2ed4 /sw
parentf60b61b2cf87e89938c760877a56bc4dd5c577a9 (diff)
fdo#69613: Code changes for TOC with flag '\z' should get preserved after RT.
Issue : TOC field flag '\z' was not getting preserved after RT. Implementation : Provided import & export support for TOC field flag '\z'. XML file difference : In document.xml, Before - <w:instrText> TOC </w:instrText> After - <w:instrText> TOC \z \o "1-3" \o "1-3" \h </w:instrText> Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx writerfilter/source/dmapper/PropertyIds.cxx writerfilter/source/dmapper/PropertyIds.hxx Reviewed on: https://gerrit.libreoffice.org/7217 Change-Id: I84f90a722c7afbdf626db2cc60c4e73580891d36
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/preserve_Z_field_TOC.docxbin0 -> 18381 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx16
-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.cxx6
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx1
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx7
-rw-r--r--sw/source/ui/index/cntex.cxx1
11 files changed, 37 insertions, 2 deletions
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 42727553d0a0..3f54ad9ebb89 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -398,6 +398,7 @@ namespace nsSwTOXElement
const SwTOXElement TOX_GRAPHIC = 32;
const SwTOXElement TOX_FRAME = 64;
const SwTOXElement TOX_SEQUENCE = 128;
+ const SwTOXElement TOX_TABLEADER = 256;
}
typedef sal_uInt16 SwTOIOptions;
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index 208592a81386..d3c983a56573 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -178,6 +178,7 @@
#define WID_USE_LEVEL_FROM_SOURCE 1020
#define WID_LEVEL_FORMAT 1021
#define WID_LEVEL_PARAGRAPH_STYLES 1022
+#define WID_HIDE_TABLEADER_PAGENUMBERS 1023
#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 bc705364a856..674d984cf9b9 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -121,6 +121,7 @@
#define UNO_NAME_CHAR_DIFF_HEIGHT_COMPLEX "CharDiffHeightComplex"
#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_CHAR_FLASH "CharFlash"
#define UNO_NAME_CHAR_KERNING "CharKerning"
diff --git a/sw/qa/extras/ooxmlexport/data/preserve_Z_field_TOC.docx b/sw/qa/extras/ooxmlexport/data/preserve_Z_field_TOC.docx
new file mode 100644
index 000000000000..63ae40287a57
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/preserve_Z_field_TOC.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a3850cbc0b4b..e570ff187741 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2315,7 +2315,7 @@ DECLARE_OOXMLEXPORT_TEST(testFieldFlagO,"TOC_field_f.docx")
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 \\f \\o \"1-3\" \\h"));
+ CPPUNIT_ASSERT(contents.match(" TOC \\z \\f \\o \"1-3\" \\h"));
}
DECLARE_OOXMLEXPORT_TEST(testTOCFlag_f, "toc_doc.docx")
@@ -2336,6 +2336,20 @@ DECLARE_OOXMLEXPORT_TEST(testTOCFlag_f, "toc_doc.docx")
OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content));
CPPUNIT_ASSERT(contents.endsWith("\\h"));
}
+
+DECLARE_OOXMLEXPORT_TEST(testPreserveZfield,"preserve_Z_field_TOC.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ // FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed
+ // not to insert an empty paragraph before TOC.
+ 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 \\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 3ecbe75492ea..d9c1c17f097d 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -657,6 +657,9 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
break;
// case WID_PARAGRAPH_STYLE_NAMES :OSL_FAIL("not implemented")
// break;
+ case WID_HIDE_TABLEADER_PAGENUMBERS:
+ lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_TABLEADER);
+ break ;
case WID_CREATE_FROM_CHAPTER:
rTOXBase.SetFromChapter(lcl_AnyToBool(rValue));
break;
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 9fe946c59d7e..d6c2f522ef3d 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1413,6 +1413,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
_BASE_INDEX_PROPERTIES_
{ 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_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},
@@ -1449,6 +1450,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_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 26a7507aa3b2..4ad9c9b5ba5c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -34,6 +34,8 @@
#include "unocoll.hxx"
#include "unoframe.hxx"
+#include "wrtww8.hxx"
+
#include <comphelper/string.hxx>
#include <oox/token/tokens.hxx>
#include <oox/export/utils.hxx>
@@ -1114,6 +1116,10 @@ void DocxAttributeOutput::StartRunProperties()
m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
+ if(GetExport().bHideTabLeaderAndPageNumbers && m_pHyperlinkAttrList )
+ {
+ m_pSerializer->singleElementNS( XML_w, XML_webHidden, FSEND );
+ }
InitCollectedRunProperties();
OSL_ASSERT( m_postponedGraphic == NULL );
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index c40f00c035a3..816f36eb73a0 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -537,6 +537,7 @@ public:
sal_uInt8 bHasFtr : 1;
sal_uInt8 bSubstituteBullets : 1; // true: SubstituteBullet() gets called
+ sal_uInt8 bHideTabLeaderAndPageNumbers : 1 ; // true: the 'z' field of TOC is set.
bool mbExportModeRTF;
bool mbOutOutlineOnly; // export outline nodes, only (send outline to clipboard/presentation)
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index b04d7d44c1bf..853f886f3a64 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2039,7 +2039,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
static const sal_Char sEntryEnd[] = "\" ";
ww::eField eCode = ww::eTOC;
- OUString sStr = pTOX->GetMSTOCExpression();
+ OUString sStr = pTOX ->GetMSTOCExpression();
if ( sStr.isEmpty() )
{
switch (pTOX->GetType())
@@ -2110,6 +2110,11 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
if( !nTOXLvl )
++nTOXLvl;
+ if(nsSwTOXElement::TOX_TABLEADER & pTOX->GetCreateType())
+ {
+ sStr +="\\z " ;
+ GetExport( ).bHideTabLeaderAndPageNumbers = 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 624c5893a9b7..5d1fe725da8b 100644
--- a/sw/source/ui/index/cntex.cxx
+++ b/sw/source/ui/index/cntex.cxx
@@ -242,6 +242,7 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample(
lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_GRAPHIC_OBJECTS, 0!=(nContentOptions&nsSwTOXElement::TOX_GRAPHIC ));
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_CREATE_FROM_CHAPTER, rDesc.IsFromChapter());
lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_PROTECTED, rDesc.IsReadonly());