summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-08-27 14:29:43 +0300
committerAndras Timar <andras.timar@collabora.com>2014-09-15 17:07:45 +0200
commite81f46baa402cd282d5f1f60e55975ac51897037 (patch)
tree6b6d50dc4db0ca87ad0eb84c39bde9c13cc2979d /embeddedobj
parent50b3dfa427cdbf661c4aef9d9b599970ef4a25a7 (diff)
bnc#648251: Avoid opening embedded OLE object as "text"
On non-Windows, when double-clicking an embedded OLE object, our glorious content type detection logic detects it as "Text", and opens it as a separate Writer document, which is somewhat pointless. (But at least we don't crash, as we did in the master branch.) Avoid this by checking for a detected filter of type "Text" explicitly, and avoiding the fun code paths in that case. This leads to double-clicks being just ignored. Maybe it would be more useful to produce a "General OLE Error" message box? (cherry picked from commit 46ad54725bf28ea75278eb63dbf95c4a29618c1c) Change-Id: Iae0726b5e9c511a92bdff7229d2978cbf76cb07b Reviewed-on: https://gerrit.libreoffice.org/11140 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'embeddedobj')
-rw-r--r--embeddedobj/source/inc/oleembobj.hxx1
-rw-r--r--embeddedobj/source/msole/oleembed.cxx14
2 files changed, 8 insertions, 7 deletions
diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx
index 58726ba46f2d..eccb7521cc26 100644
--- a/embeddedobj/source/inc/oleembobj.hxx
+++ b/embeddedobj/source/inc/oleembobj.hxx
@@ -191,6 +191,7 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper5
// if the following member is set, the object works in wrapper mode
::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject > m_xWrappedObject;
sal_Bool m_bTriedConversion;
+ OUString m_aFilterName; // if m_bTriedConversion, then the filter detected by that
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index b0c8abc0f88a..b8a474e69150 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -263,18 +263,18 @@ sal_Bool OleEmbeddedObject::TryToConvertToOOo()
// the stream must be seekable
uno::Reference< io::XSeekable > xSeekable( m_xObjectStream, uno::UNO_QUERY_THROW );
xSeekable->seek( 0 );
- OUString aFilterName = OwnView_Impl::GetFilterNameFromExtentionAndInStream( m_xFactory, OUString(), m_xObjectStream->getInputStream() );
+ m_aFilterName = OwnView_Impl::GetFilterNameFromExtentionAndInStream( m_xFactory, OUString(), m_xObjectStream->getInputStream() );
// use the solution only for OOXML format currently
- if ( !aFilterName.isEmpty()
- && ( aFilterName == "Calc MS Excel 2007 XML" || aFilterName == "Impress MS PowerPoint 2007 XML" || aFilterName == "MS Word 2007 XML" ) )
+ if ( !m_aFilterName.isEmpty()
+ && ( m_aFilterName == "Calc MS Excel 2007 XML" || m_aFilterName == "Impress MS PowerPoint 2007 XML" || m_aFilterName == "MS Word 2007 XML" ) )
{
uno::Reference< container::XNameAccess > xFilterFactory(
m_xFactory->createInstance("com.sun.star.document.FilterFactory"),
uno::UNO_QUERY_THROW );
OUString aDocServiceName;
- uno::Any aFilterAnyData = xFilterFactory->getByName( aFilterName );
+ uno::Any aFilterAnyData = xFilterFactory->getByName( m_aFilterName );
uno::Sequence< beans::PropertyValue > aFilterData;
if ( aFilterAnyData >>= aFilterData )
{
@@ -307,7 +307,7 @@ sal_Bool OleEmbeddedObject::TryToConvertToOOo()
aArgs[1].Name = "ReadOnly";
aArgs[1].Value <<= sal_True;
aArgs[2].Name = "FilterName";
- aArgs[2].Value <<= aFilterName;
+ aArgs[2].Value <<= m_aFilterName;
aArgs[3].Name = "URL";
aArgs[3].Value <<= OUString( "private:stream" );
aArgs[4].Name = "InputStream";
@@ -842,7 +842,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
}
}
- if ( !m_pOwnView && m_xObjectStream.is() )
+ if ( !m_pOwnView && m_xObjectStream.is() && m_aFilterName != "Text" )
{
try {
uno::Reference< io::XSeekable > xSeekable( m_xObjectStream, uno::UNO_QUERY );
@@ -863,7 +863,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
}
}
- if ( !m_pOwnView || !m_pOwnView->Open() )
+ if ( m_aFilterName != "Text" && (!m_pOwnView || !m_pOwnView->Open()) )
{
//Make a RO copy and see if the OS can find something to at
//least display the content for us