1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: global.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SC_XMLRUBYI_HXX
32 #define _SC_XMLRUBYI_HXX
34 #ifndef _XMLOFF_XMLICTXT_HXX
35 #include <xmloff/xmlictxt.hxx>
37 #ifndef _RTL_USTRBUF_HXX_
38 #include <rtl/ustrbuf.hxx>
42 class ScXMLTextPContext
;
43 class ScXMLTableRowCellContext
;
46 * A class for representing Asian phonetic guide information while loading ODF file.
48 class ScXMLRubyContext
: public SvXMLImportContext
50 rtl::OUString sStyleName
;
51 rtl::OUStringBuffer sBaseText
;
52 rtl::OUStringBuffer sRubyText
;
53 ScXMLTableRowCellContext
* pCellContext
;
54 ScXMLTextPContext
* pTextContext
;
56 const ScXMLImport
& GetScImport() const { return (const ScXMLImport
&)GetImport(); }
57 ScXMLImport
& GetScImport() { return (ScXMLImport
&)GetImport(); }
62 * A constructor of ScXMLRubyContext.
63 * @param rImport a reference of ScXMLImport.
64 * @param nPrfx the number of the element prefix.
65 * @param rLName the string of the element.
66 * @param xAttrList attribute list of the element.
67 * @param pContext a pointer of ScXMLTextPContext.
69 ScXMLRubyContext( ScXMLImport
& rImport
, USHORT nPrfx
,
70 const ::rtl::OUString
& rLName
,
71 const ::com::sun::star::uno::Reference
<
72 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
73 ScXMLTextPContext
* pContext
);
75 * A constructor of ScXMLRubyContext.
76 * @param rImport a reference of ScXMLImport.
77 * @param nPrfx the number of the element prefix.
78 * @param rLName the string of the element.
79 * @param xAttrList attribute list of the element.
80 * @param pContext a pointer of ScXMLTableRowCellContext.
82 ScXMLRubyContext( ScXMLImport
& rImport
, USHORT nPrfx
,
83 const ::rtl::OUString
& rLName
,
84 const ::com::sun::star::uno::Reference
<
85 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
86 ScXMLTableRowCellContext
* pContext
);
88 virtual ~ScXMLRubyContext() {};
91 * Create a childs element context. By default, the import's
92 * CreateContext method is called to create a new default context.
93 * @return a new default context.
95 virtual SvXMLImportContext
*CreateChildContext( USHORT nPrefix
,
96 const ::rtl::OUString
& rLocalName
,
97 const ::com::sun::star::uno::Reference
<
98 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
100 * EndElement is called before a context will be destructed, but
101 * after a elements context has been parsed. It may be used for actions
102 * that require virtual methods. The default is to do nothing.
104 virtual void EndElement();
107 * Adds string into cell string as base string of phonetic infrmation
108 * @param rText the base string.
110 void AddBaseText(const ::rtl::OUString
& rText
);
112 * Adds string into cell string as phonetic text
113 * @param rText the phonetic text.
115 void AddRubyText(const ::rtl::OUString
& rText
);
119 * A class for representing base text of phonetic guide information while loading ODF file.
121 class ScXMLRubyBaseContext
: public SvXMLImportContext
123 ScXMLRubyContext
* pRubyContext
;
125 const ScXMLImport
& GetScImport() const { return (const ScXMLImport
&)GetImport(); }
126 ScXMLImport
& GetScImport() { return (ScXMLImport
&)GetImport(); }
131 * A constructor of ScXMLRubyBaseContext.
132 * @param rImport a reference of ScXMLImport.
133 * @param nPrfx the number of the element prefix.
134 * @param rLName the string of the element.
135 * @param xAttrList attribute list of the element.
136 * @param pContext a pointer of ScXMLRubyContext.
138 ScXMLRubyBaseContext( ScXMLImport
& rImport
, USHORT nPrfx
,
139 const ::rtl::OUString
& rLName
,
140 const ::com::sun::star::uno::Reference
<
141 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
142 ScXMLRubyContext
* pContext
);
144 virtual ~ScXMLRubyBaseContext() {};
147 * This method is called for all characters that are contained in the
148 * current element. The default is to ignore them.
149 * @param rChars the character reference
151 virtual void Characters( const ::rtl::OUString
& rChars
);
156 * A class for representing phonetic text of phonetic guide information while loading ODF file.
158 class ScXMLRubyTextContext
: public SvXMLImportContext
160 ScXMLRubyContext
* pRubyContext
;
162 const ScXMLImport
& GetScImport() const { return (const ScXMLImport
&)GetImport(); }
163 ScXMLImport
& GetScImport() { return (ScXMLImport
&)GetImport(); }
168 * A constructor of ScXMLRubyTextContext.
169 * @param rImport a reference of ScXMLImport.
170 * @param nPrfx the number of the element prefix.
171 * @param rLName the string of the element.
172 * @param xAttrList attribute list of the element.
173 * @param pContext a pointer of ScXMLRubyContext.
175 ScXMLRubyTextContext( ScXMLImport
& rImport
, USHORT nPrfx
,
176 const ::rtl::OUString
& rLName
,
177 const ::com::sun::star::uno::Reference
<
178 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
179 ScXMLRubyContext
* pContext
);
181 virtual ~ScXMLRubyTextContext() {};
184 * This method is called for all characters that are contained in the
185 * current element. The default is to ignore them.
186 * @param rChars the character reference
188 virtual void Characters( const ::rtl::OUString
& rChars
);