[Libreoffice-commits] core.git: starmath/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Apr 20 00:56:40 PDT 2015
starmath/source/unofilter.cxx | 43 ++++++++++++++++++++++++------------------
1 file changed, 25 insertions(+), 18 deletions(-)
New commits:
commit 30a6622ca8046691d57eb5c422da7646edcb0cb1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Apr 20 09:37:40 2015 +0200
CID#1295034 uncaught exception
Change-Id: I853e520dd60c3e19cbf7a7b620115df50fc25b30
diff --git a/starmath/source/unofilter.cxx b/starmath/source/unofilter.cxx
index 4058609..423c46c 100644
--- a/starmath/source/unofilter.cxx
+++ b/starmath/source/unofilter.cxx
@@ -64,34 +64,41 @@ MathTypeFilter::~MathTypeFilter()
sal_Bool MathTypeFilter::filter(const uno::Sequence<beans::PropertyValue>& rDescriptor) throw(uno::RuntimeException, std::exception)
{
bool bSuccess = false;
- utl::MediaDescriptor aMediaDesc(rDescriptor);
- aMediaDesc.addInputStream();
- uno::Reference<io::XInputStream> xInputStream;
- aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
- std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream));
- if (pStream)
+ try
{
- if (SotStorage::IsStorageFile(pStream.get()))
+ utl::MediaDescriptor aMediaDesc(rDescriptor);
+ aMediaDesc.addInputStream();
+ uno::Reference<io::XInputStream> xInputStream;
+ aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
+ std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream));
+ if (pStream)
{
- SvStorageRef aStorage(new SotStorage(pStream.get(), false));
- // Is this a MathType Storage?
- if (aStorage->IsStream(OUString("Equation Native")))
+ if (SotStorage::IsStorageFile(pStream.get()))
{
- if (SmModel* pModel = dynamic_cast<SmModel*>(m_xDstDoc.get()))
+ SvStorageRef aStorage(new SotStorage(pStream.get(), false));
+ // Is this a MathType Storage?
+ if (aStorage->IsStream(OUString("Equation Native")))
{
- SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
- OUString aText = pDocShell->GetText();
- MathType aEquation(aText);
- bSuccess = aEquation.Parse(aStorage) == 1;
- if (bSuccess)
+ if (SmModel* pModel = dynamic_cast<SmModel*>(m_xDstDoc.get()))
{
- pDocShell->SetText(aText);
- pDocShell->Parse();
+ SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
+ OUString aText = pDocShell->GetText();
+ MathType aEquation(aText);
+ bSuccess = aEquation.Parse(aStorage) == 1;
+ if (bSuccess)
+ {
+ pDocShell->SetText(aText);
+ pDocShell->Parse();
+ }
}
}
}
}
}
+ catch (const uno::Exception& rException)
+ {
+ SAL_WARN("starmath", "Exception caught: " << rException.Message);
+ }
return bSuccess;
}
More information about the Libreoffice-commits
mailing list