22#include <ooxml/resourceids.hxx>
26#include <rtl/tencinfo.h>
57 SAL_WARN_IF( !
m_pImpl->pCurrentEntry,
"writerfilter.dmapper",
"current entry has to be set here" );
60 int nIntValue = val.
getInt();
64 case NS_ooxml::LN_CT_Pitch_val:
65 if (
static_cast<Id>(nIntValue) == NS_ooxml::LN_Value_ST_Pitch_fixed)
67 else if (
static_cast<Id>(nIntValue) == NS_ooxml::LN_Value_ST_Pitch_variable)
69 else if (
static_cast<Id>(nIntValue) == NS_ooxml::LN_Value_ST_Pitch_default)
72 SAL_WARN(
"writerfilter.dmapper",
"FontTable::lcl_attribute: unhandled NS_ooxml::CT_Pitch_val: " << nIntValue);
74 case NS_ooxml::LN_CT_Font_name:
75 m_pImpl->pCurrentEntry->sFontName = sValue;
77 case NS_ooxml::LN_CT_Charset_val:
79 if(
m_pImpl->pCurrentEntry->nTextEncoding == RTL_TEXTENCODING_DONTKNOW )
81 m_pImpl->pCurrentEntry->nTextEncoding = rtl_getTextEncodingFromWindowsCharset( nIntValue );
83 m_pImpl->pCurrentEntry->nTextEncoding = RTL_TEXTENCODING_SYMBOL;
86 case NS_ooxml::LN_CT_Charset_characterSet:
89 sValue.convertToString( &tmp, RTL_TEXTENCODING_ASCII_US, OUSTRING_TO_OSTRING_CVTFLAGS );
90 m_pImpl->pCurrentEntry->nTextEncoding = rtl_getTextEncodingFromMimeCharset( tmp.getStr() );
93 m_pImpl->pCurrentEntry->nTextEncoding = RTL_TEXTENCODING_SYMBOL;
102 SAL_WARN_IF( !
m_pImpl->pCurrentEntry,
"writerfilter.dmapper",
"current entry has to be set here" );
105 sal_uInt32 nSprmId = rSprm.
getId();
109 case NS_ooxml::LN_CT_Font_charset:
110 case NS_ooxml::LN_CT_Font_pitch:
113 case NS_ooxml::LN_CT_Font_embedRegular:
114 case NS_ooxml::LN_CT_Font_embedBold:
115 case NS_ooxml::LN_CT_Font_embedItalic:
116 case NS_ooxml::LN_CT_Font_embedBoldItalic:
122 nSprmId == NS_ooxml::LN_CT_Font_embedRegular ?
u""
123 : nSprmId == NS_ooxml::LN_CT_Font_embedBold ?
u"b"
124 : nSprmId == NS_ooxml::LN_CT_Font_embedItalic ?
u"i"
126 pProperties->resolve( handler );
130 case NS_ooxml::LN_CT_Font_altName:
132 case NS_ooxml::LN_CT_Font_panose1:
134 case NS_ooxml::LN_CT_Font_family:
136 case NS_ooxml::LN_CT_Font_sig:
138 case NS_ooxml::LN_CT_Font_notTrueType:
141 SAL_WARN(
"writerfilter.dmapper",
"FontTable::lcl_sprm: unhandled token: " << nSprmId);
150 pProperties->resolve(*
this);
156 SAL_WARN_IF(
m_pImpl->pCurrentEntry,
"writerfilter.dmapper",
"current entry has to be NULL here" );
161 m_pImpl->pCurrentEntry.clear();
225 return m_pImpl->aFontEntries.size();
229 const OUString& fontName, std::u16string_view extra,
230 std::vector<unsigned char>
const & key)
232 if (!
m_pImpl->xEmbeddedFontHelper)
234 m_pImpl->xEmbeddedFontHelper->addEmbeddedFont(
stream, fontName, extra, key);
239, m_fontTable( rFontTable )
240, m_fontName(
std::move( _fontName ))
249 std::vector< unsigned char > key( 32 );
254 static const int pos[ 16 ] = { 35, 33, 31, 29, 27, 25, 22, 20, 17, 15, 12, 10, 7, 5, 3, 1 };
261 assert(( v1 >=
'0' && v1 <=
'9' ) || ( v1 >=
'A' && v1 <=
'F' ));
262 assert(( v2 >=
'0' && v2 <=
'9' ) || ( v2 >=
'A' && v2 <=
'F' ));
263 int val = ( v1 - ( v1 <=
'9' ?
'0' :
'A' - 10 )) * 16 + v2 - ( v2 <=
'9' ?
'0' :
'A' - 10 );
277 case NS_ooxml::LN_CT_FontRel_fontKey:
280 case NS_ooxml::LN_CT_Rel_id:
282 case NS_ooxml::LN_CT_FontRel_subsetted:
285 case NS_ooxml::LN_inputstream:
An SPRM: Section, Paragraph and Run Modifier.
virtual sal_uInt32 getId() const =0
Returns id of the SPRM.
virtual writerfilter::Reference< Properties >::Pointer_t getProps()=0
Returns reference to properties contained in the SPRM.
virtual int getInt() const =0
Returns integer representation of the value.
virtual OUString getString() const =0
Returns string representation of the value.
virtual css::uno::Any getAny() const =0
Returns representation of the value as uno::Any.
EmbeddedFontHandler(FontTable &rFontTable, OUString fontName, std::u16string_view style)
virtual void lcl_sprm(Sprm &rSprm) override
virtual ~EmbeddedFontHandler() override
css::uno::Reference< css::io::XInputStream > m_inputStream
std::u16string_view m_style
virtual void lcl_attribute(Id name, Value &val) override
virtual void lcl_startCharacterGroup() override
virtual ~FontTable() override
virtual void lcl_sprm(Sprm &sprm) override
virtual void lcl_attribute(Id Name, Value &val) override
void addEmbeddedFont(const css::uno::Reference< css::io::XInputStream > &stream, const OUString &fontName, std::u16string_view extra, std::vector< unsigned char > const &key)
virtual void lcl_startParagraphGroup() override
FontEntry::Pointer_t getFontEntry(sal_uInt32 nIndex)
virtual void lcl_startShape(css::uno::Reference< css::drawing::XShape > const &xShape) override
virtual void lcl_props(writerfilter::Reference< Properties >::Pointer_t ref) override
void resolveSprm(Sprm &r_sprm)
std::unique_ptr< FontTable_Impl > m_pImpl
virtual void lcl_text(const sal_uInt8 *data, size_t len) override
virtual void lcl_endSectionGroup() override
virtual void lcl_endParagraphGroup() override
virtual void lcl_endShape() override
virtual void lcl_endCharacterGroup() override
virtual void lcl_table(Id name, writerfilter::Reference< Table >::Pointer_t ref) override
virtual void lcl_entry(writerfilter::Reference< Properties >::Pointer_t ref) override
virtual void lcl_startSectionGroup() override
virtual void lcl_utext(const sal_uInt8 *data, size_t len) override
virtual void lcl_substream(Id name, ::writerfilter::Reference< Stream >::Pointer_t ref) override
Reference< XOutputStream > stream
UNOTOOLS_DLLPUBLIC bool IsOpenSymbol(std::u16string_view rFontName)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
tools::SvRef< FontEntry > Pointer_t
std::vector< FontEntry::Pointer_t > aFontEntries
FontEntry::Pointer_t pCurrentEntry
std::unique_ptr< EmbeddedFontsHelper, o3tl::default_delete< EmbeddedFontsHelper > > xEmbeddedFontHelper