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 #pragma once
21 
22 #include <com/sun/star/uno/Reference.h>
23 #include <com/sun/star/uno/Sequence.h>
24 
25 #include <vector>
26 #include <memory>
27 #include <map>
28 
29 class SvXMLExport;
30 namespace com::sun::star {
31  namespace beans { class XPropertySet; }
32  namespace beans { struct PropertyValue; }
33  namespace text { class XText; }
34  namespace text { class XTextContent; }
35  namespace text { class XTextSection; }
36 }
37 
38 // store a list of redline properties
39 typedef ::std::vector<
40  css::uno::Reference<css::beans::XPropertySet> > ChangesVectorType;
41 
42 // store a list of redline properties for each XText
43 typedef ::std::map<
44  css::uno::Reference< css::text::XText>,
45  std::unique_ptr<ChangesVectorType> > ChangesMapType;
46 
47 
53 {
54  const OUString sDeletion;
55  const OUString sFormatChange;
56  const OUString sInsertion;
57 
59 
60 
61  // handling of change recording:
62 
63  // To support change tracking in headers and footers we need to
64  // write these changes separately. To do this, we record the
65  // changes for headers and footers. For the main document body, we
66  // get the complete list of changes from the document, which
67  // should be much more efficient than recording all of those.
68 
70 
73 
74 
75 public:
76  explicit XMLRedlineExport(SvXMLExport& rExp);
77 
79 
81  void ExportChange(
83  const css::uno::Reference<css::beans::XPropertySet> & rPropSet,
84  bool bAutoStyle);
85 
87  void ExportChangesList(bool bAutoStyles);
88 
90  void ExportChangesList(
91  const css::uno::Reference<css::text::XText> & rText,
92  bool bAutoStyles);
93 
96  void SetCurrentXText(
97  const css::uno::Reference<css::text::XText> & rText);
98 
101  void SetCurrentXText();
102 
106  const css::uno::Reference<
107  css::beans::XPropertySet> & rPropSet,
108  bool bStart);
109 
113  const css::uno::Reference<css::text::XTextContent> & rContent,
114  bool bStart);
115 
119  const css::uno::Reference<css::text::XTextSection> & rSection,
120  bool bStart);
121 
122 private:
123 
125  void ExportChangeInline(
127  const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
128 
132  const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
133 
136 
139 
141  void ExportChangedRegion(
142  const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
143 
145  void ExportChangeInfo(
146  const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
147 
149  void ExportChangeInfo(
150  const css::uno::Sequence<css::beans::PropertyValue> & rValues);
151 
153  OUString const & ConvertTypeName(std::u16string_view sApiName);
154 
156  static OUString GetRedlineID(
157  const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
158 
160  void WriteComment(std::u16string_view rComment);
161 };
162 
163 /* 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
void WriteComment(std::u16string_view rComment)
write a comment string as sequence of elements
OUString const & ConvertTypeName(std::u16string_view 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
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.