LibreOffice Module sw (master) 1
XMLRedlineImportHelper.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#ifndef INCLUDED_SW_SOURCE_FILTER_XML_XMLREDLINEIMPORTHELPER_HXX
20#define INCLUDED_SW_SOURCE_FILTER_XML_XMLREDLINEIMPORTHELPER_HXX
21
22#include <rtl/ustring.hxx>
23#include <com/sun/star/beans/XPropertySet.hpp>
24#include <com/sun/star/uno/Reference.h>
25#include <com/sun/star/uno/Sequence.h>
26#include <com/sun/star/util/DateTime.hpp>
27#include <redline.hxx>
28
29#include <map>
30
31class SvXMLImport;
32class RedlineInfo;
33class SwRedlineData;
34class SwDoc;
35namespace com::sun::star {
36 namespace text { class XTextCursor; }
37 namespace text { class XTextRange; }
38 namespace frame { class XModel; }
39}
40
41typedef std::map< OUString, RedlineInfo* > RedlineMapType;
42
44{
45 SvXMLImport & m_rImport;
46
47 const OUString m_sInsertion;
48 const OUString m_sDeletion;
49 const OUString m_sFormatChange;
50
52
53 // if true, no redlines should be inserted into document
54 // (This typically happen when a document is loaded in 'insert'-mode.)
56
57 // save information for saving and reconstruction of the redline mode
58 css::uno::Reference<css::beans::XPropertySet> m_xModelPropertySet;
59 css::uno::Reference<css::beans::XPropertySet> m_xImportInfoPropertySet;
62 css::uno::Sequence<sal_Int8> m_aProtectionKey;
63
64public:
65
67 SvXMLImport & rImport,
68 bool bIgnoreRedlines, // ignore redlines mode
69 // property sets of model + import info for saving + restoring the
70 // redline mode
71 const css::uno::Reference<css::beans::XPropertySet> & rModel,
72 const css::uno::Reference<css::beans::XPropertySet> & rImportInfoSet );
74
75 // create a redline object
76 // (The redline will be inserted into the document after both start
77 // and end cursor has been set.)
78 void Add(
79 std::u16string_view rType, // redline type (insert, del,... )
80 const OUString& rId, // use to identify this redline
81 const OUString& rAuthor, // name of the author
82 const OUString& rComment, // redline comment
83 const css::util::DateTime& rDateTime, // date+time
84 bool bMergeLastParagraph); // merge last paragraph?
85
86 // create a text section for the redline, and return an
87 // XText/XTextCursor that may be used to write into it.
88 css::uno::Reference<css::text::XTextCursor> CreateRedlineTextSection(
89 css::uno::Reference<css::text::XTextCursor> const & xOldCursor, // needed to get the document
90 const OUString& rId); // ID used to RedlineAdd() call
91
92 // Set start or end position for a redline in the text body.
93 // Accepts XTextRange objects.
94 void SetCursor(
95 const OUString& rId, // ID used in RedlineAdd() call
96 bool bStart, // start or end Range
97 css::uno::Reference<css::text::XTextRange> const & rRange, // the actual XTextRange
98 // text range is (from an XML view) outside of a paragraph
99 // (i.e. before a table)
100 bool bIsOutsideOfParagraph);
101
108 const OUString& rId); // ID used in RedlineAdd() call
109
110 // set redline mode: show changes
111 void SetShowChanges( bool bShowChanges );
112
113 // set redline mode: record changes
114 void SetRecordChanges( bool bRecordChanges );
115
116 // set redline protection key
117 void SetProtectionKey(const css::uno::Sequence<sal_Int8> & rKey );
118
119private:
120
121 static inline bool IsReady(const RedlineInfo* pRedline);
122
123 void InsertIntoDocument(RedlineInfo* pRedline);
124
126 RedlineInfo* pRedline, // RedlineInfo to be converted
127 SwDoc* pDoc); // document needed for Author-ID conversion
128};
129
130#endif
131
132/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::map< OUString, RedlineInfo * > RedlineMapType
Definition: doc.hxx:197
css::uno::Sequence< sal_Int8 > m_aProtectionKey
void SetProtectionKey(const css::uno::Sequence< sal_Int8 > &rKey)
SwRedlineData * ConvertRedline(RedlineInfo *pRedline, SwDoc *pDoc)
css::uno::Reference< css::text::XTextCursor > CreateRedlineTextSection(css::uno::Reference< css::text::XTextCursor > const &xOldCursor, const OUString &rId)
void SetCursor(const OUString &rId, bool bStart, css::uno::Reference< css::text::XTextRange > const &rRange, bool bIsOutsideOfParagraph)
void Add(std::u16string_view rType, const OUString &rId, const OUString &rAuthor, const OUString &rComment, const css::util::DateTime &rDateTime, bool bMergeLastParagraph)
css::uno::Reference< css::beans::XPropertySet > m_xModelPropertySet
static bool IsReady(const RedlineInfo *pRedline)
css::uno::Reference< css::beans::XPropertySet > m_xImportInfoPropertySet
void AdjustStartNodeCursor(const OUString &rId)
Adjust the start (end) position for a redline that begins in a start node.
void InsertIntoDocument(RedlineInfo *pRedline)
void SetShowChanges(bool bShowChanges)
void SetRecordChanges(bool bRecordChanges)
XMLRedlineImportHelper(SvXMLImport &rImport, bool bIgnoreRedlines, const css::uno::Reference< css::beans::XPropertySet > &rModel, const css::uno::Reference< css::beans::XPropertySet > &rImportInfoSet)
def text(shape, orig_st)