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