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
29class SvXMLExport;
30namespace 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
39typedef ::std::vector<
40 css::uno::Reference<css::beans::XPropertySet> > ChangesVectorType;
41
42// store a list of redline properties for each XText
43typedef ::std::map<
44 css::uno::Reference< css::text::XText>,
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
75public:
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
91 const css::uno::Reference<css::text::XText> & rText,
92 bool bAutoStyles);
93
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
122private:
123
127 const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
128
132 const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
133
136
139
142 const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
143
146 const css::uno::Reference<css::beans::XPropertySet> & rPropSet);
147
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: */
::std::vector< css::uno::Reference< css::beans::XPropertySet > > ChangesVectorType
::std::map< css::uno::Reference< css::text::XText >, ChangesVectorType > ChangesMapType
This class handles the export of redline portions.
void ExportChangesList(const css::uno::Reference< css::text::XText > &rText, bool bAutoStyles)
export the list of changes (recorded changes for this XText only)
void ExportChangeInline(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
export the change mark contained in the text body
void ExportStartOrEndRedline(const css::uno::Reference< css::text::XTextSection > &rSection, bool bStart)
convenience method, calls XPropertySet-version of this method
void ExportChangeInfo(const css::uno::Sequence< css::beans::PropertyValue > &rValues)
export a change-info element (from PropertyValues)
void ExportChangeAutoStyle(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
export the auto styles used in this change
ChangesVectorType * pCurrentChangesList
map of recorded changes
void SetCurrentXText(const css::uno::Reference< css::text::XText > &rText)
set the current XText for which changes should be recorded.
void ExportChangesListElements()
export the changes list (<text:tracked-changes>)
SvXMLExport & rExport
void ExportChangesListAutoStyles()
export the auto styles needed by the changes list
OUString const & ConvertTypeName(std::u16string_view sApiName)
convert the change type from API to XML names
void WriteComment(std::u16string_view rComment)
write a comment string as sequence of <text:p> elements
void ExportStartOrEndRedline(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, bool bStart)
export redline marks which start or end at start nodes, i.e.
static OUString GetRedlineID(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Get ID string!
const OUString sDeletion
void ExportStartOrEndRedline(const css::uno::Reference< css::text::XTextContent > &rContent, bool bStart)
start or end of text entity (e.g. paragraph)?
void ExportChangedRegion(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
export the changed-region element
void ExportChange(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, bool bAutoStyle)
export a change
const OUString sFormatChange
void ExportChangeInfo(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
export a change-info element (from a PropertySet)
void SetCurrentXText()
Do not record changes.
void ExportChangesList(bool bAutoStyles)
export the list of changes (complete list minus recorded changed)
ChangesMapType aChangeMap
XMLRedlineExport(SvXMLExport &rExp)
const OUString sInsertion
def text(shape, orig_st)
class SAL_NO_VTABLE XPropertySet