xref: /aoo4110/main/sc/source/filter/xml/xmlannoi.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef SC_XMLANNOI_HXX
24 #define SC_XMLANNOI_HXX
25 
26 #include <memory>
27 #include <xmloff/xmlictxt.hxx>
28 #include <xmloff/xmlimp.hxx>
29 #include <rtl/ustrbuf.hxx>
30 #include <editeng/editdata.hxx>
31 #include <com/sun/star/drawing/XShape.hpp>
32 #include <com/sun/star/drawing/XShapes.hpp>
33 
34 class ScXMLImport;
35 class ScXMLTableRowCellContext;
36 
37 struct ScXMLAnnotationStyleEntry
38 {
39     sal_uInt16          mnFamily;
40     rtl::OUString       maName;
41     ESelection          maSelection;
42 
ScXMLAnnotationStyleEntryScXMLAnnotationStyleEntry43     ScXMLAnnotationStyleEntry( sal_uInt16 nFam, const rtl::OUString& rNam, const ESelection& rSel ) :
44         mnFamily( nFam ),
45         maName( rNam ),
46         maSelection( rSel )
47     {
48     }
49 };
50 
51 struct ScXMLAnnotationData
52 {
53     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
54                         mxShape;
55     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
56                         mxShapes;
57     ::rtl::OUString     maAuthor;
58     ::rtl::OUString     maCreateDate;
59     ::rtl::OUString     maSimpleText;
60     ::rtl::OUString     maStyleName;
61     ::rtl::OUString     maTextStyle;
62     bool                mbUseShapePos;
63     bool                mbShown;
64     std::vector<ScXMLAnnotationStyleEntry> maContentStyles;
65 
66     explicit            ScXMLAnnotationData();
67                         ~ScXMLAnnotationData();
68 };
69 
70 class ScXMLAnnotationContext : public SvXMLImportContext
71 {
72 public:
73 
74 	ScXMLAnnotationContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
75 						const ::rtl::OUString& rLName,
76 						const ::com::sun::star::uno::Reference<
77 										::com::sun::star::xml::sax::XAttributeList>& xAttrList,
78                         ScXMLAnnotationData& rAnnotationData,
79 						ScXMLTableRowCellContext* pCellContext);
80 
81 	virtual ~ScXMLAnnotationContext();
82 
83 	virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
84 									 const ::rtl::OUString& rLocalName,
85 									 const ::com::sun::star::uno::Reference<
86 									  	::com::sun::star::xml::sax::XAttributeList>& xAttrList );
87 
88 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
89 
90 	virtual void Characters( const ::rtl::OUString& rChars );
91 
92 	virtual void EndElement();
93 
94     void SetShape(
95         const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
96         const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
97         const ::rtl::OUString& rStyleName, const ::rtl::OUString& rTextStyle );
98 
99     void AddContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ESelection& rSelection );
100 
101 private:
102     ScXMLAnnotationData& mrAnnotationData;
103     rtl::OUStringBuffer maTextBuffer;
104     rtl::OUStringBuffer maAuthorBuffer;
105     rtl::OUStringBuffer maCreateDateBuffer;
106     rtl::OUStringBuffer maCreateDateStringBuffer;
107     sal_Int32           nParagraphCount;
108     sal_Bool            bHasTextP;
109     ScXMLTableRowCellContext* pCellContext;
110     SvXMLImportContext* pShapeContext;
111 
GetScImport() const112     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
GetScImport()113     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
114 };
115 
116 
117 #endif
118 
119