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 29 #ifndef _MCNTTYPE_HXX_ 30 #define _MCNTTYPE_HXX_ 31 32 //------------------------------------------------------------------------ 33 // includes 34 //------------------------------------------------------------------------ 35 36 #include <cppuhelper/compbase1.hxx> 37 #include <rtl/ustring.hxx> 38 #include <sal/types.h> 39 #include <com/sun/star/lang/IllegalArgumentException.hpp> 40 #include <com/sun/star/datatransfer/XMimeContentType.hpp> 41 42 #include <map> 43 44 //------------------------------------------------------------------------ 45 // deklarations 46 //------------------------------------------------------------------------ 47 48 class CMimeContentType : public 49 cppu::WeakImplHelper1< com::sun::star::datatransfer::XMimeContentType > 50 { 51 public: 52 CMimeContentType( const rtl::OUString& aCntType ); 53 54 //------------------------------------------- 55 // XMimeContentType 56 //------------------------------------------- 57 58 virtual ::rtl::OUString SAL_CALL getMediaType( ) throw(::com::sun::star::uno::RuntimeException); 59 virtual ::rtl::OUString SAL_CALL getMediaSubtype( ) throw(::com::sun::star::uno::RuntimeException); 60 virtual ::rtl::OUString SAL_CALL getFullMediaType( ) throw(::com::sun::star::uno::RuntimeException); 61 62 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getParameters( ) 63 throw(::com::sun::star::uno::RuntimeException); 64 65 virtual sal_Bool SAL_CALL hasParameter( const ::rtl::OUString& aName ) 66 throw(::com::sun::star::uno::RuntimeException); 67 68 virtual ::rtl::OUString SAL_CALL getParameterValue( const ::rtl::OUString& aName ) 69 throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); 70 71 private: 72 void SAL_CALL init( const rtl::OUString& aCntType ) throw( com::sun::star::lang::IllegalArgumentException ); 73 void SAL_CALL getSym( void ); 74 void SAL_CALL acceptSym( const rtl::OUString& pSymTlb ); 75 void SAL_CALL skipSpaces( void ); 76 void SAL_CALL type( void ); 77 void SAL_CALL subtype( void ); 78 void SAL_CALL trailer( void ); 79 rtl::OUString SAL_CALL pName( ); 80 rtl::OUString SAL_CALL pValue( ); 81 rtl::OUString SAL_CALL quotedPValue( ); 82 rtl::OUString SAL_CALL nonquotedPValue( ); 83 void SAL_CALL comment( void ); 84 sal_Bool SAL_CALL isInRange( const rtl::OUString& aChr, const rtl::OUString& aRange ); 85 86 private: 87 ::osl::Mutex m_aMutex; 88 rtl::OUString m_MediaType; 89 rtl::OUString m_MediaSubtype; 90 rtl::OUString m_ContentType; 91 std::map< rtl::OUString, rtl::OUString > m_ParameterMap; 92 sal_Int32 m_nPos; 93 rtl::OUString m_nxtSym; 94 }; 95 96 #endif 97 98