15#include <document.hxx>
17#include <unomodel.hxx>
26 :
public cppu::WeakImplHelper<document::XFilter, document::XImporter, lang::XServiceInfo>
28 uno::Reference<lang::XComponent> m_xDstDoc;
34 sal_Bool SAL_CALL
filter(
const uno::Sequence<beans::PropertyValue>& rDescriptor)
override;
35 void SAL_CALL cancel()
override;
38 void SAL_CALL setTargetDocument(
const uno::Reference<lang::XComponent>& xDoc)
override;
47MathTypeFilter::MathTypeFilter() =
default;
49sal_Bool MathTypeFilter::filter(
const uno::Sequence<beans::PropertyValue>& rDescriptor)
51 bool bSuccess =
false;
55 aMediaDesc.addInputStream();
56 uno::Reference<io::XInputStream> xInputStream;
65 if (aStorage->IsStream(
"Equation Native"))
67 if (
auto pModel =
dynamic_cast<SmModel*
>(m_xDstDoc.get()))
69 auto pDocShell =
static_cast<SmDocShell*
>(pModel->GetObjectShell());
70 OUStringBuffer aText(pDocShell->GetText());
72 bSuccess = aEquation.Parse(aStorage.get());
75 pDocShell->SetText(aText.makeStringAndClear());
83 catch (
const uno::Exception&)
90void MathTypeFilter::cancel() {}
92void MathTypeFilter::setTargetDocument(
const uno::Reference<lang::XComponent>& xDoc)
97OUString MathTypeFilter::getImplementationName() {
return "com.sun.star.comp.Math.MathTypeFilter"; }
99sal_Bool MathTypeFilter::supportsService(
const OUString& rServiceName)
104uno::Sequence<OUString> MathTypeFilter::getSupportedServiceNames()
106 return {
"com.sun.star.document.ImportFilter" };
109extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
111 uno::Sequence<uno::Any>
const& )
113 return cppu::acquire(
new MathTypeFilter);
static bool IsStorageFile(OUString const &rFileName)
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
#define DBG_UNHANDLED_EXCEPTION(...)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Math_MathTypeFilter_get_implementation(uno::XComponentContext *, uno::Sequence< uno::Any > const &)