23#include <com/sun/star/awt/FontFamily.hpp>
24#include <com/sun/star/awt/FontPitch.hpp>
25#include <com/sun/star/embed/ElementModes.hpp>
26#include <com/sun/star/embed/XStorage.hpp>
50#define XML_STYLE_FAMILY_FONT XmlStyleFamily::PAGE_MASTER
59 aFamily <<= sal_Int16(awt::FontFamily::DONTKNOW);
60 aPitch <<= sal_Int16(awt::FontPitch::DONTKNOW);
65 const OUString& rValue )
107 ::std::vector< XMLPropertyState > &rProps,
108 sal_Int32 nFamilyNameIdx,
109 sal_Int32 nStyleNameIdx,
110 sal_Int32 nFamilyIdx,
112 sal_Int32 nCharsetIdx )
const
114 if( nFamilyNameIdx != -1 )
117 rProps.push_back( aPropState );
119 if( nStyleNameIdx != -1 )
122 rProps.push_back( aPropState );
124 if( nFamilyIdx != -1 )
127 rProps.push_back( aPropState );
129 if( nPitchIdx != -1 )
132 rProps.push_back( aPropState );
134 if( nCharsetIdx != -1 )
137 rProps.push_back( aPropState );
143 const css::uno::Reference< css::xml::sax::XFastAttributeList > & )
169 const OUString& rValue )
187 const css::uno::Reference< css::xml::sax::XFastAttributeList > & )
206 const css::uno::Reference< css::xml::sax::XFastAttributeList > & )
226 const OUString& rValue )
249 SAL_WARN(
"xmloff",
"svg:font-face-uri tag with no link or base64 data; ignoring." );
254 if(
format.getLength() == 0
266 SAL_WARN(
"xmloff",
"Unknown format of embedded font; assuming TTF." );
277 if(
GetImport().embeddedFontAlreadyProcessed( url ))
279 GetImport().NotifyContainsEmbeddedFont();
286 uno::Reference< embed::XStorage > storage;
287 storage.set(
GetImport().GetSourceStorage(), UNO_SET_THROW );
288 if( url.indexOf(
'/' ) > -1 )
289 storage.set( storage->openStorageElement( url.copy( 0, url.indexOf(
'/' )),
290 ::embed::ElementModes::READ ), uno::UNO_SET_THROW );
291 uno::Reference< io::XInputStream > inputStream;
292 inputStream.set( storage->openStreamElement( url.copy( url.indexOf(
'/' ) + 1 ), ::embed::ElementModes::READ ),
294 if (
GetImport().addEmbeddedFont(inputStream, fontName,
u"?", std::vector< unsigned char >(), eot))
295 GetImport().NotifyContainsEmbeddedFont();
296 inputStream->closeInput();
299 SAL_WARN(
"xmloff",
"External URL for font file not handled." );
306 if (
GetImport().addEmbeddedFont(xInput, fontName,
u"?", std::vector< unsigned char >(), eot))
307 GetImport().NotifyContainsEmbeddedFont();
308 xInput->closeInput();
313 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList )
324 rtl_TextEncoding eDfltEnc ) :
330 m_eDefaultEncoding( eDfltEnc )
337 ::std::vector< XMLPropertyState > &rProps,
338 sal_Int32 nFamilyNameIdx,
339 sal_Int32 nStyleNameIdx,
340 sal_Int32 nFamilyIdx,
342 sal_Int32 nCharsetIdx )
const
347 pFontStyle->
FillProperties( rProps, nFamilyNameIdx, nStyleNameIdx,
348 nFamilyIdx, nPitchIdx, nCharsetIdx );
349 return nullptr != pFontStyle;
const char OPENTYPE_FORMAT[]
#define XML_STYLE_FAMILY_FONT
const char TRUETYPE_FORMAT[]
This class deliberately does not support XWeak, to improve performance when loading large documents.
SvXMLImport & GetImport()
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue)
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
virtual SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
PropertyHandler for the XML-data-type:
PropertyHandler for the XML-data-type:
PropertyHandler for the XML-data-type:
PropertyHandler for the XML-data-type:
Handles <svg:font-face-format>
void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
XMLFontStyleContextFontFaceUri & uri
XMLFontStyleContextFontFaceFormat(SvXMLImport &rImport, XMLFontStyleContextFontFaceUri &uri)
Handles <style:font-face-src>
XMLFontStyleContextFontFaceSrc(SvXMLImport &rImport, const XMLFontStyleContextFontFace &font)
const XMLFontStyleContextFontFace & font
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Handles <style:font-face-uri>
void SetFormat(const OUString &rFormat)
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
::css::uno::Sequence< sal_Int8 > maFontData
void handleEmbeddedFont(const OUString &url, bool eot)
XMLFontStyleContextFontFaceUri(SvXMLImport &rImport, const XMLFontStyleContextFontFace &font)
const XMLFontStyleContextFontFace & font
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
::css::uno::Reference< ::css::io::XOutputStream > mxBase64Stream
Handles <style:font-face>
css::uno::Any aFamilyName
virtual ~XMLFontStyleContextFontFace() override
void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
void FillProperties(::std::vector< XMLPropertyState > &rProps, sal_Int32 nFamilyNameIdx, sal_Int32 nStyleNameIdx, sal_Int32 nFamilyIdx, sal_Int32 nPitchIdx, sal_Int32 nCharsetIdx) const
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
XMLFontStyleContextFontFace(SvXMLImport &rImport, XMLFontStylesContext &rStyles)
XMLFontStylesContext * GetStyles()
OUString familyName() const
bool FillProperties(const OUString &rName, ::std::vector< XMLPropertyState > &rProps, sal_Int32 nFamilyNameIdx, sal_Int32 nStyleNameIdx, sal_Int32 nFamilyIdx, sal_Int32 nPitchIdx, sal_Int32 nCharsetIdx) const
XMLFontStylesContext(SvXMLImport &rImport, rtl_TextEncoding eDfltEnc)
virtual SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
~XMLFontStylesContext() override
rtl_TextEncoding GetDfltCharset() const
#define SAL_WARN(area, stream)
XMLOFF_DLLPUBLIC bool importXML(css::uno::Reference< css::xml::sax::XFastAttributeList > const &xAttrList, css::uno::Any &rValue, OUString &rStrName, SvXMLImport &rImport)
Handling of tokens in XML:
@ XML_FONT_FAMILY_GENERIC
Smart struct to transport an Any with an index to the appropriate property-name.
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
#define XML_ELEMENT(prefix, name)