26class XMLTextBoxContext :
public XMLImportContext
29 XMLTextBoxContext(XMLImport& rImport);
32 CreateChildContext(
const OUString& rName,
33 const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs)
override;
36 startElement(
const OUString& rName,
37 const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs)
override;
38 void SAL_CALL endElement(
const OUString& rName)
override;
42XMLTextBoxContext::XMLTextBoxContext(XMLImport& rImport)
43 : XMLImportContext(rImport)
48 const OUString& rName,
const css::uno::Reference<css::xml::sax::XAttributeList>& )
53void XMLTextBoxContext::startElement(
55 const css::uno::Reference<css::xml::sax::XAttributeList>& )
57 GetImport().GetGenerator().openTextBox(librevenge::RVNGPropertyList());
60void XMLTextBoxContext::endElement(
const OUString& )
62 GetImport().GetGenerator().closeTextBox();
68class XMLTextImageContext :
public XMLImportContext
71 XMLTextImageContext(XMLImport& rImport);
74 CreateChildContext(
const OUString& rName,
75 const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs)
override;
78 startElement(
const OUString& rName,
79 const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs)
override;
80 void SAL_CALL endElement(
const OUString& rName)
override;
88XMLTextImageContext::XMLTextImageContext(XMLImport& rImport)
89 : XMLImportContext(rImport)
94 const OUString& rName,
const css::uno::Reference<css::xml::sax::XAttributeList>& )
96 if (rName ==
"office:binary-data")
104void XMLTextImageContext::startElement(
105 const OUString& ,
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs)
107 for (sal_Int16 i = 0;
i < xAttribs->getLength(); ++
i)
109 const OUString& rAttributeName = xAttribs->getNameByIndex(i);
110 if (rAttributeName ==
"loext:mime-type" || rAttributeName ==
"draw:mime-type")
115void XMLTextImageContext::endElement(
const OUString& )
117 librevenge::RVNGPropertyList aPropertyList;
119 aPropertyList.insert(
"librevenge:mime-type",
m_aMimeType.getStr());
121 aPropertyList.insert(
"office:binary-data",
m_xBinaryData->getBinaryData());
123 GetImport().GetGenerator().insertBinaryObject(aPropertyList);
132 const OUString& rName,
const css::uno::Reference<css::xml::sax::XAttributeList>& )
134 if (rName ==
"draw:image")
135 return new XMLTextImageContext(
GetImport());
136 if (rName ==
"draw:text-box")
137 return new XMLTextBoxContext(
GetImport());
138 SAL_WARN(
"writerperfect",
"XMLTextFrameContext::CreateChildContext: unhandled " << rName);
143 const OUString& ,
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs)
145 librevenge::RVNGPropertyList aPropertyList;
146 for (sal_Int16
i = 0;
i < xAttribs->getLength(); ++
i)
148 const OUString& rAttributeName = xAttribs->getNameByIndex(
i);
149 const OUString& rAttributeValue = xAttribs->getValueByIndex(
i);
151 if (rAttributeName ==
"draw:style-name")
153 GetImport().GetGraphicStyles(), aPropertyList);
158 aPropertyList.insert(
sName.getStr(), sValue.getStr());
rtl::Reference< XMLBase64ImportContext > m_xBinaryData
XMLTextFrameContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::text::TextContentAnchorType eDfltAnchorType)
Base class for a handler of a single XML element during ODF -> librevenge conversion.
ODT export feeds this class to make librevenge calls.
librevenge::RVNGTextInterface & GetGenerator() const
void SAL_CALL endElement(const OUString &rName) override
void SAL_CALL startElement(const OUString &rName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs) override
rtl::Reference< XMLImportContext > CreateChildContext(const OUString &rName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs) override
#define SAL_WARN(area, stream)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
void FillStyles(const OUString &rName, std::map< OUString, librevenge::RVNGPropertyList > &rAutomaticStyles, std::map< OUString, librevenge::RVNGPropertyList > &rNamedStyles, librevenge::RVNGPropertyList &rPropertyList)
Looks for rName in rAutomaticStyles (and failing that, in rNamedStyles) and fills rPropertyList based...
rtl::Reference< XMLImportContext > CreateTextChildContext(XMLImport &rImport, std::u16string_view rName, bool bTopLevel)
Context factory for body text, section, table cell, etc.