Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef SC_XMLANNOI_HXX
29 : : #define SC_XMLANNOI_HXX
30 : :
31 : : #include <memory>
32 : : #include <xmloff/xmlictxt.hxx>
33 : : #include <xmloff/xmlimp.hxx>
34 : : #include <rtl/ustrbuf.hxx>
35 : : #include <editeng/editdata.hxx>
36 : : #include <com/sun/star/drawing/XShape.hpp>
37 : : #include <com/sun/star/drawing/XShapes.hpp>
38 : :
39 : : class ScXMLImport;
40 : : class ScXMLTableRowCellContext;
41 : :
42 : 9 : struct ScXMLAnnotationStyleEntry
43 : : {
44 : : sal_uInt16 mnFamily;
45 : : rtl::OUString maName;
46 : : ESelection maSelection;
47 : :
48 : 3 : ScXMLAnnotationStyleEntry( sal_uInt16 nFam, const rtl::OUString& rNam, const ESelection& rSel ) :
49 : : mnFamily( nFam ),
50 : : maName( rNam ),
51 : 3 : maSelection( rSel )
52 : : {
53 : 3 : }
54 : : };
55 : :
56 : : struct ScXMLAnnotationData
57 : : {
58 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
59 : : mxShape;
60 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
61 : : mxShapes;
62 : : ::rtl::OUString maAuthor;
63 : : ::rtl::OUString maCreateDate;
64 : : ::rtl::OUString maSimpleText;
65 : : ::rtl::OUString maStyleName;
66 : : ::rtl::OUString maTextStyle;
67 : : bool mbUseShapePos;
68 : : bool mbShown;
69 : : std::vector<ScXMLAnnotationStyleEntry> maContentStyles;
70 : :
71 : : explicit ScXMLAnnotationData();
72 : : ~ScXMLAnnotationData();
73 : : };
74 : :
75 : : class ScXMLAnnotationContext : public SvXMLImportContext
76 : : {
77 : : public:
78 : :
79 : : ScXMLAnnotationContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
80 : : const ::rtl::OUString& rLName,
81 : : const ::com::sun::star::uno::Reference<
82 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
83 : : ScXMLAnnotationData& rAnnotationData,
84 : : ScXMLTableRowCellContext* pCellContext);
85 : :
86 : : virtual ~ScXMLAnnotationContext();
87 : :
88 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
89 : : const ::rtl::OUString& rLocalName,
90 : : const ::com::sun::star::uno::Reference<
91 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
92 : :
93 : : virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
94 : :
95 : : virtual void Characters( const ::rtl::OUString& rChars );
96 : :
97 : : virtual void EndElement();
98 : :
99 : : void SetShape(
100 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
101 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
102 : : const ::rtl::OUString& rStyleName, const ::rtl::OUString& rTextStyle );
103 : :
104 : : void AddContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ESelection& rSelection );
105 : :
106 : : private:
107 : : ScXMLAnnotationData& mrAnnotationData;
108 : : rtl::OUStringBuffer maTextBuffer;
109 : : rtl::OUStringBuffer maAuthorBuffer;
110 : : rtl::OUStringBuffer maCreateDateBuffer;
111 : : rtl::OUStringBuffer maCreateDateStringBuffer;
112 : : sal_Int32 nParagraphCount;
113 : : ScXMLTableRowCellContext* pCellContext;
114 : : SvXMLImportContext* pShapeContext;
115 : :
116 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
117 : 85 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
118 : : };
119 : :
120 : :
121 : : #endif
122 : :
123 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|