diff options
-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/preserve_Z_field_TOC.docx | bin | 0 -> 18381 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 16 | ||||
-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/docxattributeoutput.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 7 | ||||
-rw-r--r-- | sw/source/ui/index/cntex.cxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.cxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.hxx | 1 |
14 files changed, 48 insertions, 5 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 Binary files differnew file mode 100644 index 000000000000..63ae40287a57 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/preserve_Z_field_TOC.docx 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()); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 3ece3551e25d..a5047a969ed8 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2695,10 +2695,13 @@ void DomainMapper_Impl::handleToc bool bHyperlinks = false; bool bFromOutline = false; bool bFromEntries = false; + bool bHideTabLeaderPageNumbers = false ; + sal_Int16 nMaxLevel = 10; OUString sTemplate; OUString sChapterNoSeparator; OUString sFigureSequence; + uno::Reference< beans::XPropertySet > xTOC; // \a Builds a table of figures but does not include the captions's label and number if( lcl_FindInCommand( pContext->GetCommand(), 'a', sValue )) @@ -2788,14 +2791,16 @@ void DomainMapper_Impl::handleToc //todo: unsupported // } // \z Hides page numbers within the table of contens when shown in Web Layout View -// if( lcl_FindInCommand( pContext->GetCommand(), 'z', sValue )) -// { //todo: unsupported feature } + if( lcl_FindInCommand( pContext->GetCommand(), 'z', sValue )) + { + bHideTabLeaderPageNumbers = true ; + } //if there's no option then it should be created from outline if( !bFromOutline && !bFromEntries && sTemplate.isEmpty() ) bFromOutline = true; - uno::Reference< beans::XPropertySet > xTOC; + if (m_xTextFactory.is()) xTOC.set( m_xTextFactory->createInstance @@ -2810,6 +2815,7 @@ void DomainMapper_Impl::handleToc xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_LEVEL ), uno::makeAny( nMaxLevel ) ); xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_CREATE_FROM_OUTLINE ), uno::makeAny( bFromOutline )); 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 )); 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 1cce816a282d..dfe4369c18cf 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -360,6 +360,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_CHAR_THEME_COLOR_SHADE : sName = "CharThemeColorShade"; break; case PROP_CHAR_THEME_FILL : sName = "CharThemeFill"; break; case PROP_HORIZONTAL_MERGE: sName = "HorizontalMerge"; break; + case PROP_HIDE_TAB_LEADER_AND_PAGE_NUMBERS : sName = "HideTabLeaderAndPageNumber" ; 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 2a9c1ee6d2f1..4f73caac3272 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -331,6 +331,7 @@ enum PropertyIds ,PROP_CHAR_THEME_COLOR_SHADE ,PROP_CHAR_THEME_FILL ,PROP_HORIZONTAL_MERGE + ,PROP_HIDE_TAB_LEADER_AND_PAGE_NUMBERS }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier |