LibreOffice Module oox (master)  1
Public Member Functions | Private Attributes | List of all members
oox::core::FilterDetect Class Referencefinal

#include <filterdetect.hxx>

Inheritance diagram for oox::core::FilterDetect:
[legend]
Collaboration diagram for oox::core::FilterDetect:
[legend]

Public Member Functions

 FilterDetect (const css::uno::Reference< css::uno::XComponentContext > &rxContext)
 
virtual ~FilterDetect () override
 
css::uno::Reference< css::io::XInputStream > extractUnencryptedPackage (utl::MediaDescriptor &rMediaDesc) const
 Tries to extract an unencrypted ZIP package from the passed media descriptor. More...
 
virtual OUString SAL_CALL getImplementationName () override
 
virtual sal_Bool SAL_CALL supportsService (const OUString &rServiceName) override
 
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override
 
virtual OUString SAL_CALL detect (css::uno::Sequence< css::beans::PropertyValue > &rMediaDescSeq) override
 Detects MS Office 2007 file types and supports package decryption. More...
 

Private Attributes

css::uno::Reference< css::uno::XComponentContext > mxContext
 

Detailed Description

Definition at line 103 of file filterdetect.hxx.

Constructor & Destructor Documentation

oox::core::FilterDetect::FilterDetect ( const css::uno::Reference< css::uno::XComponentContext > &  rxContext)
explicit
Exceptions
css::uno::RuntimeException
FilterDetect::~FilterDetect ( )
overridevirtual

Definition at line 263 of file filterdetect.cxx.

Member Function Documentation

virtual OUString SAL_CALL oox::core::FilterDetect::detect ( css::uno::Sequence< css::beans::PropertyValue > &  rMediaDescSeq)
overridevirtual

Detects MS Office 2007 file types and supports package decryption.

The following file types are detected:

  • MS Word 2007 XML Document (*.docx, *.docm)
  • MS Word 2007 XML Template (*.dotx, *.dotm)
  • MS Excel 2007 XML Document (*.xlsx, *.xlsm)
  • MS Excel 2007 BIFF12 Document (*.xlsb)
  • MS Excel 2007 XML Template (*.xltx, *.xltm)
  • MS Powerpoint 2007 XML Document (*.pptx, *.pptm)
  • MS Powerpoint 2007 XML Template (*.potx, *.potm)

If the package is encrypted, the detection tries to decrypt it into a temporary file. The user may be asked for a password. The XStream interface of the temporary file will be stored in the 'ComponentData' property of the passed media descriptor.

Reference< XInputStream > FilterDetect::extractUnencryptedPackage ( utl::MediaDescriptor rMediaDesc) const

Tries to extract an unencrypted ZIP package from the passed media descriptor.

First, this function checks if the input stream provided by the media descriptor property 'InputStream' contains a ZIP package. If yes, this stream is returned.

Second, this function checks if the 'ComponentData' property exists and contains a sequence of com.sun.star.beans.NamedValue. If yes, a named value is searched with the name 'DecryptedPackage' and a value of type com.sun.star.io.XStream. If the input stream provided by this XStream contains a ZIP package, this input stream is returned.

Third, this function checks if the input stream of the media descriptor contains an OLE package. If yes, it checks the existence of the streams 'EncryptionInfo' and 'EncryptedPackage' and tries to decrypt the package into a temporary file. This may include requesting a password from the media descriptor property 'Password' or from the user, using the interaction handler provided by the descriptor. On success, and if the decrypted package is a ZIP package, the XStream of the temporary file is stored in the property 'ComponentData' of the media descriptor and its input stream is returned.

Definition at line 315 of file filterdetect.cxx.

References Any, oox::crypto::DocumentDecryption::decrypt(), Exception, utl::MediaDescriptor::getComponentDataEntry(), oox::StorageBase::isStorage(), comphelper::MS, mxContext, oox::crypto::DocumentDecryption::readEncryptionInfo(), utl::MediaDescriptor::requestAndVerifyDocPassword(), and utl::MediaDescriptor::setComponentDataEntry().

OUString SAL_CALL FilterDetect::getImplementationName ( )
overridevirtual

Definition at line 396 of file filterdetect.cxx.

Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames ( )
overridevirtual

Definition at line 406 of file filterdetect.cxx.

sal_Bool SAL_CALL FilterDetect::supportsService ( const OUString &  rServiceName)
overridevirtual

Definition at line 401 of file filterdetect.cxx.

References cppu::supportsService().

Member Data Documentation

css::uno::Reference< css::uno::XComponentContext > oox::core::FilterDetect::mxContext
private

Definition at line 164 of file filterdetect.hxx.


The documentation for this class was generated from the following files: