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 :
20 : #ifndef INCLUDED_XMLOFF_SOURCE_STYLE_XMLFONTSTYLESCONTEXT_IMPL_HXX
21 : #define INCLUDED_XMLOFF_SOURCE_STYLE_XMLFONTSTYLESCONTEXT_IMPL_HXX
22 :
23 : #include <xmloff/xmlstyle.hxx>
24 :
25 : namespace com { namespace sun { namespace star { namespace io {
26 : class XOutputStream;
27 : } } } }
28 :
29 : /// Handles <style:font-face>
30 : class XMLFontStyleContextFontFace : public SvXMLStyleContext
31 : {
32 : ::com::sun::star::uno::Any aFamilyName;
33 : ::com::sun::star::uno::Any aStyleName;
34 : ::com::sun::star::uno::Any aFamily;
35 : ::com::sun::star::uno::Any aPitch;
36 : ::com::sun::star::uno::Any aEnc;
37 :
38 : SvXMLImportContextRef xStyles;
39 :
40 36742 : XMLFontStylesContext *GetStyles()
41 : {
42 36742 : return static_cast<XMLFontStylesContext *>(&xStyles);
43 : }
44 :
45 : public:
46 :
47 : TYPEINFO_OVERRIDE();
48 :
49 : XMLFontStyleContextFontFace( SvXMLImport& rImport, sal_uInt16 nPrfx,
50 : const OUString& rLName,
51 : const ::com::sun::star::uno::Reference<
52 : ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
53 : XMLFontStylesContext& rStyles );
54 : virtual ~XMLFontStyleContextFontFace();
55 :
56 : void SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName,
57 : const OUString& rValue ) SAL_OVERRIDE;
58 :
59 : void FillProperties( ::std::vector< XMLPropertyState > &rProps,
60 : sal_Int32 nFamilyNameIdx,
61 : sal_Int32 nStyleNameIdx,
62 : sal_Int32 nFamilyIdx,
63 : sal_Int32 nPitchIdx,
64 : sal_Int32 nCharsetIdx ) const;
65 :
66 : OUString familyName() const;
67 :
68 : SvXMLImportContext * CreateChildContext(
69 : sal_uInt16 nPrefix,
70 : const OUString& rLocalName,
71 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
72 : };
73 :
74 : /// Handles <style:font-face-src>
75 10 : class XMLFontStyleContextFontFaceSrc : public SvXMLImportContext
76 : {
77 : const XMLFontStyleContextFontFace& font;
78 : public:
79 :
80 : TYPEINFO_OVERRIDE();
81 :
82 : XMLFontStyleContextFontFaceSrc( SvXMLImport& rImport, sal_uInt16 nPrfx,
83 : const OUString& rLName,
84 : const XMLFontStyleContextFontFace& font );
85 :
86 : virtual SvXMLImportContext * CreateChildContext(
87 : sal_uInt16 nPrefix,
88 : const OUString& rLocalName,
89 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
90 : };
91 :
92 : /// Handles <style:font-face-uri>
93 26 : class XMLFontStyleContextFontFaceUri : public SvXMLStyleContext
94 : {
95 : const XMLFontStyleContextFontFace& font;
96 : OUString format;
97 : OUString linkPath;
98 : ::css::uno::Sequence< sal_Int8 > maFontData;
99 : ::css::uno::Reference< ::css::io::XOutputStream > mxBase64Stream;
100 :
101 : void handleEmbeddedFont( const OUString& url, bool eot );
102 : void handleEmbeddedFont( const ::css::uno::Sequence< sal_Int8 >& rData, bool eot );
103 : public:
104 :
105 : TYPEINFO_OVERRIDE();
106 :
107 : XMLFontStyleContextFontFaceUri( SvXMLImport& rImport, sal_uInt16 nPrfx,
108 : const OUString& rLName,
109 : const ::com::sun::star::uno::Reference<
110 : ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
111 : const XMLFontStyleContextFontFace& font );
112 :
113 : virtual void SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName,
114 : const OUString& rValue ) SAL_OVERRIDE;
115 : void SetFormat( const OUString& rFormat );
116 : void EndElement() SAL_OVERRIDE;
117 : SvXMLImportContext * CreateChildContext(
118 : sal_uInt16 nPrefix,
119 : const OUString& rLocalName,
120 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
121 : };
122 :
123 : /// Handles <svg:font-face-format>
124 0 : class XMLFontStyleContextFontFaceFormat : public SvXMLStyleContext
125 : {
126 : XMLFontStyleContextFontFaceUri& uri;
127 : public:
128 : TYPEINFO_OVERRIDE();
129 :
130 : XMLFontStyleContextFontFaceFormat( SvXMLImport& rImport, sal_uInt16 nPrfx,
131 : const OUString& rLName,
132 : const ::com::sun::star::uno::Reference<
133 : ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
134 : XMLFontStyleContextFontFaceUri& uri );
135 :
136 : void SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName,
137 : const OUString& rValue ) SAL_OVERRIDE;
138 : };
139 :
140 : #endif
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|