summaryrefslogtreecommitdiff
path: root/xmloff/source/text
diff options
context:
space:
mode:
authorDaniel Vogelheim <dvo@openoffice.org>2000-11-14 13:42:50 +0000
committerDaniel Vogelheim <dvo@openoffice.org>2000-11-14 13:42:50 +0000
commitc26ca6c062ac2181a6acf5adf18e2a68b0605273 (patch)
treeae4790e4ae8ea6f125fd868d3230954f7f61ad67 /xmloff/source/text
parentb71e1da56b515e6ad6f69be7edce75c2c0d658ed (diff)
#80284# XML im-/export continued
- changed: section and TOC im-/export restructured to accomodate indices - added: im-/export of all index types (implemented but disabled due to API problems) - changed: auto style Add(), Find() made public on txtparae.hxx - changed: text:section-source-dde into office:dde-source - changed: dde attribute names now use standard terminology
Diffstat (limited to 'xmloff/source/text')
-rw-r--r--xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx302
-rw-r--r--xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx134
-rw-r--r--xmloff/source/text/XMLIndexBibliographyEntryContext.cxx240
-rw-r--r--xmloff/source/text/XMLIndexBibliographyEntryContext.hxx126
-rw-r--r--xmloff/source/text/XMLIndexBibliographySourceContext.cxx184
-rw-r--r--xmloff/source/text/XMLIndexBibliographySourceContext.hxx115
-rw-r--r--xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx205
-rw-r--r--xmloff/source/text/XMLIndexChapterInfoEntryContext.hxx122
-rw-r--r--xmloff/source/text/XMLIndexIllustrationSourceContext.cxx157
-rw-r--r--xmloff/source/text/XMLIndexIllustrationSourceContext.hxx111
-rw-r--r--xmloff/source/text/XMLIndexObjectSourceContext.cxx278
-rw-r--r--xmloff/source/text/XMLIndexObjectSourceContext.hxx128
-rw-r--r--xmloff/source/text/XMLIndexSimpleEntryContext.hxx6
-rw-r--r--xmloff/source/text/XMLIndexSourceBaseContext.cxx338
-rw-r--r--xmloff/source/text/XMLIndexSourceBaseContext.hxx165
-rw-r--r--xmloff/source/text/XMLIndexTOCContext.cxx223
-rw-r--r--xmloff/source/text/XMLIndexTOCContext.hxx32
-rw-r--r--xmloff/source/text/XMLIndexTOCSourceContext.cxx178
-rw-r--r--xmloff/source/text/XMLIndexTOCSourceContext.hxx21
-rw-r--r--xmloff/source/text/XMLIndexTableSourceContext.cxx258
-rw-r--r--xmloff/source/text/XMLIndexTableSourceContext.hxx125
-rw-r--r--xmloff/source/text/XMLIndexTemplateContext.cxx364
-rw-r--r--xmloff/source/text/XMLIndexTemplateContext.hxx43
-rw-r--r--xmloff/source/text/XMLIndexUserSourceContext.cxx276
-rw-r--r--xmloff/source/text/XMLIndexUserSourceContext.hxx128
-rw-r--r--xmloff/source/text/XMLSectionExport.cxx1445
-rw-r--r--xmloff/source/text/XMLSectionExport.hxx342
-rw-r--r--xmloff/source/text/XMLSectionImportContext.cxx38
-rw-r--r--xmloff/source/text/XMLSectionSourceDDEImportContext.cxx10
-rw-r--r--xmloff/source/text/makefile.mk24
-rw-r--r--xmloff/source/text/txtimp.cxx16
-rw-r--r--xmloff/source/text/txtparae.cxx47
-rw-r--r--xmloff/source/text/txtprmap.cxx13
-rw-r--r--xmloff/source/text/txtsecte.cxx604
34 files changed, 5886 insertions, 912 deletions
diff --git a/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx
new file mode 100644
index 000000000000..c7f721243041
--- /dev/null
+++ b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx
@@ -0,0 +1,302 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexAlphabeticalSourceContext.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_XMLINDEXALPHABETICALSOURCECONTEXT_HXX_
+#include "XMLIndexAlphabeticalSourceContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
+#include <com/sun/star/container/XIndexReplace.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
+#include "XMLIndexTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTITLETEMPLATECONTEXT_HXX_
+#include "XMLIndexTitleTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTOCSTYLESCONTEXT_HXX_
+#include "XMLIndexTOCStylesContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLICTXT_HXX
+#include "xmlictxt.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _XMLOFF_TEXTIMP_HXX_
+#include "txtimp.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+
+
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+const sal_Char sAPI_MainEntryCharacterStyleName[] = "MainEntryCharacterStyleName";
+const sal_Char sAPI_UseAlphabeticalSeparators[] = "UseAlphabeticalSeparators";
+const sal_Char sAPI_UseCombinedEntries[] = "UseCombinedEntries";
+const sal_Char sAPI_IsCaseSensitive[] = "IsCaseSensitive";
+const sal_Char sAPI_UseKeyAsEntry[] = "UseKeyAsEntry";
+const sal_Char sAPI_UseUpperCase[] = "UseUpperCase";
+const sal_Char sAPI_UseDash[] = "UseDash";
+const sal_Char sAPI_UsePP[] = "UsePP";
+
+
+TYPEINIT1( XMLIndexAlphabeticalSourceContext, XMLIndexSourceBaseContext );
+
+XMLIndexAlphabeticalSourceContext::XMLIndexAlphabeticalSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet) :
+ XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
+ rPropSet, sal_False),
+ sMainEntryStyleName(),
+ bMainEntryStyleNameOK(sal_False),
+ bSeparators(sal_False),
+ bCombineEntries(sal_True),
+ bCaseSensitive(sal_True),
+ bEntry(sal_False),
+ bUpperCase(sal_False),
+ bCombineDash(sal_False),
+ bCombinePP(sal_True),
+ sMainEntryCharacterStyleName(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_MainEntryCharacterStyleName)),
+ sUseAlphabeticalSeparators(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_UseAlphabeticalSeparators)),
+ sUseCombinedEntries(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_UseCombinedEntries)),
+ sIsCaseSensitive(RTL_CONSTASCII_USTRINGPARAM(sAPI_IsCaseSensitive)),
+ sUseKeyAsEntry(RTL_CONSTASCII_USTRINGPARAM(sAPI_UseKeyAsEntry)),
+ sUseUpperCase(RTL_CONSTASCII_USTRINGPARAM(sAPI_UseUpperCase)),
+ sUseDash(RTL_CONSTASCII_USTRINGPARAM(sAPI_UseDash)),
+ sUsePP(RTL_CONSTASCII_USTRINGPARAM(sAPI_UsePP))
+{
+}
+
+XMLIndexAlphabeticalSourceContext::~XMLIndexAlphabeticalSourceContext()
+{
+}
+
+void XMLIndexAlphabeticalSourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ sal_Bool bTmp;
+
+ switch (eParam)
+ {
+ case XML_TOK_INDEXSOURCE_MAIN_ENTRY_STYLE:
+ sMainEntryStyleName = rValue;
+ bMainEntryStyleNameOK = sal_True;
+ break;
+
+ case XML_TOK_INDEXSOURCE_IGNORE_CASE:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bCaseSensitive = !bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_SEPARATORS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bSeparators = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_COMBINE_ENTRIES:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bCombineEntries = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_COMBINE_WITH_DASH:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bCombineDash = bTmp;
+ }
+ break;
+ case XML_TOK_INDEXSOURCE_KEYS_AS_ENTRIES:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bEntry = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_COMBINE_WITH_PP:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bCombinePP = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_CAPITALIZE:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUpperCase = bTmp;
+ }
+ break;
+
+ default:
+ XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
+ break;
+ }
+}
+
+void XMLIndexAlphabeticalSourceContext::EndElement()
+{
+
+ Any aAny;
+
+ if (bMainEntryStyleNameOK)
+ {
+ aAny <<= sMainEntryStyleName;
+ rIndexPropertySet->setPropertyValue(sMainEntryCharacterStyleName,aAny);
+ }
+
+ aAny.setValue(&bSeparators, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseAlphabeticalSeparators, aAny);
+
+ aAny.setValue(&bCombineEntries, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseCombinedEntries, aAny);
+
+ aAny.setValue(&bCaseSensitive, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sIsCaseSensitive, aAny);
+
+ aAny.setValue(&bEntry, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseKeyAsEntry, aAny);
+
+ aAny.setValue(&bUpperCase, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseUpperCase, aAny);
+
+ aAny.setValue(&bCombineDash, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseDash, aAny);
+
+ aAny.setValue(&bCombinePP, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUsePP, aAny);
+
+ XMLIndexSourceBaseContext::EndElement();
+}
+
+SvXMLImportContext* XMLIndexAlphabeticalSourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (rLocalName.equalsAsciiL(sXML_alphabetical_index_entry_template,
+ sizeof(sXML_alphabetical_index_entry_template)-1)))
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameAlphaMap,
+ sXML_outline_level,
+ aLevelStylePropNameAlphaMap,
+ aAllowedTokenTypesAlpha);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+}
diff --git a/xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx
new file mode 100644
index 000000000000..dcec8f1247de
--- /dev/null
+++ b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexAlphabeticalSourceContext.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLINDEXALPHABETICALSOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXALPHABETICALSOURCECONTEXT_HXX_
+
+#ifndef _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
+#include "XMLIndexSourceBaseContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import alphabetical (keyword) index source element
+ */
+class XMLIndexAlphabeticalSourceContext : public XMLIndexSourceBaseContext
+{
+ const ::rtl::OUString sMainEntryCharacterStyleName;
+ const ::rtl::OUString sUseAlphabeticalSeparators;
+ const ::rtl::OUString sUseCombinedEntries;
+ const ::rtl::OUString sIsCaseSensitive;
+ const ::rtl::OUString sUseKeyAsEntry;
+ const ::rtl::OUString sUseUpperCase;
+ const ::rtl::OUString sUseDash;
+ const ::rtl::OUString sUsePP;
+
+ ::rtl::OUString sMainEntryStyleName;
+ sal_Bool bMainEntryStyleNameOK;
+
+ sal_Bool bSeparators;
+ sal_Bool bCombineEntries;
+ sal_Bool bCaseSensitive;
+ sal_Bool bEntry;
+ sal_Bool bUpperCase;
+ sal_Bool bCombineDash;
+ sal_Bool bCombinePP;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexAlphabeticalSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexAlphabeticalSourceContext();
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
diff --git a/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx
new file mode 100644
index 000000000000..324064a00ae5
--- /dev/null
+++ b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx
@@ -0,0 +1,240 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexBibliographyEntryContext.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_XMLINDEXBIBLIOGRAPHYENTRYCONTEXT_HXX_
+#include "XMLIndexBibliographyEntryContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
+#include "XMLIndexTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLICTXT_HXX
+#include "xmlictxt.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _XMLOFF_TEXTIMP_HXX_
+#include "txtimp.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_BIBLIOGRAPHYDATAFIELD_HPP_
+#include <com/sun/star/text/BibliographyDataField.hpp>
+#endif
+
+
+using namespace ::com::sun::star::text;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::PropertyValues;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+const sal_Char sAPI_TokenType[] = "TokenType";
+const sal_Char sAPI_CharacterStyleName[] = "CharacterStyleName";
+
+TYPEINIT1( XMLIndexBibliographyEntryContext, XMLIndexSimpleEntryContext);
+
+XMLIndexBibliographyEntryContext::XMLIndexBibliographyEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName ) :
+ XMLIndexSimpleEntryContext(rImport,
+ rTemplate.sTokenBibliographyDataField,
+ rTemplate,
+ nPrfx, rLocalName),
+ nBibliographyInfo(BibliographyDataField::IDENTIFIER),
+ bBibliographyInfoOK(sal_False)
+{
+}
+
+XMLIndexBibliographyEntryContext::~XMLIndexBibliographyEntryContext()
+{
+}
+
+SvXMLEnumMapEntry __READONLY_DATA aBibliographyDataFieldMap[] =
+{
+ { sXML_address, BibliographyDataField::ADDRESS },
+ { sXML_annote, BibliographyDataField::ANNOTE },
+ { sXML_author, BibliographyDataField::AUTHOR },
+ { sXML_bibiliographic_type, BibliographyDataField::BIBILIOGRAPHIC_TYPE },
+ { sXML_booktitle, BibliographyDataField::BOOKTITLE },
+ { sXML_chapter, BibliographyDataField::CHAPTER },
+ { sXML_custom1, BibliographyDataField::CUSTOM1 },
+ { sXML_custom2, BibliographyDataField::CUSTOM2 },
+ { sXML_custom3, BibliographyDataField::CUSTOM3 },
+ { sXML_custom4, BibliographyDataField::CUSTOM4 },
+ { sXML_custom5, BibliographyDataField::CUSTOM5 },
+ { sXML_edition, BibliographyDataField::EDITION },
+ { sXML_editor, BibliographyDataField::EDITOR },
+ { sXML_howpublished, BibliographyDataField::HOWPUBLISHED },
+ { sXML_identifier, BibliographyDataField::IDENTIFIER },
+ { sXML_institution, BibliographyDataField::INSTITUTION },
+ { sXML_isbn, BibliographyDataField::ISBN },
+ { sXML_journal, BibliographyDataField::JOURNAL },
+ { sXML_month, BibliographyDataField::MONTH },
+ { sXML_note, BibliographyDataField::NOTE },
+ { sXML_number, BibliographyDataField::NUMBER },
+ { sXML_organizations, BibliographyDataField::ORGANIZATIONS },
+ { sXML_pages, BibliographyDataField::PAGES },
+ { sXML_publisher, BibliographyDataField::PUBLISHER },
+ { sXML_report_type, BibliographyDataField::REPORT_TYPE },
+ { sXML_school, BibliographyDataField::SCHOOL },
+ { sXML_series, BibliographyDataField::SERIES },
+ { sXML_title, BibliographyDataField::TITLE },
+ { sXML_url, BibliographyDataField::URL },
+ { sXML_volume, BibliographyDataField::VOLUME },
+ { sXML_year, BibliographyDataField::YEAR },
+ { NULL, NULL }
+};
+
+void XMLIndexBibliographyEntryContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // handle both, style name and bibliography info
+ sal_Int32 nLength = xAttrList->getLength();
+ for(sal_Int32 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if (sLocalName.equalsAsciiL(sXML_style_name,
+ sizeof(sXML_style_name)-1))
+ {
+ sCharStyleName = xAttrList->getValueByIndex(nAttr);
+ bCharStyleNameOK = sal_True;
+ }
+ else if (sLocalName.equalsAsciiL(sXML_bibliography_data_field,
+ sizeof(sXML_bibliography_data_field)-1))
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(
+ nTmp, xAttrList->getValueByIndex(nAttr),
+ aBibliographyDataFieldMap))
+ {
+ nBibliographyInfo = nTmp;
+ bBibliographyInfoOK = sal_True;
+ }
+ }
+ }
+ }
+
+ // if we have a style name, set it!
+ if (bCharStyleNameOK)
+ {
+ nValues++;
+ }
+
+ // always bibliography; else element is not valid
+ nValues++;
+}
+
+void XMLIndexBibliographyEntryContext::EndElement()
+{
+ // only valid, if we have bibliography info
+ if (bBibliographyInfoOK)
+ {
+ XMLIndexSimpleEntryContext::EndElement();
+ }
+}
+
+void XMLIndexBibliographyEntryContext::FillPropertyValues(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues)
+{
+ // entry name and (optionally) style name in parent class
+ XMLIndexSimpleEntryContext::FillPropertyValues(rValues);
+
+ // bibliography data field
+ sal_Int32 nIndex = bCharStyleNameOK ? 2 : 1;
+ rValues[nIndex].Name = rTemplateContext.sBibliographyDataField;
+ Any aAny;
+ aAny <<= nBibliographyInfo;
+ rValues[nIndex].Value = aAny;
+}
diff --git a/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx b/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx
new file mode 100644
index 000000000000..52958be7657c
--- /dev/null
+++ b/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexBibliographyEntryContext.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLINDEXBIBLIOGRAPHYENTRYCONTEXT_HXX_
+#define _XMLOFF_XMLINDEXBIBLIOGRAPHYENTRYCONTEXT_HXX_
+
+#ifndef _XMLOFF_XMLINDEXSIMPLEENTRYCONTEXT_HXX_
+#include "XMLIndexSimpleEntryContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/Sequence.h>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+class XMLIndexTemplateContext;
+
+/**
+ * Import bibliography index entry templates
+ */
+class XMLIndexBibliographyEntryContext : public XMLIndexSimpleEntryContext
+{
+ // bibliography info
+ sal_Int16 nBibliographyInfo;
+ sal_Bool bBibliographyInfoOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexBibliographyEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+ ~XMLIndexBibliographyEntryContext();
+
+protected:
+
+ /** process parameters */
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /** call FillPropertyValues and insert into template */
+ 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/XMLIndexBibliographySourceContext.cxx b/xmloff/source/text/XMLIndexBibliographySourceContext.cxx
new file mode 100644
index 000000000000..fd0d37361d62
--- /dev/null
+++ b/xmloff/source/text/XMLIndexBibliographySourceContext.cxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexBibliographySourceContext.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_XMLINDEXBIBLIOGRAPHYSOURCECONTEXT_HXX_
+#include "XMLIndexBibliographySourceContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
+#include <com/sun/star/container/XIndexReplace.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
+#include "XMLIndexTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTITLETEMPLATECONTEXT_HXX_
+#include "XMLIndexTitleTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTOCSTYLESCONTEXT_HXX_
+#include "XMLIndexTOCStylesContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLICTXT_HXX
+#include "xmlictxt.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _XMLOFF_TEXTIMP_HXX_
+#include "txtimp.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+TYPEINIT1(XMLIndexBibliographySourceContext, XMLIndexSourceBaseContext);
+
+
+XMLIndexBibliographySourceContext::XMLIndexBibliographySourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet) :
+ XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
+ rPropSet, sal_False)
+{
+}
+
+XMLIndexBibliographySourceContext::~XMLIndexBibliographySourceContext()
+{
+}
+
+void XMLIndexBibliographySourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ // We have no attributes. Who wants attributes, anyway?
+}
+
+
+void XMLIndexBibliographySourceContext::EndElement()
+{
+ // No attributes, no properties.
+}
+
+
+SvXMLImportContext* XMLIndexBibliographySourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (rLocalName.equalsAsciiL(sXML_bibliography_entry_template,
+ sizeof(sXML_bibliography_entry_template)-1)))
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameBibliographyMap,
+ sXML_bibliography_type,
+ aLevelStylePropNameBibliographyMap,
+ aAllowedTokenTypesBibliography);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+}
diff --git a/xmloff/source/text/XMLIndexBibliographySourceContext.hxx b/xmloff/source/text/XMLIndexBibliographySourceContext.hxx
new file mode 100644
index 000000000000..0866506d6555
--- /dev/null
+++ b/xmloff/source/text/XMLIndexBibliographySourceContext.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexBibliographySourceContext.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLINDEXBIBLIOGRAPHYSOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXBIBLIOGRAPHYSOURCECONTEXT_HXX_
+
+#ifndef _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
+#include "XMLIndexSourceBaseContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import bibliography source element
+ */
+class XMLIndexBibliographySourceContext : public XMLIndexSourceBaseContext
+{
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexBibliographySourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexBibliographySourceContext();
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
diff --git a/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx b/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx
new file mode 100644
index 000000000000..16452d7794b5
--- /dev/null
+++ b/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexChapterInfoEntryContext.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_XMLINDEXCHAPTERINFOENTRYCONTEXT_HXX_
+#include "XMLIndexChapterInfoEntryContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
+#include "XMLIndexTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLICTXT_HXX
+#include "xmlictxt.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _XMLOFF_TEXTIMP_HXX_
+#include "txtimp.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_CHAPTERFORMAT_HPP_
+#include <com/sun/star/text/ChapterFormat.hpp>
+#endif
+
+
+using namespace ::com::sun::star::text;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::PropertyValues;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+
+TYPEINIT1( XMLIndexChapterInfoEntryContext, XMLIndexSimpleEntryContext);
+
+XMLIndexChapterInfoEntryContext::XMLIndexChapterInfoEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName ) :
+ XMLIndexSimpleEntryContext(rImport, rTemplate.sTokenChapterInfo,
+ rTemplate, nPrfx, rLocalName),
+ nChapterInfo(ChapterFormat::NAME_NUMBER),
+ bChapterInfoOK(sal_False)
+{
+}
+
+XMLIndexChapterInfoEntryContext::~XMLIndexChapterInfoEntryContext()
+{
+}
+
+static const SvXMLEnumMapEntry aChapterDisplayMap[] =
+{
+ { sXML_name, ChapterFormat::NAME },
+ { sXML_number, ChapterFormat::NUMBER },
+ { sXML_number_and_name, ChapterFormat::NAME_NUMBER },
+// not supported by the template:
+// { sXML_plain_number_and_name, ChapterFormat::NO_PREFIX_SUFFIX },
+// { sXML_plain_number, ChapterFormat::DIGIT },
+ { 0, 0 }
+};
+
+void XMLIndexChapterInfoEntryContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ // handle both, style name and bibliography info
+ sal_Int32 nLength = xAttrList->getLength();
+ for(sal_Int32 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if (sLocalName.equalsAsciiL(sXML_style_name,
+ sizeof(sXML_style_name)-1))
+ {
+ sCharStyleName = xAttrList->getValueByIndex(nAttr);
+ bCharStyleNameOK = sal_True;
+ }
+ else if (sLocalName.equalsAsciiL(sXML_display,
+ sizeof(sXML_display)-1))
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(
+ nTmp, xAttrList->getValueByIndex(nAttr),
+ aChapterDisplayMap))
+ {
+ nChapterInfo = nTmp;
+ bChapterInfoOK = sal_True;
+ }
+ }
+ }
+ }
+
+ // if we have a style name, set it!
+ if (bCharStyleNameOK)
+ {
+ nValues++;
+ }
+
+ // if we have chaper info, set it!
+ if (bChapterInfoOK)
+ {
+ nValues++;
+ }
+}
+
+void XMLIndexChapterInfoEntryContext::FillPropertyValues(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues)
+{
+ // entry name and (optionally) style name in parent class
+ XMLIndexSimpleEntryContext::FillPropertyValues(rValues);
+
+ // chapter info field
+ sal_Int32 nIndex = bCharStyleNameOK ? 2 : 1;
+ rValues[nIndex].Name = rTemplateContext.sChapterFormat;
+ Any aAny;
+ aAny <<= nChapterInfo;
+ rValues[nIndex].Value = aAny;
+}
diff --git a/xmloff/source/text/XMLIndexChapterInfoEntryContext.hxx b/xmloff/source/text/XMLIndexChapterInfoEntryContext.hxx
new file mode 100644
index 000000000000..a588a50a3d0b
--- /dev/null
+++ b/xmloff/source/text/XMLIndexChapterInfoEntryContext.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexChapterInfoEntryContext.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLINDEXCHAPTERINFOENTRYCONTEXT_HXX_
+#define _XMLOFF_XMLINDEXCHAPTERINFOENTRYCONTEXT_HXX_
+
+#ifndef _XMLOFF_XMLINDEXSIMPLEENTRYCONTEXT_HXX_
+#include "XMLIndexSimpleEntryContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/Sequence.h>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+namespace rtl { class OUString; }
+class XMLIndexTemplateContext;
+
+/**
+ * Import chapter info index entry templates
+ */
+class XMLIndexChapterInfoEntryContext : public XMLIndexSimpleEntryContext
+{
+ // chapter format
+ sal_Int16 nChapterInfo;
+ sal_Bool bChapterInfoOK;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexChapterInfoEntryContext(
+ SvXMLImport& rImport,
+ XMLIndexTemplateContext& rTemplate,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName );
+
+ ~XMLIndexChapterInfoEntryContext();
+
+protected:
+
+ /** process parameters */
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ /** 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/XMLIndexIllustrationSourceContext.cxx b/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx
new file mode 100644
index 000000000000..b01c19fbb392
--- /dev/null
+++ b/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexIllustrationSourceContext.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_XMLINDEXILLUSTRATIONSOURCECONTEXT_HXX_
+#include "XMLIndexIllustrationSourceContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
+#include "XMLIndexTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLICTXT_HXX
+#include "xmlictxt.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _XMLOFF_TEXTIMP_HXX_
+#include "txtimp.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+TYPEINIT1(XMLIndexIllustrationSourceContext, XMLIndexTableSourceContext);
+
+
+XMLIndexIllustrationSourceContext::XMLIndexIllustrationSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet) :
+ XMLIndexTableSourceContext(rImport, nPrfx, rLocalName, rPropSet)
+{
+}
+
+XMLIndexIllustrationSourceContext::~XMLIndexIllustrationSourceContext()
+{
+}
+
+SvXMLImportContext* XMLIndexIllustrationSourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (rLocalName.equalsAsciiL(sXML_illustration_index_entry_template,
+ sizeof(sXML_illustration_index_entry_template)-1)))
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameTableMap,
+ NULL, // no outline-level attr
+ aLevelStylePropNameTableMap,
+ aAllowedTokenTypesTable);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+}
diff --git a/xmloff/source/text/XMLIndexIllustrationSourceContext.hxx b/xmloff/source/text/XMLIndexIllustrationSourceContext.hxx
new file mode 100644
index 000000000000..79c7d97d1d9f
--- /dev/null
+++ b/xmloff/source/text/XMLIndexIllustrationSourceContext.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexIllustrationSourceContext.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLINDEXILLUSTRATIONSOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXILLUSTRATIONSOURCECONTEXT_HXX_
+
+#ifndef _XMLOFF_XMLINDEXTABLESOURCECONTEXT_HXX_
+#include "XMLIndexTableSourceContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import illustration index source element;
+ *
+ * All logic is inherited from table source context. The only difference is
+ * the different child context (illustration entry template).
+ */
+class XMLIndexIllustrationSourceContext : public XMLIndexTableSourceContext
+{
+public:
+
+ TYPEINFO();
+
+ XMLIndexIllustrationSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexIllustrationSourceContext();
+
+protected:
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
diff --git a/xmloff/source/text/XMLIndexObjectSourceContext.cxx b/xmloff/source/text/XMLIndexObjectSourceContext.cxx
new file mode 100644
index 000000000000..865217d53336
--- /dev/null
+++ b/xmloff/source/text/XMLIndexObjectSourceContext.cxx
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexObjectSourceContext.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_XMLINDEXOBJECTSOURCECONTEXT_HXX_
+#include "XMLIndexObjectSourceContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
+#include <com/sun/star/container/XIndexReplace.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
+#include "XMLIndexTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTITLETEMPLATECONTEXT_HXX_
+#include "XMLIndexTitleTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTOCSTYLESCONTEXT_HXX_
+#include "XMLIndexTOCStylesContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLICTXT_HXX
+#include "xmlictxt.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _XMLOFF_TEXTIMP_HXX_
+#include "txtimp.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+
+
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+const sal_Char sAPI_CreateFromStarCalc[] = "CreateFromStarCalc";
+const sal_Char sAPI_CreateFromStarChart[] = "CreateFromStarChart";
+const sal_Char sAPI_CreateFromStarDraw[] = "CreateFromStarDraw";
+const sal_Char sAPI_CreateFromStarImage[] = "CreateFromStarImage";
+const sal_Char sAPI_CreateFromStarMath[] = "CreateFromStarMath";
+const sal_Char sAPI_CreateFromOtherEmbeddedObjects[] = "CreateFromOtherEmbeddedObjects";
+
+TYPEINIT1( XMLIndexObjectSourceContext, XMLIndexSourceBaseContext );
+
+XMLIndexObjectSourceContext::XMLIndexObjectSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet) :
+ XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
+ rPropSet, sal_False),
+ sCreateFromStarCalc(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromStarCalc)),
+ sCreateFromStarChart(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromStarChart)),
+ sCreateFromStarDraw(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromStarDraw)),
+ sCreateFromStarImage(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromStarImage)),
+ sCreateFromStarMath(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromStarMath)),
+ sCreateFromOtherEmbeddedObjects(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromOtherEmbeddedObjects)),
+ bUseCalc(sal_False),
+ bUseChart(sal_False),
+ bUseDraw(sal_False),
+ bUseImage(sal_False),
+ bUseMath(sal_False),
+ bUseOtherObjects(sal_False)
+{
+}
+
+XMLIndexObjectSourceContext::~XMLIndexObjectSourceContext()
+{
+}
+
+void XMLIndexObjectSourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ switch (eParam)
+ {
+ sal_Bool bTmp;
+
+ case XML_TOK_INDEXSOURCE_USE_OTHER_OBJECTS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseOtherObjects = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_SHEET:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseCalc = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_CHART:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseChart = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_DRAW:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseDraw = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_IMAGE:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseImage = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_MATH:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseMath = bTmp;
+ }
+ break;
+
+ default:
+ XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
+ break;
+ }
+}
+
+void XMLIndexObjectSourceContext::EndElement()
+{
+ Any aAny;
+
+ aAny.setValue(&bUseCalc, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromStarCalc, aAny);
+
+ aAny.setValue(&bUseChart, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromStarChart, aAny);
+
+ aAny.setValue(&bUseDraw, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromStarDraw, aAny);
+
+ aAny.setValue(&bUseImage, ::getBooleanCppuType());
+// TODO: wait for API
+// rIndexPropertySet->setPropertyValue(sCreateFromStarImage, aAny);
+
+ aAny.setValue(&bUseMath, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromStarMath, aAny);
+
+ aAny.setValue(&bUseOtherObjects, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromOtherEmbeddedObjects, aAny);
+
+ XMLIndexSourceBaseContext::EndElement();
+}
+
+SvXMLImportContext* XMLIndexObjectSourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (rLocalName.equalsAsciiL(sXML_object_index_entry_template,
+ sizeof(sXML_object_index_entry_template)-1)))
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameTableMap,
+ NULL, // no outline-level attr
+ aLevelStylePropNameTableMap,
+ aAllowedTokenTypesTable);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+}
diff --git a/xmloff/source/text/XMLIndexObjectSourceContext.hxx b/xmloff/source/text/XMLIndexObjectSourceContext.hxx
new file mode 100644
index 000000000000..aebfebd4a4b9
--- /dev/null
+++ b/xmloff/source/text/XMLIndexObjectSourceContext.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexObjectSourceContext.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLINDEXOBJECTSOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXOBJECTSOURCECONTEXT_HXX_
+
+#ifndef _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
+#include "XMLIndexSourceBaseContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import object index source element
+ */
+class XMLIndexObjectSourceContext : public XMLIndexSourceBaseContext
+{
+ const ::rtl::OUString sCreateFromStarCalc;
+ const ::rtl::OUString sCreateFromStarChart;
+ const ::rtl::OUString sCreateFromStarDraw;
+ const ::rtl::OUString sCreateFromStarImage;
+ const ::rtl::OUString sCreateFromStarMath;
+ const ::rtl::OUString sCreateFromOtherEmbeddedObjects;
+
+ sal_Bool bUseCalc;
+ sal_Bool bUseChart;
+ sal_Bool bUseDraw;
+ sal_Bool bUseImage;
+ sal_Bool bUseMath;
+ sal_Bool bUseOtherObjects;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexObjectSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexObjectSourceContext();
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
diff --git a/xmloff/source/text/XMLIndexSimpleEntryContext.hxx b/xmloff/source/text/XMLIndexSimpleEntryContext.hxx
index e96ce4cd3d06..c627e70cbcf9 100644
--- a/xmloff/source/text/XMLIndexSimpleEntryContext.hxx
+++ b/xmloff/source/text/XMLIndexSimpleEntryContext.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLIndexSimpleEntryContext.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -94,11 +94,11 @@ class XMLIndexSimpleEntryContext : public SvXMLImportContext
// entry type
const ::rtl::OUString& rEntryType;
+protected:
// character style
::rtl::OUString sCharStyleName;
sal_Bool bCharStyleNameOK;
-protected:
// surrounding template
XMLIndexTemplateContext& rTemplateContext;
diff --git a/xmloff/source/text/XMLIndexSourceBaseContext.cxx b/xmloff/source/text/XMLIndexSourceBaseContext.cxx
new file mode 100644
index 000000000000..cc334e304f7f
--- /dev/null
+++ b/xmloff/source/text/XMLIndexSourceBaseContext.cxx
@@ -0,0 +1,338 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexSourceBaseContext.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
+#include "XMLIndexSourceBaseContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
+#include <com/sun/star/container/XIndexReplace.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
+#include "XMLIndexTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTITLETEMPLATECONTEXT_HXX_
+#include "XMLIndexTitleTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTOCSTYLESCONTEXT_HXX_
+#include "XMLIndexTOCStylesContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLICTXT_HXX
+#include "xmlictxt.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _XMLOFF_TEXTIMP_HXX_
+#include "txtimp.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+
+
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+const sal_Char sAPI_CreateFromChapter[] = "CreateFromChapter";
+
+static __FAR_DATA SvXMLTokenMapEntry aIndexSourceTokenMap[] =
+{
+ { XML_NAMESPACE_TEXT,
+ sXML_outline_level,
+ XML_TOK_INDEXSOURCE_OUTLINE_LEVEL},
+ { XML_NAMESPACE_TEXT,
+ sXML_use_index_marks,
+ XML_TOK_INDEXSOURCE_USE_INDEX_MARKS },
+ { XML_NAMESPACE_TEXT,
+ sXML_index_scope,
+ XML_TOK_INDEXSOURCE_INDEX_SCOPE },
+ { XML_NAMESPACE_TEXT,
+ sXML_relative_tab_stop_position,
+ XML_TOK_INDEXSOURCE_RELATIVE_TABS } ,
+ { XML_NAMESPACE_TEXT,
+ sXML_use_other_objects,
+ XML_TOK_INDEXSOURCE_USE_OTHER_OBJECTS },
+ { XML_NAMESPACE_TEXT,
+ sXML_use_spreadsheet_objects,
+ XML_TOK_INDEXSOURCE_USE_SHEET },
+ { XML_NAMESPACE_TEXT,
+ sXML_use_chart_objects,
+ XML_TOK_INDEXSOURCE_USE_CHART },
+ { XML_NAMESPACE_TEXT,
+ sXML_use_draw_objects,
+ XML_TOK_INDEXSOURCE_USE_DRAW },
+ { XML_NAMESPACE_TEXT,
+ sXML_use_image_objects,
+ XML_TOK_INDEXSOURCE_USE_IMAGE },
+ { XML_NAMESPACE_TEXT,
+ sXML_use_math_objects,
+ XML_TOK_INDEXSOURCE_USE_MATH },
+ { XML_NAMESPACE_TEXT,
+ sXML_main_entry_style_name,
+ XML_TOK_INDEXSOURCE_MAIN_ENTRY_STYLE },
+ { XML_NAMESPACE_TEXT,
+ sXML_ignore_case,
+ XML_TOK_INDEXSOURCE_IGNORE_CASE },
+ { XML_NAMESPACE_TEXT,
+ sXML_alphabetical_separators,
+ XML_TOK_INDEXSOURCE_SEPARATORS },
+ { XML_NAMESPACE_TEXT,
+ sXML_combine_entries,
+ XML_TOK_INDEXSOURCE_COMBINE_ENTRIES },
+ { XML_NAMESPACE_TEXT,
+ sXML_combine_entries_with_dash,
+ XML_TOK_INDEXSOURCE_COMBINE_WITH_DASH },
+ { XML_NAMESPACE_TEXT,
+ sXML_use_keys_as_entries,
+ XML_TOK_INDEXSOURCE_KEYS_AS_ENTRIES },
+ { XML_NAMESPACE_TEXT,
+ sXML_combine_entries_with_pp,
+ XML_TOK_INDEXSOURCE_COMBINE_WITH_PP },
+ { XML_NAMESPACE_TEXT,
+ sXML_capitalize_entries,
+ XML_TOK_INDEXSOURCE_CAPITALIZE },
+ { XML_NAMESPACE_TEXT,
+ sXML_use_objects,
+ XML_TOK_INDEXSOURCE_USE_OBJECTS },
+ { XML_NAMESPACE_TEXT,
+ sXML_use_graphics,
+ XML_TOK_INDEXSOURCE_USE_GRAPHICS },
+ { XML_NAMESPACE_TEXT,
+ sXML_use_tables,
+ XML_TOK_INDEXSOURCE_USE_TABLES },
+ { XML_NAMESPACE_TEXT,
+ sXML_use_floating_frames,
+ XML_TOK_INDEXSOURCE_USE_FRAMES },
+ { XML_NAMESPACE_TEXT,
+ sXML_copy_outline_levels,
+ XML_TOK_INDEXSOURCE_COPY_OUTLINE_LEVELS },
+ { XML_NAMESPACE_TEXT,
+ sXML_use_caption,
+ XML_TOK_INDEXSOURCE_USE_CAPTION },
+ { XML_NAMESPACE_TEXT,
+ sXML_caption_sequence_name,
+ XML_TOK_INDEXSOURCE_SEQUENCE_NAME },
+ { XML_NAMESPACE_TEXT,
+ sXML_caption_sequence_format,
+ XML_TOK_INDEXSOURCE_SEQUENCE_FORMAT },
+
+ XML_TOKEN_MAP_END
+};
+
+
+TYPEINIT1( XMLIndexSourceBaseContext, SvXMLImportContext );
+
+XMLIndexSourceBaseContext::XMLIndexSourceBaseContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet,
+ sal_Bool bLevelFormats) :
+ SvXMLImportContext(rImport, nPrfx, rLocalName),
+ rIndexPropertySet(rPropSet),
+ bChapterIndex(sal_False),
+ bRelativeTabs(sal_True),
+ bUseLevelFormats(bLevelFormats),
+ sCreateFromChapter(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromChapter))
+{
+}
+
+XMLIndexSourceBaseContext::~XMLIndexSourceBaseContext()
+{
+}
+
+void XMLIndexSourceBaseContext::StartElement(
+ const Reference<XAttributeList> & xAttrList)
+{
+ SvXMLTokenMap aTokenMap(aIndexSourceTokenMap);
+
+ // process attributes
+ sal_Int32 nLength = xAttrList->getLength();
+ for(sal_Int32 i=0; i<nLength; i++)
+ {
+ // map to IndexSourceParamEnum
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+ sal_uInt16 nToken = aTokenMap.Get(nPrefix, sLocalName);
+
+ // process attribute
+ ProcessAttribute((enum IndexSourceParamEnum)nToken,
+ xAttrList->getValueByIndex(i));
+ }
+}
+
+void XMLIndexSourceBaseContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ switch (eParam)
+ {
+ case XML_TOK_INDEXSOURCE_INDEX_SCOPE:
+ if (rValue.equalsAsciiL(sXML_chapter, sizeof(sXML_chapter)-1))
+ {
+ bChapterIndex = sal_True;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_RELATIVE_TABS:
+ {
+ sal_Bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bRelativeTabs = bTmp;
+ }
+ break;
+ }
+
+ default:
+ // unknown attribute -> ignore
+ break;
+ }
+}
+
+void XMLIndexSourceBaseContext::EndElement()
+{
+ Any aAny;
+
+ aAny.setValue(&bRelativeTabs, ::getBooleanCppuType());
+ // TODO: api lacking
+// rIndexPropertySet->setPropertyValue(s..., aAny);
+
+ aAny.setValue(&bChapterIndex, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromChapter, aAny);
+}
+
+SvXMLImportContext* XMLIndexSourceBaseContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if (rLocalName.equalsAsciiL(sXML_index_title_template,
+ sizeof(sXML_index_title_template)-1))
+ {
+ pContext = new XMLIndexTitleTemplateContext(GetImport(),
+ rIndexPropertySet,
+ nPrefix, rLocalName);
+ }
+ else if (bUseLevelFormats &&
+ rLocalName.equalsAsciiL(sXML_index_source_styles,
+ sizeof(sXML_index_source_styles)-1))
+ {
+ pContext = new XMLIndexTOCStylesContext(GetImport(),
+ rIndexPropertySet,
+ nPrefix, rLocalName);
+ }
+ // else: unknown element in text namespace -> ignore
+ }
+ // else: unknown namespace -> ignore
+
+ // use default context
+ if (pContext == NULL)
+ {
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+ }
+
+ return pContext;
+}
diff --git a/xmloff/source/text/XMLIndexSourceBaseContext.hxx b/xmloff/source/text/XMLIndexSourceBaseContext.hxx
new file mode 100644
index 000000000000..1e2dfec454e4
--- /dev/null
+++ b/xmloff/source/text/XMLIndexSourceBaseContext.hxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexSourceBaseContext.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
+
+#ifndef _XMLOFF_XMLICTXT_HXX
+#include "xmlictxt.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+
+enum IndexSourceParamEnum
+{
+ XML_TOK_INDEXSOURCE_OUTLINE_LEVEL,
+ XML_TOK_INDEXSOURCE_USE_INDEX_MARKS,
+ XML_TOK_INDEXSOURCE_INDEX_SCOPE,
+ XML_TOK_INDEXSOURCE_RELATIVE_TABS,
+ XML_TOK_INDEXSOURCE_USE_OTHER_OBJECTS,
+ XML_TOK_INDEXSOURCE_USE_SHEET,
+ XML_TOK_INDEXSOURCE_USE_CHART,
+ XML_TOK_INDEXSOURCE_USE_DRAW,
+ XML_TOK_INDEXSOURCE_USE_IMAGE,
+ XML_TOK_INDEXSOURCE_USE_MATH,
+ XML_TOK_INDEXSOURCE_MAIN_ENTRY_STYLE,
+ XML_TOK_INDEXSOURCE_IGNORE_CASE,
+ XML_TOK_INDEXSOURCE_SEPARATORS,
+ XML_TOK_INDEXSOURCE_COMBINE_ENTRIES,
+ XML_TOK_INDEXSOURCE_COMBINE_WITH_DASH,
+ XML_TOK_INDEXSOURCE_KEYS_AS_ENTRIES,
+ XML_TOK_INDEXSOURCE_COMBINE_WITH_PP,
+ XML_TOK_INDEXSOURCE_CAPITALIZE,
+ XML_TOK_INDEXSOURCE_USE_OBJECTS,
+ XML_TOK_INDEXSOURCE_USE_GRAPHICS,
+ XML_TOK_INDEXSOURCE_USE_TABLES,
+ XML_TOK_INDEXSOURCE_USE_FRAMES,
+ XML_TOK_INDEXSOURCE_COPY_OUTLINE_LEVELS,
+ XML_TOK_INDEXSOURCE_USE_CAPTION,
+ XML_TOK_INDEXSOURCE_SEQUENCE_NAME,
+ XML_TOK_INDEXSOURCE_SEQUENCE_FORMAT
+};
+
+
+/**
+ * Superclass for index source elements
+ */
+class XMLIndexSourceBaseContext : public SvXMLImportContext
+{
+ const ::rtl::OUString sCreateFromChapter;
+
+ sal_Bool bUseLevelFormats;
+
+ sal_Bool bChapterIndex; /// chapter-wise or document index?
+ sal_Bool bRelativeTabs; /// tab stops relative to margin or indent?
+
+protected:
+
+ /// property set of index; must be accessible to subclasses
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rIndexPropertySet;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexSourceBaseContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ sal_Bool bLevelFormats);
+
+ ~XMLIndexSourceBaseContext();
+
+protected:
+
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
diff --git a/xmloff/source/text/XMLIndexTOCContext.cxx b/xmloff/source/text/XMLIndexTOCContext.cxx
index 95657bb43223..6e4047962b90 100644
--- a/xmloff/source/text/XMLIndexTOCContext.cxx
+++ b/xmloff/source/text/XMLIndexTOCContext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLIndexTOCContext.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,6 +84,30 @@
#include "XMLIndexTOCSourceContext.hxx"
#endif
+#ifndef _XMLOFF_XMLINDEXOBJECTSOURCECONTEXT_HXX_
+#include "XMLIndexObjectSourceContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXALPHABETICALSOURCECONTEXT_HXX_
+#include "XMLIndexAlphabeticalSourceContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXUSERSOURCECONTEXT_HXX_
+#include "XMLIndexUserSourceContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXBIBLIOGRAPHYSOURCECONTEXT_HXX_
+#include "XMLIndexBibliographySourceContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTABLESOURCECONTEXT_HXX_
+#include "XMLIndexTableSourceContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXILLUSTRATIONSOURCECONTEXT_HXX_
+#include "XMLIndexIllustrationSourceContext.hxx"
+#endif
+
#ifndef _XMLOFF_XMLICTXT_HXX
#include "xmlictxt.hxx"
#endif
@@ -112,6 +136,10 @@
#include "prstylei.hxx"
#endif
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
@@ -120,6 +148,11 @@
#include <rtl/ustring.hxx>
#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::text;
@@ -132,12 +165,67 @@ using ::com::sun::star::lang::XMultiServiceFactory;
TYPEINIT1(XMLIndexTOCContext, SvXMLImportContext);
+static const sal_Char* aIndexServiceMap[] =
+{
+ "com.sun.star.text.ContentIndex",
+ "com.sun.star.text.DocumentIndex",
+ "com.sun.star.text.TableIndex",
+ "com.sun.star.text.ObjectIndex",
+ "com.sun.star.text.Bibliography",
+ "com.sun.star.text.UserIndex",
+ "com.sun.star.text.IllustrationsIndex"
+};
+
+static const sal_Char* aIndexSourceElementMap[] =
+{
+ sXML_table_of_content_source,
+ sXML_alphabetical_index_source,
+ sXML_table_index_source,
+ sXML_object_index_source,
+ sXML_bibliography_source,
+ sXML_user_index_source,
+ sXML_illustration_index_source
+};
+
+SvXMLEnumMapEntry __READONLY_DATA aIndexTypeMap[] =
+{
+ { sXML_table_of_content, TEXT_INDEX_TOC },
+ { sXML_alphabetical_index, TEXT_INDEX_ALPHABETICAL },
+ { sXML_table_index, TEXT_INDEX_TABLE },
+ { sXML_object_index, TEXT_INDEX_OBJECT },
+ { sXML_bibliography, TEXT_INDEX_BIBLIOGRAPHY },
+ { sXML_user_index, TEXT_INDEX_USER },
+ { sXML_illustration_index, TEXT_INDEX_ILLUSTRATION },
+ { NULL, NULL }
+};
+
+
XMLIndexTOCContext::XMLIndexTOCContext(
SvXMLImport& rImport,
sal_uInt16 nPrfx,
const OUString& rLocalName ) :
- SvXMLImportContext(rImport, nPrfx, rLocalName)
+ SvXMLImportContext(rImport, nPrfx, rLocalName),
+ pSourceElementName(NULL),
+ bValid(sal_False)
{
+ if (XML_NAMESPACE_TEXT == nPrfx)
+ {
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, rLocalName, aIndexTypeMap))
+ {
+ // check for array index:
+ DBG_ASSERT(nTmp >= 0, "index too low");
+ DBG_ASSERT(nTmp < (sizeof(aIndexServiceMap)/sizeof(sal_Char*)),
+ "index too high");
+ DBG_ASSERT(sizeof(aIndexServiceMap) ==
+ sizeof(aIndexSourceElementMap),
+ "service and source element maps must be same size");
+
+ eIndexType = (enum IndexTypeEnum)nTmp;
+ pSourceElementName = aIndexSourceElementMap[eIndexType];
+ bValid = sal_True;
+ }
+ }
}
XMLIndexTOCContext::~XMLIndexTOCContext()
@@ -147,43 +235,45 @@ XMLIndexTOCContext::~XMLIndexTOCContext()
void XMLIndexTOCContext::StartElement(
const Reference<XAttributeList> & xAttrList)
{
- // TODO: solve properly when API is up to task
- const sal_Char sAPI_toc[] = "com.sun.star.text.ContentIndex";
- const OUString sContentIndex(RTL_CONSTASCII_USTRINGPARAM(sAPI_toc));
-
- // create table of content (via MultiServiceFactory)
- Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY);
- if( xFactory.is() )
+ if (bValid)
{
- Reference<XInterface> xIfc = xFactory->createInstance(sContentIndex);
- if( xIfc.is() )
+ // create table of content (via MultiServiceFactory)
+ Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),
+ UNO_QUERY);
+ if( xFactory.is() )
{
- Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
- GetImport().GetTextImport()->InsertTextContent(xTextContent);
+ Reference<XInterface> xIfc =
+ xFactory->createInstance(
+ OUString::createFromAscii(aIndexServiceMap[eIndexType]));
+ if( xIfc.is() )
+ {
+ Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
+ GetImport().GetTextImport()->InsertTextContent(xTextContent);
- Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY);
- xTOCPropertySet = xPropSet;
+ Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY);
+ xTOCPropertySet = xPropSet;
+ }
}
- }
- // find text:style-name attribute and set section style
- sal_Int32 nCount = xAttrList->getLength();
- for(sal_Int32 nAttr = 0; nAttr < nCount; nAttr++)
- {
- OUString sLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
- GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
- &sLocalName );
- if ( (XML_NAMESPACE_TEXT == nPrefix) &&
- (sLocalName.equalsAsciiL(sXML_style_name,
- sizeof(sXML_style_name)-1)) )
+ // find text:style-name attribute and set section style
+ sal_Int32 nCount = xAttrList->getLength();
+ for(sal_Int32 nAttr = 0; nAttr < nCount; nAttr++)
{
- XMLPropStyleContext* pStyle =
- GetImport().GetTextImport()->FindSectionStyle(
- xAttrList->getValueByIndex(nAttr));
- if (pStyle != NULL)
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (sLocalName.equalsAsciiL(sXML_style_name,
+ sizeof(sXML_style_name)-1)) )
{
- pStyle->FillPropertySet( xTOCPropertySet );
+ XMLPropStyleContext* pStyle =
+ GetImport().GetTextImport()->FindSectionStyle(
+ xAttrList->getValueByIndex(nAttr));
+ if (pStyle != NULL)
+ {
+ pStyle->FillPropertySet( xTOCPropertySet );
+ }
}
}
}
@@ -201,18 +291,65 @@ SvXMLImportContext* XMLIndexTOCContext::CreateChildContext(
{
SvXMLImportContext* pContext = NULL;
- if ( (XML_NAMESPACE_TEXT == nPrefix) &&
- (rLocalName.equalsAsciiL(sXML_table_of_content_source,
- sizeof(sXML_table_of_content_source)-1)) )
+ if (bValid)
{
- pContext = new XMLIndexTOCSourceContext(GetImport(),
- nPrefix, rLocalName,
- xTOCPropertySet);
- }
- else
- {
- // TODO: text content
+ if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if (rLocalName.equalsAsciiL(sXML_index_body,
+ sizeof(sXML_index_body)-1))
+ {
+ // TODO: text content
+ }
+ else if (0 == rLocalName.compareToAscii(pSourceElementName))
+ {
+ // instantiate source context for this index type
+ switch (eIndexType)
+ {
+ case TEXT_INDEX_TOC:
+ pContext = new XMLIndexTOCSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_OBJECT:
+ pContext = new XMLIndexObjectSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_ALPHABETICAL:
+ pContext = new XMLIndexAlphabeticalSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_USER:
+ pContext = new XMLIndexUserSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_BIBLIOGRAPHY:
+ pContext = new XMLIndexBibliographySourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_TABLE:
+ pContext = new XMLIndexTableSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ case TEXT_INDEX_ILLUSTRATION:
+ pContext = new XMLIndexIllustrationSourceContext(
+ GetImport(), nPrefix, rLocalName, xTOCPropertySet);
+ break;
+
+ default:
+ DBG_ERROR("index type not implemented");
+ break;
+ }
+ }
+ // else: ignore
+ }
+ // else: no text: namespace -> ignore
}
+ // else: not valid -> ignore
// default: ignore
if (pContext == NULL)
diff --git a/xmloff/source/text/XMLIndexTOCContext.hxx b/xmloff/source/text/XMLIndexTOCContext.hxx
index e91c783fd326..01875024bde1 100644
--- a/xmloff/source/text/XMLIndexTOCContext.hxx
+++ b/xmloff/source/text/XMLIndexTOCContext.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLIndexTOCContext.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -78,8 +78,27 @@ namespace com { namespace sun { namespace star {
namespace rtl { class OUString; }
+enum IndexTypeEnum
+{
+ TEXT_INDEX_TOC,
+ TEXT_INDEX_ALPHABETICAL,
+ TEXT_INDEX_TABLE,
+ TEXT_INDEX_OBJECT,
+ TEXT_INDEX_BIBLIOGRAPHY,
+ TEXT_INDEX_USER,
+ TEXT_INDEX_ILLUSTRATION,
+
+ TEXT_INDEX_UNKNOWN
+};
+
+
/**
- * Import table of context
+ * Import all indices.
+ *
+ * Originally, this class would import only the TOC (table of
+ * content), but now it's role has been expanded to handle all
+ * indices, and hence is named inappropriately. Depending on the
+ * element name it decides which index source element context to create.
*/
class XMLIndexTOCContext : public SvXMLImportContext
{
@@ -88,6 +107,13 @@ class XMLIndexTOCContext : public SvXMLImportContext
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet> xTOCPropertySet;
+ enum IndexTypeEnum eIndexType;
+
+ /** source element name (for CreateChildContext) */
+ const sal_Char* pSourceElementName;
+
+ sal_Bool bValid;
+
public:
TYPEINFO();
diff --git a/xmloff/source/text/XMLIndexTOCSourceContext.cxx b/xmloff/source/text/XMLIndexTOCSourceContext.cxx
index b3aeaf78fb58..b11a2c8ef69f 100644
--- a/xmloff/source/text/XMLIndexTOCSourceContext.cxx
+++ b/xmloff/source/text/XMLIndexTOCSourceContext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLIndexTOCSourceContext.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -134,26 +134,23 @@ const sal_Char sAPI_CreateFromOutline[] = "CreateFromOutline";
const sal_Char sAPI_CreateFromMarks[] = "CreateFromMarks";
const sal_Char sAPI_Level[] = "Level";
-TYPEINIT1( XMLIndexTOCSourceContext, SvXMLImportContext );
+TYPEINIT1( XMLIndexTOCSourceContext, XMLIndexSourceBaseContext );
XMLIndexTOCSourceContext::XMLIndexTOCSourceContext(
SvXMLImport& rImport,
sal_uInt16 nPrfx,
const OUString& rLocalName,
Reference<XPropertySet> & rPropSet) :
- SvXMLImportContext(rImport, nPrfx, rLocalName),
- rTOCPropertySet(rPropSet),
+ XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
+ rPropSet, sal_True),
// use all chapters by default
nOutlineLevel(rImport.GetTextImport()->GetChapterNumbering()->
getCount()),
bUseOutline(sal_True),
bUseMarks(sal_True),
- bChapterIndex(sal_False),
- bRelativeTabs(sal_True),
sCreateFromMarks(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromMarks)),
sLevel(RTL_CONSTASCII_USTRINGPARAM(sAPI_Level)),
- sCreateFromChapter(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromChapter)),
- sCreateFromOutline(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromOutline))
+ sCreateFromOutline(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromOutline))
{
}
@@ -161,92 +158,44 @@ XMLIndexTOCSourceContext::~XMLIndexTOCSourceContext()
{
}
-enum IndexTOCSourceTokenEnum
+void XMLIndexTOCSourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
{
- XML_TOK_TOCSOURCE_OUTLINE_LEVEL,
- XML_TOK_TOCSOURCE_USE_INDEX_MARKS,
- XML_TOK_TOCSOURCE_INDEX_SCOPE,
- XML_TOK_TOCSOURCE_RELATIVE_TABS
-};
-
-static __FAR_DATA SvXMLTokenMapEntry aIndexTOCSourceTokenMap[] =
-{
- { XML_NAMESPACE_TEXT, sXML_outline_level, XML_TOK_TOCSOURCE_OUTLINE_LEVEL},
- { XML_NAMESPACE_TEXT, sXML_use_index_marks,
- XML_TOK_TOCSOURCE_USE_INDEX_MARKS },
- { XML_NAMESPACE_TEXT, sXML_index_scope, XML_TOK_TOCSOURCE_INDEX_SCOPE },
- { XML_NAMESPACE_TEXT, sXML_relative_tab_stop_position,
- XML_TOK_TOCSOURCE_RELATIVE_TABS } ,
- XML_TOKEN_MAP_END
-};
-
-void XMLIndexTOCSourceContext::StartElement(
- const Reference<XAttributeList> & xAttrList)
-{
- SvXMLTokenMap aTokenMap(aIndexTOCSourceTokenMap);
-
- // process attributes
- sal_Int32 nLength = xAttrList->getLength();
- for(sal_Int32 i=0; i<nLength; i++)
+ switch (eParam)
{
-
- OUString sLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
- GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
-
- OUString sAttr = xAttrList->getValueByIndex(i);
-
- switch (aTokenMap.Get(nPrefix, sLocalName))
- {
- case XML_TOK_TOCSOURCE_OUTLINE_LEVEL:
- if (sAttr.equalsAsciiL(sXML_none, sizeof(sXML_none)-1))
- {
- bUseOutline = sal_False;
- }
- else
- {
- sal_Int32 nTmp;
- if (SvXMLUnitConverter::convertNumber(
- nTmp, sAttr, 1, GetImport().GetTextImport()->
- GetChapterNumbering()->getCount()))
- {
- bUseOutline = sal_True;
- nOutlineLevel = nTmp;
- }
- }
- break;
-
- case XML_TOK_TOCSOURCE_USE_INDEX_MARKS:
+ case XML_TOK_INDEXSOURCE_OUTLINE_LEVEL:
+ if (rValue.equalsAsciiL(sXML_none, sizeof(sXML_none)-1))
{
- sal_Bool bTmp;
- if (SvXMLUnitConverter::convertBool(bTmp, sAttr))
- {
- bUseMarks = bTmp;
- }
- break;
+ bUseOutline = sal_False;
}
-
- case XML_TOK_TOCSOURCE_INDEX_SCOPE:
- if (sAttr.equalsAsciiL(sXML_chapter, sizeof(sXML_chapter)-1))
- {
- bChapterIndex = sal_True;
- }
- break;
-
- case XML_TOK_TOCSOURCE_RELATIVE_TABS:
+ else
{
- sal_Bool bTmp;
- if (SvXMLUnitConverter::convertBool(bTmp, sAttr))
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(
+ nTmp, rValue, 1, GetImport().GetTextImport()->
+ GetChapterNumbering()->getCount()))
{
- bRelativeTabs = bTmp;
+ bUseOutline = sal_True;
+ nOutlineLevel = nTmp;
}
- break;
}
+ break;
- default:
- // unknown attribute -> ignore
- break;
+ case XML_TOK_INDEXSOURCE_USE_INDEX_MARKS:
+ {
+ sal_Bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseMarks = bTmp;
+ }
+ break;
}
+
+ default:
+ // default: ask superclass
+ XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
+ break;
}
}
@@ -254,62 +203,37 @@ void XMLIndexTOCSourceContext::EndElement()
{
Any aAny;
- aAny.setValue(&bRelativeTabs, ::getBooleanCppuType());
-// rTOCPropertySet->setPropertyValue(s..., aAny);
-
- aAny.setValue(&bChapterIndex, ::getBooleanCppuType());
- rTOCPropertySet->setPropertyValue(sCreateFromChapter, aAny);
-
aAny.setValue(&bUseMarks, ::getBooleanCppuType());
- rTOCPropertySet->setPropertyValue(sCreateFromMarks, aAny);
+ rIndexPropertySet->setPropertyValue(sCreateFromMarks, aAny);
aAny.setValue(&bUseOutline, ::getBooleanCppuType());
- rTOCPropertySet->setPropertyValue(sCreateFromOutline, aAny);
+ rIndexPropertySet->setPropertyValue(sCreateFromOutline, aAny);
aAny <<= (sal_Int16)nOutlineLevel;
- rTOCPropertySet->setPropertyValue(sLevel, aAny);
+ rIndexPropertySet->setPropertyValue(sLevel, aAny);
}
+
SvXMLImportContext* XMLIndexTOCSourceContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const Reference<XAttributeList> & xAttrList )
{
- SvXMLImportContext* pContext = NULL;
-
- if (XML_NAMESPACE_TEXT == nPrefix)
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (rLocalName.equalsAsciiL(sXML_table_of_content_entry_template,
+ sizeof(sXML_table_of_content_entry_template)-1)))
{
- if (rLocalName.equalsAsciiL(sXML_index_entry_template,
- sizeof(sXML_index_entry_template)-1))
- {
- pContext = new XMLIndexTemplateContext(GetImport(),
- rTOCPropertySet,
- nPrefix, rLocalName);
- }
- else if (rLocalName.equalsAsciiL(sXML_index_title_template,
- sizeof(sXML_index_title_template)-1))
- {
- pContext = new XMLIndexTitleTemplateContext(GetImport(),
- rTOCPropertySet,
- nPrefix, rLocalName);
- }
- else if (rLocalName.equalsAsciiL(sXML_index_source_styles,
- sizeof(sXML_index_source_styles)-1))
- {
- pContext = new XMLIndexTOCStylesContext(GetImport(),
- rTOCPropertySet,
- nPrefix, rLocalName);
- }
- // else: unknown element in text namespace -> ignore
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameTOCMap,
+ sXML_outline_level,
+ aLevelStylePropNameTOCMap,
+ aAllowedTokenTypesTOC);
}
- // else: unknown namespace -> ignore
-
- // use default namespace
- if (pContext == NULL)
+ else
{
- pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
- xAttrList);
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
}
-
- return pContext;
}
diff --git a/xmloff/source/text/XMLIndexTOCSourceContext.hxx b/xmloff/source/text/XMLIndexTOCSourceContext.hxx
index 3e1db09ef1df..bf08fa6025e5 100644
--- a/xmloff/source/text/XMLIndexTOCSourceContext.hxx
+++ b/xmloff/source/text/XMLIndexTOCSourceContext.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLIndexTOCSourceContext.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,8 +62,8 @@
#ifndef _XMLOFF_XMLINDEXTOCSOURCECONTEXT_HXX_
#define _XMLOFF_XMLINDEXTOCSOURCECONTEXT_HXX_
-#ifndef _XMLOFF_XMLICTXT_HXX
-#include "xmlictxt.hxx"
+#ifndef _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
+#include "XMLIndexSourceBaseContext.hxx"
#endif
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
@@ -81,21 +81,16 @@ namespace rtl { class OUString; }
/**
* Import table of context source element
*/
-class XMLIndexTOCSourceContext : public SvXMLImportContext
+class XMLIndexTOCSourceContext : public XMLIndexSourceBaseContext
{
const ::rtl::OUString sCreateFromMarks;
const ::rtl::OUString sLevel;
const ::rtl::OUString sCreateFromChapter;
const ::rtl::OUString sCreateFromOutline;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet> & rTOCPropertySet;
-
sal_Int32 nOutlineLevel;
sal_Bool bUseOutline;
sal_Bool bUseMarks;
- sal_Bool bChapterIndex;
- sal_Bool bRelativeTabs;
public:
@@ -112,9 +107,9 @@ public:
protected:
- virtual void StartElement(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
virtual void EndElement();
diff --git a/xmloff/source/text/XMLIndexTableSourceContext.cxx b/xmloff/source/text/XMLIndexTableSourceContext.cxx
new file mode 100644
index 000000000000..a933e3576e9c
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTableSourceContext.cxx
@@ -0,0 +1,258 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexTableSourceContext.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_XMLINDEXTABLESOURCECONTEXT_HXX_
+#include "XMLIndexTableSourceContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
+#include <com/sun/star/container/XIndexReplace.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_REFERENCEFIELD_PART_HPP
+#include <com/sun/star/text/ReferenceFieldpart.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
+#include "XMLIndexTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTITLETEMPLATECONTEXT_HXX_
+#include "XMLIndexTitleTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTOCSTYLESCONTEXT_HXX_
+#include "XMLIndexTOCStylesContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLICTXT_HXX
+#include "xmlictxt.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _XMLOFF_TEXTIMP_HXX_
+#include "txtimp.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+using namespace ::com::sun::star::text;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+const sal_Char sAPI_CreateFromLabels[] = "CreateFromLabels";
+const sal_Char sAPI_LabelCategory[] = "LabelCategory";
+const sal_Char sAPI_LabelDisplayType[] = "LabelDisplayType";
+
+
+TYPEINIT1(XMLIndexTableSourceContext, XMLIndexSourceBaseContext);
+
+
+XMLIndexTableSourceContext::XMLIndexTableSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet) :
+ XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
+ rPropSet, sal_False),
+ sCreateFromLabels(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromLabels)),
+ sLabelCategory(RTL_CONSTASCII_USTRINGPARAM(sAPI_LabelCategory)),
+ sLabelDisplayType(RTL_CONSTASCII_USTRINGPARAM(sAPI_LabelDisplayType)),
+ bSequenceOK(sal_False),
+ bDisplayFormatOK(sal_False),
+ bUseCaption(sal_False)
+{
+}
+
+XMLIndexTableSourceContext::~XMLIndexTableSourceContext()
+{
+}
+
+static SvXMLEnumMapEntry __READONLY_DATA lcl_aReferenceTypeTokenMap[] =
+{
+ { sXML_text, ReferenceFieldPart::TEXT },
+ { sXML_category_and_value, ReferenceFieldPart::CATEGORY_AND_NUMBER },
+ { sXML_caption, ReferenceFieldPart::ONLY_CAPTION },
+ { 0, 0 }
+};
+
+void XMLIndexTableSourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ sal_Bool bTmp;
+
+ switch (eParam)
+ {
+ case XML_TOK_INDEXSOURCE_USE_CAPTION:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseCaption = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_SEQUENCE_NAME:
+ sSequence = rValue;
+ bSequenceOK = sal_True;
+ break;
+
+ case XML_TOK_INDEXSOURCE_SEQUENCE_FORMAT:
+ {
+ // TODO: API problem
+
+// sal_uInt16 nTmp;
+// if (SvXMLUnitConverter::convertEnum(nTmp, rValue,
+// lcl_aReferenceTypeTokenMap))
+// {
+// nDisplayFormat = nTmp;
+// bDisplayFormatOK = sal_True;
+// }
+ break;
+ }
+
+ default:
+ XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
+ break;
+ }
+}
+
+
+void XMLIndexTableSourceContext::EndElement()
+{
+ Any aAny;
+
+ aAny.setValue(&bUseCaption, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromLabels, aAny);
+
+ if (bSequenceOK)
+ {
+ aAny <<= sSequence;
+ rIndexPropertySet->setPropertyValue(sLabelCategory, aAny);
+ }
+
+ if (bDisplayFormatOK)
+ {
+ aAny <<= nDisplayFormat;
+ rIndexPropertySet->setPropertyValue(sLabelDisplayType, aAny);
+ }
+
+ XMLIndexSourceBaseContext::EndElement();
+}
+
+
+SvXMLImportContext* XMLIndexTableSourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (rLocalName.equalsAsciiL(sXML_table_index_entry_template,
+ sizeof(sXML_table_index_entry_template)-1)))
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameTableMap,
+ NULL, // no outline-level attr
+ aLevelStylePropNameTableMap,
+ aAllowedTokenTypesTable);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+}
diff --git a/xmloff/source/text/XMLIndexTableSourceContext.hxx b/xmloff/source/text/XMLIndexTableSourceContext.hxx
new file mode 100644
index 000000000000..7029119c479d
--- /dev/null
+++ b/xmloff/source/text/XMLIndexTableSourceContext.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexTableSourceContext.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLINDEXTABLESOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXTABLESOURCECONTEXT_HXX_
+
+#ifndef _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
+#include "XMLIndexSourceBaseContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import table index source element
+ */
+class XMLIndexTableSourceContext : public XMLIndexSourceBaseContext
+{
+ const ::rtl::OUString sCreateFromLabels;
+ const ::rtl::OUString sLabelCategory;
+ const ::rtl::OUString sLabelDisplayType;
+
+ ::rtl::OUString sSequence;
+ sal_Int16 nDisplayFormat;
+
+ sal_Bool bSequenceOK;
+ sal_Bool bDisplayFormatOK;
+ sal_Bool bUseCaption;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexTableSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexTableSourceContext();
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
diff --git a/xmloff/source/text/XMLIndexTemplateContext.cxx b/xmloff/source/text/XMLIndexTemplateContext.cxx
index 072a1312972a..e391bd822c75 100644
--- a/xmloff/source/text/XMLIndexTemplateContext.cxx
+++ b/xmloff/source/text/XMLIndexTemplateContext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLIndexTemplateContext.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,14 @@
#include "XMLIndexTabStopEntryContext.hxx"
#endif
+#ifndef _XMLOFF_XMLINDEXBIBLIOGRAPHYENTRYCONTEXT_HXX_
+#include "XMLIndexBibliographyEntryContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXCHAPTERINFOENTRYCONTEXT_HXX_
+#include "XMLIndexChapterInfoEntryContext.hxx"
+#endif
+
#ifndef _XMLOFF_XMLICTXT_HXX
#include "xmlictxt.hxx"
#endif
@@ -153,9 +161,21 @@ XMLIndexTemplateContext::XMLIndexTemplateContext(
SvXMLImport& rImport,
Reference<XPropertySet> & rPropSet,
sal_uInt16 nPrfx,
- const OUString& rLocalName ) :
+ const OUString& rLocalName,
+ const SvXMLEnumMapEntry* pLevelNameMap,
+ const sal_Char* pLevelAttrName,
+ const sal_Char** pLevelStylePropMap,
+ const sal_Bool* pAllowedTokenTypes) :
SvXMLImportContext(rImport, nPrfx, rLocalName),
rPropertySet(rPropSet),
+ sStyleName(),
+ nOutlineLevel(1), // all indices have level 1 (0 is for header)
+ bStyleNameOK(sal_False),
+ bOutlineLevelOK(sal_False),
+ pOutlineLevelAttrName(pLevelAttrName),
+ pOutlineLevelNameMap(pLevelNameMap),
+ pOutlineLevelStylePropMap(pLevelStylePropMap),
+ pAllowedTokenTypesMap(pAllowedTokenTypes),
sTokenEntryNumber(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenEntryNumber)),
sTokenEntryText(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenEntryText)),
sTokenTabStop(RTL_CONSTASCII_USTRINGPARAM(sAPI_TokenTabStop)),
@@ -177,8 +197,23 @@ XMLIndexTemplateContext::XMLIndexTemplateContext(
"TabStopFillCharacter")),
sCharacterStyleName(RTL_CONSTASCII_USTRINGPARAM("CharacterStyleName")),
sTokenType(RTL_CONSTASCII_USTRINGPARAM("TokenType")),
- sText(RTL_CONSTASCII_USTRINGPARAM("Text"))
+ sText(RTL_CONSTASCII_USTRINGPARAM("Text")),
+ sBibliographyDataField(RTL_CONSTASCII_USTRINGPARAM(
+ "BibliographyDataField")),
+ sChapterFormat(RTL_CONSTASCII_USTRINGPARAM("ChapterFormat"))
{
+ DBG_ASSERT( ((NULL != pLevelAttrName) && (NULL != pLevelNameMap))
+ || ((NULL == pLevelAttrName) && (NULL == pLevelNameMap)),
+ "need both, attribute name and value map, or neither" );
+ DBG_ASSERT( NULL != pOutlineLevelStylePropMap, "need property name map" );
+ DBG_ASSERT( NULL != pAllowedTokenTypes, "need allowed tokens map" );
+
+ // no map for outline-level? then use 1
+ if (NULL == pLevelNameMap)
+ {
+ nOutlineLevel = 1;
+ bOutlineLevelOK = sal_True;
+ }
}
XMLIndexTemplateContext::~XMLIndexTemplateContext()
@@ -192,6 +227,7 @@ void XMLIndexTemplateContext::addTemplateEntry(
aValueVector.push_back(aValues);
}
+
void XMLIndexTemplateContext::StartElement(
const Reference<XAttributeList> & xAttrList)
{
@@ -212,23 +248,27 @@ void XMLIndexTemplateContext::StartElement(
sStyleName = xAttrList->getValueByIndex(nAttr);
bStyleNameOK = sal_True;
}
- else if (sLocalName.equalsAsciiL(sXML_outline_level,
- sizeof(sXML_outline_level)-1))
+ else if (NULL != pOutlineLevelAttrName)
{
- // outline level
- sal_Int32 nTmp;
- if (SvXMLUnitConverter::convertNumber(
- nTmp, xAttrList->getValueByIndex(nAttr), 1,
- GetImport().GetTextImport()->
- GetChapterNumbering()->getCount() ))
+ // we have an attr name! Then see if we have the attr, too.
+ if (0 == sLocalName.compareToAscii(pOutlineLevelAttrName))
{
- nOutlineLevel = nTmp;
- bOutlineLevelOK = sal_True;
+ // outline level
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(
+ nTmp, xAttrList->getValueByIndex(nAttr),
+ pOutlineLevelNameMap))
+ {
+ nOutlineLevel = nTmp;
+ bOutlineLevelOK = sal_True;
+ }
+ // else: illegal value -> ignore
}
+ // else: unknown attribute -> ignore
}
- // else: unknown attribute
+ // else: we don't care about outline-level -> ignore
}
- // else: attribute not in text namespace
+ // else: attribute not in text namespace -> ignore
}
}
@@ -254,29 +294,37 @@ void XMLIndexTemplateContext::EndElement()
if (bStyleNameOK)
{
- // create property name and set
- OUStringBuffer sBuf;
- sBuf.append(sParaStyleLevel);
- sBuf.append(nOutlineLevel);
+ const sal_Char* pStyleProperty =
+ pOutlineLevelStylePropMap[nOutlineLevel];
- aAny <<= sStyleName;
- rPropertySet->setPropertyValue(sBuf.makeStringAndClear(), aAny);
+ DBG_ASSERT(NULL != pStyleProperty, "need property name");
+ if (NULL != pStyleProperty)
+ {
+ aAny <<= sStyleName;
+ rPropertySet->setPropertyValue(
+ OUString::createFromAscii(pStyleProperty), aAny);
+ }
}
}
}
+
+
+/// template token types; used for aTokenTypeMap parameter
enum TemplateTokenType
{
- XML_TOK_INDEX_TYPE_ENTRY_TEXT,
+ XML_TOK_INDEX_TYPE_ENTRY_TEXT = 0,
XML_TOK_INDEX_TYPE_TAB_STOP,
XML_TOK_INDEX_TYPE_TEXT,
XML_TOK_INDEX_TYPE_PAGE_NUMBER,
XML_TOK_INDEX_TYPE_CHAPTER,
+ XML_TOK_INDEX_TYPE_CHAPTER_NUMBER,
XML_TOK_INDEX_TYPE_LINK_START,
XML_TOK_INDEX_TYPE_LINK_END,
XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
};
+
SvXMLEnumMapEntry aTemplateTokenTypeMap[] =
{
{ sXML_index_entry_chapter, XML_TOK_INDEX_TYPE_CHAPTER },
@@ -284,6 +332,7 @@ SvXMLEnumMapEntry aTemplateTokenTypeMap[] =
{ sXML_index_entry_tab_stop, XML_TOK_INDEX_TYPE_TAB_STOP },
{ sXML_index_entry_span, XML_TOK_INDEX_TYPE_TEXT },
{ sXML_index_entry_page_number, XML_TOK_INDEX_TYPE_PAGE_NUMBER },
+ { sXML_index_entry_chapter_number, XML_TOK_INDEX_TYPE_CHAPTER_NUMBER },
{ sXML_index_entry_chapter, XML_TOK_INDEX_TYPE_CHAPTER },
{ sXML_index_entry_link_start, XML_TOK_INDEX_TYPE_LINK_START },
{ sXML_index_entry_link_end, XML_TOK_INDEX_TYPE_LINK_END },
@@ -304,55 +353,65 @@ SvXMLImportContext *XMLIndexTemplateContext::CreateChildContext(
if (SvXMLUnitConverter::convertEnum(nToken, rLocalName,
aTemplateTokenTypeMap))
{
- switch ((TemplateTokenType)nToken)
+ // can this index accept this kind of token?
+ if (pAllowedTokenTypesMap[nToken])
{
-// TODO: only allow entries for the appropriate index types!
- case XML_TOK_INDEX_TYPE_ENTRY_TEXT:
- pContext = new XMLIndexSimpleEntryContext(
- GetImport(), sTokenEntryText, *this,
- nPrefix, rLocalName);
- break;
-
- case XML_TOK_INDEX_TYPE_PAGE_NUMBER:
- pContext = new XMLIndexSimpleEntryContext(
- GetImport(), sTokenPageNumber, *this,
- nPrefix, rLocalName);
- break;
-
- case XML_TOK_INDEX_TYPE_LINK_START:
- pContext = new XMLIndexSimpleEntryContext(
- GetImport(), sTokenHyperlinkStart, *this,
- nPrefix, rLocalName);
- break;
-
- case XML_TOK_INDEX_TYPE_LINK_END:
- pContext = new XMLIndexSimpleEntryContext(
- GetImport(), sTokenHyperlinkEnd, *this,
- nPrefix, rLocalName);
- break;
-
- case XML_TOK_INDEX_TYPE_TEXT:
- pContext = new XMLIndexSpanEntryContext(
- GetImport(), *this, nPrefix, rLocalName);
- break;
-
- case XML_TOK_INDEX_TYPE_TAB_STOP:
- pContext = new XMLIndexTabStopEntryContext(
- GetImport(), *this, nPrefix, rLocalName);
- break;
-
- case XML_TOK_INDEX_TYPE_CHAPTER:
- // TODO: implement "real" chapter context that
- // parses chapter attributes
- pContext = new XMLIndexSimpleEntryContext(
- GetImport(), sTokenEntryNumber, *this,
- nPrefix, rLocalName);
- break;
-
- case XML_TOK_INDEX_TYPE_BIBLIOGRAPHY:
- // TODO: bibliography context
- default:
- break;
+ switch ((TemplateTokenType)nToken)
+ {
+ case XML_TOK_INDEX_TYPE_ENTRY_TEXT:
+ pContext = new XMLIndexSimpleEntryContext(
+ GetImport(), sTokenEntryText, *this,
+ nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_PAGE_NUMBER:
+ pContext = new XMLIndexSimpleEntryContext(
+ GetImport(), sTokenPageNumber, *this,
+ nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_LINK_START:
+ pContext = new XMLIndexSimpleEntryContext(
+ GetImport(), sTokenHyperlinkStart, *this,
+ nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_LINK_END:
+ pContext = new XMLIndexSimpleEntryContext(
+ GetImport(), sTokenHyperlinkEnd, *this,
+ nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_TEXT:
+ pContext = new XMLIndexSpanEntryContext(
+ GetImport(), *this, nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_TAB_STOP:
+ pContext = new XMLIndexTabStopEntryContext(
+ GetImport(), *this, nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_CHAPTER_NUMBER:
+ pContext = new XMLIndexSimpleEntryContext(
+ GetImport(), sTokenEntryNumber, *this,
+ nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_BIBLIOGRAPHY:
+ pContext = new XMLIndexBibliographyEntryContext(
+ GetImport(), *this, nPrefix, rLocalName);
+ break;
+
+ case XML_TOK_INDEX_TYPE_CHAPTER:
+ pContext = new XMLIndexChapterInfoEntryContext(
+ GetImport(), *this, nPrefix, rLocalName);
+ break;
+
+ default:
+ // ignore!
+ break;
+ }
}
}
}
@@ -366,3 +425,166 @@ SvXMLImportContext *XMLIndexTemplateContext::CreateChildContext(
return pContext;
}
+
+
+
+//
+// maps for the XMLIndexTemplateContext constructor
+//
+
+
+// table of content and user defined index:
+
+const SvXMLEnumMapEntry aLevelNameTOCMap[] =
+{
+ { sXML_1, 1 },
+ { sXML_2, 2 },
+ { sXML_3, 3 },
+ { sXML_4, 4 },
+ { sXML_5, 5 },
+ { sXML_6, 6 },
+ { sXML_7, 7 },
+ { sXML_8, 8 },
+ { sXML_9, 9 },
+ { sXML_10, 10 },
+ { NULL, NULL }
+};
+
+const sal_Char* aLevelStylePropNameTOCMap[] =
+ { NULL, "ParaStyleLevel1", "ParaStyleLevel2", "ParaStyleLevel3",
+ "ParaStyleLevel4", "ParaStyleLevel5", "ParaStyleLevel6",
+ "ParaStyleLevel7", "ParaStyleLevel8", "ParaStyleLevel9",
+ "ParaStyleLevel10", NULL };
+
+const sal_Bool aAllowedTokenTypesTOC[] =
+{
+ sal_True, // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
+ sal_True, // XML_TOK_INDEX_TYPE_TAB_STOP,
+ sal_True, // XML_TOK_INDEX_TYPE_TEXT,
+ sal_True, // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+ sal_False, // XML_TOK_INDEX_TYPE_CHAPTER,
+ sal_True, // XML_TOK_INDEX_TYPE_CHAPTER_NUMBER
+ sal_True, // XML_TOK_INDEX_TYPE_LINK_START,
+ sal_True, // XML_TOK_INDEX_TYPE_LINK_END,
+ sal_False // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
+const sal_Bool aAllowedTokenTypesUser[] =
+{
+ sal_True, // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
+ sal_True, // XML_TOK_INDEX_TYPE_TAB_STOP,
+ sal_True, // XML_TOK_INDEX_TYPE_TEXT,
+ sal_True, // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+ sal_False, // XML_TOK_INDEX_TYPE_CHAPTER,
+ sal_True, // XML_TOK_INDEX_TYPE_CHAPTER_NUMBER
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_START,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_END,
+ sal_False // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
+
+// alphabetical index
+
+const SvXMLEnumMapEntry aLevelNameAlphaMap[] =
+{
+ { sXML_separator, 1 },
+ { sXML_1, 2 },
+ { sXML_2, 3 },
+ { sXML_3, 4 },
+ { NULL, NULL }
+};
+
+const sal_Char* aLevelStylePropNameAlphaMap[] =
+ { NULL, "ParaStyleSeparator", "ParaStyleLevel1", "ParaStyleLevel2",
+ "ParaStyleLevel3", NULL };
+
+const sal_Bool aAllowedTokenTypesAlpha[] =
+{
+ sal_True, // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
+ sal_True, // XML_TOK_INDEX_TYPE_TAB_STOP,
+ sal_True, // XML_TOK_INDEX_TYPE_TEXT,
+ sal_True, // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+ sal_True, // XML_TOK_INDEX_TYPE_CHAPTER,
+ sal_False, // XML_TOK_INDEX_TYPE_CHAPTER_NUMBER
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_START,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_END,
+ sal_False // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
+
+// bibliography index:
+
+const SvXMLEnumMapEntry aLevelNameBibliographyMap[] =
+{
+ { sXML_article, 1 },
+ { sXML_book, 2 },
+ { sXML_booklet, 3 },
+ { sXML_conference, 4 },
+ { sXML_custom1, 5 },
+ { sXML_custom2, 6 },
+ { sXML_custom3, 7 },
+ { sXML_custom4, 8 },
+ { sXML_custom5, 9 },
+ { sXML_email, 10 },
+ { sXML_inbook, 11 },
+ { sXML_incollection, 12 },
+ { sXML_inproceedings, 13 },
+ { sXML_journal, 14 },
+ { sXML_manual, 15 },
+ { sXML_mastersthesis, 16 },
+ { sXML_misc, 17 },
+ { sXML_phdthesis, 18 },
+ { sXML_proceedings, 19 },
+ { sXML_techreport, 20 },
+ { sXML_unpublished, 21 },
+ { sXML_www, 22 },
+ { NULL, NULL }
+};
+
+// TODO: replace with real property names, when available
+const sal_Char* aLevelStylePropNameBibliographyMap[] =
+{
+ NULL, "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", NULL };
+
+const sal_Bool aAllowedTokenTypesBibliography[] =
+{
+ sal_True, // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
+ sal_True, // XML_TOK_INDEX_TYPE_TAB_STOP,
+ sal_True, // XML_TOK_INDEX_TYPE_TEXT,
+ sal_True, // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+ sal_False, // XML_TOK_INDEX_TYPE_CHAPTER,
+ sal_False, // XML_TOK_INDEX_TYPE_CHAPTER_NUMBER
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_START,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_END,
+ sal_True // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
+
+// table, illustration and object index
+
+// no name map
+const SvXMLEnumMapEntry* aLevelNameTableMap = NULL;
+
+const sal_Char* aLevelStylePropNameTableMap[] =
+ { NULL, "ParaStyleLevel1", NULL };
+
+const sal_Bool aAllowedTokenTypesTable[] =
+{
+ sal_True, // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
+ sal_True, // XML_TOK_INDEX_TYPE_TAB_STOP,
+ sal_True, // XML_TOK_INDEX_TYPE_TEXT,
+ sal_True, // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+ sal_True, // XML_TOK_INDEX_TYPE_CHAPTER,
+ sal_False, // XML_TOK_INDEX_TYPE_CHAPTER_NUMBER
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_START,
+ sal_False, // XML_TOK_INDEX_TYPE_LINK_END,
+ sal_False // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
diff --git a/xmloff/source/text/XMLIndexTemplateContext.hxx b/xmloff/source/text/XMLIndexTemplateContext.hxx
index c1ebea269291..958f216f951e 100644
--- a/xmloff/source/text/XMLIndexTemplateContext.hxx
+++ b/xmloff/source/text/XMLIndexTemplateContext.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLIndexTemplateContext.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -88,6 +88,31 @@ namespace com { namespace sun { namespace star {
namespace beans { class XPropertySet; }
} } }
namespace rtl { class OUString; }
+struct SvXMLEnumMapEntry;
+
+
+// constants for the XMLIndexTemplateContext constructor
+
+// TOC and user defined index:
+extern const SvXMLEnumMapEntry aLevelNameTOCMap[];
+extern const sal_Char* aLevelStylePropNameTOCMap[];
+extern const sal_Bool aAllowedTokenTypesTOC[];
+extern const sal_Bool aAllowedTokenTypesUser[];
+
+// alphabetical index:
+extern const SvXMLEnumMapEntry aLevelNameAlphaMap[];
+extern const sal_Char* aLevelStylePropNameAlphaMap[];
+extern const sal_Bool aAllowedTokenTypesAlpha[];
+
+// bibliography:
+extern const SvXMLEnumMapEntry aLevelNameBibliographyMap[];
+extern const sal_Char* aLevelStylePropNameBibliographyMap[];
+extern const sal_Bool aAllowedTokenTypesBibliography[];
+
+// table, illustration and object tables:
+extern const SvXMLEnumMapEntry* aLevelNameTableMap; // NULL: no outline-level
+extern const sal_Char* aLevelStylePropNameTableMap[];
+extern const sal_Bool aAllowedTokenTypesTable[];
/**
@@ -99,6 +124,12 @@ class XMLIndexTemplateContext : public SvXMLImportContext
::std::vector< ::com::sun::star::beans::PropertyValues > aValueVector;
::rtl::OUString sStyleName;
+
+ const SvXMLEnumMapEntry* pOutlineLevelNameMap;
+ const sal_Char* pOutlineLevelAttrName;
+ const sal_Char** pOutlineLevelStylePropMap;
+ const sal_Bool* pAllowedTokenTypesMap;
+
sal_Int32 nOutlineLevel;
sal_Bool bStyleNameOK;
sal_Bool bOutlineLevelOK;
@@ -127,6 +158,8 @@ public:
const ::rtl::OUString sTabStopRightAligned;
const ::rtl::OUString sTabStopPosition;
const ::rtl::OUString sTabStopFillCharacter;
+ const ::rtl::OUString sBibliographyDataField;
+ const ::rtl::OUString sChapterFormat;
const ::rtl::OUString sLevelFormat;
const ::rtl::OUString sParaStyleLevel;
@@ -139,7 +172,11 @@ public:
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet> & rPropSet,
sal_uInt16 nPrfx,
- const ::rtl::OUString& rLocalName );
+ const ::rtl::OUString& rLocalName,
+ const SvXMLEnumMapEntry* aLevelNameMap,
+ const sal_Char* pLevelAttrName,
+ const sal_Char** aLevelStylePropNameMap,
+ const sal_Bool* aAllowedTokenTypes);
~XMLIndexTemplateContext();
diff --git a/xmloff/source/text/XMLIndexUserSourceContext.cxx b/xmloff/source/text/XMLIndexUserSourceContext.cxx
new file mode 100644
index 000000000000..dba3eee5c0a2
--- /dev/null
+++ b/xmloff/source/text/XMLIndexUserSourceContext.cxx
@@ -0,0 +1,276 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexUserSourceContext.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_XMLINDEXUSERSOURCECONTEXT_HXX_
+#include "XMLIndexUserSourceContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
+#include <com/sun/star/container/XIndexReplace.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
+#include "XMLIndexTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTITLETEMPLATECONTEXT_HXX_
+#include "XMLIndexTitleTemplateContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLINDEXTOCSTYLESCONTEXT_HXX_
+#include "XMLIndexTOCStylesContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLICTXT_HXX
+#include "xmlictxt.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _XMLOFF_TEXTIMP_HXX_
+#include "txtimp.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::xml::sax::XAttributeList;
+
+
+const sal_Char sAPI_CreateFromEmbeddedObjects[] = "CreateFromEmbeddedObjects";
+const sal_Char sAPI_CreateFromGraphicObjects[] = "CreateFromGraphicObjects";
+const sal_Char sAPI_CreateFromMarks[] = "CreateFromMarks";
+const sal_Char sAPI_CreateFromTables[] = "CreateFromTables";
+const sal_Char sAPI_CreateFromTextFrames[] = "CreateFromTextFrames";
+const sal_Char sAPI_UseLevelFromSource[] = "UseLevelFromSource";
+
+TYPEINIT1(XMLIndexUserSourceContext, XMLIndexSourceBaseContext);
+
+
+XMLIndexUserSourceContext::XMLIndexUserSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropSet) :
+ XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
+ rPropSet, sal_True),
+ sCreateFromEmbeddedObjects(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromEmbeddedObjects)),
+ sCreateFromGraphicObjects(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromGraphicObjects)),
+ sCreateFromMarks(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromMarks)),
+ sCreateFromTables(RTL_CONSTASCII_USTRINGPARAM(sAPI_CreateFromTables)),
+ sCreateFromTextFrames(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_CreateFromTextFrames)),
+ sUseLevelFromSource(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_UseLevelFromSource)),
+ bUseObjects(sal_False),
+ bUseGraphic(sal_False),
+ bUseMarks(sal_False),
+ bUseTables(sal_False),
+ bUseFrames(sal_False),
+ bUseLevelFromSource(sal_False)
+{
+}
+
+XMLIndexUserSourceContext::~XMLIndexUserSourceContext()
+{
+}
+
+void XMLIndexUserSourceContext::ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const OUString& rValue)
+{
+ sal_Bool bTmp;
+
+ switch (eParam)
+ {
+ case XML_TOK_INDEXSOURCE_USE_INDEX_MARKS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseMarks = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_OBJECTS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseObjects = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_GRAPHICS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseGraphic = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_TABLES:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseTables = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_USE_FRAMES:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseFrames = bTmp;
+ }
+ break;
+
+ case XML_TOK_INDEXSOURCE_COPY_OUTLINE_LEVELS:
+ if (SvXMLUnitConverter::convertBool(bTmp, rValue))
+ {
+ bUseLevelFromSource = bTmp;
+ }
+ break;
+
+ default:
+ XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
+ break;
+ }
+}
+
+
+void XMLIndexUserSourceContext::EndElement()
+{
+ Any aAny;
+
+ aAny.setValue(&bUseObjects, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromEmbeddedObjects, aAny);
+
+ aAny.setValue(&bUseGraphic, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromGraphicObjects, aAny);
+
+ aAny.setValue(&bUseLevelFromSource, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sUseLevelFromSource, aAny);
+
+ aAny.setValue(&bUseMarks, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromMarks, aAny);
+
+ aAny.setValue(&bUseTables, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromTables, aAny);
+
+ aAny.setValue(&bUseFrames, ::getBooleanCppuType());
+ rIndexPropertySet->setPropertyValue(sCreateFromTextFrames, aAny);
+
+ XMLIndexSourceBaseContext::EndElement();
+}
+
+
+SvXMLImportContext* XMLIndexUserSourceContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ (rLocalName.equalsAsciiL(sXML_user_index_entry_template,
+ sizeof(sXML_user_index_entry_template)-1)))
+ {
+ return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
+ nPrefix, rLocalName,
+ aLevelNameTOCMap,
+ sXML_outline_level,
+ aLevelStylePropNameTOCMap,
+ aAllowedTokenTypesUser);
+ }
+ else
+ {
+ return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
+ rLocalName,
+ xAttrList);
+ }
+
+}
diff --git a/xmloff/source/text/XMLIndexUserSourceContext.hxx b/xmloff/source/text/XMLIndexUserSourceContext.hxx
new file mode 100644
index 000000000000..ab3659410725
--- /dev/null
+++ b/xmloff/source/text/XMLIndexUserSourceContext.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLIndexUserSourceContext.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLINDEXUSERSOURCECONTEXT_HXX_
+#define _XMLOFF_XMLINDEXUSERSOURCECONTEXT_HXX_
+
+#ifndef _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
+#include "XMLIndexSourceBaseContext.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XAttributeList; } }
+ namespace beans { class XPropertySet; }
+} } }
+namespace rtl { class OUString; }
+
+
+/**
+ * Import user defined index source element
+ */
+class XMLIndexUserSourceContext : public XMLIndexSourceBaseContext
+{
+ const ::rtl::OUString sCreateFromEmbeddedObjects;
+ const ::rtl::OUString sCreateFromGraphicObjects;
+ const ::rtl::OUString sCreateFromMarks;
+ const ::rtl::OUString sCreateFromTables;
+ const ::rtl::OUString sCreateFromTextFrames;
+ const ::rtl::OUString sUseLevelFromSource;
+
+ sal_Bool bUseObjects;
+ sal_Bool bUseGraphic;
+ sal_Bool bUseMarks;
+ sal_Bool bUseTables;
+ sal_Bool bUseFrames;
+ sal_Bool bUseLevelFromSource;
+
+public:
+
+ TYPEINFO();
+
+ XMLIndexUserSourceContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet);
+
+ ~XMLIndexUserSourceContext();
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum IndexSourceParamEnum eParam,
+ const ::rtl::OUString& rValue);
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx
new file mode 100644
index 000000000000..0230a13f4f5c
--- /dev/null
+++ b/xmloff/source/text/XMLSectionExport.cxx
@@ -0,0 +1,1445 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLSectionExport.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLSECTIONEXPORT_HXX_
+#include "XMLSectionExport.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef __SGI_STL_VECTOR
+#include <stl/vector>
+#endif
+
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
+#include <com/sun/star/container/XIndexReplace.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HPP_
+#include <com/sun/star/beans/PropertyValues.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_
+#include <com/sun/star/beans/PropertyState.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_XTEXT_HPP_
+#include <com/sun/star/text/XText.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_XTEXTSECTION_HPP_
+#include <com/sun/star/text/XTextSection.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_SECTIONFILELINK_HPP_
+#include <com/sun/star/text/SectionFileLink.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
+#include <com/sun/star/container/XNamed.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_XDOCUMENTINDEX_HPP_
+#include <com/sun/star/text/XDocumentIndex.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_BIBLIOGRAPHYDATAFIELD_HPP_
+#include <com/sun/star/text/BibliographyDataField.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_FAMILIES_HXX_
+#include "families.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLEXP_HXX
+#include "xmlexp.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLTKMAP_HXX
+#include "xmltkmap.hxx"
+#endif
+
+#ifndef _XMLOFF_TXTFLDE_HXX
+#include "txtflde.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLTEXTNUMRULEINFO_HXX
+#include "XMLTextNumRuleInfo.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::std;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::PropertyValues;
+using ::com::sun::star::beans::PropertyState;
+using ::com::sun::star::container::XIndexReplace;
+using ::com::sun::star::container::XNamed;
+using ::com::sun::star::lang::XServiceInfo;
+
+
+
+
+XMLSectionExport::XMLSectionExport(
+ SvXMLExport& rExp,
+ XMLTextParagraphExport& rParaExp) :
+ rExport(rExp),
+ rParaExport(rParaExp),
+ sCondition(RTL_CONSTASCII_USTRINGPARAM("Condition")),
+ sCreateFromChapter(RTL_CONSTASCII_USTRINGPARAM("CreateFromChapter")),
+ sCreateFromLabels(RTL_CONSTASCII_USTRINGPARAM("CreateFromLabels")),
+ sCreateFromMarks(RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks")),
+ sCreateFromOutline(RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline")),
+ sDdeCommandElement(RTL_CONSTASCII_USTRINGPARAM("DDECommandElement")),
+ sDdeCommandFile(RTL_CONSTASCII_USTRINGPARAM("DDECommandFile")),
+ sDdeCommandType(RTL_CONSTASCII_USTRINGPARAM("DDECommandType")),
+ sFileLink(RTL_CONSTASCII_USTRINGPARAM("FileLink")),
+ sIsCaseSensitive(RTL_CONSTASCII_USTRINGPARAM("IsCaseSensitive")),
+ sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected")),
+ sIsVisible(RTL_CONSTASCII_USTRINGPARAM("IsVisible")),
+ sLabelCategory(RTL_CONSTASCII_USTRINGPARAM("LabelCategory")),
+ sLabelDisplayType(RTL_CONSTASCII_USTRINGPARAM("LabelDisplayType")),
+ sLevel(RTL_CONSTASCII_USTRINGPARAM("Level")),
+ sLevelFormat(RTL_CONSTASCII_USTRINGPARAM("LevelFormat")),
+ sLevelParagraphStyles(
+ RTL_CONSTASCII_USTRINGPARAM("LevelParagraphStyles")),
+ sLinkRegion(RTL_CONSTASCII_USTRINGPARAM("LinkRegion")),
+ sMainEntryCharacterStyleName(
+ RTL_CONSTASCII_USTRINGPARAM("MainEntryCharacterStyleName")),
+ sParaStyleHeading(RTL_CONSTASCII_USTRINGPARAM("ParaStyleHeading")),
+ sParaStyleLevel(RTL_CONSTASCII_USTRINGPARAM("ParaStyleLevel")),
+ sSection(RTL_CONSTASCII_USTRINGPARAM(sXML_section)),
+ sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")),
+ sUseAlphabeticalSeparators(
+ RTL_CONSTASCII_USTRINGPARAM("UseAlphabeticalSeparators")),
+ sUseCombinedEntries(RTL_CONSTASCII_USTRINGPARAM("UseCombinedEntries")),
+ sUseDash(RTL_CONSTASCII_USTRINGPARAM("UseDash")),
+ sUseKeyAsEntry(RTL_CONSTASCII_USTRINGPARAM("UseKeyAsEntry")),
+ sUsePP(RTL_CONSTASCII_USTRINGPARAM("UsePP")),
+ sUseUpperCase(RTL_CONSTASCII_USTRINGPARAM("UseUpperCase")),
+ sCreateFromOtherEmbeddedObjects(RTL_CONSTASCII_USTRINGPARAM("CreateFromOtherEmbeddedObjects")),
+ sCreateFromStarCalc(RTL_CONSTASCII_USTRINGPARAM("CreateFromStarCalc")),
+ sCreateFromStarChart(RTL_CONSTASCII_USTRINGPARAM("CreateFromStarChart")),
+ sCreateFromStarDraw(RTL_CONSTASCII_USTRINGPARAM("CreateFromStarDraw")),
+ sCreateFromStarImage(RTL_CONSTASCII_USTRINGPARAM("CreateFromStarImage")),
+ sCreateFromStarMath(RTL_CONSTASCII_USTRINGPARAM("CreateFromStarMath")),
+ sCreateFromEmbeddedObjects(RTL_CONSTASCII_USTRINGPARAM("CreateFromEmbeddedObjects")),
+ sCreateFromGraphicObjects(RTL_CONSTASCII_USTRINGPARAM("CreateFromGraphicObjects")),
+ sCreateFromTables(RTL_CONSTASCII_USTRINGPARAM("CreateFromTables")),
+ sCreateFromTextFrames(RTL_CONSTASCII_USTRINGPARAM("CreateFromTextFrames")),
+ sUseLevelFromSource(RTL_CONSTASCII_USTRINGPARAM("UseLevelFromSource")),
+ sTableOfContent(RTL_CONSTASCII_USTRINGPARAM(sXML_table_of_content)),
+ sIllustrationIndex(RTL_CONSTASCII_USTRINGPARAM(sXML_illustration_index)),
+ sAlphabeticalIndex(RTL_CONSTASCII_USTRINGPARAM(sXML_alphabetical_index)),
+ sTableIndex(RTL_CONSTASCII_USTRINGPARAM(sXML_table_index)),
+ sObjectIndex(RTL_CONSTASCII_USTRINGPARAM(sXML_object_index)),
+ sBibliography(RTL_CONSTASCII_USTRINGPARAM(sXML_bibliography)),
+ sUserIndex(RTL_CONSTASCII_USTRINGPARAM(sXML_user_index)),
+ sEmpty()
+{
+}
+
+void XMLSectionExport::ExportSectionStart(
+ const Reference<XTextSection> & rSection,
+ sal_Bool bAutoStyles)
+{
+ if (bAutoStyles)
+ {
+ // get PropertySet and add section style
+ Reference<XPropertySet> xPropertySet(rSection, UNO_QUERY);
+ GetParaExport().Add( XML_STYLE_FAMILY_TEXT_SECTION, xPropertySet );
+ }
+ else
+ {
+ ExportRegularSectionStart(rSection);
+ }
+}
+
+void XMLSectionExport::ExportSectionEnd(
+ const Reference<XTextSection> & rSection,
+ sal_Bool bAutoStyles)
+{
+ // any old attributes?
+ GetExport().CheckAttrList();
+
+ // TODO: end element section dependent
+
+ // export end of element
+ GetExport().GetDocHandler()->endElement(
+ GetExport().GetNamespaceMap().GetQNameByKey(XML_NAMESPACE_TEXT,
+ sSection) );
+ GetExport().GetDocHandler()->ignorableWhitespace( GetExport().sWS );
+}
+
+void XMLSectionExport::ExportIndexStart(
+ const Reference<XDocumentIndex> & rIndex,
+ sal_Bool bAutoStyles)
+{
+ // HACK: disable index export until all problems have been resolved:
+ return;
+
+ // get PropertySet
+ Reference<XPropertySet> xPropertySet(rIndex, UNO_QUERY);
+
+ if (bAutoStyles)
+ {
+ // treat index as section style
+ GetParaExport().Add( XML_STYLE_FAMILY_TEXT_SECTION, xPropertySet );
+ }
+ else
+ {
+ switch (MapSectionType(rIndex->getServiceName()))
+ {
+ case TEXT_SECTION_TYPE_TOC:
+ ExportTableOfContentStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_ILLUSTRATION:
+ ExportIllustrationIndexStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_ALPHABETICAL:
+ ExportAlphabeticalIndexStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_TABLE:
+ ExportTableIndexStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_OBJECT:
+ ExportObjectIndexStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_USER:
+ ExportUserIndexStart(xPropertySet);
+ break;
+
+ case TEXT_SECTION_TYPE_BIBLIOGRAPHY:
+ ExportBibliographyStart(xPropertySet);
+ break;
+
+ default:
+ // skip index
+ DBG_ERROR("unknown index type");
+ break;
+ }
+ }
+
+ // TODO: remove when proper solution found
+ ExportIndexEnd(rIndex, bAutoStyles);
+}
+
+
+SvXMLEnumMapEntry __READONLY_DATA aIndexTypeMap[] =
+{
+ { "com.sun.star.text.ContentIndex", TEXT_SECTION_TYPE_TOC },
+ { "com.sun.star.text.DocumentIndex", TEXT_SECTION_TYPE_ALPHABETICAL },
+ { "com.sun.star.text.TableIndex", TEXT_SECTION_TYPE_TABLE },
+ { "com.sun.star.text.ObjectIndex", TEXT_SECTION_TYPE_OBJECT },
+ { "com.sun.star.text.Bibliography", TEXT_SECTION_TYPE_BIBLIOGRAPHY },
+ { "com.sun.star.text.UserIndex", TEXT_SECTION_TYPE_USER },
+ { "com.sun.star.text.IllustrationsIndex", TEXT_SECTION_TYPE_ILLUSTRATION },
+ { NULL, NULL }
+};
+
+enum SectionTypeEnum XMLSectionExport::MapSectionType(
+ const OUString& rServiceName)
+{
+ enum SectionTypeEnum eType = TEXT_SECTION_TYPE_UNKNOWN;
+
+ sal_uInt16 nTmp;
+ if (SvXMLUnitConverter::convertEnum(nTmp, rServiceName, aIndexTypeMap))
+ {
+ eType = (enum SectionTypeEnum)nTmp;
+ }
+
+ // TODO: index header section types, etc.
+
+ return eType;
+}
+
+void XMLSectionExport::ExportIndexEnd(
+ const Reference<XDocumentIndex> & rIndex,
+ sal_Bool bAutoStyles)
+{
+ // HACK: disable index export until all problems have been resolved:
+ return;
+
+ if (! bAutoStyles)
+ {
+ sal_Char* pElementName = NULL;
+
+ switch (MapSectionType(rIndex->getServiceName()))
+ {
+ case TEXT_SECTION_TYPE_TOC:
+ pElementName = sXML_table_of_content;
+ break;
+
+ case TEXT_SECTION_TYPE_ILLUSTRATION:
+ pElementName = sXML_illustration_index;
+ break;
+
+ case TEXT_SECTION_TYPE_ALPHABETICAL:
+ pElementName = sXML_alphabetical_index;
+ break;
+
+ case TEXT_SECTION_TYPE_TABLE:
+ pElementName = sXML_table_index;
+ break;
+
+ case TEXT_SECTION_TYPE_OBJECT:
+ pElementName = sXML_object_index;
+ break;
+
+ case TEXT_SECTION_TYPE_USER:
+ pElementName = sXML_user_index;
+ break;
+
+ case TEXT_SECTION_TYPE_BIBLIOGRAPHY:
+ pElementName = sXML_bibliography;
+ break;
+
+ default:
+ DBG_ERROR("unknown index type");
+ // default: skip index!
+ break;
+ }
+
+ if (NULL != pElementName)
+ {
+ // TODO: remove, if end handling is made proper
+ GetExport().GetDocHandler()->endElement(
+ GetExport().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TEXT,
+ OUString::createFromAscii(pElementName)));
+ GetExport().GetDocHandler()->ignorableWhitespace(GetExport().sWS);
+ }
+ }
+}
+
+void XMLSectionExport::ExportRegularSectionStart(
+ const Reference<XTextSection> & rSection)
+{
+ // any old attributes?
+ GetExport().CheckAttrList();
+
+ Reference<XNamed> xName(rSection, UNO_QUERY);
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_name,
+ xName->getName());
+
+ // get XPropertySet for other values
+ Reference<XPropertySet> xPropSet(rSection, UNO_QUERY);
+ Any aAny;
+
+ // style name
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_style_name,
+ GetParaExport().Find(
+ XML_STYLE_FAMILY_TEXT_SECTION,
+ xPropSet, sEmpty ));
+
+ // condition and display
+ aAny = xPropSet->getPropertyValue(sCondition);
+ OUString sCond;
+ aAny >>= sCond;
+ sal_Char* pDisplay;
+ if (sCond.getLength() > 0)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_condition,
+ sCond);
+ pDisplay = sXML_condition;
+ }
+ else
+ {
+ pDisplay = sXML_none;
+ }
+ aAny = xPropSet->getPropertyValue(sIsVisible);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT, sXML_display,
+ pDisplay);
+ }
+
+ // export element
+ GetExport().GetDocHandler()->ignorableWhitespace( GetExport().sWS );
+ GetExport().GetDocHandler()->startElement(
+ GetExport().GetNamespaceMap().GetQNameByKey(XML_NAMESPACE_TEXT,
+ sSection),
+ GetExport().GetXAttrList() );
+ GetExport().ClearAttrList();
+
+ // data source
+ // unfortunately, we have to test all relevant strings for non-zero length
+ aAny = xPropSet->getPropertyValue(sFileLink);
+ SectionFileLink aFileLink;
+ aAny >>= aFileLink;
+
+ aAny = xPropSet->getPropertyValue(sLinkRegion);
+ OUString sRegionName;
+ aAny >>= sRegionName;
+
+ if ( (aFileLink.FileURL.getLength() > 0) ||
+ (aFileLink.FilterName.getLength() > 0) ||
+ (sRegionName.getLength() > 0) )
+ {
+ if (aFileLink.FileURL.getLength() > 0)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_XLINK, sXML_href,
+ aFileLink.FileURL);
+ }
+
+ if (aFileLink.FilterName.getLength() > 0)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_filter_name,
+ aFileLink.FilterName);
+ }
+
+ if (sRegionName.getLength() > 0)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_section_name,
+ sRegionName);
+ }
+
+ SvXMLElementExport aElem(GetExport(),
+ XML_NAMESPACE_TEXT, sXML_section_source,
+ sal_True, sal_True);
+ }
+ else
+ {
+ // data source DDE
+ // unfortunately, we have to test all relevant strings for
+ // non-zero length
+ aAny = xPropSet->getPropertyValue(sDdeCommandFile);
+ OUString sApplication;
+ aAny >>= sApplication;
+ aAny = xPropSet->getPropertyValue(sDdeCommandType);
+ OUString sTopic;
+ aAny >>= sTopic;
+ aAny = xPropSet->getPropertyValue(sDdeCommandElement);
+ OUString sItem;
+ aAny >>= sItem;
+
+ if ( (sApplication.getLength() > 0) ||
+ (sTopic.getLength() > 0) ||
+ (sItem.getLength() > 0 ) )
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_OFFICE,
+ sXML_dde_application, sApplication);
+ GetExport().AddAttribute(XML_NAMESPACE_OFFICE, sXML_dde_topic,
+ sTopic);
+ GetExport().AddAttribute(XML_NAMESPACE_OFFICE, sXML_dde_item,
+ sItem);
+
+ SvXMLElementExport aElem(GetExport(),
+ XML_NAMESPACE_OFFICE,
+ sXML_dde_source,
+ sal_True, sal_True);
+ }
+ // else: no data source
+ }
+}
+
+void XMLSectionExport::ExportTableOfContentStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export TOC element start
+ ExportBaseIndexStart(sTableOfContent, rPropertySet);
+
+ // scope for table-of-content-source element
+ {
+
+ Any aAny;
+
+ // TOC specific index source attributes:
+
+ // outline-level (none|1..10)
+ aAny = rPropertySet->getPropertyValue(sCreateFromOutline);
+ if (*(sal_Bool*)aAny.getValue())
+ {
+ // outline-level: 1..10
+ aAny = rPropertySet->getPropertyValue(sLevel);
+ sal_Int16 nLevel;
+ aAny >>= nLevel;
+
+ OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertNumber(sBuffer,
+ (sal_Int32)nLevel);
+
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ sXML_outline_level,
+ sBuffer.makeStringAndClear());
+ }
+ else
+ {
+ // outline-level: none
+ GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT,
+ sXML_outline_level,
+ sXML_none);
+ }
+
+ // use index marks
+ aAny = rPropertySet->getPropertyValue(sCreateFromMarks);
+ if (! (*(sal_Bool*)aAny.getValue()))
+ {
+ GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT,
+ sXML_use_index_marks,
+ sXML_true);
+ }
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_TOC, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_TOC, rPropertySet);
+}
+
+void XMLSectionExport::ExportObjectIndexStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export index start
+ ExportBaseIndexStart(sObjectIndex, rPropertySet);
+
+ // scope for index source element
+ {
+ ExportBoolean(rPropertySet, sCreateFromOtherEmbeddedObjects,
+ sXML_use_other_objects, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromStarCalc,
+ sXML_use_spreadsheet_objects, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromStarChart,
+ sXML_use_chart_objects, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromStarDraw,
+ sXML_use_draw_objects,sal_False);
+// TODO: wait for API
+// ExportBoolean(rPropertySet, sCreateFromStarImage,
+// sXML_use_image_objects, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromStarMath,
+ sXML_use_math_objects, sal_False);
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_OBJECT, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_OBJECT, rPropertySet);
+}
+
+void XMLSectionExport::ExportIllustrationIndexStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export index start
+ ExportBaseIndexStart(sIllustrationIndex, rPropertySet);
+
+ // scope for index source element
+ {
+ // export common attributes for illustration and table indices
+ ExportTableAndIllustrationIndexSourceAttributes(rPropertySet);
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_ILLUSTRATION, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_ILLUSTRATION, rPropertySet);
+}
+
+void XMLSectionExport::ExportTableIndexStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export index start
+ ExportBaseIndexStart(sTableIndex, rPropertySet);
+
+ // scope for index source element
+ {
+ // export common attributes for illustration and table indices
+ ExportTableAndIllustrationIndexSourceAttributes(rPropertySet);
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_TABLE, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_TABLE, rPropertySet);
+}
+
+void XMLSectionExport::ExportAlphabeticalIndexStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export TOC element start
+ ExportBaseIndexStart(sAlphabeticalIndex, rPropertySet);
+
+ // scope for table-of-content-source element
+ {
+
+ // style name (if present)
+ Any aAny;
+ aAny = rPropertySet->getPropertyValue(sMainEntryCharacterStyleName);
+ OUString sStyleName;
+ aAny >>= sStyleName;
+ if (sStyleName.getLength())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ sXML_main_entry_style_name,
+ sStyleName);
+ }
+
+ // other (boolean) attributes
+ ExportBoolean(rPropertySet, sIsCaseSensitive, sXML_ignore_case,
+ sal_False, sal_True);
+ ExportBoolean(rPropertySet, sUseAlphabeticalSeparators,
+ sXML_alphabetical_separators, sal_False);
+ ExportBoolean(rPropertySet, sUseCombinedEntries, sXML_combine_entries,
+ sal_True);
+ ExportBoolean(rPropertySet, sUseDash, sXML_combine_entries_with_dash,
+ sal_False);
+ ExportBoolean(rPropertySet, sUseKeyAsEntry, sXML_use_keys_as_entries,
+ sal_False);
+ ExportBoolean(rPropertySet, sUsePP, sXML_combine_entries_with_pp,
+ sal_True);
+ ExportBoolean(rPropertySet, sUseUpperCase, sXML_capitalize_entries,
+ sal_False);
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_ALPHABETICAL, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_ALPHABETICAL, rPropertySet);
+}
+
+void XMLSectionExport::ExportUserIndexStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export TOC element start
+ ExportBaseIndexStart(sUserIndex, rPropertySet);
+
+ // scope for table-of-content-source element
+ {
+ // bool attributes
+ ExportBoolean(rPropertySet, sCreateFromEmbeddedObjects,
+ sXML_use_objects, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromGraphicObjects,
+ sXML_use_graphics, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromMarks,
+ sXML_use_index_marks, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromTables,
+ sXML_use_tables, sal_False);
+ ExportBoolean(rPropertySet, sCreateFromTextFrames,
+ sXML_use_floating_frames, sal_False);
+ ExportBoolean(rPropertySet, sUseLevelFromSource,
+ sXML_copy_outline_levels, sal_False);
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_USER, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_USER, rPropertySet);
+}
+
+void XMLSectionExport::ExportBibliographyStart(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // export TOC element start
+ ExportBaseIndexStart(sBibliography, rPropertySet);
+
+ // scope for table-of-content-source element
+ {
+ // No attributes. Fine.
+
+ ExportBaseIndexSource(TEXT_SECTION_TYPE_BIBLIOGRAPHY, rPropertySet);
+ }
+
+ ExportBaseIndexBody(TEXT_SECTION_TYPE_BIBLIOGRAPHY, rPropertySet);
+}
+
+
+void XMLSectionExport::ExportBaseIndexStart(
+ const OUString sElementName,
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // section style name
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_style_name,
+ GetParaExport().Find(
+ XML_STYLE_FAMILY_TEXT_SECTION,
+ rPropertySet, sEmpty ));
+
+ // index Element start
+ GetExport().GetDocHandler()->ignorableWhitespace( GetExport().sWS );
+ GetExport().GetDocHandler()->startElement(
+ GetExport().GetNamespaceMap().GetQNameByKey(XML_NAMESPACE_TEXT,
+ sElementName),
+ GetExport().GetXAttrList() );
+ GetExport().ClearAttrList();
+}
+
+static const sal_Char* aTypeSourceElementNameMap[] =
+{
+ sXML_table_of_content_source, // TOC
+ sXML_table_index_source, // table index
+ sXML_illustration_index_source, // illustration index
+ sXML_object_index_source, // object index
+ sXML_user_index_source, // user index
+ sXML_alphabetical_index_source, // alphabetical index
+ sXML_bibliography_source // bibliography
+};
+
+void XMLSectionExport::ExportBaseIndexSource(
+ SectionTypeEnum eType,
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // check type
+ DBG_ASSERT(eType >= TEXT_SECTION_TYPE_TOC, "illegal index type");
+ DBG_ASSERT(eType <= TEXT_SECTION_TYPE_BIBLIOGRAPHY, "illegal index type");
+
+ Any aAny;
+
+ // common attributes; not supported by bibliography
+ if (eType != TEXT_SECTION_TYPE_BIBLIOGRAPHY)
+ {
+ // document or chapter index?
+ aAny = rPropertySet->getPropertyValue(sCreateFromChapter);
+ if (*(sal_Bool*)aAny.getValue())
+ {
+ GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT,
+ sXML_index_scope,
+ sXML_chapter);
+ }
+
+ // tab-stops relative to margin?
+ // TODO: property fehlt?!
+ }
+
+ // the index source element (all indices)
+ SvXMLElementExport aElem(GetExport(),
+ XML_NAMESPACE_TEXT,
+ aTypeSourceElementNameMap[
+ eType - TEXT_SECTION_TYPE_TOC],
+ sal_True, sal_True);
+
+ // scope for title template (all indices)
+ {
+ // header style name
+ aAny = rPropertySet->getPropertyValue(sParaStyleHeading);
+ OUString sStyleName;
+ aAny >>= sStyleName;
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ sXML_style_name,
+ sStyleName);
+
+ // title template
+ SvXMLElementExport aHeaderTemplate(GetExport(),
+ XML_NAMESPACE_TEXT,
+ sXML_index_title_template,
+ sal_True, sal_False);
+
+ // title as element content
+ aAny = rPropertySet->getPropertyValue(sTitle);
+ OUString sTitleString;
+ aAny >>= sTitleString;
+ GetExport().GetDocHandler()->characters(sTitleString);
+ }
+
+ // export level templates (all indices)
+ aAny = rPropertySet->getPropertyValue(sLevelFormat);
+ Reference<XIndexReplace> xLevelTemplates;
+ aAny >>= xLevelTemplates;
+
+ // iterate over level formats;
+ // skip element 0 (empty template for title)
+ sal_Int32 nLevelCount = xLevelTemplates->getCount();
+ for(sal_Int32 i = 1; i<nLevelCount; i++)
+ {
+ // get sequence
+ Sequence<PropertyValues> aTemplateSequence;
+ aAny = xLevelTemplates->getByIndex(i);
+ aAny >>= aTemplateSequence;
+
+ // export the sequence
+ ExportIndexTemplate(eType, i, rPropertySet, aTemplateSequence);
+ }
+
+ // only TOC and user index:
+ // styles from which to build the index (LevelParagraphStyles)
+ if ( (TEXT_SECTION_TYPE_TOC == eType) ||
+ (TEXT_SECTION_TYPE_USER == eType) )
+ {
+ aAny = rPropertySet->getPropertyValue(sLevelParagraphStyles);
+ Reference<XIndexReplace> xLevelParagraphStyles;
+ aAny >>= xLevelParagraphStyles;
+ ExportLevelParagraphStyles(xLevelParagraphStyles);
+ }
+}
+
+
+void XMLSectionExport::ExportBaseIndexBody(
+ SectionTypeEnum eType,
+ const Reference<XPropertySet> & rSection)
+{
+ // type not used; checked anyway.
+ DBG_ASSERT(eType >= TEXT_SECTION_TYPE_TOC, "illegal index type");
+ DBG_ASSERT(eType <= TEXT_SECTION_TYPE_BIBLIOGRAPHY, "illegal index type");
+
+ SvXMLElementExport aIndexBody(GetExport(),
+ XML_NAMESPACE_TEXT,
+ sXML_index_body,
+ sal_True, sal_True);
+}
+
+void XMLSectionExport::ExportTableAndIllustrationIndexSourceAttributes(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // use caption
+ Any aAny = rPropertySet->getPropertyValue(sCreateFromLabels);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT,
+ sXML_use_caption,
+ sXML_false);
+ }
+
+ // sequence name
+ aAny = rPropertySet->getPropertyValue(sLabelCategory);
+ OUString sSequenceName;
+ aAny >>= sSequenceName;
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ sXML_caption_sequence_name,
+ sSequenceName);
+
+ // caption format
+ aAny = rPropertySet->getPropertyValue(sLabelDisplayType);
+ sal_Int16 nType;
+ aAny >>= nType;
+ GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT,
+ sXML_caption_sequence_format,
+ XMLTextFieldExport::MapReferenceType(nType));
+}
+
+
+// map index of LevelFormats to attribute value;
+// level 0 is always the header
+static const sal_Char* aLevelNameTOCMap[] =
+ { NULL, sXML_1, sXML_2, sXML_3, sXML_4, sXML_5, sXML_6, sXML_7,
+ sXML_8, sXML_9, sXML_10, NULL };
+static const sal_Char* aLevelNameTableMap[] =
+ { NULL, "", NULL };
+static const sal_Char* aLevelNameAlphaMap[] =
+ { NULL, sXML_separator, sXML_1, sXML_2, sXML_3, NULL };
+static const sal_Char* aLevelNameBibliographyMap[] =
+ { NULL, sXML_article, sXML_book, sXML_booklet, sXML_conference,
+ sXML_custom1, sXML_custom2, sXML_custom3, sXML_custom4,
+ sXML_custom5, sXML_email, sXML_inbook, sXML_incollection,
+ sXML_inproceedings, sXML_journal,
+ sXML_manual, sXML_mastersthesis, sXML_misc, sXML_phdthesis,
+ sXML_proceedings, sXML_techreport, sXML_unpublished, sXML_www,
+ NULL };
+
+static const sal_Char** aTypeLevelNameMap[] =
+{
+ aLevelNameTOCMap, // TOC
+ aLevelNameTableMap, // table index
+ aLevelNameTableMap, // illustration index
+ aLevelNameTableMap, // object index
+ aLevelNameTOCMap, // user index
+ aLevelNameAlphaMap, // alphabetical index
+ aLevelNameBibliographyMap // bibliography
+};
+
+static const sal_Char* aLevelStylePropNameTOCMap[] =
+ { NULL, "ParaStyleLevel1", "ParaStyleLevel2", "ParaStyleLevel3",
+ "ParaStyleLevel4", "ParaStyleLevel5", "ParaStyleLevel6",
+ "ParaStyleLevel7", "ParaStyleLevel8", "ParaStyleLevel9",
+ "ParaStyleLevel10", NULL };
+static const sal_Char* aLevelStylePropNameTableMap[] =
+ { NULL, "ParaStyleLevel1", NULL };
+static const sal_Char* aLevelStylePropNameAlphaMap[] =
+ { NULL, "ParaStyleSeparator", "ParaStyleLevel1", "ParaStyleLevel2",
+ "ParaStyleLevel3", NULL };
+static const sal_Char* aLevelStylePropNameBibliographyMap[] =
+ // TODO: replace with real property names, when available
+ { NULL, "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
+ "ParaStyleLevel1",
+ NULL };
+
+static const sal_Char** aTypeLevelStylePropNameMap[] =
+{
+ aLevelStylePropNameTOCMap, // TOC
+ aLevelStylePropNameTableMap, // table index
+ aLevelStylePropNameTableMap, // illustration index
+ aLevelStylePropNameTableMap, // object index
+ aLevelStylePropNameTOCMap, // user index
+ aLevelStylePropNameAlphaMap, // alphabetical index
+ aLevelStylePropNameBibliographyMap // bibliography
+};
+
+static const sal_Char* aTypeLevelAttrMap[] =
+{
+ sXML_outline_level, // TOC
+ NULL, // table index
+ NULL, // illustration index
+ NULL, // object index
+ sXML_outline_level, // user index
+ sXML_outline_level, // alphabetical index
+ sXML_bibliography_type // bibliography
+};
+
+static const sal_Char* aTypeElementNameMap[] =
+{
+ sXML_table_of_content_entry_template, // TOC
+ sXML_table_index_entry_template, // table index
+ sXML_illustration_index_entry_template, // illustration index
+ sXML_object_index_entry_template, // object index
+ sXML_user_index_entry_template, // user index
+ sXML_alphabetical_index_entry_template, // alphabetical index
+ sXML_bibliography_entry_template // bibliography
+};
+
+
+void XMLSectionExport::ExportIndexTemplate(
+ SectionTypeEnum eType,
+ sal_Int32 nOutlineLevel,
+ const Reference<XPropertySet> & rPropertySet,
+ Sequence<Sequence<PropertyValue> > & rValues)
+{
+ DBG_ASSERT(eType >= TEXT_SECTION_TYPE_TOC, "illegal index type");
+ DBG_ASSERT(eType <= TEXT_SECTION_TYPE_BIBLIOGRAPHY, "illegal index type");
+ DBG_ASSERT(nOutlineLevel >= 0, "illegal outline level");
+
+ if ( (eType >= TEXT_SECTION_TYPE_TOC) &&
+ (eType <= TEXT_SECTION_TYPE_BIBLIOGRAPHY) &&
+ (nOutlineLevel >= 0) )
+ {
+ // get level name and level attribute name from aLevelNameMap;
+ const sal_Char* pLevelAttrName =
+ aTypeLevelAttrMap[eType-TEXT_SECTION_TYPE_TOC];
+ const sal_Char* pLevelName =
+ aTypeLevelNameMap[eType-TEXT_SECTION_TYPE_TOC][nOutlineLevel];
+
+ // output level name
+ DBG_ASSERT(NULL != pLevelName, "can't find level name");
+ if ((NULL != pLevelName) && (NULL != pLevelAttrName))
+ {
+ GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT,
+ pLevelAttrName,
+ pLevelName);
+ }
+
+ // paragraph level style name
+ const sal_Char* pPropName =
+ aTypeLevelStylePropNameMap[eType-TEXT_SECTION_TYPE_TOC][nOutlineLevel];
+ DBG_ASSERT(NULL != pPropName, "can't find property name");
+ if (NULL != pPropName)
+ {
+ Any aAny = rPropertySet->getPropertyValue(
+ OUString::createFromAscii(pPropName));
+ OUString sParaStyleName;
+ aAny >>= sParaStyleName;
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ sXML_style_name,
+ sParaStyleName);
+ }
+
+ // template element
+ const sal_Char* pElementName =
+ aTypeElementNameMap[eType - TEXT_SECTION_TYPE_TOC];
+ SvXMLElementExport aLevelTemplate(GetExport(),
+ XML_NAMESPACE_TEXT,
+ pElementName,
+ sal_True, sal_True);
+
+ // export sequence
+ sal_Int32 nTemplateCount = rValues.getLength();
+ for(sal_Int32 nTemplateNo = 0;
+ nTemplateNo < nTemplateCount;
+ nTemplateNo++)
+ {
+ ExportIndexTemplateElement(
+ rValues[nTemplateNo]);
+ }
+ }
+}
+
+
+enum TemplateTypeEnum
+{
+ TOK_TTYPE_ENTRY_NUMBER,
+ TOK_TTYPE_ENTRY_TEXT,
+ TOK_TTYPE_TAB_STOP,
+ TOK_TTYPE_TEXT,
+ TOK_TTYPE_PAGE_NUMBER,
+ TOK_TTYPE_CHAPTER_INFO,
+ TOK_TTYPE_HYPERLINK_START,
+ TOK_TTYPE_HYPERLINK_END,
+ TOK_TTYPE_BIBLIOGRAPHY,
+ TOK_TTYPE_INVALID
+};
+
+enum TemplateParamEnum
+{
+ TOK_TPARAM_TOKEN_TYPE,
+ TOK_TPARAM_CHAR_STYLE,
+ TOK_TPARAM_TAB_RIGHT_ALIGNED,
+ TOK_TPARAM_TAB_POSITION,
+ TOK_TPARAM_TAB_FILL_CHAR,
+ TOK_TPARAM_TEXT,
+ TOK_TPARAM_CHAPTER_FORMAT,
+ TOK_TPARAM_BIBLIOGRAPHY_DATA
+};
+
+SvXMLEnumMapEntry __READONLY_DATA aTemplateTypeMap[] =
+{
+ { "TokenEntryNumber", TOK_TTYPE_ENTRY_NUMBER },
+ { "TokenEntryText", TOK_TTYPE_ENTRY_TEXT },
+ { "TokenTabStop", TOK_TTYPE_TAB_STOP },
+ { "TokenText", TOK_TTYPE_TEXT },
+ { "TokenPageNumber", TOK_TTYPE_PAGE_NUMBER },
+ { "TokenChapterInfo", TOK_TTYPE_CHAPTER_INFO },
+ { "TokenHyperlinkStart", TOK_TTYPE_HYPERLINK_START },
+ { "TokenHyperlinkEnd", TOK_TTYPE_HYPERLINK_END },
+ { "TokenBibliographyDataField", TOK_TTYPE_BIBLIOGRAPHY },
+ { NULL, NULL }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA aTemplateParamMap[] =
+{
+ { "TokenType", TOK_TPARAM_TOKEN_TYPE },
+ { "CharacterStyleName", TOK_TPARAM_CHAR_STYLE },
+ { "TabStopRightAligned", TOK_TPARAM_TAB_RIGHT_ALIGNED },
+ { "TabStopPosition", TOK_TPARAM_TAB_POSITION },
+ { "TabStopFillCharacter", TOK_TPARAM_TAB_FILL_CHAR },
+ { "Text", TOK_TPARAM_TEXT },
+ { "ChapterFormat", TOK_TPARAM_CHAPTER_FORMAT },
+ { "BibliographyDataField", TOK_TPARAM_BIBLIOGRAPHY_DATA },
+ { NULL, NULL }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA aBibliographyDataFieldMap[] =
+{
+ { sXML_address, BibliographyDataField::ADDRESS },
+ { sXML_annote, BibliographyDataField::ANNOTE },
+ { sXML_author, BibliographyDataField::AUTHOR },
+ { sXML_bibiliographic_type, BibliographyDataField::BIBILIOGRAPHIC_TYPE },
+ { sXML_booktitle, BibliographyDataField::BOOKTITLE },
+ { sXML_chapter, BibliographyDataField::CHAPTER },
+ { sXML_custom1, BibliographyDataField::CUSTOM1 },
+ { sXML_custom2, BibliographyDataField::CUSTOM2 },
+ { sXML_custom3, BibliographyDataField::CUSTOM3 },
+ { sXML_custom4, BibliographyDataField::CUSTOM4 },
+ { sXML_custom5, BibliographyDataField::CUSTOM5 },
+ { sXML_edition, BibliographyDataField::EDITION },
+ { sXML_editor, BibliographyDataField::EDITOR },
+ { sXML_howpublished, BibliographyDataField::HOWPUBLISHED },
+ { sXML_identifier, BibliographyDataField::IDENTIFIER },
+ { sXML_institution, BibliographyDataField::INSTITUTION },
+ { sXML_isbn, BibliographyDataField::ISBN },
+ { sXML_journal, BibliographyDataField::JOURNAL },
+ { sXML_month, BibliographyDataField::MONTH },
+ { sXML_note, BibliographyDataField::NOTE },
+ { sXML_number, BibliographyDataField::NUMBER },
+ { sXML_organizations, BibliographyDataField::ORGANIZATIONS },
+ { sXML_pages, BibliographyDataField::PAGES },
+ { sXML_publisher, BibliographyDataField::PUBLISHER },
+ { sXML_report_type, BibliographyDataField::REPORT_TYPE },
+ { sXML_school, BibliographyDataField::SCHOOL },
+ { sXML_series, BibliographyDataField::SERIES },
+ { sXML_title, BibliographyDataField::TITLE },
+ { sXML_url, BibliographyDataField::URL },
+ { sXML_volume, BibliographyDataField::VOLUME },
+ { sXML_year, BibliographyDataField::YEAR },
+ { NULL, NULL }
+};
+
+void XMLSectionExport::ExportIndexTemplateElement(
+ Sequence<PropertyValue> & rValues)
+{
+ // variables for template values
+
+ // char style
+ OUString sCharStyle;
+ sal_Bool bCharStyleOK = sal_False;
+
+ // text
+ OUString sText;
+ sal_Bool bTextOK = sal_False;
+
+ // tab position
+ sal_Bool bRightAligned = sal_False;
+ sal_Bool bRightAlignedOK = sal_False;
+
+ // tab position
+ sal_Int32 nTabPosition = 0;
+ sal_Bool bTabPositionOK = sal_False;
+
+ // fill character
+ OUString sFillChar;
+ sal_Bool bFillCharOK = sal_False;
+
+ // chapter format
+ sal_Int16 nChapterFormat;
+ sal_Bool bChapterFormatOK = sal_False;
+
+ // Bibliography Data
+ sal_Int16 nBibliographyData;
+ sal_Bool bBibliographyDataOK = sal_False;
+
+
+ // token type
+ enum TemplateTypeEnum nTokenType = TOK_TTYPE_INVALID;
+
+ sal_Int32 nCount = rValues.getLength();
+ for(sal_Int32 i = 0; i<nCount; i++)
+ {
+ sal_uInt16 nToken;
+ if ( SvXMLUnitConverter::convertEnum( nToken, rValues[i].Name,
+ aTemplateParamMap ) )
+ {
+ // Only use direct and default values.
+ // Wrong. no property states, so ignore.
+ // if ( (beans::PropertyState_DIRECT_VALUE == rValues[i].State) ||
+ // (beans::PropertyState_DEFAULT_VALUE == rValues[i].State) )
+
+ switch (nToken)
+ {
+ case TOK_TPARAM_TOKEN_TYPE:
+ {
+ sal_uInt16 nTmp;
+ OUString sVal;
+ rValues[i].Value >>= sVal;
+ if (SvXMLUnitConverter::convertEnum( nTmp, sVal,
+ aTemplateTypeMap))
+ {
+ nTokenType = (enum TemplateTypeEnum)nTmp;
+ }
+ break;
+ }
+
+ case TOK_TPARAM_CHAR_STYLE:
+ // only valid, if not empty
+ rValues[i].Value >>= sCharStyle;
+ bCharStyleOK = sCharStyle.getLength() > 0;
+ break;
+
+ case TOK_TPARAM_TEXT:
+ rValues[i].Value >>= sText;
+ bTextOK = sal_True;
+ break;
+
+ case TOK_TPARAM_TAB_RIGHT_ALIGNED:
+ bRightAligned =
+ *(sal_Bool *)rValues[i].Value.getValue();
+ bRightAlignedOK = sal_True;
+ break;
+
+ case TOK_TPARAM_TAB_POSITION:
+ rValues[i].Value >>= nTabPosition;
+ bTabPositionOK = sal_True;
+ break;
+
+ case TOK_TPARAM_TAB_FILL_CHAR:
+ rValues[i].Value >>= sFillChar;
+ bFillCharOK = sal_True;
+ break;
+
+ case TOK_TPARAM_CHAPTER_FORMAT:
+ rValues[i].Value >>= nChapterFormat;
+ bChapterFormatOK = sal_True;
+ break;
+ case TOK_TPARAM_BIBLIOGRAPHY_DATA:
+ rValues[i].Value >>= nBibliographyData;
+ bBibliographyDataOK = sal_True;
+ break;
+ }
+ }
+ }
+
+ // convert type to token (and check validity) ...
+ sal_Char* pElement = NULL;
+ switch(nTokenType)
+ {
+ case TOK_TTYPE_ENTRY_TEXT:
+ pElement = sXML_index_entry_text;
+ break;
+ case TOK_TTYPE_TAB_STOP:
+ // test validity
+ pElement = ( bRightAligned || bTabPositionOK || bFillCharOK )
+ ? sXML_index_entry_tab_stop : NULL;
+ break;
+ case TOK_TTYPE_TEXT:
+ // test validity
+ pElement = bTextOK ? sXML_index_entry_span : NULL;
+ break;
+ case TOK_TTYPE_PAGE_NUMBER:
+ pElement = sXML_index_entry_page_number;
+ break;
+ case TOK_TTYPE_CHAPTER_INFO: // keyword index
+ pElement = sXML_index_entry_chapter;
+ break;
+ case TOK_TTYPE_ENTRY_NUMBER: // table of content
+ pElement = sXML_index_entry_chapter_number;
+ break;
+ case TOK_TTYPE_HYPERLINK_START:
+ pElement = sXML_index_entry_link_start;
+ break;
+ case TOK_TTYPE_HYPERLINK_END:
+ pElement = sXML_index_entry_link_end;
+ break;
+ case TOK_TTYPE_BIBLIOGRAPHY:
+ pElement = bBibliographyDataOK
+ ? sXML_index_entry_bibliography : NULL;
+ break;
+ default:
+ ; // unknown/unimplemented template
+ break;
+ }
+
+ // ... and write Element
+ if (pElement != NULL)
+ {
+ // character style (for most templates)
+ if (bCharStyleOK)
+ {
+ switch (nTokenType)
+ {
+ case TOK_TTYPE_ENTRY_TEXT:
+ case TOK_TTYPE_TEXT:
+ case TOK_TTYPE_PAGE_NUMBER:
+ case TOK_TTYPE_ENTRY_NUMBER:
+ case TOK_TTYPE_HYPERLINK_START:
+ case TOK_TTYPE_HYPERLINK_END:
+ case TOK_TTYPE_BIBLIOGRAPHY:
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ sXML_style_name, sCharStyle);
+ break;
+ default:
+ ; // nothing: no character style
+ break;
+ }
+ }
+
+ // tab properties
+ if (TOK_TTYPE_TAB_STOP == nTokenType)
+ {
+ // tab type
+ GetExport().AddAttributeASCII(XML_NAMESPACE_STYLE,
+ sXML_type,
+ bRightAligned ? sXML_right : sXML_left);
+
+ if (bTabPositionOK && (! bRightAligned))
+ {
+ // position for left tabs (convert to measure)
+ OUStringBuffer sBuf;
+ GetExport().GetMM100UnitConverter().convertMeasure(sBuf,
+ nTabPosition);
+ GetExport().AddAttribute(XML_NAMESPACE_STYLE,
+ sXML_position,
+ sBuf.makeStringAndClear());
+ }
+
+ // fill char ("leader char")
+ if (bFillCharOK && (sFillChar.getLength() > 0))
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_STYLE,
+ sXML_leader_char, sFillChar);
+ }
+ }
+
+ // bibliography data
+ if (TOK_TTYPE_BIBLIOGRAPHY == nTokenType)
+ {
+ DBG_ASSERT(bBibliographyDataOK, "need bibl data");
+ OUStringBuffer sBuf;
+ if (SvXMLUnitConverter::convertEnum( sBuf, nBibliographyData,
+ aBibliographyDataFieldMap ) )
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ sXML_bibliography_data_field,
+ sBuf.makeStringAndClear());
+ }
+ }
+
+ // chapter info
+ if (TOK_TTYPE_CHAPTER_INFO == nTokenType)
+ {
+ DBG_ASSERT(bChapterFormatOK, "need chapter info");
+ GetExport().AddAttributeASCII(
+ XML_NAMESPACE_TEXT, sXML_display,
+ XMLTextFieldExport::MapChapterDisplayFormat(nChapterFormat));
+ }
+
+ // export template
+ SvXMLElementExport aTemplateElement(GetExport(), XML_NAMESPACE_TEXT,
+ pElement, sal_True, sal_False);
+
+ // entry text or span element: write text
+ if (TOK_TTYPE_TEXT == nTokenType)
+ {
+ GetExport().GetDocHandler()->characters(sText);
+ }
+ }
+}
+
+void XMLSectionExport::ExportLevelParagraphStyles(
+ Reference<XIndexReplace> & xLevelParagraphStyles)
+{
+ // iterate over levels
+ sal_Int32 nPLevelCount = xLevelParagraphStyles->getCount();
+ for(sal_Int32 nLevel = 0; nLevel < nPLevelCount; nLevel++)
+ {
+ Any aAny = xLevelParagraphStyles->getByIndex(nLevel);
+ Sequence<OUString> aStyleNames;
+ aAny >>= aStyleNames;
+
+ // export only if at least one style is contained
+ sal_Int32 nNamesCount = aStyleNames.getLength();
+ if (nNamesCount > 0)
+ {
+ // level attribute; we count 1..10; API 0..9
+ OUStringBuffer sBuf;
+ sal_Int32 nLevelPlusOne = nLevel + 1;
+ SvXMLUnitConverter::convertNumber(sBuf, nLevelPlusOne);
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ sXML_outline_level,
+ sBuf.makeStringAndClear());
+
+ // source styles element
+ SvXMLElementExport aParaStyles(GetExport(),
+ XML_NAMESPACE_TEXT,
+ sXML_index_source_styles,
+ sal_True, sal_True);
+
+ // iterate over styles in this level
+ for(sal_Int32 nName = 0; nName < nNamesCount; nName++)
+ {
+ // stylename attribute
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT,
+ sXML_style_name,
+ aStyleNames[nName]);
+
+ // element
+ SvXMLElementExport aParaStyle(GetExport(),
+ XML_NAMESPACE_TEXT,
+ sXML_index_source_style,
+ sal_True, sal_False);
+ }
+ }
+ }
+}
+
+void XMLSectionExport::ExportBoolean(
+ const Reference<XPropertySet> & rPropSet,
+ const OUString& sPropertyName,
+ const sal_Char* pAttributeName,
+ sal_Bool bDefault,
+ sal_Bool bInvert)
+{
+ DBG_ASSERT(NULL != pAttributeName, "Need attribute name");
+
+ Any aAny = rPropSet->getPropertyValue(sPropertyName);
+ sal_Bool bTmp = *(sal_Bool*)aAny.getValue();
+
+ // value = value ^ bInvert
+ // omit if value == default
+ // negate forces sal_Bool to 0/1, making them comparable
+ if ((!(bTmp ^ bInvert)) != (!bDefault))
+ {
+ // export non-default value (since default is omitted)
+ GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT,
+ pAttributeName,
+ bDefault ? sXML_false : sXML_true);
+ }
+}
diff --git a/xmloff/source/text/XMLSectionExport.hxx b/xmloff/source/text/XMLSectionExport.hxx
new file mode 100644
index 000000000000..e40297bc2f88
--- /dev/null
+++ b/xmloff/source/text/XMLSectionExport.hxx
@@ -0,0 +1,342 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLSectionExport.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLSECTIONEXPORT_HXX_
+#define _XMLOFF_XMLSECTIONEXPORT_HXX_
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/Sequence.h>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+class SvXMLExport;
+class XMLTextParagraphExport;
+namespace com { namespace sun { namespace star {
+ namespace text
+ {
+ class XTextSection;
+ class XDocumentIndex;
+ }
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace container
+ {
+ class XIndexReplace;
+ }
+} } }
+
+
+enum SectionTypeEnum
+{
+ TEXT_SECTION_TYPE_SECTION,
+
+ // indices: keep index valued together and do not change order,
+ // because they are used to index into array
+ TEXT_SECTION_TYPE_TOC,
+ TEXT_SECTION_TYPE_TABLE,
+ TEXT_SECTION_TYPE_ILLUSTRATION,
+ TEXT_SECTION_TYPE_OBJECT,
+ TEXT_SECTION_TYPE_USER,
+ TEXT_SECTION_TYPE_ALPHABETICAL,
+ TEXT_SECTION_TYPE_BIBLIOGRAPHY,
+
+ // index header sections:
+ // todo
+
+ TEXT_SECTION_TYPE_UNKNOWN
+};
+
+
+/**
+ * This class handles the export of sections and indices (which are,
+ * internally, just sections). It is intended to be used only from
+ * within the XMLTextParagraphExport class.
+ */
+class XMLSectionExport
+{
+ const ::rtl::OUString sCondition;
+ const ::rtl::OUString sCreateFromChapter;
+ const ::rtl::OUString sCreateFromEmbeddedObjects;
+ const ::rtl::OUString sCreateFromGraphicObjects;
+ const ::rtl::OUString sCreateFromLabels;
+ const ::rtl::OUString sCreateFromMarks;
+ const ::rtl::OUString sCreateFromOtherEmbeddedObjects;
+ const ::rtl::OUString sCreateFromOutline;
+ const ::rtl::OUString sCreateFromStarCalc;
+ const ::rtl::OUString sCreateFromStarChart;
+ const ::rtl::OUString sCreateFromStarDraw;
+ const ::rtl::OUString sCreateFromStarImage;
+ const ::rtl::OUString sCreateFromStarMath;
+ const ::rtl::OUString sCreateFromTables;
+ const ::rtl::OUString sCreateFromTextFrames;
+ const ::rtl::OUString sDdeCommandElement;
+ const ::rtl::OUString sDdeCommandFile;
+ const ::rtl::OUString sDdeCommandType;
+ const ::rtl::OUString sFileLink;
+ const ::rtl::OUString sIsCaseSensitive;
+ const ::rtl::OUString sIsProtected;
+ const ::rtl::OUString sIsVisible;
+ const ::rtl::OUString sLabelCategory;
+ const ::rtl::OUString sLabelDisplayType;
+ const ::rtl::OUString sLevel;
+ const ::rtl::OUString sLevelFormat;
+ const ::rtl::OUString sLevelParagraphStyles;
+ const ::rtl::OUString sLinkRegion;
+ const ::rtl::OUString sMainEntryCharacterStyleName;
+ const ::rtl::OUString sParaStyleHeading;
+ const ::rtl::OUString sParaStyleLevel;
+ const ::rtl::OUString sSection;
+ const ::rtl::OUString sTitle;
+ const ::rtl::OUString sUseAlphabeticalSeparators;
+ const ::rtl::OUString sUseCombinedEntries;
+ const ::rtl::OUString sUseDash;
+ const ::rtl::OUString sUseKeyAsEntry;
+ const ::rtl::OUString sUseLevelFromSource;
+ const ::rtl::OUString sUsePP;
+ const ::rtl::OUString sUseUpperCase;
+
+ const ::rtl::OUString sTableOfContent;
+ const ::rtl::OUString sIllustrationIndex;
+ const ::rtl::OUString sTableIndex;
+ const ::rtl::OUString sAlphabeticalIndex;
+ const ::rtl::OUString sObjectIndex;
+ const ::rtl::OUString sBibliography;
+ const ::rtl::OUString sUserIndex;
+
+ const ::rtl::OUString sEmpty;
+
+ SvXMLExport& rExport;
+ XMLTextParagraphExport& rParaExport;
+
+public:
+ XMLSectionExport(SvXMLExport& rExp,
+ XMLTextParagraphExport& rParaExp);
+
+ /**
+ * export section or index start and source elements. This
+ * method handles the section styles, and delegates to the
+ * appropriate section or index method.
+ */
+ void ExportSectionStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rSection,
+ sal_Bool bAutoStyles);
+
+ /**
+ * export section or index end elements
+ */
+ void ExportSectionEnd(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rSection,
+ sal_Bool bAutoStyles);
+
+ /**
+ * export an index start element. This method should eventually be replaced
+ * by calls to ExportSectionStart. Also handle section styles.
+ *
+ * @deprecated Once the API allows to recognize an index section
+ * as index, this method should be removed.
+ */
+ void ExportIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XDocumentIndex > & rSection,
+ sal_Bool bAutoStyles);
+
+ /** @deprecated see ExportIndexStart */
+ void ExportIndexEnd(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XDocumentIndex > & rSection,
+ sal_Bool bAutoStyles);
+
+protected:
+
+ inline SvXMLExport& GetExport() { return rExport; }
+ inline XMLTextParagraphExport& GetParaExport() { return rParaExport; }
+
+ // export methods for section and index start:
+
+ /// export a proper section (and source elements)
+ void ExportRegularSectionStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::text::XTextSection > & rSection);
+
+ /// export a table of content (and source element)
+ void ExportTableOfContentStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export a table index (and source element)
+ void ExportTableIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export an object index (and source element)
+ void ExportObjectIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export an illustration index (and source element)
+ void ExportIllustrationIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export an alphabetical/keyword index (and source element)
+ void ExportAlphabeticalIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export a user index (and source element)
+ void ExportUserIndexStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export the bibliography (and source element)
+ void ExportBibliographyStart(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rIndex);
+
+
+ // helper methods:
+
+ /// map service name to section type
+ enum SectionTypeEnum MapSectionType(const ::rtl::OUString& rSectionName);
+
+ /**
+ * Export the index element start (for all index types).
+ *
+ * All additional attributes (usually none) for the index element
+ * should have been set at GetExport() before calling this method.
+ */
+ void ExportBaseIndexStart(
+ const ::rtl::OUString sElementName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /**
+ * Export the index source element (common for all index types).
+ *
+ * All additional attributes for the source element should have
+ * been set at the GetExport() before calling this method.
+ */
+ void ExportBaseIndexSource(
+ SectionTypeEnum eType, /// index type
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /**
+ * Export the index body (common for all index types).
+ */
+ void ExportBaseIndexBody(
+ SectionTypeEnum eType, /// index type
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+
+ /**
+ * Helper method to export common attributes for table and
+ * illustration indices
+ */
+ void ExportTableAndIllustrationIndexSourceAttributes(
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & rSection);
+
+ /// export one template for the specific index type
+ void ExportIndexTemplate(
+ SectionTypeEnum eType, /// index type
+ sal_Int32 nLevel, /// outline level (if applicable)
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> > & rValues);
+
+ /// export a single template element (e.g. span or tab-stop)
+ void ExportIndexTemplateElement(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue> & rValues);
+
+ /// export level paragraph styles
+ void ExportLevelParagraphStyles(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexReplace> & xStyles);
+
+
+ /// helper to export boolean properties
+ void ExportBoolean(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropSet,
+ const ::rtl::OUString& sPropertyName,
+ const sal_Char* pAttributeName,
+ sal_Bool bDefault,
+ sal_Bool bInvert = sal_False);
+};
+
+#endif
diff --git a/xmloff/source/text/XMLSectionImportContext.cxx b/xmloff/source/text/XMLSectionImportContext.cxx
index 533667ed4768..b6ac5c39efa6 100644
--- a/xmloff/source/text/XMLSectionImportContext.cxx
+++ b/xmloff/source/text/XMLSectionImportContext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLSectionImportContext.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -344,27 +344,25 @@ SvXMLImportContext* XMLSectionImportContext::CreateChildContext(
SvXMLImportContext* pContext = NULL;
// section-source (-dde) elements
- if (XML_NAMESPACE_TEXT == nPrefix)
+ if ((XML_NAMESPACE_TEXT == nPrefix) &&
+ rLocalName.equalsAsciiL(sXML_section_source,
+ sizeof(sXML_section_source)-1))
{
- if (rLocalName.equalsAsciiL(sXML_section_source,
- sizeof(sXML_section_source)-1))
- {
- pContext = new XMLSectionSourceImportContext(GetImport(),
- nPrefix, rLocalName,
- xSectionPropertySet);
- }
- else if (rLocalName.equalsAsciiL(sXML_section_source_dde,
- sizeof(sXML_section_source_dde)-1))
- {
- pContext = new XMLSectionSourceDDEImportContext(GetImport(),
- nPrefix, rLocalName,
- xSectionPropertySet);
- }
+ pContext = new XMLSectionSourceImportContext(GetImport(),
+ nPrefix, rLocalName,
+ xSectionPropertySet);
}
-
- // otherwise: text context
- if (NULL == pContext)
+ else if ((XML_NAMESPACE_OFFICE == nPrefix) &&
+ rLocalName.equalsAsciiL(sXML_dde_source,
+ sizeof(sXML_dde_source)-1))
+ {
+ pContext = new XMLSectionSourceDDEImportContext(GetImport(),
+ nPrefix, rLocalName,
+ xSectionPropertySet);
+ }
+ else
{
+ // otherwise: text context
pContext = GetImport().GetTextImport()->CreateTextChildContext(
GetImport(), nPrefix, rLocalName, xAttrList);
diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
index 15f188a1e2c4..bfd1be11eb28 100644
--- a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
+++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLSectionSourceDDEImportContext.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2000-10-16 13:01:58 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -144,10 +144,10 @@ enum XMLSectionSourceDDEToken
static __FAR_DATA SvXMLTokenMapEntry aSectionSourceDDETokenMap[] =
{
- { XML_NAMESPACE_TEXT, sXML_dde_application,
+ { XML_NAMESPACE_OFFICE, sXML_dde_application,
XML_TOK_SECTION_DDE_APPLICATION },
- { XML_NAMESPACE_TEXT, sXML_dde_topic, XML_TOK_SECTION_DDE_TOPIC },
- { XML_NAMESPACE_TEXT, sXML_dde_item, XML_TOK_SECTION_DDE_ITEM },
+ { XML_NAMESPACE_OFFICE, sXML_dde_topic, XML_TOK_SECTION_DDE_TOPIC },
+ { XML_NAMESPACE_OFFICE, sXML_dde_item, XML_TOK_SECTION_DDE_ITEM },
XML_TOKEN_MAP_END
};
diff --git a/xmloff/source/text/makefile.mk b/xmloff/source/text/makefile.mk
index fc8b69a86be6..acf8525a57f8 100644
--- a/xmloff/source/text/makefile.mk
+++ b/xmloff/source/text/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.10 $
+# $Revision: 1.11 $
#
-# last change: $Author: mib $ $Date: 2000-11-07 13:33:08 $
+# last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -96,15 +96,25 @@ CXXFILES = \
XMLFootnoteBodyImportContext.cxx \
XMLFootnoteConfigurationImportContext.cxx \
XMLFootnoteImportContext.cxx \
+ XMLIndexAlphabeticalSourceContext.cxx \
+ XMLIndexBibliographyEntryContext.cxx \
+ XMLIndexBibliographySourceContext.cxx \
+ XMLIndexChapterInfoEntryContext.cxx \
+ XMLIndexIllustrationSourceContext.cxx \
+ XMLIndexObjectSourceContext.cxx \
XMLIndexSimpleEntryContext.cxx \
XMLIndexSpanEntryContext.cxx \
XMLIndexTabStopEntryContext.cxx \
+ XMLIndexSourceBaseContext.cxx \
+ XMLIndexTableSourceContext.cxx \
XMLIndexTOCContext.cxx \
XMLIndexTOCSourceContext.cxx \
XMLIndexTOCStylesContext.cxx \
XMLIndexTemplateContext.cxx \
XMLIndexTitleTemplateContext.cxx \
+ XMLIndexUserSourceContext.cxx \
XMLPropertyBackpatcher.cxx \
+ XMLSectionExport.cxx \
XMLSectionImportContext.cxx \
XMLSectionSourceDDEImportContext.cxx \
XMLSectionSourceImportContext.cxx \
@@ -145,15 +155,25 @@ SLOFILES = \
$(SLO)$/XMLFootnoteBodyImportContext.obj \
$(SLO)$/XMLFootnoteConfigurationImportContext.obj \
$(SLO)$/XMLFootnoteImportContext.obj \
+ $(SLO)$/XMLIndexAlphabeticalSourceContext.obj \
+ $(SLO)$/XMLIndexBibliographyEntryContext.obj \
+ $(SLO)$/XMLIndexBibliographySourceContext.obj \
+ $(SLO)$/XMLIndexChapterInfoEntryContext.obj \
+ $(SLO)$/XMLIndexIllustrationSourceContext.obj \
+ $(SLO)$/XMLIndexObjectSourceContext.obj \
$(SLO)$/XMLIndexSimpleEntryContext.obj \
$(SLO)$/XMLIndexSpanEntryContext.obj \
+ $(SLO)$/XMLIndexSourceBaseContext.obj \
$(SLO)$/XMLIndexTOCContext.obj \
$(SLO)$/XMLIndexTOCSourceContext.obj \
$(SLO)$/XMLIndexTOCStylesContext.obj \
+ $(SLO)$/XMLIndexTableSourceContext.obj \
$(SLO)$/XMLIndexTabStopEntryContext.obj \
$(SLO)$/XMLIndexTemplateContext.obj \
$(SLO)$/XMLIndexTitleTemplateContext.obj \
+ $(SLO)$/XMLIndexUserSourceContext.obj \
$(SLO)$/XMLPropertyBackpatcher.obj \
+ $(SLO)$/XMLSectionExport.obj \
$(SLO)$/XMLSectionImportContext.obj \
$(SLO)$/XMLSectionSourceDDEImportContext.obj \
$(SLO)$/XMLSectionSourceImportContext.obj \
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 1e03ab549ab6..429b8e26fce7 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtimp.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: mib $ $Date: 2000-11-13 08:42:14 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -204,6 +204,12 @@ static __FAR_DATA SvXMLTokenMapEntry aTextElemTokenMap[] =
{ XML_NAMESPACE_TEXT, sXML_dde_connection_decls, XML_TOK_TEXT_DDE_DECLS },
{ XML_NAMESPACE_TEXT, sXML_section, XML_TOK_TEXT_SECTION },
{ XML_NAMESPACE_TEXT, sXML_table_of_content, XML_TOK_TEXT_TOC },
+ { XML_NAMESPACE_TEXT, sXML_object_index, XML_TOK_TEXT_OBJECT_INDEX },
+ { XML_NAMESPACE_TEXT, sXML_table_index, XML_TOK_TEXT_TABLE_INDEX },
+ { XML_NAMESPACE_TEXT, sXML_illustration_index, XML_TOK_TEXT_ILLUSTRATION_INDEX },
+ { XML_NAMESPACE_TEXT, sXML_user_index, XML_TOK_TEXT_USER_INDEX },
+ { XML_NAMESPACE_TEXT, sXML_alphabetical_index, XML_TOK_TEXT_ALPHABETICAL_INDEX },
+ { XML_NAMESPACE_TEXT, sXML_bibliography, XML_TOK_TEXT_BIBLIOGRAPHY_INDEX },
XML_TOKEN_MAP_END
};
@@ -996,6 +1002,12 @@ SvXMLImportContext *XMLTextImportHelper::CreateTextChildContext(
break;
case XML_TOK_TEXT_TOC:
+ case XML_TOK_TEXT_OBJECT_INDEX:
+ case XML_TOK_TEXT_TABLE_INDEX:
+ case XML_TOK_TEXT_ILLUSTRATION_INDEX:
+ case XML_TOK_TEXT_USER_INDEX:
+ case XML_TOK_TEXT_ALPHABETICAL_INDEX:
+ case XML_TOK_TEXT_BIBLIOGRAPHY_INDEX:
pContext = new XMLIndexTOCContext( rImport, nPrefix, rLocalName );
break;
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index f1ea0e8263d0..dec67315342a 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtparae.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: mib $ $Date: 2000-11-07 13:33:09 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -209,6 +209,10 @@
#ifndef _XMLOFF_TXTPARAE_HXX
#include "txtparae.hxx"
#endif
+#ifndef _XMLOFF_XMLSECTIONEXPORT_HXX_
+#include "XMLSectionExport.hxx"
+#endif
+
using namespace ::rtl;
using namespace ::std;
@@ -549,6 +553,7 @@ XMLTextParagraphExport::XMLTextParagraphExport(
pPageShapeIdxs( 0 ),
pFrameTextFrameIdxs( 0 ),
pFrameGraphicIdxs( 0 ),
+ pSectionExport( NULL ),
pFrameShapeIdxs( 0 ),
sParagraphService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph")),
sTableService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable")),
@@ -612,30 +617,9 @@ XMLTextParagraphExport::XMLTextParagraphExport(
sUnvisitedCharStyleName(RTL_CONSTASCII_USTRINGPARAM("UnvisitedCharStyleName")),
sVisitedCharStyleName(RTL_CONSTASCII_USTRINGPARAM("VisitedCharStyleName")),
sTextSection(RTL_CONSTASCII_USTRINGPARAM("TextSection")),
- sSection(RTL_CONSTASCII_USTRINGPARAM(sXML_section)),
- sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected")),
- sIsVisible(RTL_CONSTASCII_USTRINGPARAM("IsVisible")),
- sCondition(RTL_CONSTASCII_USTRINGPARAM("Condition")),
- sFileLink(RTL_CONSTASCII_USTRINGPARAM("FileLink")),
- sLinkRegion(RTL_CONSTASCII_USTRINGPARAM("LinkRegion")),
- sDdeCommandFile(RTL_CONSTASCII_USTRINGPARAM("DDECommandFile")),
- sDdeCommandType(RTL_CONSTASCII_USTRINGPARAM("DDECommandType")),
- sDdeCommandElement(RTL_CONSTASCII_USTRINGPARAM("DDECommandElement")),
sDocumentIndex(RTL_CONSTASCII_USTRINGPARAM("DocumentIndex")),
- sCreateFromOutline(RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline")),
- sLevel(RTL_CONSTASCII_USTRINGPARAM("Level")),
- sCreateFromMarks(RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks")),
- sCreateFromChapter(RTL_CONSTASCII_USTRINGPARAM("CreateFromChapter")),
- sLevelFormat(RTL_CONSTASCII_USTRINGPARAM("LevelFormat")),
- sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")),
- sParaStyleHeading(RTL_CONSTASCII_USTRINGPARAM("ParaStyleHeading")),
- sParaStyleLevel(RTL_CONSTASCII_USTRINGPARAM("ParaStyleLevel")),
- sLevelParagraphStyles(RTL_CONSTASCII_USTRINGPARAM("LevelParagraphStyles")),
- sEmpty()
+ sDocumentIndexMark(RTL_CONSTASCII_USTRINGPARAM("DocumentIndexMark"))
{
- sText_Section = GetExport().GetNamespaceMap().GetQNameByKey(
- XML_NAMESPACE_TEXT, sSection);
-
UniReference < XMLPropertySetMapper > xPropMapper =
new XMLTextPropertySetMapper( TEXT_PROP_MAP_PARA );
xParaPropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
@@ -675,10 +659,12 @@ XMLTextParagraphExport::XMLTextParagraphExport(
GetExport() );
pFieldExport = new XMLTextFieldExport( rExp );
+ pSectionExport = new XMLSectionExport( rExp, *this );
}
XMLTextParagraphExport::~XMLTextParagraphExport()
{
+ delete pSectionExport;
delete pFieldExport;
delete pListElements;
delete pExportedLists;
@@ -1095,6 +1081,12 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
bAutoStyles);
bPrevCharIsSpace = sal_False;
}
+ else if (sType.equals(sDocumentIndexMark))
+ {
+ exportIndexMark(xPropSet,
+ bAutoStyles);
+ bPrevCharIsSpace = sal_False;
+ }
else
DBG_ERROR("unknown text portion type");
}
@@ -1213,6 +1205,13 @@ void XMLTextParagraphExport::exportTextMark(
// else: no styles. (see above)
}
+void XMLTextParagraphExport::exportIndexMark(
+ const Reference < XPropertySet > & rPropSet,
+ sal_Bool bAutoStyles)
+{
+ // TODO: export index mark
+}
+
sal_Int32 XMLTextParagraphExport::addTextFrameAttributes(
const Reference < XPropertySet >& rPropSet,
sal_Bool bShape )
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 20aa9fc0e661..9676824c3add 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtprmap.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: mib $ $Date: 2000-11-13 08:42:14 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -553,7 +553,16 @@ XMLPropertyMapEntry aXMLShapePropMap[] =
XMLPropertyMapEntry aXMLSectionPropMap[] =
{
+ // RES_COL
M_E( "TextColumns", STYLE, columns, MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_COLUMNS, CTF_TEXTCOLUMNS ),
+
+ // RES_BACKGROUND
+ M_E( "BackColor", FO, background_color, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
+ M_E( "BackTransparent", FO, background_color, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ M_E( "BackGraphicLocation", STYLE, position, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BUILDIN_CMP_ONLY, CTF_BACKGROUND_POS ),
+ M_E( "BackGraphicFilter",STYLE, filter_name, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_FILTER ),
+ M_E( "BackGraphicURL", STYLE, background_image, MID_FLAG_ELEMENT_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_URL ),
+
M_E( "IsProtected", STYLE, protect, XML_TYPE_BOOL, 0 ),
{ 0, 0, 0, 0 }
};
diff --git a/xmloff/source/text/txtsecte.cxx b/xmloff/source/text/txtsecte.cxx
index 2f8e38c1dca0..0cda39075a4f 100644
--- a/xmloff/source/text/txtsecte.cxx
+++ b/xmloff/source/text/txtsecte.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtsecte.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $
+ * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -156,6 +156,10 @@
#include "XMLTextNumRuleInfo.hxx"
#endif
+#ifndef _XMLOFF_XMLSECTIONEXPORT_HXX_
+#include "XMLSectionExport.hxx"
+#endif
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::text;
using namespace ::com::sun::star::uno;
@@ -200,7 +204,7 @@ void XMLTextParagraphExport::exportListAndSectionChange(
if (xDocumentIndex.is() && !rPrevSection.is())
{
- exportDocumentIndex(xDocumentIndex, bAutoStyles);
+ pSectionExport->ExportIndexStart(xDocumentIndex, bAutoStyles);
}
}
}
@@ -212,8 +216,7 @@ void XMLTextParagraphExport::exportListAndSectionChange(
{
if ( xNextSection.is() )
{
- Reference<XPropertySet> xPropSet( xNextSection, UNO_QUERY);
- Add( XML_STYLE_FAMILY_TEXT_SECTION, xPropSet );
+ pSectionExport->ExportSectionStart( xNextSection, bAutoStyles );
}
}
else
@@ -260,18 +263,13 @@ void XMLTextParagraphExport::exportListAndSectionChange(
// close all elements of aOld, open all of aNew
while (aOld != aOldStack.rend())
{
- Reference<XNamed> xName(*aOld, UNO_QUERY);
- GetExport().GetDocHandler()->ignorableWhitespace(
- GetExport().sWS );
- GetExport().GetDocHandler()->endElement(sText_Section);
- GetExport().GetDocHandler()->ignorableWhitespace(
- GetExport().sWS );
+ pSectionExport->ExportSectionEnd(*aOld, bAutoStyles);
aOld++;
}
while (aNew != aNewStack.rend())
{
- exportSectionStart(*aNew);
+ pSectionExport->ExportSectionStart(*aNew, bAutoStyles);
aNew++;
}
@@ -288,585 +286,3 @@ void XMLTextParagraphExport::exportListAndSectionChange(
// save old section (old numRule gets saved in calling method
rPrevSection = xNextSection;
}
-
-void XMLTextParagraphExport::exportSectionStart(
- const ::com::sun::star::uno::Reference <
- ::com::sun::star::text::XTextSection > & rSection)
-{
- // any old attributes?
- GetExport().CheckAttrList();
-
- Reference<XNamed> xName(rSection, UNO_QUERY);
- GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_name,
- xName->getName());
-
- // get XPropertySet for other values
- Reference<XPropertySet> xPropSet(rSection, UNO_QUERY);
- Any aAny;
-
- // style name
- GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_style_name,
- Find( XML_STYLE_FAMILY_TEXT_SECTION,
- xPropSet, sEmpty ));
-
- // condition and display
- aAny = xPropSet->getPropertyValue(sCondition);
- OUString sCond;
- aAny >>= sCond;
- sal_Char* pDisplay;
- if (sCond.getLength() > 0)
- {
- GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_condition,
- sCond);
- pDisplay = sXML_condition;
- }
- else
- {
- pDisplay = sXML_none;
- }
- aAny = xPropSet->getPropertyValue(sIsVisible);
- if (! *(sal_Bool*)aAny.getValue())
- {
- GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT, sXML_display,
- pDisplay);
- }
-
- // export element
- GetExport().GetDocHandler()->ignorableWhitespace( GetExport().sWS );
- GetExport().GetDocHandler()->startElement( sText_Section,
- GetExport().GetXAttrList() );
- GetExport().ClearAttrList();
-
- // data source
- // unfortunately, we have to test all relevant strings for non-zero length
- aAny = xPropSet->getPropertyValue(sFileLink);
- SectionFileLink aFileLink;
- aAny >>= aFileLink;
-
- aAny = xPropSet->getPropertyValue(sLinkRegion);
- OUString sRegionName;
- aAny >>= sRegionName;
-
- if ( (aFileLink.FileURL.getLength() > 0) ||
- (aFileLink.FilterName.getLength() > 0) ||
- (sRegionName.getLength() > 0) )
- {
- if (aFileLink.FileURL.getLength() > 0)
- {
- GetExport().AddAttribute(XML_NAMESPACE_XLINK, sXML_href,
- aFileLink.FileURL);
- }
-
- if (aFileLink.FilterName.getLength() > 0)
- {
- GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_filter_name,
- aFileLink.FilterName);
- }
-
- if (sRegionName.getLength() > 0)
- {
- GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_section_name,
- sRegionName);
- }
-
- SvXMLElementExport aElem(GetExport(),
- XML_NAMESPACE_TEXT, sXML_section_source,
- sal_True, sal_True);
- }
- else
- {
- // data source DDE
- // unfortunately, we have to test all relevant strings for
- // non-zero length
- aAny = xPropSet->getPropertyValue(sDdeCommandFile);
- OUString sApplication;
- aAny >>= sApplication;
- aAny = xPropSet->getPropertyValue(sDdeCommandType);
- OUString sTopic;
- aAny >>= sTopic;
- aAny = xPropSet->getPropertyValue(sDdeCommandElement);
- OUString sItem;
- aAny >>= sItem;
-
- if ( (sApplication.getLength() > 0) ||
- (sTopic.getLength() > 0) ||
- (sItem.getLength() > 0 ) )
- {
- GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_dde_application,
- sApplication);
- GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_dde_topic,
- sTopic);
- GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_dde_item,
- sItem);
-
- SvXMLElementExport aElem(GetExport(),
- XML_NAMESPACE_TEXT,
- sXML_section_source_dde,
- sal_True, sal_True);
- }
- // else: no data source
- }
-}
-
-void XMLTextParagraphExport::exportDocumentIndex(
- Reference<XDocumentIndex> & rIndex,
- sal_Bool bAutoStyles)
-{
- OUString sServiceName = rIndex->getServiceName();
-
- const sal_Char sAPI_ContentIndex[] = "com.sun.star.text.ContentIndex";
-
- if (sServiceName.equalsAsciiL(sAPI_ContentIndex,
- sizeof(sAPI_ContentIndex)-1))
- {
- Reference<XPropertySet> xPropertySet(rIndex, UNO_QUERY);
-
- if (bAutoStyles)
- {
- // treat index as section style
- Add( XML_STYLE_FAMILY_TEXT_SECTION, xPropertySet );
- }
- else
- {
- Any aAny;
-
- // style name
- GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_style_name,
- Find( XML_STYLE_FAMILY_TEXT_SECTION,
- xPropertySet, sEmpty ));
-
- // table of content Element
- SvXMLElementExport aElem(GetExport(),
- XML_NAMESPACE_TEXT,
- sXML_table_of_content,
- sal_True, sal_True);
-
- {
- // scope for table-of-content-source element
-
- // outline-level (none|1..10)
- aAny = xPropertySet->getPropertyValue(sCreateFromOutline);
- if (*(sal_Bool*)aAny.getValue())
- {
- // outline-level: 1..10
- aAny = xPropertySet->getPropertyValue(sLevel);
- sal_Int16 nLevel;
- aAny >>= nLevel;
-
- OUStringBuffer sBuffer;
- SvXMLUnitConverter::convertNumber(sBuffer,
- (sal_Int32)nLevel);
-
- GetExport().AddAttribute(XML_NAMESPACE_TEXT,
- sXML_outline_level,
- sBuffer.makeStringAndClear());
- }
- else
- {
- // outline-level: none
- GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT,
- sXML_outline_level,
- sXML_none);
- }
-
- // use index marks
- aAny = xPropertySet->getPropertyValue(sCreateFromMarks);
- if (! (*(sal_Bool*)aAny.getValue()))
- {
- GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT,
- sXML_use_index_marks,
- sXML_true);
- }
-
- // document or chapter index?
- aAny = xPropertySet->getPropertyValue(sCreateFromChapter);
- if (*(sal_Bool*)aAny.getValue())
- {
- GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT,
- sXML_index_scope,
- sXML_chapter);
- }
-
- // the TOC source element
- SvXMLElementExport aElem(GetExport(),
- XML_NAMESPACE_TEXT,
- sXML_table_of_content_source,
- sal_True, sal_True);
-
- // styles from which to build the index (LevelParagraphStyles)
- aAny = xPropertySet->getPropertyValue(sLevelParagraphStyles);
- Reference<XIndexReplace> xLevelParagraphStyles;
- aAny >>= xLevelParagraphStyles;
-
- // iterate over levels
- sal_Int32 nPLevelCount = xLevelParagraphStyles->getCount();
- for(sal_Int32 nLevel = 0; nLevel < nPLevelCount; nLevel++)
- {
- aAny = xLevelParagraphStyles->getByIndex(nLevel);
- Sequence<OUString> aStyleNames;
- aAny >>= aStyleNames;
-
- // export only if at least one style is contained
- sal_Int32 nNamesCount = aStyleNames.getLength();
- if (nNamesCount > 0)
- {
-
- // level attribute; we count 1..10; API 0..9
- OUStringBuffer sBuf;
- sal_Int32 nLevelPlusOne = nLevel + 1;
- SvXMLUnitConverter::convertNumber(sBuf, nLevelPlusOne);
- GetExport().AddAttribute(XML_NAMESPACE_TEXT,
- sXML_outline_level,
- sBuf.makeStringAndClear());
-
- // source styles element
- SvXMLElementExport aParaStyles(GetExport(),
- XML_NAMESPACE_TEXT,
- sXML_index_source_styles,
- sal_True, sal_True);
-
- // iterate over styles in this level
- for(sal_Int32 nName = 0; nName < nNamesCount; nName++)
- {
- // stylename attribute
- GetExport().AddAttribute(XML_NAMESPACE_TEXT,
- sXML_style_name,
- aStyleNames[nName]);
-
- // element
- SvXMLElementExport aParaStyle(GetExport(),
- XML_NAMESPACE_TEXT,
- sXML_index_source_style,
- sal_True, sal_False);
- }
- }
- }
-
- // scope for title template
- {
- // header style name
- aAny = xPropertySet->getPropertyValue(sParaStyleHeading);
- OUString sStyleName;
- aAny >>= sStyleName;
- GetExport().AddAttribute(XML_NAMESPACE_TEXT,
- sXML_style_name,
- sStyleName);
-
- // title template
- SvXMLElementExport aHeaderTemplate(GetExport(),
- XML_NAMESPACE_TEXT,
- sXML_index_title_template,
- sal_True, sal_False);
-
- // title as element content
- aAny = xPropertySet->getPropertyValue(sTitle);
- OUString sTitleString;
- aAny >>= sTitleString;
- GetExport().GetDocHandler()->characters(sTitleString);
- }
-
- // export level templates
- aAny = xPropertySet->getPropertyValue(sLevelFormat);
- Reference<XIndexReplace> xLevelTemplates;
- aAny >>= xLevelTemplates;
-
- // iterate over level formats;
- // skip element 0 (empty template for title)
- sal_Int32 nLevelCount = xLevelTemplates->getCount();
- for(sal_Int32 i = 1; i<nLevelCount; i++)
- {
- // level number
- OUStringBuffer sBuffer;
- SvXMLUnitConverter::convertNumber(sBuffer, i);
- OUString sNumber = sBuffer.makeStringAndClear();
-
- GetExport().AddAttribute(XML_NAMESPACE_TEXT,
- sXML_outline_level,
- sNumber);
-
- // style name
- sBuffer.append(sParaStyleLevel);
- sBuffer.append(i);
- aAny = xPropertySet->getPropertyValue(
- sBuffer.makeStringAndClear());
- OUString sLevelStyle;
- aAny >>= sLevelStyle;
- GetExport().AddAttribute(XML_NAMESPACE_TEXT,
- sXML_style_name,
- sLevelStyle);
-
- // template element
- SvXMLElementExport aLevelTemplate(GetExport(),
- XML_NAMESPACE_TEXT,
- sXML_index_entry_template,
- sal_True, sal_True);
-
- // get sequence
- Sequence<PropertyValues> aTemplateSequence;
- aAny = xLevelTemplates->getByIndex(i);
- aAny >>= aTemplateSequence;
-
- // export sequence
- sal_Int32 nTemplateCount = aTemplateSequence.getLength();
- for(sal_Int32 nTemplateNo = 0;
- nTemplateNo < nTemplateCount;
- nTemplateNo++)
- {
- exportIndexTemplateElement(
- aTemplateSequence[nTemplateNo]);
- }
- }
- }
-
- {
- SvXMLElementExport aIndexBody(GetExport(),
- XML_NAMESPACE_TEXT,
- sXML_table_of_content_body,
- sal_True, sal_True);
- }
- }
- }
-}
-
-
-enum TemplateTypeEnum
-{
- TOK_TTYPE_ENTRY_NUMBER,
- TOK_TTYPE_ENTRY_TEXT,
- TOK_TTYPE_TAB_STOP,
- TOK_TTYPE_TEXT,
- TOK_TTYPE_PAGE_NUMBER,
- TOK_TTYPE_CHAPTER_INFO,
- TOK_TTYPE_HYPERLINK_START,
- TOK_TTYPE_HYPERLINK_END,
- TOK_TTYPE_BIBLIOGRAPHY,
- TOK_TTYPE_INVALID
-};
-
-enum TemplateParamEnum
-{
- TOK_TPARAM_TOKEN_TYPE,
- TOK_TPARAM_CHAR_STYLE,
- TOK_TPARAM_TAB_RIGHT_ALIGNED,
- TOK_TPARAM_TAB_POSITION,
- TOK_TPARAM_TAB_FILL_CHAR,
- TOK_TPARAM_TEXT,
- TOK_TPARAM_CHAPTER_FORMAT
-};
-
-SvXMLEnumMapEntry __READONLY_DATA aTemplateTypeMap[] =
-{
- { "TokenEntryNumber", TOK_TTYPE_ENTRY_NUMBER },
- { "TokenEntryText", TOK_TTYPE_ENTRY_TEXT },
- { "TokenTabStop", TOK_TTYPE_TAB_STOP },
- { "TokenText", TOK_TTYPE_TEXT },
- { "TokenPageNumber", TOK_TTYPE_PAGE_NUMBER },
- { "TokenChapterInfo", TOK_TTYPE_CHAPTER_INFO },
- { "TokenHyperlinkStart", TOK_TTYPE_HYPERLINK_START },
- { "TokenHyperlinkEnd", TOK_TTYPE_HYPERLINK_END },
- { "TokenBibliogaphyDataField", TOK_TTYPE_BIBLIOGRAPHY },
- { NULL, NULL }
-};
-
-SvXMLEnumMapEntry __READONLY_DATA aTemplateParamMap[] =
-{
- { "TokenType", TOK_TPARAM_TOKEN_TYPE },
- { "CharacterStyleName", TOK_TPARAM_CHAR_STYLE },
- { "TabStopRightAligned", TOK_TPARAM_TAB_RIGHT_ALIGNED },
- { "TabStopPosition", TOK_TPARAM_TAB_POSITION },
- { "TabStopFillCharacter", TOK_TPARAM_TAB_FILL_CHAR },
- { "Text", TOK_TPARAM_TEXT },
- { "ChapterFormat", TOK_TPARAM_CHAPTER_FORMAT },
- { NULL, NULL }
-};
-
-void XMLTextParagraphExport::exportIndexTemplateElement(
- Sequence<PropertyValue> & rValues)
-{
-
- // variables for template values
-
- // char style
- OUString sCharStyle;
- sal_Bool bCharStyleOK = sal_False;
-
- // text
- OUString sText;
- sal_Bool bTextOK = sal_False;
-
- // tab position
- sal_Bool bRightAligned = sal_False;
- sal_Bool bRightAlignedOK = sal_False;
-
- // tab position
- sal_Int32 nTabPosition = 0;
- sal_Bool bTabPositionOK = sal_False;
-
- // fill character
- OUString sFillChar;
- sal_Bool bFillCharOK = sal_False;
-
- // chapter format
- sal_Int16 nChapterFormat;
- sal_Bool bChapterFormatOK = sal_False;
-
-
- // token type
- enum TemplateTypeEnum nTokenType = TOK_TTYPE_INVALID;
-
- sal_Int32 nCount = rValues.getLength();
- for(sal_Int32 i = 0; i<nCount; i++)
- {
- sal_uInt16 nToken;
- if ( SvXMLUnitConverter::convertEnum( nToken, rValues[i].Name,
- aTemplateParamMap ) )
- {
- // Only use direct and default values.
- // Wrong. no property states, so ignore.
- // if ( (beans::PropertyState_DIRECT_VALUE == rValues[i].State) ||
- // (beans::PropertyState_DEFAULT_VALUE == rValues[i].State) )
-
- switch (nToken)
- {
- case TOK_TPARAM_TOKEN_TYPE:
- {
- sal_uInt16 nTmp;
- OUString sVal;
- rValues[i].Value >>= sVal;
- if (SvXMLUnitConverter::convertEnum( nTmp, sVal,
- aTemplateTypeMap))
- {
- nTokenType = (enum TemplateTypeEnum)nTmp;
- }
- break;
- }
-
- case TOK_TPARAM_CHAR_STYLE:
- // only valid, if not empty
- rValues[i].Value >>= sCharStyle;
- bCharStyleOK = sCharStyle.getLength() > 0;
- break;
-
- case TOK_TPARAM_TEXT:
- rValues[i].Value >>= sText;
- bTextOK = sal_True;
- break;
-
- case TOK_TPARAM_TAB_RIGHT_ALIGNED:
- bRightAligned =
- *(sal_Bool *)rValues[i].Value.getValue();
- bRightAlignedOK = sal_True;
- break;
-
- case TOK_TPARAM_TAB_POSITION:
- rValues[i].Value >>= nTabPosition;
- bTabPositionOK = sal_True;
- break;
-
- case TOK_TPARAM_TAB_FILL_CHAR:
- rValues[i].Value >>= sFillChar;
- bFillCharOK = sal_True;
- break;
-
- case TOK_TPARAM_CHAPTER_FORMAT:
- rValues[i].Value >>= nChapterFormat;
- bChapterFormatOK = sal_True;
- break;
- }
- }
- }
-
- // convert type to token (and check validity) ...
- sal_Char* pElement = NULL;
- switch(nTokenType)
- {
- case TOK_TTYPE_ENTRY_TEXT:
- pElement = sXML_index_entry_text;
- break;
- case TOK_TTYPE_TAB_STOP:
- // test validity
- pElement = ( bRightAligned || bTabPositionOK || bFillCharOK )
- ? sXML_index_entry_tab_stop : NULL;
- break;
- case TOK_TTYPE_TEXT:
- // test validity
- pElement = bTextOK ? sXML_index_entry_span : NULL;
- break;
- case TOK_TTYPE_PAGE_NUMBER:
- pElement = sXML_index_entry_page_number;
- break;
- case TOK_TTYPE_CHAPTER_INFO: // keyword index
- case TOK_TTYPE_ENTRY_NUMBER: // table of content
- // sanitize format: both as chapter fields
- pElement = sXML_index_entry_chapter;
- break;
- case TOK_TTYPE_HYPERLINK_START:
- pElement = sXML_index_entry_link_start;
- break;
- case TOK_TTYPE_HYPERLINK_END:
- pElement = sXML_index_entry_link_end;
- break;
- case TOK_TTYPE_BIBLIOGRAPHY:
- pElement = sXML_index_entry_bibliography;
- default:
- ; // unknown/unimplemented template
- break;
- }
-
- // ... and write Element
- if (pElement != NULL)
- {
- // character style (for most templates)
- if (bCharStyleOK)
- {
- switch (nTokenType)
- {
- case TOK_TTYPE_ENTRY_TEXT:
- case TOK_TTYPE_TEXT:
- case TOK_TTYPE_PAGE_NUMBER:
- case TOK_TTYPE_ENTRY_NUMBER:
- case TOK_TTYPE_HYPERLINK_START:
- case TOK_TTYPE_HYPERLINK_END:
- GetExport().AddAttribute(XML_NAMESPACE_TEXT,
- sXML_style_name, sCharStyle);
- break;
- default:
- ; // nothing: no character style
- break;
- }
- }
-
- if (TOK_TTYPE_TAB_STOP == nTokenType)
- {
- // tab type
- GetExport().AddAttributeASCII(XML_NAMESPACE_STYLE,
- sXML_type,
- bRightAligned ? sXML_right : sXML_left);
-
- if (! bRightAligned)
- {
- // position for left tabs (convert to measure)
- OUStringBuffer sBuf;
- GetExport().GetMM100UnitConverter().convertMeasure(sBuf,
- nTabPosition);
- GetExport().AddAttribute(XML_NAMESPACE_STYLE,
- sXML_position,
- sBuf.makeStringAndClear());
- }
-
- // fill char ("leader char")
- GetExport().AddAttribute(XML_NAMESPACE_STYLE, sXML_leader_char,
- sFillChar);
- }
-
- // export template
- SvXMLElementExport aTemplateElement(GetExport(), XML_NAMESPACE_TEXT,
- pElement, sal_True, sal_False);
-
- // entry text or span element: write text
- if (TOK_TTYPE_TEXT == nTokenType)
- {
- GetExport().GetDocHandler()->characters(sText);
- }
- }
-}