diff options
author | Daniel Vogelheim <dvo@openoffice.org> | 2001-07-02 09:18:42 +0000 |
---|---|---|
committer | Daniel Vogelheim <dvo@openoffice.org> | 2001-07-02 09:18:42 +0000 |
commit | df92c866bba51243676d5ce76cf34c451be00f1d (patch) | |
tree | 0728e49127701f21d7534d8a6f0ce6f28b01f08b /xmloff | |
parent | d2f8c93e824d8882302db1a399bf6219884864ac (diff) |
#87303# added character style to index template entries for tab stops
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLIndexTabStopEntryContext.cxx | 66 | ||||
-rw-r--r-- | xmloff/source/text/XMLIndexTabStopEntryContext.hxx | 17 | ||||
-rw-r--r-- | xmloff/source/text/XMLSectionExport.cxx | 5 |
3 files changed, 47 insertions, 41 deletions
diff --git a/xmloff/source/text/XMLIndexTabStopEntryContext.cxx b/xmloff/source/text/XMLIndexTabStopEntryContext.cxx index 84bf522d2b72..b9b536370b97 100644 --- a/xmloff/source/text/XMLIndexTabStopEntryContext.cxx +++ b/xmloff/source/text/XMLIndexTabStopEntryContext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLIndexTabStopEntryContext.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dvo $ $Date: 2001-06-29 21:07:22 $ + * last change: $Author: dvo $ $Date: 2001-07-02 10:18:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -100,6 +100,10 @@ #include <rtl/ustring.hxx> #endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif + using namespace ::xmloff::token; @@ -111,15 +115,15 @@ using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::xml::sax::XAttributeList; -TYPEINIT1( XMLIndexTabStopEntryContext, SvXMLImportContext ); +TYPEINIT1( XMLIndexTabStopEntryContext, XMLIndexSimpleEntryContext ); XMLIndexTabStopEntryContext::XMLIndexTabStopEntryContext( SvXMLImport& rImport, XMLIndexTemplateContext& rTemplate, sal_uInt16 nPrfx, const OUString& rLocalName ) : - SvXMLImportContext(rImport, nPrfx, rLocalName), - rTemplateContext(rTemplate), + XMLIndexSimpleEntryContext(rImport, rTemplate.sTokenTabStop, + rTemplate, nPrfx, rLocalName), sLeaderChar(), nTabPosition(0), bTabPositionOK(sal_False), @@ -173,47 +177,47 @@ void XMLIndexTabStopEntryContext::StartElement( } // else: no style attribute -> ignore } -} -void XMLIndexTabStopEntryContext::EndElement() -{ // how many entries? - sal_Int32 nValues = 2 + (bTabPositionOK ? 1 : 0) + (bLeaderCharOK ? 1 : 0); + nValues += 1 + (bTabPositionOK ? 1 : 0) + (bLeaderCharOK ? 1 : 0); - Sequence<PropertyValue> aValues(nValues); - Any aAny; - sal_Int32 nCount = 0; + // now try parent class (for character style) + XMLIndexSimpleEntryContext::StartElement( xAttrList ); +} + +void XMLIndexTabStopEntryContext::FillPropertyValues( + Sequence<PropertyValue> & rValues) +{ + // fill vlues from parent class (type + style name) + XMLIndexSimpleEntryContext::FillPropertyValues(rValues); - // type: tab stop - aValues[nCount].Name = rTemplateContext.sTokenType; - aAny <<= rTemplateContext.sTokenTabStop; - aValues[nCount].Value = aAny; - nCount++; + // get values array and next entry to be written; + sal_Int32 nNextEntry = bCharStyleNameOK ? 2 : 1; + PropertyValue* pValues = rValues.getArray(); // right aligned? - aValues[nCount].Name = rTemplateContext.sTabStopRightAligned; - aAny.setValue(&bTabRightAligned, ::getBooleanCppuType()); - aValues[nCount].Value = aAny; - nCount++; + pValues[nNextEntry].Name = rTemplateContext.sTabStopRightAligned; + pValues[nNextEntry].Value.setValue( &bTabRightAligned, + ::getBooleanCppuType()); + nNextEntry++; // position if (bTabPositionOK) { - aValues[nCount].Name = rTemplateContext.sTabStopPosition; - aAny <<= nTabPosition; - aValues[nCount].Value = aAny; - nCount++; + pValues[nNextEntry].Name = rTemplateContext.sTabStopPosition; + pValues[nNextEntry].Value <<= nTabPosition; + nNextEntry++; } // leader char if (bLeaderCharOK) { - aValues[nCount].Name = rTemplateContext.sTabStopFillCharacter; - aAny <<= sLeaderChar; - aValues[nCount].Value = aAny; - nCount++; + pValues[nNextEntry].Name = rTemplateContext.sTabStopFillCharacter; + pValues[nNextEntry].Value <<= sLeaderChar; + nNextEntry++; } - // add this template entry - rTemplateContext.addTemplateEntry(aValues); + // check whether we really filled all elements of the sequence + DBG_ASSERT( nNextEntry == rValues.getLength(), + "length incorrectly precumputed!" ); } diff --git a/xmloff/source/text/XMLIndexTabStopEntryContext.hxx b/xmloff/source/text/XMLIndexTabStopEntryContext.hxx index b0736c772b31..f8d49c08aa1f 100644 --- a/xmloff/source/text/XMLIndexTabStopEntryContext.hxx +++ b/xmloff/source/text/XMLIndexTabStopEntryContext.hxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLIndexTabStopEntryContext.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $ + * last change: $Author: dvo $ $Date: 2001-07-02 10:18:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,8 +62,8 @@ #ifndef _XMLOFF_XMLINDEXTABSTOPENTRYCONTEXT_HXX_ #define _XMLOFF_XMLINDEXTABSTOPENTRYCONTEXT_HXX_ -#ifndef _XMLOFF_XMLICTXT_HXX -#include "xmlictxt.hxx" +#ifndef _XMLOFF_XMLINDEXSIMPLEENTRYCONTEXT_HXX_ +#include "XMLIndexSimpleEntryContext.hxx" #endif #ifndef _RTL_USTRING_ @@ -91,10 +91,8 @@ class XMLIndexTemplateContext; /** * Import index entry templates */ -class XMLIndexTabStopEntryContext : public SvXMLImportContext +class XMLIndexTabStopEntryContext : public XMLIndexSimpleEntryContext { - XMLIndexTemplateContext& rTemplateContext; - ::rtl::OUString sLeaderChar; /// fill ("leader") character sal_Int32 nTabPosition; /// tab position sal_Bool bTabPositionOK; /// is tab right aligned? @@ -119,7 +117,10 @@ protected: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList> & xAttrList); - virtual void EndElement(); + /** fill property values for this template entry */ + virtual void FillPropertyValues( + ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue> & rValues); }; #endif diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index 15d288b57312..d3d456dacc4c 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLSectionExport.cxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: dvo $ $Date: 2001-06-29 21:00:01 $ + * last change: $Author: dvo $ $Date: 2001-07-02 10:18:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1489,6 +1489,7 @@ void XMLSectionExport::ExportIndexTemplateElement( case TOK_TTYPE_HYPERLINK_END: case TOK_TTYPE_BIBLIOGRAPHY: case TOK_TTYPE_CHAPTER_INFO: + case TOK_TTYPE_TAB_STOP: GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, sCharStyle); break; |