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 :
10 : #ifndef INCLUDED_SC_SOURCE_FILTER_XML_CELLTEXTPARACONTEXT_HXX
11 : #define INCLUDED_SC_SOURCE_FILTER_XML_CELLTEXTPARACONTEXT_HXX
12 :
13 : #include "importcontext.hxx"
14 :
15 : class ScXMLImport;
16 : class ScXMLTableRowCellContext;
17 :
18 : /**
19 : * This context handles <text:p> element inside <table:table-cell>.
20 : */
21 17628 : class ScXMLCellTextParaContext : public ScXMLImportContext
22 : {
23 : ScXMLTableRowCellContext& mrParentCxt;
24 : OUString maContent;
25 : public:
26 : ScXMLCellTextParaContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLTableRowCellContext& rParent);
27 :
28 : virtual void StartElement(const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
29 : virtual void EndElement() SAL_OVERRIDE;
30 : virtual void Characters(const OUString& rChars) SAL_OVERRIDE;
31 : virtual SvXMLImportContext* CreateChildContext(
32 : sal_uInt16 nPrefix, const OUString& rLocalName, const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
33 :
34 : void PushSpan(const OUString& rSpan, const OUString& rStyleName);
35 : void PushFieldSheetName(const OUString& rStyleName);
36 : void PushFieldDate(const OUString& rStyleName);
37 : void PushFieldTitle(const OUString& rStyleName);
38 : void PushFieldURL(const OUString& rURL, const OUString& rRep, const OUString& rStyleName);
39 : };
40 :
41 : /**
42 : * This context handles <text:span> element inside <text:p>.
43 : */
44 806 : class ScXMLCellTextSpanContext : public ScXMLImportContext
45 : {
46 : ScXMLCellTextParaContext& mrParentCxt;
47 : OUString maStyleName;
48 : OUString maContent;
49 : public:
50 : ScXMLCellTextSpanContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
51 :
52 : virtual void StartElement(const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
53 : virtual void EndElement() SAL_OVERRIDE;
54 : virtual void Characters(const OUString& rChars) SAL_OVERRIDE;
55 : virtual SvXMLImportContext* CreateChildContext(
56 : sal_uInt16 nPrefix, const OUString& rLocalName, const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
57 : };
58 :
59 : /**
60 : * This context handles <text:sheet-name> element inside <text:p>.
61 : */
62 4 : class ScXMLCellFieldSheetNameContext : public ScXMLImportContext
63 : {
64 : ScXMLCellTextParaContext& mrParentCxt;
65 : OUString maStyleName;
66 : public:
67 : ScXMLCellFieldSheetNameContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
68 :
69 : void SetStyleName(const OUString& rStyleName);
70 :
71 : virtual void StartElement(const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
72 : virtual void EndElement() SAL_OVERRIDE;
73 : virtual void Characters(const OUString& rChars) SAL_OVERRIDE;
74 : virtual SvXMLImportContext* CreateChildContext(
75 : sal_uInt16 nPrefix, const OUString& rLocalName, const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
76 : };
77 :
78 : /**
79 : * This context handles <text:date> element inside <text:p>.
80 : */
81 4 : class ScXMLCellFieldDateContext : public ScXMLImportContext
82 : {
83 : ScXMLCellTextParaContext& mrParentCxt;
84 : OUString maStyleName;
85 : public:
86 : ScXMLCellFieldDateContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
87 :
88 : void SetStyleName(const OUString& rStyleName);
89 :
90 : virtual void StartElement(const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
91 : virtual void EndElement() SAL_OVERRIDE;
92 : virtual void Characters(const OUString& rChars) SAL_OVERRIDE;
93 : virtual SvXMLImportContext* CreateChildContext(
94 : sal_uInt16 nPrefix, const OUString& rLocalName, const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
95 : };
96 :
97 : /**
98 : * This context handles <text:title> element inside <text:p>.
99 : */
100 4 : class ScXMLCellFieldTitleContext : public ScXMLImportContext
101 : {
102 : ScXMLCellTextParaContext& mrParentCxt;
103 : OUString maStyleName;
104 : public:
105 : ScXMLCellFieldTitleContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
106 :
107 : void SetStyleName(const OUString& rStyleName);
108 :
109 : virtual void StartElement(const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
110 : virtual void EndElement() SAL_OVERRIDE;
111 : virtual void Characters(const OUString& rChars) SAL_OVERRIDE;
112 : virtual SvXMLImportContext* CreateChildContext(
113 : sal_uInt16 nPrefix, const OUString& rLocalName, const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
114 : };
115 :
116 : /**
117 : * This context handles <text:a> element inside <text:p> or <text:span>.
118 : */
119 20 : class ScXMLCellFieldURLContext : public ScXMLImportContext
120 : {
121 : ScXMLCellTextParaContext& mrParentCxt;
122 : OUString maStyleName;
123 : OUString maURL;
124 : OUString maRep;
125 : public:
126 : ScXMLCellFieldURLContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
127 :
128 : void SetStyleName(const OUString& rStyleName);
129 :
130 : virtual void StartElement(const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
131 : virtual void EndElement() SAL_OVERRIDE;
132 : virtual void Characters(const OUString& rChars) SAL_OVERRIDE;
133 : virtual SvXMLImportContext* CreateChildContext(
134 : sal_uInt16 nPrefix, const OUString& rLocalName, const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
135 : };
136 :
137 : /**
138 : * This context handles <text:s> element inside <text:p> or <text:span>.
139 : */
140 28 : class ScXMLCellFieldSContext : public ScXMLImportContext
141 : {
142 : ScXMLCellTextParaContext& mrParentCxt;
143 : OUString maStyleName;
144 : sal_Int32 mnCount;
145 :
146 : void PushSpaces();
147 : public:
148 : ScXMLCellFieldSContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
149 :
150 : void SetStyleName(const OUString& rStyleName);
151 :
152 : virtual void StartElement(const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
153 : virtual void EndElement() SAL_OVERRIDE;
154 : virtual SvXMLImportContext* CreateChildContext(
155 : sal_uInt16 nPrefix, const OUString& rLocalName, const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList) SAL_OVERRIDE;
156 : };
157 :
158 : #endif
159 :
160 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|