LibreOffice Module xmloff (master)  1
XMLRedlineExport.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_XMLOFF_SOURCE_TEXT_XMLREDLINEEXPORT_HXX
21 #define INCLUDED_XMLOFF_SOURCE_TEXT_XMLREDLINEEXPORT_HXX
22 
23 #include <com/sun/star/uno/Reference.h>
24 #include <com/sun/star/uno/Sequence.h>
25 
26 #include <vector>
27 #include <memory>
28 #include <map>
29 
30 class SvXMLExport;
31 namespace com::sun::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 }
38 
39 // store a list of redline properties
40 typedef ::std::vector<
41  css::uno::Reference<css::beans::XPropertySet> > ChangesVectorType;
42 
43 // store a list of redline properties for each XText
44 typedef ::std::map<
45  css::uno::Reference< css::text::XText>,
46  std::unique_ptr<ChangesVectorType> > ChangesMapType;
47 
48 
54 {
55  const OUString sDeletion;
56  const OUString sFormatChange;
57  const OUString sInsertion;
58 
60 
61 
62  // handling of change recording:
63 
64  // To support change tracking in headers and footers we need to
65  // write these changes separately. To do this, we record the
66  // changes for headers and footers. For the main document body, we
67  // get the complete list of changes from the document, which
68  // should be much more efficient than recording all of those.
69 
71 
74 
75 
76 public:
77  explicit XMLRedlineExport(SvXMLExport& rExp);
78 
80 
82  void ExportChange(
84  const css::uno::Reference<css::beans::XPropertySet> & rPropSet,
85  bool bAutoStyle);
86 
88  void ExportChangesList(bool bAutoStyles);
89 
91  void ExportChangesList(
92  const css::uno::Reference<css::text::XText> & rText,
93  bool bAutoStyles);
94 
97  void SetCurrentXText(
98  const css::uno::Reference<css::text::XText> & rText);
99 
102  void SetCurrentXText();
103 
107  const css::uno::Reference<
108  css::beans::XPropertySet> & rPropSet,
109  bool bStart);
110 
114  const css::uno::Reference<css::text::XTextContent> & rContent,
115  bool bStart);
116 
120  const css::uno::Reference<css::text::XTextSection> & rSection,
121  bool bStart);
122 
123 private:
124 
126  void ExportChangeInline(
128  const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
129 
133  const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
134 
137 
140 
142  void ExportChangedRegion(
143  const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
144 
146  void ExportChangeInfo(
147  const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
148 
150  void ExportChangeInfo(
151  const css::uno::Sequence<css::beans::PropertyValue> & rValues);
152 
154  OUString const & ConvertTypeName(const OUString& sApiName);
155 
157  static OUString GetRedlineID(
158  const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
159 
161  void WriteComment(const OUString& rComment);
162 };
163 
164 #endif
165 
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ChangesMapType aChangeMap
void ExportStartOrEndRedline(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, bool bStart)
export redline marks which start or end at start nodes, i.e.
const OUString sFormatChange
OUString const & ConvertTypeName(const OUString &sApiName)
convert the change type from API to XML names
void ExportChangeInline(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
export the change mark contained in the text body
void ExportChangesList(bool bAutoStyles)
export the list of changes (complete list minus recorded changed)
ChangesVectorType * pCurrentChangesList
map of recorded changes
exports com.sun.star. text
void ExportChangesListAutoStyles()
export the auto styles needed by the changes list
void ExportChangesListElements()
export the changes list ()
class SAL_NO_VTABLE XPropertySet
static OUString GetRedlineID(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Get ID string!
void ExportChange(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, bool bAutoStyle)
export a change
const OUString sDeletion
::std::map< css::uno::Reference< css::text::XText >, std::unique_ptr< ChangesVectorType > > ChangesMapType
void ExportChangeAutoStyle(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
export the auto styles used in this change
exports com.sun.star. beans
::std::vector< css::uno::Reference< css::beans::XPropertySet > > ChangesVectorType
void WriteComment(const OUString &rComment)
write a comment string as sequence of elements
const OUString sInsertion
void SetCurrentXText()
Do not record changes.
void ExportChangedRegion(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
export the changed-region element
XMLRedlineExport(SvXMLExport &rExp)
SvXMLExport & rExport
void ExportChangeInfo(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
export a change-info element (from a PropertySet)
This class handles the export of redline portions.