diff options
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/dtd/office.mod | 10 | ||||
-rw-r--r-- | xmloff/dtd/text.mod | 32 | ||||
-rw-r--r-- | xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx | 144 | ||||
-rw-r--r-- | xmloff/inc/xmlkywd.hxx | 27 | ||||
-rw-r--r-- | xmloff/source/style/xmlstyle.cxx | 14 | ||||
-rw-r--r-- | xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx | 323 | ||||
-rw-r--r-- | xmloff/source/text/XMLIndexBibliographyEntryContext.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/text/XMLIndexBibliographyEntryContext.hxx | 7 | ||||
-rw-r--r-- | xmloff/source/text/XMLSectionExport.cxx | 269 | ||||
-rw-r--r-- | xmloff/source/text/XMLSectionExport.hxx | 35 | ||||
-rw-r--r-- | xmloff/source/text/XMLSectionImportContext.cxx | 35 | ||||
-rw-r--r-- | xmloff/source/text/XMLSectionImportContext.hxx | 8 | ||||
-rw-r--r-- | xmloff/source/text/makefile.mk | 6 | ||||
-rw-r--r-- | xmloff/source/text/txtimp.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/text/txtstyle.cxx | 8 |
15 files changed, 829 insertions, 103 deletions
diff --git a/xmloff/dtd/office.mod b/xmloff/dtd/office.mod index bcf33f368df1..b9c53b236e13 100644 --- a/xmloff/dtd/office.mod +++ b/xmloff/dtd/office.mod @@ -1,5 +1,5 @@ <!-- - $Id: office.mod,v 1.14 2000-11-30 16:46:14 dvo Exp $ + $Id: office.mod,v 1.15 2000-12-02 21:43:39 dvo Exp $ The Contents of this file are made available subject to the terms of either of the following licenses @@ -112,13 +112,15 @@ <!-- Validity constraint: The elements text:outline-style, - text:footnotes-configuration and - text:endnotes-configuration + text:footnotes-configuration, + text:endnotes-configuration and + text:bibliography-configuration may appear only once! Unfortunatetly, this constraint cannot be easily specified in the DTD. --> <!ELEMENT office:styles (%styles;|text:outline-style| - text:footnotes-configuration|text:endnotes-configuration)*> + text:footnotes-configuration|text:endnotes-configuration| + text:bibliography-configuration)*> <!ELEMENT office:automatic-styles (%styles;|style:page-master)*> diff --git a/xmloff/dtd/text.mod b/xmloff/dtd/text.mod index b6e9862ed09e..0914d80c1e0e 100644 --- a/xmloff/dtd/text.mod +++ b/xmloff/dtd/text.mod @@ -1,5 +1,5 @@ <!-- - $Id: text.mod,v 1.9 2000-12-01 17:24:27 cl Exp $ + $Id: text.mod,v 1.10 2000-12-02 21:43:39 dvo Exp $ The Contents of this file are made available subject to the terms of either of the following licenses @@ -684,7 +684,8 @@ draw:a|draw:text-box|draw:image|text:section| text:table-of-content|text:illustration-index| text:table-index|text:object-index|text:user-index| - text:alphabetical-index|text:bibliography)*"> + text:alphabetical-index|text:bibliography| + text:index-title)*"> <!ELEMENT text:section ((text:section-source|office:dde-source)?, %sectionText;) > @@ -743,7 +744,7 @@ <!ATTLIST text:illustration-index-source text:use-caption %boolean; "true"> <!ATTLIST text:illustration-index-source text:caption-sequence-name %string; #IMPLIED> -<!ATTLIST text:illustration-index-source text:sequence-format +<!ATTLIST text:illustration-index-source text:caption-sequence-format (text|category-and-value|caption) #IMPLIED> <!ELEMENT text:illustration-index-entry-template @@ -766,7 +767,7 @@ <!ATTLIST text:table-index-source text:use-caption %boolean; "true"> <!ATTLIST text:table-index-source text:caption-sequence-name %string; #IMPLIED> -<!ATTLIST text:table-index-source text:sequence-format +<!ATTLIST text:table-index-source text:caption-sequence-format (text|category-and-value|caption) #IMPLIED> <!ELEMENT text:table-index-entry-template ( text:index-entry-page-number | @@ -884,6 +885,14 @@ <!ELEMENT text:index-body %sectionText; > +<!-- +Validity constraint: text:index-title elements may appear only in +indices, and there may be only one text:index-title element. +--> +<!ELEMENT text:index-title %sectionText; > +<!ATTLIST text:index-title text:style-name %styleName; #IMPLIED> +<!ATTLIST text:index-title text:name %string; #IMPLIED> + <!ELEMENT text:index-title-template (#PCDATA)> <!ATTLIST text:index-title-template text:style-name %styleName; #IMPLIED> @@ -972,3 +981,18 @@ <!ATTLIST text:alphabetical-index-mark text:key1 %string; #IMPLIED> <!ATTLIST text:alphabetical-index-mark text:key2 %string; #IMPLIED> <!ATTLIST text:alphabetical-index-mark text:main-etry %boolean; "false"> + +<!ELEMENT text:bibliography-configuration (text:sort-key)*> +<!ATTLIST text:bibliography-configuration text:prefix %string; #IMPLIED> +<!ATTLIST text:bibliography-configuration text:suffix %string; #IMPLIED> +<!ATTLIST text:bibliography-configuration text:sort-by-position %boolean; "true"> +<!ATTLIST text:bibliography-configuration text:numbered-entries %boolean; "false"> + +<!ELEMENT text:sort-key EMPTY> +<!ATTLIST text:sort-key text:key ( address | annote | author | + bibiliographic_type | booktitle | chapter | custom1 | custom2 | + custom3 | custom4 | custom5 | edition | editor | howpublished | + identifier | institution | isbn | journal | month | note | number | + organizations | pages | publisher | report_type | school | series | + title | url | volume | year ) #REQUIRED> +<!ATTLIST text:sort-key text:sort-ascending %boolean; "true"> diff --git a/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx b/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx new file mode 100644 index 000000000000..79bb71110009 --- /dev/null +++ b/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx @@ -0,0 +1,144 @@ +/************************************************************************* + * + * $RCSfile: XMLIndexBibliographyConfigurationContext.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:37 $ + * + * 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_XMLINDEXBIBLIOGRAPHYCONFIGURATIONCONTEXT_HXX_ +#define _XMLOFF_XMLINDEXBIBLIOGRAPHYCONFIGURATIONCONTEXT_HXX_ + +#ifndef _XMLOFF_XMLSTYLE_HXX +#include "xmlstyle.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 + +#include <vector> + +namespace com { namespace sun { namespace star { + namespace xml { namespace sax { class XAttributeList; } } +} } } +namespace rtl { class OUString; } + +/** + * Import bibliography configuration. + * + * Little cheat: Cover all child elements in CreateChildContext. + */ +class XMLIndexBibliographyConfigurationContext : public SvXMLStyleContext +{ + const ::rtl::OUString sFieldMaster_Bibliography; + const ::rtl::OUString sBracketBefore; + const ::rtl::OUString sBracketAfter; + const ::rtl::OUString sIsNumberEntries; + const ::rtl::OUString sIsSortByPosition; + const ::rtl::OUString sSortKeys; + const ::rtl::OUString sSortKey; + const ::rtl::OUString sIsSortAscending; + + ::rtl::OUString sSuffix; + ::rtl::OUString sPrefix; + sal_Bool bNumberedEntries; + sal_Bool bSortByPosition; + + ::std::vector< ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue> > aSortKeys; + +public: + + TYPEINFO(); + + XMLIndexBibliographyConfigurationContext( + SvXMLImport& rImport, + sal_uInt16 nPrfx, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList> & xAttrList); + + ~XMLIndexBibliographyConfigurationContext(); + +protected: + + virtual void StartElement( + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList> & xAttrList); + + 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 ); + + void ProcessAttribute( + const ::rtl::OUString sLocalName, + const ::rtl::OUString sValue); +}; + +#endif diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx index a198f5e756f7..bf46906615c1 100644 --- a/xmloff/inc/xmlkywd.hxx +++ b/xmloff/inc/xmlkywd.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlkywd.hxx,v $ * - * $Revision: 1.65 $ + * $Revision: 1.66 $ * - * last change: $Author: nn $ $Date: 2000-12-02 16:05:18 $ + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -219,10 +219,10 @@ XML_CONSTASCII_ACTION( sXML_auto_reload, "auto-reload" ); XML_CONSTASCII_ACTION( sXML_auto_text_indent, "auto-text-indent" ); XML_CONSTASCII_ACTION( sXML_auto_update, "auto-update" ); XML_CONSTASCII_ACTION( sXML_automatic, "automatic"); +XML_CONSTASCII_ACTION( sXML_automatic_find_labels, "automatic-find-labels" ); XML_CONSTASCII_ACTION( sXML_automatic_order, "automatic-order" ); XML_CONSTASCII_ACTION( sXML_automatic_styles, "automatic-styles" ); XML_CONSTASCII_ACTION( sXML_automatic_update, "automatic-update" ); -XML_CONSTASCII_ACTION( sXML_automatic_find_labels, "automatic-find-labels" ); XML_CONSTASCII_ACTION( sXML_average, "average" ); XML_CONSTASCII_ACTION( sXML_axis, "axis" ); XML_CONSTASCII_ACTION( sXML_background, "background" ); @@ -238,6 +238,7 @@ XML_CONSTASCII_ACTION( sXML_below , "below" ); XML_CONSTASCII_ACTION( sXML_bevel , "bevel" ); XML_CONSTASCII_ACTION( sXML_bibiliographic_type, "bibiliographic-type" ); XML_CONSTASCII_ACTION( sXML_bibliography, "bibliography" ); +XML_CONSTASCII_ACTION( sXML_bibliography_configuration, "bibliography-configuration" ); XML_CONSTASCII_ACTION( sXML_bibliography_data_field, "bibliography-data-field" ); XML_CONSTASCII_ACTION( sXML_bibliography_entry_template, "bibliography-entry-template" ); XML_CONSTASCII_ACTION( sXML_bibliography_mark, "bibliography-mark" ); @@ -739,6 +740,7 @@ XML_CONSTASCII_ACTION( sXML_index_name, "index-name" ); XML_CONSTASCII_ACTION( sXML_index_scope, "index-scope" ); XML_CONSTASCII_ACTION( sXML_index_source_style, "index-source-style" ); XML_CONSTASCII_ACTION( sXML_index_source_styles, "index-source-styles" ); +XML_CONSTASCII_ACTION( sXML_index_title, "index-title" ); XML_CONSTASCII_ACTION( sXML_index_title_template, "index-title-template" ); XML_CONSTASCII_ACTION( sXML_information, "information" ); XML_CONSTASCII_ACTION( sXML_initial_creator, "initial-creator" ); @@ -765,6 +767,7 @@ XML_CONSTASCII_ACTION( sXML_justify, "justify" ); XML_CONSTASCII_ACTION( sXML_justify_single_word, "justify-single-word" ); XML_CONSTASCII_ACTION( sXML_keep_with_next, "keep-with-next" ); XML_CONSTASCII_ACTION( sXML_kerning_normal, "normal" ); +XML_CONSTASCII_ACTION( sXML_key, "key" ); XML_CONSTASCII_ACTION( sXML_key1, "key1" ); XML_CONSTASCII_ACTION( sXML_key2, "key2" ); XML_CONSTASCII_ACTION( sXML_keyword, "keyword" ); @@ -788,10 +791,10 @@ XML_CONSTASCII_ACTION( sXML_legend, "legend" ); XML_CONSTASCII_ACTION( sXML_legend_position, "legend-position" ); XML_CONSTASCII_ACTION( sXML_length, "length" ); XML_CONSTASCII_ACTION( sXML_leq, "leq" ); +XML_CONSTASCII_ACTION( sXML_let_text, "let-text" ); XML_CONSTASCII_ACTION( sXML_letter_kerning, "letter-kerning" ); XML_CONSTASCII_ACTION( sXML_letter_spacing, "letter-spacing" ); XML_CONSTASCII_ACTION( sXML_letters, "letters" ); -XML_CONSTASCII_ACTION( sXML_let_text, "let-text" ); XML_CONSTASCII_ACTION( sXML_level, "level" ); XML_CONSTASCII_ACTION( sXML_limit, "limit" ); XML_CONSTASCII_ACTION( sXML_line, "line" ); @@ -803,8 +806,8 @@ XML_CONSTASCII_ACTION( sXML_linear, "linear" ); XML_CONSTASCII_ACTION( sXML_lines, "lines" ); XML_CONSTASCII_ACTION( sXML_lines_used, "lines-used" ); XML_CONSTASCII_ACTION( sXML_link_target_url, "link-target-url" ); -XML_CONSTASCII_ACTION( sXML_linked_library, "linked-library" ); XML_CONSTASCII_ACTION( sXML_link_to_source_data, "link-to-source-data" ); +XML_CONSTASCII_ACTION( sXML_linked_library, "linked-library" ); XML_CONSTASCII_ACTION( sXML_list, "list"); XML_CONSTASCII_ACTION( sXML_list_block, "list-block" ); XML_CONSTASCII_ACTION( sXML_list_header, "list-header" ); @@ -956,6 +959,7 @@ XML_CONSTASCII_ACTION( sXML_number_rows_repeated, "number-rows-repeated" ); XML_CONSTASCII_ACTION( sXML_number_rows_spanned, "number-rows-spanned" ); XML_CONSTASCII_ACTION( sXML_number_style, "number-style" ); XML_CONSTASCII_ACTION( sXML_number_wrapped_paragraphs, "number-wrapped-paragraphs" ); +XML_CONSTASCII_ACTION( sXML_numbered_entries, "numbered-entries" ); XML_CONSTASCII_ACTION( sXML_object, "object" ); XML_CONSTASCII_ACTION( sXML_object_count, "object-count" ); XML_CONSTASCII_ACTION( sXML_object_index, "object-index" ); @@ -1052,8 +1056,8 @@ XML_CONSTASCII_ACTION( sXML_posture_italic, "italic" ); XML_CONSTASCII_ACTION( sXML_posture_normal, "normal" ); XML_CONSTASCII_ACTION( sXML_posture_oblique, "oblique" ); XML_CONSTASCII_ACTION( sXML_power, "power" ); -XML_CONSTASCII_ACTION( sXML_prefix, "prefix" ); XML_CONSTASCII_ACTION( sXML_precision_as_shown, "precision-as-shown" ); +XML_CONSTASCII_ACTION( sXML_prefix, "prefix" ); XML_CONSTASCII_ACTION( sXML_presentation_chart , "chart" ); XML_CONSTASCII_ACTION( sXML_presentation_graphic , "graphic" ); XML_CONSTASCII_ACTION( sXML_presentation_notes , "notes" ); @@ -1086,8 +1090,8 @@ XML_CONSTASCII_ACTION( sXML_protect_size, "size" ); XML_CONSTASCII_ACTION( sXML_protected, "protected" ); XML_CONSTASCII_ACTION( sXML_prsubset, "prsubset" ); XML_CONSTASCII_ACTION( sXML_publisher, "publisher" ); -XML_CONSTASCII_ACTION( sXML_pyramid, "pyramid" ); XML_CONSTASCII_ACTION( sXML_punctuation_wrap, "punctuation-wrap" ); +XML_CONSTASCII_ACTION( sXML_pyramid, "pyramid" ); XML_CONSTASCII_ACTION( sXML_quarter, "quarter" ); XML_CONSTASCII_ACTION( sXML_query_name, "query-name"); XML_CONSTASCII_ACTION( sXML_quo_vadis, "quo-vadis" ); @@ -1166,6 +1170,7 @@ XML_CONSTASCII_ACTION( sXML_scientific_number, "scientific-number" ); XML_CONSTASCII_ACTION( sXML_score_spaces, "score-spaces" ); XML_CONSTASCII_ACTION( sXML_script, "script" ); XML_CONSTASCII_ACTION( sXML_sdev, "sdev" ); +XML_CONSTASCII_ACTION( sXML_search_criteria_must_apply_to_whole_cell, "search-criteria-must-apply-to-whole-cell" ); XML_CONSTASCII_ACTION( sXML_sec, "sec" ); XML_CONSTASCII_ACTION( sXML_sech, "sech" ); XML_CONSTASCII_ACTION( sXML_seconds, "seconds" ); @@ -1199,7 +1204,6 @@ XML_CONSTASCII_ACTION( sXML_sequence, "sequence" ); XML_CONSTASCII_ACTION( sXML_sequence_decl, "sequence-decl" ); XML_CONSTASCII_ACTION( sXML_sequence_decls, "sequence-decls" ); XML_CONSTASCII_ACTION( sXML_sequence_ref, "sequence-ref" ); -XML_CONSTASCII_ACTION( sXML_search_criteria_must_apply_to_whole_cell, "search-criteria-must-apply-to-whole-cell" ); XML_CONSTASCII_ACTION( sXML_series, "series" ); XML_CONSTASCII_ACTION( sXML_server_map, "server-map" ); XML_CONSTASCII_ACTION( sXML_set, "set" ); @@ -1223,8 +1227,11 @@ XML_CONSTASCII_ACTION( sXML_slow, "slow" ); XML_CONSTASCII_ACTION( sXML_solid, "solid" ); XML_CONSTASCII_ACTION( sXML_solid_type, "solid-type" ); XML_CONSTASCII_ACTION( sXML_sort, "sort"); +XML_CONSTASCII_ACTION( sXML_sort_ascending, "sort-ascending" ); XML_CONSTASCII_ACTION( sXML_sort_by, "sort-by"); +XML_CONSTASCII_ACTION( sXML_sort_by_position, "sort-by-position" ); XML_CONSTASCII_ACTION( sXML_sort_groups, "sort-groups"); +XML_CONSTASCII_ACTION( sXML_sort_key, "sort-key"); XML_CONSTASCII_ACTION( sXML_source_cell_range, "source-cell-range"); XML_CONSTASCII_ACTION( sXML_source_cell_range_addresses, "source-cell-range-addresses"); XML_CONSTASCII_ACTION( sXML_source_field_name, "source-field-name"); @@ -1263,11 +1270,11 @@ XML_CONSTASCII_ACTION( sXML_stretch_from_bottom, "stretch-from-bottom" ); XML_CONSTASCII_ACTION( sXML_stretch_from_left, "stretch-from-left" ); XML_CONSTASCII_ACTION( sXML_stretch_from_right, "stretch-from-right" ); XML_CONSTASCII_ACTION( sXML_stretch_from_top, "stretch-from-top" ); +XML_CONSTASCII_ACTION( sXML_strict , "strict" ); XML_CONSTASCII_ACTION( sXML_string, "string"); XML_CONSTASCII_ACTION( sXML_string_value, "string-value"); XML_CONSTASCII_ACTION( sXML_string_value_if_false, "string-value-if-false" ); XML_CONSTASCII_ACTION( sXML_string_value_if_true, "string-value-if-true" ); -XML_CONSTASCII_ACTION( sXML_strict , "strict" ); XML_CONSTASCII_ACTION( sXML_stroke , "stroke" ); XML_CONSTASCII_ACTION( sXML_stroke_color , "stroke-color" ); XML_CONSTASCII_ACTION( sXML_stroke_dash , "stroke-dash" ); @@ -1493,8 +1500,8 @@ XML_CONSTASCII_ACTION( sXML_y, "y" ); XML_CONSTASCII_ACTION( sXML_y1, "y1" ); XML_CONSTASCII_ACTION( sXML_y2, "y2" ); XML_CONSTASCII_ACTION( sXML_year, "year" ); -XML_CONSTASCII_ACTION( sXML_zindex, "z-index" ); XML_CONSTASCII_ACTION( sXML_zero_values, "zero-values" ); +XML_CONSTASCII_ACTION( sXML_zindex, "z-index" ); XML_CONSTASCII_ACTION( sXML_horizontal_segments, "horizontal-segments" ); XML_CONSTASCII_ACTION( sXML_vertical_segments, "vertical-segments" ); diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index 51fb5cc8278c..f3863f21df2c 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlstyle.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: cl $ $Date: 2000-11-28 14:25:18 $ + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -167,6 +167,9 @@ #ifndef _XMLOFF_XMLFOOTNOTECONFIGURATIONIMPORTCONTEXT_HXX #include "XMLFootnoteConfigurationImportContext.hxx" #endif +#ifndef _XMLOFF_XMLINDEXBIBLIOGRAPHYCONFIGURATIONCONTEXT_HXX_ +#include "XMLIndexBibliographyConfigurationContext.hxx" +#endif #ifndef _XMLOFF_PAGEMASTERIMPORTCONTEXT_HXX #include "PageMasterImportContext.hxx" #endif @@ -198,6 +201,8 @@ static __FAR_DATA SvXMLTokenMapEntry aStyleStylesElemTokenMap[] = XML_TOK_TEXT_FOOTNOTE_CONFIG }, { XML_NAMESPACE_TEXT, sXML_endnotes_configuration, XML_TOK_TEXT_ENDNOTE_CONFIG }, + { XML_NAMESPACE_TEXT, sXML_bibliography_configuration, + XML_TOK_TEXT_BIBLIOGRAPHY_CONFIG }, XML_TOKEN_MAP_END }; @@ -571,6 +576,11 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext( xAttrList, sal_True); break; + case XML_TOK_TEXT_BIBLIOGRAPHY_CONFIG: + pStyle = new XMLIndexBibliographyConfigurationContext( + GetImport(), nPrefix, rLocalName, xAttrList); + break; + // // FillStyles // diff --git a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx new file mode 100644 index 000000000000..0320ee9df6f8 --- /dev/null +++ b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx @@ -0,0 +1,323 @@ +/************************************************************************* + * + * $RCSfile: XMLIndexBibliographyConfigurationContext.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:40 $ + * + * 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_XMLINDEXBIBLIOGRAPHYCONFIGURATIONCONTEXT_HXX_ +#include "XMLIndexBibliographyConfigurationContext.hxx" +#endif + +#ifndef _XMLOFF_XMLINDEXBIBLIOGRAPHYENTRYCONTEXT_HXX_ +#include "XMLIndexBibliographyEntryContext.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 _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +using namespace ::com::sun::star::text; +using namespace ::com::sun::star::uno; + +using ::rtl::OUString; +using ::com::sun::star::xml::sax::XAttributeList; +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::beans::XPropertySet; +using ::com::sun::star::lang::XMultiServiceFactory; + +const sal_Char sAPI_FieldMaster_Bibliography[] = + "com.sun.star.text.FieldMaster.Bibliography"; + + +TYPEINIT1( XMLIndexBibliographyConfigurationContext, SvXMLStyleContext ); + +XMLIndexBibliographyConfigurationContext::XMLIndexBibliographyConfigurationContext( + SvXMLImport& rImport, + sal_uInt16 nPrfx, + const OUString& rLocalName, + const Reference<XAttributeList> & xAttrList) : + SvXMLStyleContext(rImport, nPrfx, rLocalName, xAttrList), + sFieldMaster_Bibliography( + RTL_CONSTASCII_USTRINGPARAM(sAPI_FieldMaster_Bibliography)), + sBracketBefore(RTL_CONSTASCII_USTRINGPARAM("BracketBefore")), + sBracketAfter(RTL_CONSTASCII_USTRINGPARAM("BracketAfter")), + sIsNumberEntries(RTL_CONSTASCII_USTRINGPARAM("IsNumberEntries")), + sIsSortByPosition(RTL_CONSTASCII_USTRINGPARAM("IsSortByPosition")), + sSortKeys(RTL_CONSTASCII_USTRINGPARAM("SortKeys")), + sSortKey(RTL_CONSTASCII_USTRINGPARAM("SortKey")), + sIsSortAscending(RTL_CONSTASCII_USTRINGPARAM("IsSortAscending")), + sSuffix(), + sPrefix(), + bNumberedEntries(sal_False), + bSortByPosition(sal_True) +{ + SetFamily(XML_STYLE_FAMILY_TEXT_BIBLIOGRAPHYCONFIG); +} + +XMLIndexBibliographyConfigurationContext::~XMLIndexBibliographyConfigurationContext() +{ +} + +void XMLIndexBibliographyConfigurationContext::StartElement( + const Reference<XAttributeList> & xAttrList) +{ + 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 (nPrefix == XML_NAMESPACE_TEXT) + { + ProcessAttribute(sLocalName, xAttrList->getValueByIndex(nAttr)); + } + // else: ignore + } +} + +void XMLIndexBibliographyConfigurationContext::ProcessAttribute( + OUString sLocalName, + OUString sValue) +{ + if (sLocalName.equalsAsciiL(sXML_prefix, sizeof(sXML_prefix)-1)) + { + sPrefix = sValue; + } + else if (sLocalName.equalsAsciiL(sXML_suffix, sizeof(sXML_suffix)-1)) + { + sSuffix = sValue; + } + else if (sLocalName.equalsAsciiL(sXML_numbered_entries, + sizeof(sXML_numbered_entries)-1)) + { + sal_Bool bTmp; + if (SvXMLUnitConverter::convertBool(bTmp, sValue)) + { + bNumberedEntries = bTmp; + } + } + else if (sLocalName.equalsAsciiL(sXML_sort_by_position, + sizeof(sXML_sort_by_position)-1)) + { + sal_Bool bTmp; + if (SvXMLUnitConverter::convertBool(bTmp, sValue)) + { + bSortByPosition = bTmp; + } + } +} + + +SvXMLImportContext *XMLIndexBibliographyConfigurationContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const Reference<XAttributeList> & xAttrList ) +{ + OUString sKey; + sal_Bool bSort(sal_True); + + // process children here and use default context! + if ((nPrefix == XML_NAMESPACE_TEXT) && + rLocalName.equalsAsciiL(sXML_sort_key, sizeof(sXML_sort_key)-1)) + { + sal_Int32 nLength = xAttrList->getLength(); + for(sal_Int32 nAttr = 0; nAttr < nLength; nAttr++) + { + OUString sLocalName; + sal_uInt16 nPrfx = GetImport().GetNamespaceMap(). + GetKeyByAttrName( xAttrList->getNameByIndex(nAttr), + &sLocalName ); + + if (nPrfx == XML_NAMESPACE_TEXT) + { + if (sLocalName.equalsAsciiL(sXML_key, sizeof(sXML_key)-1)) + { + sKey = xAttrList->getValueByIndex(nAttr); + } + else if (sLocalName.equalsAsciiL(sXML_sort_ascending, + sizeof(sXML_sort_ascending)-1)) + { + sal_Bool bTmp; + if (SvXMLUnitConverter::convertBool( + bTmp, xAttrList->getValueByIndex(nAttr))) + { + bSort = bTmp; + } + } + } + } + + // valid data? + sal_uInt16 nKey; + if (SvXMLUnitConverter::convertEnum(nKey, sKey, + aBibliographyDataFieldMap)) + { + + Any aAny; + Sequence<PropertyValue> aKey(2); + + PropertyValue aNameValue; + aNameValue.Name = sSortKey; + aAny <<= (sal_Int16)nKey; + aNameValue.Value = aAny; + aKey[0] = aNameValue; + + PropertyValue aSortValue; + aSortValue.Name = sIsSortAscending; + aAny.setValue(&bSort, ::getBooleanCppuType()); + aSortValue.Value = aAny; + aKey[1] = aSortValue; + + aSortKeys.push_back(aKey); + } + } + + return SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, + xAttrList); +} + +void XMLIndexBibliographyConfigurationContext::EndElement() +{ + // (code almost the same as export...) + + // first: get field master + // (we'll create one, and get the only master for this type) + Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY); + if( xFactory.is() ) + { + Reference<XInterface> xIfc = + xFactory->createInstance(sFieldMaster_Bibliography); + if( xIfc.is() ) + { + Reference<XPropertySet> xPropSet( xIfc, UNO_QUERY ); + Any aAny; + + if (sSuffix.getLength() > 0) + { + aAny <<= sSuffix; + xPropSet->setPropertyValue(sBracketAfter, aAny); + } + + if (sPrefix.getLength() > 0) + { + aAny <<= sPrefix; + xPropSet->setPropertyValue(sBracketBefore, aAny); + } + + aAny.setValue(&bNumberedEntries, ::getBooleanCppuType()); + xPropSet->setPropertyValue(sIsNumberEntries, aAny); + + aAny.setValue(&bSortByPosition, ::getBooleanCppuType()); + xPropSet->setPropertyValue(sIsSortByPosition, aAny); + + sal_Int32 nCount = aSortKeys.size(); + Sequence<Sequence<PropertyValue> > aKeysSeq(nCount); + for(sal_Int32 i = 0; i < nCount; i++) + { + aKeysSeq[i] = aSortKeys[i]; + } + aAny <<= aKeysSeq; + xPropSet->setPropertyValue(sSortKeys, aAny); + } + // else: can't get FieldMaster -> ignore + } + // else: can't even get Factory -> ignore +} diff --git a/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx index 324064a00ae5..db2c232726e5 100644 --- a/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx +++ b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLIndexBibliographyEntryContext.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $ + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -135,7 +135,7 @@ XMLIndexBibliographyEntryContext::~XMLIndexBibliographyEntryContext() { } -SvXMLEnumMapEntry __READONLY_DATA aBibliographyDataFieldMap[] = +static const SvXMLEnumMapEntry aBibliographyDataFieldMap[] = { { sXML_address, BibliographyDataField::ADDRESS }, { sXML_annote, BibliographyDataField::ANNOTE }, diff --git a/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx b/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx index 52958be7657c..e1516236f618 100644 --- a/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx +++ b/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLIndexBibliographyEntryContext.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dvo $ $Date: 2000-11-14 14:42:50 $ + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,6 +84,9 @@ namespace com { namespace sun { namespace star { } } } namespace rtl { class OUString; } class XMLIndexTemplateContext; +struct SvXMLEnumMapEntry; + +extern const SvXMLEnumMapEntry aBibliographyDataFieldMap[]; /** * Import bibliography index entry templates diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index ce11bdba4d24..e4b6582692f7 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLSectionExport.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: dvo $ $Date: 2000-11-30 16:46:20 $ + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -124,6 +124,14 @@ #include <com/sun/star/text/XDocumentIndex.hpp> #endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_ +#include <com/sun/star/uno/XInterface.hpp> +#endif + #ifndef _COM_SUN_STAR_TEXT_BIBLIOGRAPHYDATAFIELD_HPP_ #include <com/sun/star/text/BibliographyDataField.hpp> #endif @@ -178,6 +186,8 @@ using ::com::sun::star::beans::PropertyState; using ::com::sun::star::container::XIndexReplace; using ::com::sun::star::container::XNamed; using ::com::sun::star::lang::XServiceInfo; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::uno::XInterface; @@ -237,6 +247,7 @@ XMLSectionExport::XMLSectionExport( RTL_CONSTASCII_USTRINGPARAM("CreateFromLevelParagraphStyles")), sDocumentIndex(RTL_CONSTASCII_USTRINGPARAM("DocumentIndex")), sContentSection(RTL_CONSTASCII_USTRINGPARAM("ContentSection")), + sHeaderSection(RTL_CONSTASCII_USTRINGPARAM("HeaderSection")), sTableOfContent(RTL_CONSTASCII_USTRINGPARAM(sXML_table_of_content)), sIllustrationIndex(RTL_CONSTASCII_USTRINGPARAM(sXML_illustration_index)), sAlphabeticalIndex(RTL_CONSTASCII_USTRINGPARAM(sXML_alphabetical_index)), @@ -245,6 +256,7 @@ XMLSectionExport::XMLSectionExport( sBibliography(RTL_CONSTASCII_USTRINGPARAM(sXML_bibliography)), sUserIndex(RTL_CONSTASCII_USTRINGPARAM(sXML_user_index)), sIndexBody(RTL_CONSTASCII_USTRINGPARAM(sXML_index_body)), + sIndexTitle(RTL_CONSTASCII_USTRINGPARAM(sXML_index_title)), sEmpty() { } @@ -271,11 +283,18 @@ void XMLSectionExport::ExportSectionStart( // export index or regular section Reference<XDocumentIndex> xIndex; - GetIndex(rSection, xIndex); - if (xIndex.is()) + if (GetIndex(rSection, xIndex)) { - // we are an index - ExportIndexStart(xIndex); + if (xIndex.is()) + { + // we are an index + ExportIndexStart(xIndex); + } + else + { + // we are an index header + ExportIndexHeaderStart(rSection); + } } else { @@ -285,11 +304,12 @@ void XMLSectionExport::ExportSectionStart( } } -void XMLSectionExport::GetIndex( +sal_Bool XMLSectionExport::GetIndex( const Reference<XTextSection> & rSection, Reference<XDocumentIndex> & rIndex) { // first, reset result + sal_Bool bRet = sal_False; rIndex = NULL; // get section Properties @@ -316,12 +336,27 @@ void XMLSectionExport::GetIndex( if (rSection == xEnclosingSection) { rIndex = xDocumentIndex; + bRet = sal_True; + } + // else: index header or regular section + + // is the enclosing index identical with the header section? + aAny = xIndexPropSet->getPropertyValue(sHeaderSection); + // now mis-named: contains header section + aAny >>= xEnclosingSection; + + // if the enclosing section is "our" section, then we are an index! + if (rSection == xEnclosingSection) + { + bRet = sal_True; } - // else: we are no index + // else: regular section } // else: we aren't even inside of an index } // else: we don't even know what an index is. + + return bRet; } @@ -336,51 +371,58 @@ void XMLSectionExport::ExportSectionEnd( // export index or regular section end Reference<XDocumentIndex> xIndex; - GetIndex(rSection, xIndex); - if (xIndex.is()) + if (GetIndex(rSection, xIndex)) { - - // index end: close index body element - GetExport().GetDocHandler()->ignorableWhitespace(GetExport().sWS); - GetExport().GetDocHandler()->endElement( - GetExport().GetNamespaceMap().GetQNameByKey( - XML_NAMESPACE_TEXT, sIndexBody)); - GetExport().GetDocHandler()->ignorableWhitespace(GetExport().sWS); - - switch (MapSectionType(xIndex->getServiceName())) + if (xIndex.is()) { - 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; + // index end: close index body element + GetExport().GetDocHandler()->ignorableWhitespace( + GetExport().sWS); + GetExport().GetDocHandler()->endElement( + GetExport().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_TEXT, sIndexBody)); + GetExport().GetDocHandler()->ignorableWhitespace( + GetExport().sWS); + + switch (MapSectionType(xIndex->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; + } + } + else + { + pElementName = sXML_index_title; } } else @@ -452,6 +494,23 @@ void XMLSectionExport::ExportIndexStart( } } +void XMLSectionExport::ExportIndexHeaderStart( + const Reference<XTextSection> & rSection) +{ + // export name, dammit! + Reference<XNamed> xName(rSection, UNO_QUERY); + GetExport().AddAttribute(XML_NAMESPACE_TEXT, sXML_name, xName->getName()); + + // format already handled -> export only start element + GetExport().GetDocHandler()->ignorableWhitespace(GetExport().sWS); + GetExport().GetDocHandler()->startElement( + GetExport().GetNamespaceMap().GetQNameByKey(XML_NAMESPACE_TEXT, + sIndexTitle), + GetExport().GetXAttrList() ); + GetExport().GetDocHandler()->ignorableWhitespace(GetExport().sWS); + GetExport().ClearAttrList(); +} + SvXMLEnumMapEntry __READONLY_DATA aIndexTypeMap[] = { @@ -1517,3 +1576,111 @@ void XMLSectionExport::ExportBoolean( bDefault ? sXML_false : sXML_true); } } + +const sal_Char sAPI_FieldMaster_Bibliography[] = + "com.sun.star.text.FieldMaster.Bibliography"; +const sal_Char sAPI_SortKey[] = "SortKey"; +const sal_Char sAPI_IsSortAscending[] = "IsSortAscending"; + +void XMLSectionExport::ExportBibliographyConfiguration(SvXMLExport& rExport) +{ + // first: get field master + // (we'll create one, and get the only master for this type) + Reference<XMultiServiceFactory> xFactory(rExport.GetModel(),UNO_QUERY); + if( xFactory.is() ) + { + const OUString sFieldMaster_Bibliography( + RTL_CONSTASCII_USTRINGPARAM(sAPI_FieldMaster_Bibliography)); + + const OUString sBracketBefore( + RTL_CONSTASCII_USTRINGPARAM("BracketBefore")); + const OUString sBracketAfter( + RTL_CONSTASCII_USTRINGPARAM("BracketAfter")); + const OUString sIsNumberEntries( + RTL_CONSTASCII_USTRINGPARAM("IsNumberEntries")); + const OUString sIsSortByPosition( + RTL_CONSTASCII_USTRINGPARAM("IsSortByPosition")); + const OUString sSortKeys( + RTL_CONSTASCII_USTRINGPARAM("SortKeys")); + + Reference<XInterface> xIfc = + xFactory->createInstance(sFieldMaster_Bibliography); + if( xIfc.is() ) + { + Reference<XPropertySet> xPropSet( xIfc, UNO_QUERY ); + + Any aAny; + OUString sTmp; + + aAny = xPropSet->getPropertyValue(sBracketBefore); + aAny >>= sTmp; + rExport.AddAttribute(XML_NAMESPACE_TEXT, sXML_prefix, sTmp); + + aAny = xPropSet->getPropertyValue(sBracketAfter); + aAny >>= sTmp; + rExport.AddAttribute(XML_NAMESPACE_TEXT, sXML_suffix, sTmp); + + aAny = xPropSet->getPropertyValue(sIsNumberEntries); + if (*(sal_Bool*)aAny.getValue()) + { + rExport.AddAttributeASCII(XML_NAMESPACE_TEXT, + sXML_numbered_entries, sXML_true); + } + + aAny = xPropSet->getPropertyValue(sIsSortByPosition); + if (! *(sal_Bool*)aAny.getValue()) + { + rExport.AddAttributeASCII(XML_NAMESPACE_TEXT, + sXML_sort_by_position, sXML_false); + } + + // configuration elementXML_CONSTASCII_ACTION( sXML_suffix, "suffix" ); + + SvXMLElementExport aElement(rExport, XML_NAMESPACE_TEXT, + sXML_bibliography_configuration, + sal_True, sal_True); + + // sort keys + aAny = xPropSet->getPropertyValue(sSortKeys); + Sequence<Sequence<PropertyValue> > aKeys; + aAny >>= aKeys; + sal_Int32 nKeysCount = aKeys.getLength(); + for(sal_Int32 nKeys = 0; nKeys < nKeysCount; nKeys++) + { + Sequence<PropertyValue> & rKey = aKeys[nKeys]; + + sal_Int32 nKeyCount = rKey.getLength(); + for(sal_Int32 nKey = 0; nKey < nKeyCount; nKey++) + { + PropertyValue& rValue = rKey[nKey]; + + if (rValue.Name.equalsAsciiL(sAPI_SortKey, + sizeof(sAPI_SortKey)-1)) + { + sal_Int16 nKey; + rValue.Value >>= nKey; + OUStringBuffer sBuf; + if (SvXMLUnitConverter::convertEnum( sBuf, nKey, + aBibliographyDataFieldMap ) ) + { + rExport.AddAttribute(XML_NAMESPACE_TEXT, sXML_key, + sBuf.makeStringAndClear()); + } + } + else if (rValue.Name.equalsAsciiL(sAPI_IsSortAscending, + sizeof(sAPI_IsSortAscending)-1)) + { + sal_Bool bTmp = *(sal_Bool*)rValue.Value.getValue(); + rExport.AddAttributeASCII(XML_NAMESPACE_TEXT, + sXML_sort_ascending, + bTmp ? sXML_true : sXML_false); + } + } + + SvXMLElementExport aKeyElem(rExport, + XML_NAMESPACE_TEXT, sXML_sort_key, + sal_True, sal_True); + } + } + } +} diff --git a/xmloff/source/text/XMLSectionExport.hxx b/xmloff/source/text/XMLSectionExport.hxx index 0c756e22b3d0..d598b299a196 100644 --- a/xmloff/source/text/XMLSectionExport.hxx +++ b/xmloff/source/text/XMLSectionExport.hxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLSectionExport.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: dvo $ $Date: 2000-11-30 16:46:20 $ + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,7 +109,7 @@ enum SectionTypeEnum TEXT_SECTION_TYPE_BIBLIOGRAPHY, // index header sections: - // todo + TEXT_SECTION_TYPE_HEADER, TEXT_SECTION_TYPE_UNKNOWN }; @@ -168,6 +168,7 @@ class XMLSectionExport const ::rtl::OUString sCreateFromLevelParagraphStyles; const ::rtl::OUString sDocumentIndex; const ::rtl::OUString sContentSection; + const ::rtl::OUString sHeaderSection; const ::rtl::OUString sTableOfContent; const ::rtl::OUString sIllustrationIndex; @@ -177,6 +178,7 @@ class XMLSectionExport const ::rtl::OUString sBibliography; const ::rtl::OUString sUserIndex; const ::rtl::OUString sIndexBody; + const ::rtl::OUString sIndexTitle; const ::rtl::OUString sEmpty; @@ -205,6 +207,13 @@ public: ::com::sun::star::text::XTextSection > & rSection, sal_Bool bAutoStyles); + /** + * Export the configuration element for bibliography indices. + * + * (This is part of XMLSectionExport because all section- and + * index-related items are handled here.) + */ + static void ExportBibliographyConfiguration(SvXMLExport& rExport); protected: @@ -213,11 +222,16 @@ protected: // export methods for section and index start: - /// export an index start element. This method is to be called + /// export an index start element. void ExportIndexStart( const ::com::sun::star::uno::Reference < ::com::sun::star::text::XDocumentIndex > & rSection); + /// export an index header start element. + void ExportIndexHeaderStart( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextSection > & rSection); + /// export a proper section (and source elements) void ExportRegularSectionStart( const ::com::sun::star::uno::Reference < @@ -262,10 +276,15 @@ protected: // helper methods: /** - * If this section is an index, return the index; else return an - * empty reference. - */ - void GetIndex( + * If this section is an index, the index is written in the + * rIndex parameter. The return value is sal_True for all "special" + * sections. + * + * Thus we have: + * return sal_False: regular section + * return sal_True, xIndex is empty: index header section + * return sal_True, xIndex is set: index section */ + sal_Bool GetIndex( const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextSection > & rSection, ::com::sun::star::uno::Reference < diff --git a/xmloff/source/text/XMLSectionImportContext.cxx b/xmloff/source/text/XMLSectionImportContext.cxx index bc6841c9037d..ada310ffed6f 100644 --- a/xmloff/source/text/XMLSectionImportContext.cxx +++ b/xmloff/source/text/XMLSectionImportContext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLSectionImportContext.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: dvo $ $Date: 2000-11-30 16:46:20 $ + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -141,6 +141,7 @@ using namespace ::com::sun::star::text; TYPEINIT1( XMLSectionImportContext, SvXMLImportContext ); const sal_Char sAPI_TextSection[] = "com.sun.star.text.TextSection"; +const sal_Char sAPI_IndexHeaderSection[] = "com.sun.star.text.IndexHeaderSection"; const sal_Char sAPI_IsProtected[] = "IsProtected"; const sal_Char sAPI_Condition[] = "Condition"; const sal_Char sAPI_IsVisible[] = "IsVisible"; @@ -176,6 +177,8 @@ XMLSectionImportContext::XMLSectionImportContext( xEndRange(), xSectionPropertySet(), sTextSection(RTL_CONSTASCII_USTRINGPARAM(sAPI_TextSection)), + sIndexHeaderSection(RTL_CONSTASCII_USTRINGPARAM( + sAPI_IndexHeaderSection)), sCondition(RTL_CONSTASCII_USTRINGPARAM(sAPI_Condition)), sIsVisible(RTL_CONSTASCII_USTRINGPARAM(sAPI_IsVisible)), sStyleName(), @@ -198,6 +201,14 @@ void XMLSectionImportContext::StartElement( // process attributes ProcessAttributes(xAttrList); + // process index headers: + sal_Bool bIsIndexHeader = GetLocalName().equalsAsciiL( + sXML_index_title, sizeof(sXML_index_title)-1); + if (bIsIndexHeader) + { + bValid = sal_True; + } + UniReference<XMLTextImportHelper> rHelper = GetImport().GetTextImport(); // valid? @@ -209,7 +220,8 @@ void XMLSectionImportContext::StartElement( if (xFactory.is()) { Reference<XInterface> xIfc = - xFactory->createInstance( sTextSection ); + xFactory->createInstance( bIsIndexHeader ? sIndexHeaderSection + : sTextSection ); if (xIfc.is()) { Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY); @@ -233,14 +245,17 @@ void XMLSectionImportContext::StartElement( } } - // IsVisible and condition - Any aAny; - aAny.setValue( &bIsVisible, ::getBooleanCppuType() ); - xPropSet->setPropertyValue( sIsVisible, aAny ); - if (bCondOK) + // IsVisible and condition (not for index headers) + if (! bIsIndexHeader) { - aAny <<= sCond; - xPropSet->setPropertyValue( sCondition, aAny ); + Any aAny; + aAny.setValue( &bIsVisible, ::getBooleanCppuType() ); + xPropSet->setPropertyValue( sIsVisible, aAny ); + if (bCondOK) + { + aAny <<= sCond; + xPropSet->setPropertyValue( sCondition, aAny ); + } } // insert X, <paragraph>, X; then insert diff --git a/xmloff/source/text/XMLSectionImportContext.hxx b/xmloff/source/text/XMLSectionImportContext.hxx index 4d17948261ee..74078f3f30a5 100644 --- a/xmloff/source/text/XMLSectionImportContext.hxx +++ b/xmloff/source/text/XMLSectionImportContext.hxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLSectionImportContext.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $ + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,6 +81,9 @@ class XMLTextImportHelper; /** * Import text sections. + * + * This context may *also* be used for index header sections. The + * differentiates its behaviour based on GetLocalName(). */ class XMLSectionImportContext : public SvXMLImportContext { @@ -97,6 +100,7 @@ class XMLSectionImportContext : public SvXMLImportContext ::com::sun::star::beans::XPropertySet> xSectionPropertySet; const ::rtl::OUString sTextSection; + const ::rtl::OUString sIndexHeaderSection; const ::rtl::OUString sCondition; const ::rtl::OUString sIsVisible; const ::rtl::OUString sEmpty; diff --git a/xmloff/source/text/makefile.mk b/xmloff/source/text/makefile.mk index ff7efce0a77f..4dc69994295e 100644 --- a/xmloff/source/text/makefile.mk +++ b/xmloff/source/text/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.12 $ +# $Revision: 1.13 $ # -# last change: $Author: dvo $ $Date: 2000-11-30 16:46:20 $ +# last change: $Author: dvo $ $Date: 2000-12-02 21:43:40 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -97,6 +97,7 @@ CXXFILES = \ XMLFootnoteConfigurationImportContext.cxx \ XMLFootnoteImportContext.cxx \ XMLIndexAlphabeticalSourceContext.cxx \ + XMLIndexBibliographyConfigurationContext.cxx \ XMLIndexBibliographyEntryContext.cxx \ XMLIndexBibliographySourceContext.cxx \ XMLIndexBodyContext.cxx \ @@ -159,6 +160,7 @@ SLOFILES = \ $(SLO)$/XMLFootnoteImportContext.obj \ $(SLO)$/XMLIndexAlphabeticalSourceContext.obj \ $(SLO)$/XMLIndexBodyContext.obj \ + $(SLO)$/XMLIndexBibliographyConfigurationContext.obj \ $(SLO)$/XMLIndexBibliographyEntryContext.obj \ $(SLO)$/XMLIndexBibliographySourceContext.obj \ $(SLO)$/XMLIndexChapterInfoEntryContext.obj \ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 9f299011039a..0384b097693f 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtimp.cxx,v $ * - * $Revision: 1.29 $ + * $Revision: 1.30 $ * - * last change: $Author: dvo $ $Date: 2000-11-30 16:46:20 $ + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -214,7 +214,8 @@ static __FAR_DATA SvXMLTokenMapEntry aTextElemTokenMap[] = { 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_NAMESPACE_TEXT, sXML_bibliography, XML_TOK_TEXT_BIBLIOGRAPHY_INDEX }, + { XML_NAMESPACE_TEXT, sXML_index_title, XML_TOK_TEXT_INDEX_TITLE }, XML_TOKEN_MAP_END }; @@ -1085,6 +1086,7 @@ SvXMLImportContext *XMLTextImportHelper::CreateTextChildContext( } break; + case XML_TOK_TEXT_INDEX_TITLE: case XML_TOK_TEXT_SECTION: pContext = new XMLSectionImportContext( rImport, nPrefix, rLocalName ); break; diff --git a/xmloff/source/text/txtstyle.cxx b/xmloff/source/text/txtstyle.cxx index d49e051b30e4..2ae17f23a344 100644 --- a/xmloff/source/text/txtstyle.cxx +++ b/xmloff/source/text/txtstyle.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtstyle.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mib $ $Date: 2000-11-07 13:33:09 $ + * last change: $Author: dvo $ $Date: 2000-12-02 21:43:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,6 +102,9 @@ #ifndef _XMLOFF_XMLEXP_HXX #include "xmlexp.hxx" #endif +#ifndef _XMLOFF_XMLSECTIONEXPORT_HXX +#include "XMLSectionExport.hxx" +#endif #ifndef _XMLOFF_STYLEEXP_HXX //#include "styleexp.hxx" @@ -190,6 +193,7 @@ void XMLTextParagraphExport::exportTextStyles( sal_Bool bUsed ) bUsed, XML_STYLE_FAMILY_TEXT_FRAME ); exportNumStyles( bUsed ); exportTextFootnoteConfiguration(); + XMLSectionExport::ExportBibliographyConfiguration(GetExport()); } |