fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / xmloff / source / text / XMLRedlineExport.hxx
blob0b105301bcbae77251a0d650fb3e2d1724342bcc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _XMLOFF_XMLREDLINEEXPORT_HXX
21 #define _XMLOFF_XMLREDLINEEXPORT_HXX
23 #include <rtl/ustrbuf.hxx>
24 #include <com/sun/star/uno/Reference.h>
25 #include <com/sun/star/uno/Sequence.h>
27 #include <list>
28 #include <map>
30 class SvXMLExport;
31 namespace com { namespace sun { namespace star {
32 namespace beans { class XPropertySet; }
33 namespace beans { struct PropertyValue; }
34 namespace text { class XText; }
35 namespace text { class XTextContent; }
36 namespace text { class XTextSection; }
37 } } }
39 // store a list of redline properties
40 typedef ::std::list<
41 ::com::sun::star::uno::Reference<
42 ::com::sun::star::beans::XPropertySet> > ChangesListType;
44 // store a list of redline properties for each XText
45 typedef ::std::map<
46 ::com::sun::star::uno::Reference< ::com::sun::star::text::XText>,
47 ChangesListType* > ChangesMapType;
50 /**
51 * This class handles the export of redline portions.
52 * It is to be called from XMLTextParagraphExport.
54 class XMLRedlineExport
56 const OUString sDelete;
57 const OUString sDeletion;
58 const OUString sFormat;
59 const OUString sFormatChange;
60 const OUString sInsert;
61 const OUString sInsertion;
62 const OUString sIsCollapsed;
63 const OUString sIsStart;
64 const OUString sRedlineAuthor;
65 const OUString sRedlineComment;
66 const OUString sRedlineDateTime;
67 const OUString sRedlineSuccessorData;
68 const OUString sRedlineText;
69 const OUString sRedlineType;
70 const OUString sStyle;
71 const OUString sTextTable;
72 const OUString sUnknownChange;
73 const OUString sStartRedline;
74 const OUString sEndRedline;
75 const OUString sRedlineIdentifier;
76 const OUString sIsInHeaderFooter;
77 const OUString sRedlineProtectionKey;
78 const OUString sRecordChanges;
79 const OUString sMergeLastPara;
81 const OUString sChangePrefix;
83 SvXMLExport& rExport;
86 // handling of change recording:
88 // To support change tracking in headers and footers we need to
89 // write these changes separately. To do this, we record the
90 // changes for headers and footers. For the main document body, we
91 // get the complete list of changes from the document, which
92 // should be much more efficient than recording all of those.
94 ChangesMapType aChangeMap; /// map of recorded changes
96 /// list of current changes; is NULL or points to member of aChangeMap
97 ChangesListType* pCurrentChangesList;
100 public:
101 XMLRedlineExport(SvXMLExport& rExp);
103 ~XMLRedlineExport();
105 /// export a change
106 void ExportChange(
107 /// PropertySet of RedlinePortion
108 const ::com::sun::star::uno::Reference<
109 ::com::sun::star::beans::XPropertySet> & rPropSet,
110 sal_Bool bAutoStyle);
112 /// export the list of changes (complete list minus recorded changed)
113 void ExportChangesList(sal_Bool bAutoStyles);
115 /// export the list of changes (recorded changes for this XText only)
116 void ExportChangesList(
117 const ::com::sun::star::uno::Reference<
118 ::com::sun::star::text::XText> & rText,
119 sal_Bool bAutoStyles);
121 /// set the current XText for which changes should be recorded.
122 /// An empty XText means: don't record changes
123 void SetCurrentXText(
124 const ::com::sun::star::uno::Reference<
125 ::com::sun::star::text::XText> & rText);
127 /// Do not record changes.
128 /// Same as SetCurrentXText(Reference<XText>) with empty argument.
129 void SetCurrentXText();
131 /// export redline marks which start or end at start nodes,
132 /// i.e. that include the complete paragraph/table/section
133 void ExportStartOrEndRedline(
134 const ::com::sun::star::uno::Reference<
135 ::com::sun::star::beans::XPropertySet> & rPropSet,
136 sal_Bool bStart); /// start or end of text entity (e.g. paragraph)?
138 /// convenience method, calls XPropertySet-version of this method
139 void ExportStartOrEndRedline(
140 /// XTextContent; must also be an XPropertySet
141 const ::com::sun::star::uno::Reference<
142 ::com::sun::star::text::XTextContent> & rContent,
143 sal_Bool bStart);
145 /// convenience method, calls XPropertySet-version of this method
146 void ExportStartOrEndRedline(
147 /// XTextSection; must also be an XPropertySet
148 const ::com::sun::star::uno::Reference<
149 ::com::sun::star::text::XTextSection> & rSection,
150 sal_Bool bStart);
152 private:
154 /// export the change mark contained in the text body
155 void ExportChangeInline(
156 /// PropertySet of RedlinePortion
157 const ::com::sun::star::uno::Reference<
158 ::com::sun::star::beans::XPropertySet> & rPropSet);
160 /// export the auto styles used in this change
161 void ExportChangeAutoStyle(
162 /// PropertySet of RedlinePortion
163 const ::com::sun::star::uno::Reference<
164 ::com::sun::star::beans::XPropertySet> & rPropSet);
166 /// export the changes list (<text:tracked-changes>)
167 void ExportChangesListElements();
169 /// export the auto styles needed by the changes list
170 void ExportChangesListAutoStyles();
172 /// export the changed-region element
173 void ExportChangedRegion(
174 const ::com::sun::star::uno::Reference<
175 ::com::sun::star::beans::XPropertySet> & rPropSet);
177 /// export an change-info element (from a PropertySet)
178 void ExportChangeInfo(
179 const ::com::sun::star::uno::Reference<
180 ::com::sun::star::beans::XPropertySet> & rPropSet);
182 /// export an change-info element (from PropertyValues)
183 void ExportChangeInfo(
184 const ::com::sun::star::uno::Sequence<
185 ::com::sun::star::beans::PropertyValue> & rValues);
187 /// convert the change type from API to XML names
188 const OUString ConvertTypeName(const OUString& sApiName);
190 /// Get ID string!
191 const OUString GetRedlineID(
192 const ::com::sun::star::uno::Reference<
193 ::com::sun::star::beans::XPropertySet> & rPropSet);
195 /// write a comment string as sequence of <text:p> elements
196 void WriteComment(const OUString& rComment);
199 #endif
201 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */