diff options
author | Michael Brauer <mib@openoffice.org> | 2002-12-05 08:58:07 +0000 |
---|---|---|
committer | Michael Brauer <mib@openoffice.org> | 2002-12-05 08:58:07 +0000 |
commit | e767bb081eeedaa083418648bcc14fdda810cdba (patch) | |
tree | f3348578b3e50c0f5b7eb5808aed633e2e921e8a /xmloff | |
parent | b5ab28614f7a81efffe8c1ddc6f89b7f7a5f4604 (diff) |
#100400#: export dummy headings to keep chapter numbering in master docs
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLSectionExport.cxx | 58 | ||||
-rw-r--r-- | xmloff/source/text/XMLSectionExport.hxx | 16 | ||||
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 13 |
3 files changed, 79 insertions, 8 deletions
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index cafe880519e2..39bf5a07734f 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLSectionExport.cxx,v $ * - * $Revision: 1.32 $ + * $Revision: 1.33 $ * - * last change: $Author: dvo $ $Date: 2002-10-08 14:05:02 $ + * last change: $Author: mib $ $Date: 2002-12-05 09:58:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -141,6 +141,9 @@ #ifndef _COM_SUN_STAR_TEXT_XTEXTFIELDSSUPPLIER_HPP_ #include <com/sun/star/text/XTextFieldsSupplier.hpp> #endif +#ifndef _COM_SUN_STAR_TEXT_XCHAPTERNUMBERINGSUPPLIER_HPP_ +#include <com/sun/star/text/XChapterNumberingSupplier.hpp> +#endif #ifndef _XMLOFF_XMLKYWD_HXX #include "xmlkywd.hxx" @@ -265,7 +268,9 @@ XMLSectionExport::XMLSectionExport( sLocale(RTL_CONSTASCII_USTRINGPARAM("Locale")), sUserIndexName(RTL_CONSTASCII_USTRINGPARAM("UserIndexName")), sIsCurrentlyVisible(RTL_CONSTASCII_USTRINGPARAM("IsCurrentlyVisible")), - sEmpty() + sHeadingStyleName(RTL_CONSTASCII_USTRINGPARAM("HeadingStyleName")), + sEmpty(), + bHeadingDummiesExported( sal_False ) { } @@ -1877,3 +1882,50 @@ sal_Bool XMLSectionExport::IsInSection( return bRet; } + + +void XMLSectionExport::ExportMasterDocHeadingDummies() +{ + if( bHeadingDummiesExported ) + return; + + Reference< XChapterNumberingSupplier > xCNSupplier( rExport.GetModel(), + UNO_QUERY ); + + Reference< XIndexReplace > xChapterNumbering; + if( xCNSupplier.is() ) + xChapterNumbering = xCNSupplier->getChapterNumberingRules(); + + if( !xChapterNumbering.is() ) + return; + + sal_Int32 nCount = xChapterNumbering->getCount(); + for( sal_Int32 nLevel = 0; nLevel < nCount; nLevel++ ) + { + OUString sStyle; + Sequence<PropertyValue> aProperties; + xChapterNumbering->getByIndex( nLevel ) >>= aProperties; + for( sal_Int32 i = 0; i < aProperties.getLength(); i++ ) + { + if( aProperties[i].Name == sHeadingStyleName ) + { + aProperties[i].Value >>= sStyle; + break; + } + } + if( sStyle.getLength() > 0 ) + { + GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, + sStyle ); + + OUStringBuffer sTmp; + sTmp.append( nLevel+1L ); + GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, + sTmp.makeStringAndClear() ); + SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, XML_H, + sal_True, sal_False ); + } + } + + bHeadingDummiesExported = sal_True; +} diff --git a/xmloff/source/text/XMLSectionExport.hxx b/xmloff/source/text/XMLSectionExport.hxx index e32c70cdca37..865ac58d2571 100644 --- a/xmloff/source/text/XMLSectionExport.hxx +++ b/xmloff/source/text/XMLSectionExport.hxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLSectionExport.hxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: dvo $ $Date: 2002-10-08 14:05:02 $ + * last change: $Author: mib $ $Date: 2002-12-05 09:58:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -182,12 +182,15 @@ class XMLSectionExport const ::rtl::OUString sUserIndexName; const ::rtl::OUString sIsCurrentlyVisible; + const ::rtl::OUString sHeadingStyleName; const ::rtl::OUString sEmpty; SvXMLExport& rExport; XMLTextParagraphExport& rParaExport; + sal_Bool bHeadingDummiesExported; + public: XMLSectionExport(SvXMLExport& rExp, XMLTextParagraphExport& rParaExp); @@ -248,6 +251,14 @@ public: */ static void ExportBibliographyConfiguration(SvXMLExport& rExport); + /** export a heading for every level. This is used by master documents + * to not loose the heading information if master documents are exported + * without section contents + */ + void ExportMasterDocHeadingDummies(); + + + protected: inline SvXMLExport& GetExport() { return rExport; } @@ -305,7 +316,6 @@ protected: const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & rIndex); - // helper methods: /** diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 42d63db46658..5a5e18211405 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtparae.cxx,v $ * - * $Revision: 1.105 $ + * $Revision: 1.106 $ * - * last change: $Author: mib $ $Date: 2002-10-10 12:27:38 $ + * last change: $Author: mib $ $Date: 2002-12-05 09:58:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1598,6 +1598,10 @@ sal_Bool XMLTextParagraphExport::exportTextContentEnumeration( // if we found a mute section: skip all section content if (pSectionExport->IsMuteSection(xCurrentTextSection)) { + // Make sure headings are exported anyway. + if( !bAutoStyles ) + pSectionExport->ExportMasterDocHeadingDummies(); + while (rContEnum->hasMoreElements() && pSectionExport->IsInSection( xCurrentTextSection, xTxtCntnt, sal_True )) @@ -1639,6 +1643,11 @@ sal_Bool XMLTextParagraphExport::exportTextContentEnumeration( if ((! bAutoStyles) && (NULL != pRedlineExport)) pRedlineExport->ExportStartOrEndRedline(xTxtCntnt, sal_False); } + else if( !bAutoStyles ) + { + // Make sure headings are exported anyway. + pSectionExport->ExportMasterDocHeadingDummies(); + } bHasContent = sal_True; } |