Line data Source code
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 SC_XMLANNOI_HXX
20 : #define SC_XMLANNOI_HXX
21 :
22 : #include <memory>
23 : #include <xmloff/xmlictxt.hxx>
24 : #include <xmloff/xmlimp.hxx>
25 : #include <rtl/ustrbuf.hxx>
26 : #include <editeng/editdata.hxx>
27 : #include <com/sun/star/drawing/XShape.hpp>
28 : #include <com/sun/star/drawing/XShapes.hpp>
29 :
30 : class ScXMLImport;
31 : class ScXMLTableRowCellContext;
32 :
33 3 : struct ScXMLAnnotationStyleEntry
34 : {
35 : sal_uInt16 mnFamily;
36 : rtl::OUString maName;
37 : ESelection maSelection;
38 :
39 1 : ScXMLAnnotationStyleEntry( sal_uInt16 nFam, const rtl::OUString& rNam, const ESelection& rSel ) :
40 : mnFamily( nFam ),
41 : maName( rNam ),
42 1 : maSelection( rSel )
43 : {
44 1 : }
45 : };
46 :
47 : struct ScXMLAnnotationData
48 : {
49 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
50 : mxShape;
51 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
52 : mxShapes;
53 : ::rtl::OUString maAuthor;
54 : ::rtl::OUString maCreateDate;
55 : ::rtl::OUString maSimpleText;
56 : ::rtl::OUString maStyleName;
57 : ::rtl::OUString maTextStyle;
58 : bool mbUseShapePos;
59 : bool mbShown;
60 : std::vector<ScXMLAnnotationStyleEntry> maContentStyles;
61 :
62 : explicit ScXMLAnnotationData();
63 : ~ScXMLAnnotationData();
64 : };
65 :
66 : class ScXMLAnnotationContext : public SvXMLImportContext
67 : {
68 : public:
69 :
70 : ScXMLAnnotationContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
71 : const ::rtl::OUString& rLName,
72 : const ::com::sun::star::uno::Reference<
73 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
74 : ScXMLAnnotationData& rAnnotationData,
75 : ScXMLTableRowCellContext* pCellContext);
76 :
77 : virtual ~ScXMLAnnotationContext();
78 :
79 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
80 : const ::rtl::OUString& rLocalName,
81 : const ::com::sun::star::uno::Reference<
82 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
83 :
84 : virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
85 :
86 : virtual void Characters( const ::rtl::OUString& rChars );
87 :
88 : virtual void EndElement();
89 :
90 : void SetShape(
91 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
92 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
93 : const ::rtl::OUString& rStyleName, const ::rtl::OUString& rTextStyle );
94 :
95 : void AddContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ESelection& rSelection );
96 :
97 : private:
98 : ScXMLAnnotationData& mrAnnotationData;
99 : rtl::OUStringBuffer maTextBuffer;
100 : rtl::OUStringBuffer maAuthorBuffer;
101 : rtl::OUStringBuffer maCreateDateBuffer;
102 : rtl::OUStringBuffer maCreateDateStringBuffer;
103 : ScXMLTableRowCellContext* pCellContext;
104 : SvXMLImportContext* pShapeContext;
105 :
106 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
107 15 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
108 : };
109 :
110 :
111 : #endif
112 :
113 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|