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);
74 if(
GetStyles()->GetFamilyNameHdl().importXML( rValue, aAny,
82 if(
GetStyles()->GetFamilyHdl().importXML( rValue, aAny,
87 if(
GetStyles()->GetPitchHdl().importXML( rValue, aAny,
92 if(
GetStyles()->GetEncodingHdl().importXML( rValue, aAny,
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 > & )
187 const css::uno::Reference< css::xml::sax::XFastAttributeList > & )
206 const css::uno::Reference< css::xml::sax::XFastAttributeList > & )
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 ))
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 ),
296 inputStream->closeInput();
299 SAL_WARN(
"xmloff",
"External URL for font file not handled." );
306 if (
GetImport().addEmbeddedFont(xInput, fontName,
"?", std::vector< unsigned char >(), eot))
308 xInput->closeInput();
313 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList )
324 rtl_TextEncoding eDfltEnc ) :
330 eDfltEncoding( 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;
virtual SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
~XMLFontStylesContext() override
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
XMLFontStyleContextFontFaceUri & uri
XMLFontStyleContextFontFaceSrc(SvXMLImport &rImport, const XMLFontStyleContextFontFace &font)
PropertyHandler for the XML-data-type:
const char OPENTYPE_FORMAT[]
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
const XMLFontStyleContextFontFace & font
void FillProperties(::std::vector< XMLPropertyState > &rProps, sal_Int32 nFamilyNameIdx, sal_Int32 nStyleNameIdx, sal_Int32 nFamilyIdx, sal_Int32 nPitchIdx, sal_Int32 nCharsetIdx) const
SvXMLImport & GetImport()
XMLFontStylesContext * GetStyles()
virtual void NotifyContainsEmbeddedFont()
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
css::uno::Any const & rValue
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
#define XML_STYLE_FAMILY_FONT
PropertyHandler for the XML-data-type:
virtual ~XMLFontStyleContextFontFace() override
PropertyHandler for the XML-data-type:
const XMLFontStyleContextFontFace & font
virtual SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue)
rtl_TextEncoding GetDfltCharset() const
XMLFontStylesContext(SvXMLImport &rImport, rtl_TextEncoding eDfltEnc)
::css::uno::Sequence< sal_Int8 > maFontData
This class deliberately does not support XWeak, to improve performance when loading large documents...
XMLFontStyleContextFontFaceUri(SvXMLImport &rImport, 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
Handling of tokens in XML:
OUString familyName() const
::css::uno::Reference< ::css::io::XOutputStream > mxBase64Stream
void handleEmbeddedFont(const OUString &url, bool eot)
#define XML_ELEMENT(prefix, name)
Smart struct to transport an Any with an index to the appropriate property-name.
const SvXMLUnitConverter & GetMM100UnitConverter() const
void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
XMLFontStyleContextFontFace(SvXMLImport &rImport, XMLFontStylesContext &rStyles)
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
XMLFontStyleContextFontFaceFormat(SvXMLImport &rImport, XMLFontStyleContextFontFaceUri &uri)
const char TRUETYPE_FORMAT[]
#define SAL_WARN(area, stream)
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
PropertyHandler for the XML-data-type:
bool addEmbeddedFont(const css::uno::Reference< css::io::XInputStream > &stream, const OUString &fontName, const char *extra, std::vector< unsigned char > const &key, bool eot)
css::uno::Any aFamilyName
void SetFormat(const OUString &rFormat)
exports com.sun.star. uri