diff options
-rw-r--r-- | xmloff/inc/xmlkywd.hxx | 49 | ||||
-rw-r--r-- | xmloff/source/text/XMLRedlineExport.cxx | 358 | ||||
-rw-r--r-- | xmloff/source/text/XMLRedlineExport.hxx | 176 | ||||
-rw-r--r-- | xmloff/source/text/makefile.mk | 6 | ||||
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 26 |
5 files changed, 593 insertions, 22 deletions
diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx index 66b2885ee5c2..1cec83c858be 100644 --- a/xmloff/inc/xmlkywd.hxx +++ b/xmloff/inc/xmlkywd.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlkywd.hxx,v $ * - * $Revision: 1.80 $ + * $Revision: 1.81 $ * - * last change: $Author: cl $ $Date: 2000-12-20 16:15:45 $ + * last change: $Author: dvo $ $Date: 2001-01-02 14:38:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -148,9 +148,6 @@ XML_CONSTASCII_ACTION( sXML_1, "1" ); XML_CONSTASCII_ACTION( sXML_10, "10" ); XML_CONSTASCII_ACTION( sXML_2, "2" ); XML_CONSTASCII_ACTION( sXML_3, "3" ); -XML_CONSTASCII_ACTION( sXML_cube, "cube" ); -XML_CONSTASCII_ACTION( sXML_extrude, "extrude" ); -XML_CONSTASCII_ACTION( sXML_scene, "scene"); XML_CONSTASCII_ACTION( sXML_4, "4" ); XML_CONSTASCII_ACTION( sXML_5, "5" ); XML_CONSTASCII_ACTION( sXML_6, "6" ); @@ -190,8 +187,8 @@ XML_CONSTASCII_ACTION( sXML_alphabetical_index_mark_end, "alphabetical-index-mar XML_CONSTASCII_ACTION( sXML_alphabetical_index_mark_start, "alphabetical-index-mark-start" ); XML_CONSTASCII_ACTION( sXML_alphabetical_index_source, "alphabetical-index-source" ); XML_CONSTASCII_ACTION( sXML_alphabetical_separators, "alphabetical-separators" ); -XML_CONSTASCII_ACTION( sXML_ambient_color, "ambient-color"); XML_CONSTASCII_ACTION( sXML_am_pm, "am-pm" ); +XML_CONSTASCII_ACTION( sXML_ambient_color, "ambient-color"); XML_CONSTASCII_ACTION( sXML_anchor_page_number, "anchor-page-number" ); XML_CONSTASCII_ACTION( sXML_anchor_type, "anchor-type" ); XML_CONSTASCII_ACTION( sXML_and, "and" ); @@ -226,6 +223,7 @@ XML_CONSTASCII_ACTION( sXML_automatic_styles, "automatic-styles" ); XML_CONSTASCII_ACTION( sXML_automatic_update, "automatic-update" ); XML_CONSTASCII_ACTION( sXML_average, "average" ); XML_CONSTASCII_ACTION( sXML_axis, "axis" ); +XML_CONSTASCII_ACTION( sXML_back_scale, "back-scale" ); XML_CONSTASCII_ACTION( sXML_backface_culling, "backface-culling" ); XML_CONSTASCII_ACTION( sXML_background, "background" ); XML_CONSTASCII_ACTION( sXML_background_color, "background-color" ); @@ -233,7 +231,6 @@ XML_CONSTASCII_ACTION( sXML_background_image, "background-image" ); XML_CONSTASCII_ACTION( sXML_background_no_repeat, "no-repeat" ); XML_CONSTASCII_ACTION( sXML_background_repeat, "repeat" ); XML_CONSTASCII_ACTION( sXML_background_stretch, "stretch" ); -XML_CONSTASCII_ACTION( sXML_back_scale, "back-scale" ); XML_CONSTASCII_ACTION( sXML_bar, "bar" ); XML_CONSTASCII_ACTION( sXML_base_cell_address, "base-cell-address"); XML_CONSTASCII_ACTION( sXML_baseline, "baseline" ); @@ -309,11 +306,20 @@ XML_CONSTASCII_ACTION( sXML_cell_range_address, "cell-range-address"); XML_CONSTASCII_ACTION( sXML_cell_range_source, "cell-range-source"); XML_CONSTASCII_ACTION( sXML_center, "center" ); XML_CONSTASCII_ACTION( sXML_chain_next_name, "chain-next-name" ); +XML_CONSTASCII_ACTION( sXML_change, "change" ); +XML_CONSTASCII_ACTION( sXML_change_end, "change-end" ); +XML_CONSTASCII_ACTION( sXML_change_id, "change-id" ); +XML_CONSTASCII_ACTION( sXML_change_info, "change-info" ); +XML_CONSTASCII_ACTION( sXML_change_start, "change-start" ); +XML_CONSTASCII_ACTION( sXML_changed_region, "changed-region" ); XML_CONSTASCII_ACTION( sXML_chapter, "chapter"); XML_CONSTASCII_ACTION( sXML_char, "char" ); XML_CONSTASCII_ACTION( sXML_character_count, "character-count" ); XML_CONSTASCII_ACTION( sXML_chart, "chart" ); XML_CONSTASCII_ACTION( sXML_charts, "charts" ); +XML_CONSTASCII_ACTION( sXML_chg_author, "chg-author" ); +XML_CONSTASCII_ACTION( sXML_chg_comment, "chg-comment" ); +XML_CONSTASCII_ACTION( sXML_chg_date_time, "chg-date-time" ); XML_CONSTASCII_ACTION( sXML_ci, "ci" ); XML_CONSTASCII_ACTION( sXML_circle, "circle" ); XML_CONSTASCII_ACTION( sXML_citation_body_style_name, "citation-body-style-name" ); @@ -404,6 +410,7 @@ XML_CONSTASCII_ACTION( sXML_crossedout_slash, "slash" ); XML_CONSTASCII_ACTION( sXML_crossedout_thick, "thick-line" ); XML_CONSTASCII_ACTION( sXML_csc, "csc" ); XML_CONSTASCII_ACTION( sXML_csch, "csch" ); +XML_CONSTASCII_ACTION( sXML_cube, "cube" ); XML_CONSTASCII_ACTION( sXML_cuboid, "cuboid" ); XML_CONSTASCII_ACTION( sXML_currency, "currency"); XML_CONSTASCII_ACTION( sXML_currency_style, "currency-style" ); @@ -472,6 +479,7 @@ XML_CONSTASCII_ACTION( sXML_default, "default" ); XML_CONSTASCII_ACTION( sXML_default_style_name, "default-style-name" ); XML_CONSTASCII_ACTION( sXML_degree, "degree" ); XML_CONSTASCII_ACTION( sXML_delay, "delay" ); +XML_CONSTASCII_ACTION( sXML_deletion, "deletion" ); XML_CONSTASCII_ACTION( sXML_depth, "depth" ); XML_CONSTASCII_ACTION( sXML_desc, "desc" ); XML_CONSTASCII_ACTION( sXML_descending, "descending"); @@ -553,8 +561,8 @@ XML_CONSTASCII_ACTION( sXML_escapement_sub, "sub" ); XML_CONSTASCII_ACTION( sXML_escapement_super, "super" ); XML_CONSTASCII_ACTION( sXML_even_page, "even-page" ); XML_CONSTASCII_ACTION( sXML_event, "event" ); -XML_CONSTASCII_ACTION( sXML_events, "events" ); XML_CONSTASCII_ACTION( sXML_event_name, "event-name" ); +XML_CONSTASCII_ACTION( sXML_events, "events" ); XML_CONSTASCII_ACTION( sXML_execute, "execute" ); XML_CONSTASCII_ACTION( sXML_execute_macro, "execute-macro" ); XML_CONSTASCII_ACTION( sXML_exists, "exists" ); @@ -562,6 +570,7 @@ XML_CONSTASCII_ACTION( sXML_exp, "exp" ); XML_CONSTASCII_ACTION( sXML_exponential, "exponential" ); XML_CONSTASCII_ACTION( sXML_expression, "expression"); XML_CONSTASCII_ACTION( sXML_extra, "extra"); +XML_CONSTASCII_ACTION( sXML_extrude, "extrude" ); XML_CONSTASCII_ACTION( sXML_factorial, "factorial" ); XML_CONSTASCII_ACTION( sXML_fade_from_bottom, "fade-from-bottom" ); XML_CONSTASCII_ACTION( sXML_fade_from_center, "fade-from-center" ); @@ -583,8 +592,8 @@ XML_CONSTASCII_ACTION( sXML_fill_color , "fill-color" ); XML_CONSTASCII_ACTION( sXML_fill_gradient_name, "fill-gradient-name" ); XML_CONSTASCII_ACTION( sXML_fill_hatch_name, "fill-hatch-name" ); XML_CONSTASCII_ACTION( sXML_fill_image, "fill-image" ); -XML_CONSTASCII_ACTION( sXML_fill_image_name, "fill-image-name" ); XML_CONSTASCII_ACTION( sXML_fill_image_height, "fill-image-height" ); +XML_CONSTASCII_ACTION( sXML_fill_image_name, "fill-image-name" ); XML_CONSTASCII_ACTION( sXML_fill_image_width, "fill-image-width" ); XML_CONSTASCII_ACTION( sXML_filter, "filter"); XML_CONSTASCII_ACTION( sXML_filter_and, "filter-and"); @@ -600,10 +609,10 @@ XML_CONSTASCII_ACTION( sXML_float, "float"); XML_CONSTASCII_ACTION( sXML_floor, "floor" ); XML_CONSTASCII_ACTION( sXML_fn, "fn" ); XML_CONSTASCII_ACTION( sXML_focal_length, "focal-length"); +XML_CONSTASCII_ACTION( sXML_font_char_width, "font-char-width" ); XML_CONSTASCII_ACTION( sXML_font_charset, "font-charset" ); XML_CONSTASCII_ACTION( sXML_font_charset_asian, "font-charset-asian" ); XML_CONSTASCII_ACTION( sXML_font_charset_complex, "font-charset-complex" ); -XML_CONSTASCII_ACTION( sXML_font_char_width, "font-char-width" ); XML_CONSTASCII_ACTION( sXML_font_color, "font-color" ); XML_CONSTASCII_ACTION( sXML_font_decl, "font-decl" ); XML_CONSTASCII_ACTION( sXML_font_decls, "font-decls" ); @@ -656,6 +665,7 @@ XML_CONSTASCII_ACTION( sXML_footnotes_position, "footnotes-position" ); XML_CONSTASCII_ACTION( sXML_forall, "forall" ); XML_CONSTASCII_ACTION( sXML_foreground, "foreground" ); XML_CONSTASCII_ACTION( sXML_foreign_object, "foreign-object" ); +XML_CONSTASCII_ACTION( sXML_format_change, "format-change" ); XML_CONSTASCII_ACTION( sXML_format_source, "format-source" ); XML_CONSTASCII_ACTION( sXML_formula, "formula"); XML_CONSTASCII_ACTION( sXML_formula_hidden, "formula-hidden"); @@ -670,9 +680,9 @@ XML_CONSTASCII_ACTION( sXML_from_inside, "from-inside" ); XML_CONSTASCII_ACTION( sXML_from_left, "from-left" ); XML_CONSTASCII_ACTION( sXML_from_same_table, "from-same-table" ); XML_CONSTASCII_ACTION( sXML_from_top, "from-top" ); +XML_CONSTASCII_ACTION( sXML_fuchsia, "fuchsia"); XML_CONSTASCII_ACTION( sXML_full, "full" ); XML_CONSTASCII_ACTION( sXML_function, "function"); -XML_CONSTASCII_ACTION( sXML_fuchsia, "fuchsia"); XML_CONSTASCII_ACTION( sXML_g , "g" ); XML_CONSTASCII_ACTION( sXML_gamma , "gamma" ); XML_CONSTASCII_ACTION( sXML_gap_width, "gap-width" ); @@ -780,6 +790,7 @@ XML_CONSTASCII_ACTION( sXML_index_title_template, "index-title-template" ); XML_CONSTASCII_ACTION( sXML_information, "information" ); XML_CONSTASCII_ACTION( sXML_initial_creator, "initial-creator" ); XML_CONSTASCII_ACTION( sXML_inproceedings, "inproceedings" ); +XML_CONSTASCII_ACTION( sXML_insertion, "insertion" ); XML_CONSTASCII_ACTION( sXML_inset, "inset" ); XML_CONSTASCII_ACTION( sXML_inside, "inside" ); XML_CONSTASCII_ACTION( sXML_institution, "institution" ); @@ -871,8 +882,8 @@ XML_CONSTASCII_ACTION( sXML_lr_tb, "lr-tb" ); XML_CONSTASCII_ACTION( sXML_lt, "lt"); XML_CONSTASCII_ACTION( sXML_ltr, "ltr"); XML_CONSTASCII_ACTION( sXML_luminance , "luminance" ); -XML_CONSTASCII_ACTION( sXML_maction, "maction"); XML_CONSTASCII_ACTION( sXML_macro_name, "macro-name"); +XML_CONSTASCII_ACTION( sXML_maction, "maction"); XML_CONSTASCII_ACTION( sXML_main_entry_style_name, "main-entry-style-name" ); XML_CONSTASCII_ACTION( sXML_major, "major" ); XML_CONSTASCII_ACTION( sXML_maligngroup, "maligngroup"); @@ -901,9 +912,9 @@ XML_CONSTASCII_ACTION( sXML_math, "math"); XML_CONSTASCII_ACTION( sXML_matrix, "matrix"); XML_CONSTASCII_ACTION( sXML_matrixrow, "matrixrow"); XML_CONSTASCII_ACTION( sXML_max, "max" ); +XML_CONSTASCII_ACTION( sXML_max_edge, "max-edge"); XML_CONSTASCII_ACTION( sXML_maximum, "maximum" ); XML_CONSTASCII_ACTION( sXML_maximum_difference, "maximum-difference" ); -XML_CONSTASCII_ACTION( sXML_max_edge, "max-edge"); XML_CONSTASCII_ACTION( sXML_may_break_between_rows, "may-break-between-rows" ); XML_CONSTASCII_ACTION( sXML_mean, "mean" ); XML_CONSTASCII_ACTION( sXML_mean_value, "mean-value" ); @@ -1225,6 +1236,7 @@ XML_CONSTASCII_ACTION( sXML_scale_to_pages, "scale-to-pages" ); XML_CONSTASCII_ACTION( sXML_scatter, "scatter" ); XML_CONSTASCII_ACTION( sXML_scenario, "scenario" ); XML_CONSTASCII_ACTION( sXML_scenario_ranges, "scenario-ranges" ); +XML_CONSTASCII_ACTION( sXML_scene, "scene"); XML_CONSTASCII_ACTION( sXML_school, "school" ); XML_CONSTASCII_ACTION( sXML_scientific_number, "scientific-number" ); XML_CONSTASCII_ACTION( sXML_score_spaces, "score-spaces" ); @@ -1399,6 +1411,11 @@ XML_CONSTASCII_ACTION( sXML_techreport, "techreport" ); XML_CONSTASCII_ACTION( sXML_template, "template" ); XML_CONSTASCII_ACTION( sXML_template_name, "template-name" ); XML_CONSTASCII_ACTION( sXML_tendsto, "tendsto" ); +XML_CONSTASCII_ACTION( sXML_tex_filter, "texture-filter" ); +XML_CONSTASCII_ACTION( sXML_tex_generation_mode_x, "texture-generation-mode-x" ); +XML_CONSTASCII_ACTION( sXML_tex_generation_mode_y, "texture-generation-mode-y" ); +XML_CONSTASCII_ACTION( sXML_tex_kind, "texture-kind" ); +XML_CONSTASCII_ACTION( sXML_tex_mode, "texture-mode" ); XML_CONSTASCII_ACTION( sXML_text, "text" ); XML_CONSTASCII_ACTION( sXML_text_align, "text-align" ); XML_CONSTASCII_ACTION( sXML_text_align_last, "text-align-last" ); @@ -1423,11 +1440,6 @@ XML_CONSTASCII_ACTION( sXML_text_transform, "text-transform" ); XML_CONSTASCII_ACTION( sXML_text_underline, "text-underline" ); XML_CONSTASCII_ACTION( sXML_text_underline_color, "text-underline-color" ); XML_CONSTASCII_ACTION( sXML_textual, "textual" ); -XML_CONSTASCII_ACTION( sXML_tex_filter, "texture-filter" ); -XML_CONSTASCII_ACTION( sXML_tex_generation_mode_x, "texture-generation-mode-x" ); -XML_CONSTASCII_ACTION( sXML_tex_generation_mode_y, "texture-generation-mode-y" ); -XML_CONSTASCII_ACTION( sXML_tex_kind, "texture-kind" ); -XML_CONSTASCII_ACTION( sXML_tex_mode, "texture-mode" ); XML_CONSTASCII_ACTION( sXML_thick, "thick" ); XML_CONSTASCII_ACTION( sXML_thin, "thin" ); XML_CONSTASCII_ACTION( sXML_three_dimensional, "three-dimensional" ); @@ -1452,6 +1464,7 @@ XML_CONSTASCII_ACTION( sXML_top_values, "top values"); XML_CONSTASCII_ACTION( sXML_trace_dependents, "trace-dependents" ); XML_CONSTASCII_ACTION( sXML_trace_errors, "trace-errors" ); XML_CONSTASCII_ACTION( sXML_trace_precedents, "trace-precedents" ); +XML_CONSTASCII_ACTION( sXML_tracked_changes, "tracked-changes" ); XML_CONSTASCII_ACTION( sXML_transform , "transform" ); XML_CONSTASCII_ACTION( sXML_transparency, "transparency" ); XML_CONSTASCII_ACTION( sXML_transparency_name, "transparency-name" ); diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx new file mode 100644 index 000000000000..7ce82341a5a2 --- /dev/null +++ b/xmloff/source/text/XMLRedlineExport.cxx @@ -0,0 +1,358 @@ +/************************************************************************* + * + * $RCSfile: XMLRedlineExport.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: dvo $ $Date: 2001-01-02 14:38: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_XMLREDLINEEXPORT_HXX +#include "XMLRedlineExport.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 _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif + +#ifndef _COM_SUN_STAR_TEXT_XTEXT_HPP_ +#include <com/sun/star/text/XText.hpp> +#endif + +#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ +#include <com/sun/star/util/DateTime.hpp> +#endif + +#ifndef _XMLOFF_XMLKYWD_HXX +#include "xmlkywd.hxx" +#endif + +#ifndef _XMLOFF_XMLNMSPE_HXX +#include "xmlnmspe.hxx" +#endif + +#ifndef _XMLOFF_XMLEXP_HXX +#include "xmlexp.hxx" +#endif + +#ifndef _XMLOFF_XMLUCONV_HXX +#include "xmluconv.hxx" +#endif + + +using namespace ::com::sun::star; + +using ::rtl::OUString; +using ::rtl::OUStringBuffer; +using ::com::sun::star::text::XText; +using ::com::sun::star::beans::XPropertySet; +using ::com::sun::star::util::DateTime; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Any; +using ::std::list; + + +XMLRedlineExport::XMLRedlineExport(SvXMLExport& rExp) : + sDelete(RTL_CONSTASCII_USTRINGPARAM("Delete")), + sDeletion(RTL_CONSTASCII_USTRINGPARAM(sXML_deletion)), + sFormat(RTL_CONSTASCII_USTRINGPARAM("Format")), + sFormatChange(RTL_CONSTASCII_USTRINGPARAM(sXML_format_change)), + sInsert(RTL_CONSTASCII_USTRINGPARAM("Insert")), + sInsertion(RTL_CONSTASCII_USTRINGPARAM(sXML_insertion)), + sIsCollapsed(RTL_CONSTASCII_USTRINGPARAM("IsCollapsed")), + sIsStart(RTL_CONSTASCII_USTRINGPARAM("IsStart")), + sRL(RTL_CONSTASCII_USTRINGPARAM("RL")), + sRedlineAuthor(RTL_CONSTASCII_USTRINGPARAM("RedlineAuthor")), + sRedlineComment(RTL_CONSTASCII_USTRINGPARAM("RedlineComment")), + sRedlineDateTime(RTL_CONSTASCII_USTRINGPARAM("RedlineDateTime")), + sRedlineSuccessorData(RTL_CONSTASCII_USTRINGPARAM("RedlineSuccessorData")), + sRedlineType(RTL_CONSTASCII_USTRINGPARAM("RedlineType")), + sStyle(RTL_CONSTASCII_USTRINGPARAM("Style")), + sTextTable(RTL_CONSTASCII_USTRINGPARAM("TextTable")), + sUnknownChange(RTL_CONSTASCII_USTRINGPARAM("UnknownChange")), + rExport(rExp), + aChangesList(), + nCountCallsExportChangedRegion(0), + nCountCallsExportChangeInline(0) +{ +} + +XMLRedlineExport::~XMLRedlineExport() +{ +} + +void XMLRedlineExport::ExportChange( + const Reference<XPropertySet> & rPropSet, + sal_Bool bAutoStyle) +{ + if (bAutoStyle) + { + CollectChange(rPropSet); + } + else + { + ExportChangeInline(rPropSet); + } +} + +void XMLRedlineExport::CollectChange( + const Reference<XPropertySet> & rPropSet) +{ + // collect change in the big list + aChangesList.push_back(rPropSet); +} + +void XMLRedlineExport::ExportChangesList() +{ + // write changes list only if we have redlines + if (aChangesList.size() > 0) + { + // changes container element + SvXMLElementExport aChanges(rExport, XML_NAMESPACE_TEXT, + sXML_tracked_changes, sal_True, sal_True); + + // iterate over all changes and call ExportChangeRegion, the + // discard changes lists + ChangesListType::iterator aEnd = aChangesList.end(); + for(ChangesListType::iterator aIter = aChangesList.begin(); + aIter != aEnd; + aIter++) + { + ExportChangedRegion(*aIter); + } + aChangesList.clear(); + } + // else: no redlines -> no export +} + +void XMLRedlineExport::ExportChangeInline( + const Reference<XPropertySet> & rPropSet) +{ + // silly ID handling: (see GetRedlineID()) + ++nCountCallsExportChangeInline; + + // determine element name (depending on collapsed, start/end) + sal_Char* pElement = NULL; + Any aAny = rPropSet->getPropertyValue(sIsCollapsed); + sal_Bool bCollapsed = *(sal_Bool *)aAny.getValue(); + sal_Bool bStart = sal_True; // ignored if bCollapsed = sal_True + if (bCollapsed) + { + pElement = sXML_change; + } + else + { + aAny = rPropSet->getPropertyValue(sIsStart); + bStart = *(sal_Bool *)aAny.getValue(); + pElement = bStart ? sXML_change_start : sXML_change_end; + } + + if (NULL != pElement) + { + // we always need the ID + rExport.AddAttribute(XML_NAMESPACE_TEXT, sXML_change_id, + GetRedlineID(rPropSet, sal_False, + bCollapsed||bStart)); + + // export the element (no whitespace because we're in the text body) + SvXMLElementExport aChangeElem(rExport, XML_NAMESPACE_TEXT, + pElement, sal_False, sal_False); + } +} + + +void XMLRedlineExport::ExportChangedRegion( + const Reference<XPropertySet> & rPropSet) +{ + // silly ID handling: (see GetRedlineID()) + ++nCountCallsExportChangedRegion; + + // determine collapsed, start, end + Any aAny = rPropSet->getPropertyValue(sIsCollapsed); + sal_Bool bCollapsed = *(sal_Bool *)aAny.getValue(); + aAny = rPropSet->getPropertyValue(sIsStart); + sal_Bool bStart = *(sal_Bool *)aAny.getValue(); + + // only export changed-region once per change + if (bStart || bCollapsed) + { + // export changed-region element (with change-ID) + rExport.AddAttribute(XML_NAMESPACE_TEXT, sXML_id, + GetRedlineID(rPropSet, sal_True, sal_True) ); + SvXMLElementExport aChangedRegion(rExport, XML_NAMESPACE_TEXT, + sXML_changed_region, + sal_True, sal_True); + + // scope for change element + { + Any aAny = rPropSet->getPropertyValue(sRedlineType); + OUString sType; + aAny >>= sType; + SvXMLElementExport aChange(rExport, XML_NAMESPACE_TEXT, + ConvertTypeName(sType), + sal_True, sal_True); + + ExportChangeInfo(rPropSet); + } + + // if the region is collapsed, we need to export it's content + if (bCollapsed) + { + // get XText from the redline text portion + Reference<XText> xText(rPropSet, uno::UNO_QUERY); + if (xText.is()) + { + rExport.GetTextParagraphExport()->collectTextAutoStyles(xText); + // default parameters: bProgress, bExportParagraph ??? + rExport.GetTextParagraphExport()->exportText(xText); + // default parameters: bProgress, bExportParagraph ??? + } + // else: no text, no export. Bummer! + } + // else: not collapsed: content will be exported inline + } + // else: region end: don't export +} + + +const OUString XMLRedlineExport::ConvertTypeName( + const OUString& sApiName) +{ + if (sApiName == sDelete) + { + return sDeletion; + } + else if (sApiName == sInsert) + { + return sInsertion; + } + else if (sApiName == sFormat) + { + return sFormatChange; + } + else + { + DBG_ERROR("unknown redline type"); + return sUnknownChange; + } +} + + +/* + * The current method of identifying redlines is this: + * a) We rely on the fact that they appear in the same order. Therefore + * it is sufficient to simply count the calls to CollectChange and + * ExportChangeInline, and to use the current count as ID number. + * b) We rely on the fact that changes cannot overlap. To identify start + * with end change elements, we simply subtract one for the end elements. + */ +const OUString XMLRedlineExport::GetRedlineID( + const Reference<XPropertySet> & rPropSet, + sal_Bool bFirstPass, + sal_Bool bIsStart) +{ + sal_Int32 nId = bFirstPass ? nCountCallsExportChangedRegion : + nCountCallsExportChangeInline; + if (!bIsStart) + nId--; + OUStringBuffer sBuf(sRL); + sBuf.append(nId); + return sBuf.makeStringAndClear(); +} + + +void XMLRedlineExport::ExportChangeInfo( + const Reference<XPropertySet> & rPropSet) +{ + Any aAny = rPropSet->getPropertyValue(sRedlineAuthor); + OUString sTmp; + aAny >>= sTmp; + if (sTmp.getLength() > 0) + { + rExport.AddAttribute(XML_NAMESPACE_TEXT, sXML_chg_author, sTmp); + } + + aAny = rPropSet->getPropertyValue(sRedlineComment); + aAny >>= sTmp; + if (sTmp.getLength() > 0) + { + rExport.AddAttribute(XML_NAMESPACE_TEXT, sXML_chg_comment, sTmp); + } + + aAny = rPropSet->getPropertyValue(sRedlineDateTime); + util::DateTime aDateTime; + aAny >>= aDateTime; + OUStringBuffer sBuf; + rExport.GetMM100UnitConverter().convertDateTime(sBuf, aDateTime); + rExport.AddAttribute(XML_NAMESPACE_TEXT, sXML_chg_date_time, + sBuf.makeStringAndClear()); + + SvXMLElementExport aChangeInfo(rExport, XML_NAMESPACE_TEXT, + sXML_change_info, sal_True, sal_True); +} + + diff --git a/xmloff/source/text/XMLRedlineExport.hxx b/xmloff/source/text/XMLRedlineExport.hxx new file mode 100644 index 000000000000..4d4e98ca8db0 --- /dev/null +++ b/xmloff/source/text/XMLRedlineExport.hxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * $RCSfile: XMLRedlineExport.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: dvo $ $Date: 2001-01-02 14:38: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_XMLREDLINEEXPORT_HXX +#define _XMLOFF_XMLREDLINEEXPORT_HXX + +#ifndef _RTL_USTRBUF_HXX_ +#include <rtl/ustrbuf.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 + +#include <list> + +class SvXMLExport; +namespace com { namespace sun { namespace star { + namespace beans { class XPropertySet; } + } } } +namespace rtl { + class OUString; + class OUStringBuffer; +} + +typedef ::std::list< + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> > ChangesListType; + +/** + * This class handles the export of redline portions. + * It is to be called from XMLTextParagraphExport. + */ +class XMLRedlineExport +{ + const ::rtl::OUString sDelete; + const ::rtl::OUString sDeletion; + const ::rtl::OUString sFormat; + const ::rtl::OUString sFormatChange; + const ::rtl::OUString sInsert; + const ::rtl::OUString sInsertion; + const ::rtl::OUString sIsCollapsed; + const ::rtl::OUString sIsStart; + const ::rtl::OUString sRL; + const ::rtl::OUString sRedlineAuthor; + const ::rtl::OUString sRedlineComment; + const ::rtl::OUString sRedlineDateTime; + const ::rtl::OUString sRedlineSuccessorData; + const ::rtl::OUString sRedlineType; + const ::rtl::OUString sStyle; + const ::rtl::OUString sTextTable; + const ::rtl::OUString sUnknownChange; + + SvXMLExport& rExport; + + ChangesListType aChangesList; /// list of changes + sal_Int32 nCountCallsExportChangedRegion; + sal_Int32 nCountCallsExportChangeInline; + + +public: + XMLRedlineExport(SvXMLExport& rExp); + + ~XMLRedlineExport(); + + /// export a change + /// convenience method:calls CollectChange() if + /// bAutoStyle is set, and ExportChangeInline() if not + void ExportChange( + /// PropertySet of RedlinePortion + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & rPropSet, + /// if (bAutoStyle) CollectChange(..) else ExoirtChangeInline(...) + sal_Bool bAutoStyle); + + + /// put a RedlinePortion into the list of changes + void CollectChange( + /// PropertySet of RedlinePortion + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & rPropSet); + + /// process the list of changes that have been previously + /// registered using the CollectChange() method + void ExportChangesList(); + + /// export the change mark contained in the text body + void ExportChangeInline( + /// PropertySet of RedlinePortion + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & rPropSet); + +private: + /// export the changed-region element + void ExportChangedRegion( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & rPropSet); + + /// export an change-info element + void ExportChangeInfo( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & rPropSet); + + /// convert the change type from API to XML names + const ::rtl::OUString ConvertTypeName(const ::rtl::OUString& sApiName); + + // HACK: IDs need to be dealt with properly!!! + /// Get ID string! + const ::rtl::OUString GetRedlineID( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & rPropSet, + sal_Bool bFirstPass, sal_Bool bIsStart); + +}; + +#endif diff --git a/xmloff/source/text/makefile.mk b/xmloff/source/text/makefile.mk index 31249bf467da..5775e6295b0a 100644 --- a/xmloff/source/text/makefile.mk +++ b/xmloff/source/text/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.14 $ +# $Revision: 1.15 $ # -# last change: $Author: dvo $ $Date: 2000-12-11 19:14:26 $ +# last change: $Author: dvo $ $Date: 2001-01-02 14:38:40 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -120,6 +120,7 @@ CXXFILES = \ XMLLineNumberingImportContext.cxx \ XMLLineNumberingSeparatorImportContext.cxx \ XMLPropertyBackpatcher.cxx \ + XMLRedlineExport.cxx \ XMLSectionExport.cxx \ XMLSectionImportContext.cxx \ XMLSectionSourceDDEImportContext.cxx \ @@ -185,6 +186,7 @@ SLOFILES = \ $(SLO)$/XMLLineNumberingImportContext.obj \ $(SLO)$/XMLLineNumberingSeparatorImportContext.obj \ $(SLO)$/XMLPropertyBackpatcher.obj \ + $(SLO)$/XMLRedlineExport.obj \ $(SLO)$/XMLSectionExport.obj \ $(SLO)$/XMLSectionImportContext.obj \ $(SLO)$/XMLSectionSourceDDEImportContext.obj \ diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index c659cb3bf786..1d445d9c5945 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtparae.cxx,v $ * - * $Revision: 1.40 $ + * $Revision: 1.41 $ * - * last change: $Author: dvo $ $Date: 2001-01-02 14:05:02 $ + * last change: $Author: dvo $ $Date: 2001-01-02 14:38:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -172,6 +172,10 @@ #include <com/sun/star/drawing/XShape.hpp> #endif +#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ +#include <com/sun/star/util/DateTime.hpp> +#endif + #ifndef _XMLOFF_XMLKYWD_HXX #include "xmlkywd.hxx" #endif @@ -233,6 +237,9 @@ #ifndef _XMLOFF_XMLEVENTEXPORT_HXX #include "XMLEventExport.hxx" #endif +#ifndef _XMLOFF_XMLREDLINEEXPORT_HXX +#include "XMLRedlineExport.hxx" +#endif using namespace ::rtl; using namespace ::std; @@ -620,6 +627,7 @@ XMLTextParagraphExport::XMLTextParagraphExport( pFrameEmbeddedIdxs( 0 ), pSectionExport( NULL ), pIndexMarkExport( NULL ), + pRedlineExport( NULL ), pFrameShapeIdxs( 0 ), sParagraphService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph")), sTableService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable")), @@ -690,6 +698,7 @@ XMLTextParagraphExport::XMLTextParagraphExport( sContourPolyPolygon(RTL_CONSTASCII_USTRINGPARAM("ContourPolyPolygon")), sAnchorCharStyleName(RTL_CONSTASCII_USTRINGPARAM("AnchorCharStyleName")), sServerMap(RTL_CONSTASCII_USTRINGPARAM("ServerMap")), + sRedline(RTL_CONSTASCII_USTRINGPARAM("Redline")), nProgress( nProg ) { UniReference < XMLPropertySetMapper > xPropMapper = @@ -740,10 +749,12 @@ XMLTextParagraphExport::XMLTextParagraphExport( pFieldExport = new XMLTextFieldExport( rExp ); pSectionExport = new XMLSectionExport( rExp, *this ); pIndexMarkExport = new XMLIndexMarkExport( rExp, *this ); + pRedlineExport = new XMLRedlineExport( rExp ); } XMLTextParagraphExport::~XMLTextParagraphExport() { + delete pRedlineExport; delete pIndexMarkExport; delete pSectionExport; delete pFieldExport; @@ -1269,6 +1280,11 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( { pIndexMarkExport->ExportIndexMark(xPropSet, bAutoStyles); } + else if (sType.equals(sRedline)) + { + // disable change tracking until implemented properly: + // pRedlineExport->ExportChange(xPropSet, bAutoStyles); + } else DBG_ERROR("unknown text portion type"); } @@ -2245,6 +2261,12 @@ void XMLTextParagraphExport::exportTextDeclarations() pFieldExport->ExportFieldDeclarations(); } +void XMLTextParagraphExport::exportTrackedChanges() +{ + // disable change tracking until implemented properly: + // pRedlineExport->ExportChangesList(); +} + void XMLTextParagraphExport::exportTextAutoStyles() { GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_PARAGRAPH, |