1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef OOX_XLS_BIFFDETECTOR_HXX 29 #define OOX_XLS_BIFFDETECTOR_HXX 30 31 #include <com/sun/star/document/XExtendedFilterDetection.hpp> 32 #include <com/sun/star/lang/XServiceInfo.hpp> 33 #include <cppuhelper/implbase2.hxx> 34 #include "oox/helper/storagebase.hxx" 35 #include "oox/xls/biffhelper.hxx" 36 37 namespace com { namespace sun { namespace star { 38 namespace beans { struct PropertyValue; } 39 namespace uno { class XComponentContext; } 40 } } } 41 42 namespace oox { class BinaryInputStream; } 43 44 namespace oox { 45 namespace xls { 46 47 // ============================================================================ 48 49 /** Detection service for BIFF streams or storages. */ 50 class BiffDetector : public ::cppu::WeakImplHelper2< 51 ::com::sun::star::lang::XServiceInfo, 52 ::com::sun::star::document::XExtendedFilterDetection > 53 { 54 public: 55 explicit BiffDetector( 56 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) 57 throw( ::com::sun::star::uno::RuntimeException ); 58 59 virtual ~BiffDetector(); 60 61 /** Detects the BIFF version of the passed stream. */ 62 static BiffType detectStreamBiffVersion( BinaryInputStream& rInStream ); 63 64 /** Detects the BIFF version and workbook stream name of the passed storage. */ 65 static BiffType detectStorageBiffVersion( 66 ::rtl::OUString& orWorkbookStreamName, 67 const StorageRef& rxStorage ); 68 69 // com.sun.star.lang.XServiceInfo interface ------------------------------- 70 71 virtual ::rtl::OUString SAL_CALL 72 getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); 73 74 virtual sal_Bool SAL_CALL 75 supportsService( const ::rtl::OUString& rService ) 76 throw( ::com::sun::star::uno::RuntimeException ); 77 78 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 79 getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); 80 81 // com.sun.star.document.XExtendedFilterDetect interface ------------------ 82 83 virtual ::rtl::OUString SAL_CALL 84 detect( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& orDescriptor ) 85 throw( ::com::sun::star::uno::RuntimeException ); 86 87 private: 88 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > 89 mxContext; 90 }; 91 92 // ============================================================================ 93 94 } // namespace xls 95 } // namespace oox 96 97 #endif 98