22#include <com/sun/star/document/XTypeDetection.hpp>
23#include <com/sun/star/frame/XTerminateListener.hpp>
31class TerminateDetection;
35class TypeDetection :
public ::cppu::ImplInheritanceHelper< BaseContainer ,
36 css::document::XTypeDetection >
41 css::uno::Reference< css::uno::XComponentContext >
m_xContext;
56 explicit TypeDetection(
const css::uno::Reference< css::uno::XComponentContext >& rxContext);
74 std::unique_lock<std::mutex>& rGuard,
75 const OUString& sPreSelType,
const css::util::URL& aParsedURL,
FlatDetection& rFlatTypes,
bool bDocService);
78 std::unique_lock<std::mutex>& rGuard,
79 const OUString& sPreSelDocumentService,
const css::util::URL& aParsedURL,
FlatDetection& rFlatTypes);
87 std::unique_lock<std::mutex>& rGuard,
129 OUString& rLastChance );
237 const OUString& sType );
259 const OUString& sFilter );
317 virtual OUString SAL_CALL
queryTypeByURL(
const OUString& sURL)
override;
319 virtual OUString SAL_CALL
queryTypeByDescriptor(css::uno::Sequence< css::beans::PropertyValue >& lDescriptor,
332 virtual void SAL_CALL
disposing(
const css::lang::EventObject&)
override
virtual void disposing(std::unique_lock< std::mutex > &)
virtual void SAL_CALL notifyTermination(const css::lang::EventObject &) override
virtual void SAL_CALL queryTermination(const css::lang::EventObject &) override
virtual void SAL_CALL disposing(const css::lang::EventObject &) override
TypeDetection * m_pTypeDetection
TerminateDetection(TypeDetection *pTypeDetection)
implements the service <type scope="com.sun.star.document">TypeDetection</type>.
static void impl_getPreselectionForDocumentService(std::unique_lock< std::mutex > &rGuard, const OUString &sPreSelDocumentService, const css::util::URL &aParsedURL, FlatDetection &rFlatTypes)
TypeDetection(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
standard ctor to connect this interface wrapper to the global filter cache instance ....
OUString impl_askDetectService(const OUString &sDetectService, utl::MediaDescriptor &rDescriptor)
make deep type detection for a specified detect service (threadsafe!).
void impl_checkResultsAndAddBestFilter(utl::MediaDescriptor &rDescriptor, OUString &sType)
search the best suitable filter for the given type and add it into the media descriptor.
static void impl_getAllFormatTypes(std::unique_lock< std::mutex > &rGuard, const css::util::URL &aParsedURL, utl::MediaDescriptor const &rDescriptor, FlatDetection &rFlatTypes)
Get all format types that we handle.
static bool impl_validateAndSetTypeOnDescriptor(utl::MediaDescriptor &rDescriptor, const OUString &sType)
validate the specified type and its relationships and set all needed information related to this type...
rtl::Reference< TerminateDetection > m_xTerminateListener
static OUString impl_askUserForTypeAndFilterIfAllowed(utl::MediaDescriptor &rDescriptor)
try to find an interaction handler and ask him to select a possible filter for this unknown format.
static void impl_seekStreamToZero(utl::MediaDescriptor const &rDescriptor)
seek a might existing stream to position 0.
static OUString impl_getTypeFromFilter(std::unique_lock< std::mutex > &rGuard, const OUString &rFilterName)
static void impl_removeTypeFilterFromDescriptor(utl::MediaDescriptor &rDescriptor)
remove anything related to a TYPE/FILTER entry from the specified MediaDescriptor.
virtual OUString SAL_CALL queryTypeByURL(const OUString &sURL) override
void impl_openStream(utl::MediaDescriptor &rDescriptor)
check if an input stream is already part of the given MediaDescriptor and creates a new one if necess...
virtual ~TypeDetection() override
standard dtor.
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual OUString SAL_CALL queryTypeByDescriptor(css::uno::Sequence< css::beans::PropertyValue > &lDescriptor, sal_Bool bAllowDeep) override
OUString impl_detectTypeFlatAndDeep(utl::MediaDescriptor &rDescriptor, const FlatDetection &lFlatTypes, bool bAllowDeep, OUString &rLastChance)
make a combined flat/deep type detection
static bool impl_getPreselectionForType(std::unique_lock< std::mutex > &rGuard, const OUString &sPreSelType, const css::util::URL &aParsedURL, FlatDetection &rFlatTypes, bool bDocService)
static bool impl_validateAndSetFilterOnDescriptor(utl::MediaDescriptor &rDescriptor, const OUString &sFilter)
validate the specified filter and its relationships and set all needed information related to this fi...
::std::vector< FlatDetectionInfo > FlatDetection