summaryrefslogtreecommitdiff
path: root/xmloff/source/text/XMLIndexTabStopEntryContext.cxx
diff options
context:
space:
mode:
authorDaniel Vogelheim <dvo@openoffice.org>2001-07-02 09:18:42 +0000
committerDaniel Vogelheim <dvo@openoffice.org>2001-07-02 09:18:42 +0000
commitdf92c866bba51243676d5ce76cf34c451be00f1d (patch)
tree0728e49127701f21d7534d8a6f0ce6f28b01f08b /xmloff/source/text/XMLIndexTabStopEntryContext.cxx
parentd2f8c93e824d8882302db1a399bf6219884864ac (diff)
#87303# added character style to index template entries for tab stops
Diffstat (limited to 'xmloff/source/text/XMLIndexTabStopEntryContext.cxx')
-rw-r--r--xmloff/source/text/XMLIndexTabStopEntryContext.cxx66
1 files changed, 35 insertions, 31 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!" );
}