xref: /trunk/main/xmloff/source/text/XMLChangedRegionImportContext.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 
29 #ifndef _XMLOFF_XMLCHANGEDREGIONIMPORTCONTEXT_HXX
30 #define _XMLOFF_XMLCHANGEDREGIONIMPORTCONTEXT_HXX
31 
32 #include <xmloff/xmlictxt.hxx>
33 #include <com/sun/star/uno/Reference.h>
34 
35 
36 namespace com { namespace sun { namespace star {
37     namespace text {
38         class XTextCursor;
39     }
40     namespace xml { namespace sax {
41         class XAttributeList;
42     } }
43 } } }
44 namespace rtl {
45     class OUString;
46 }
47 
48 
49 class XMLChangedRegionImportContext : public SvXMLImportContext
50 {
51     const ::rtl::OUString sEmpty;
52 
53     /// if we replace the current XTextCursor/XText by the ones for
54     /// the redline, we remeber the old cursor here.
55     ::com::sun::star::uno::Reference<
56         ::com::sun::star::text::XTextCursor> xOldCursor;
57 
58     ::rtl::OUString sID;        /// redline-ID
59 
60     sal_Bool bMergeLastPara;    /// merge-last-paragraph flag
61 
62 public:
63 
64     TYPEINFO();
65 
66     XMLChangedRegionImportContext(
67         SvXMLImport& rImport,
68         sal_uInt16 nPrefix,
69         const ::rtl::OUString& rLocalName);
70 
71     ~XMLChangedRegionImportContext();
72 
73     virtual void StartElement(
74         const ::com::sun::star::uno::Reference<
75             ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
76 
77     virtual SvXMLImportContext* CreateChildContext(
78         sal_uInt16 nPrefix,
79         const ::rtl::OUString& rLocalName,
80         const ::com::sun::star::uno::Reference<
81             ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
82 
83     virtual void EndElement();
84 
85 
86     /// change info: To be called from change-info context
87     void SetChangeInfo(const ::rtl::OUString& rType,
88                        const ::rtl::OUString& rAuthor,
89                        const ::rtl::OUString& rComment,
90                        const ::rtl::OUString& rDate);
91 
92     /// create redline XText/XTextCursor on demand and register with
93     /// XMLTextImportHelper
94     void UseRedlineText();
95 };
96 
97 
98 #endif
99