xref: /AOO41X/main/dtrans/source/cnttype/mcnttype.hxx (revision fbcf0fe955ab8df0a2f1d76ae10cf7d5c87503b1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 #ifndef _MCNTTYPE_HXX_
26 #define _MCNTTYPE_HXX_
27 
28 //------------------------------------------------------------------------
29 // includes
30 //------------------------------------------------------------------------
31 
32 #include <cppuhelper/compbase1.hxx>
33 #include <rtl/ustring.hxx>
34 #include <sal/types.h>
35 #include <com/sun/star/lang/IllegalArgumentException.hpp>
36 #include <com/sun/star/datatransfer/XMimeContentType.hpp>
37 
38 #include <map>
39 
40 //------------------------------------------------------------------------
41 // deklarations
42 //------------------------------------------------------------------------
43 
44 class CMimeContentType : public
45     cppu::WeakImplHelper1< com::sun::star::datatransfer::XMimeContentType >
46 {
47 public:
48     CMimeContentType( const rtl::OUString& aCntType );
49 
50     //-------------------------------------------
51     // XMimeContentType
52     //-------------------------------------------
53 
54     virtual ::rtl::OUString SAL_CALL getMediaType(  ) throw(::com::sun::star::uno::RuntimeException);
55     virtual ::rtl::OUString SAL_CALL getMediaSubtype(  ) throw(::com::sun::star::uno::RuntimeException);
56     virtual ::rtl::OUString SAL_CALL getFullMediaType(  ) throw(::com::sun::star::uno::RuntimeException);
57 
58     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getParameters(  )
59         throw(::com::sun::star::uno::RuntimeException);
60 
61     virtual sal_Bool SAL_CALL hasParameter( const ::rtl::OUString& aName )
62         throw(::com::sun::star::uno::RuntimeException);
63 
64     virtual ::rtl::OUString SAL_CALL getParameterValue( const ::rtl::OUString& aName )
65         throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
66 
67 private:
68     void SAL_CALL init( const rtl::OUString& aCntType ) throw( com::sun::star::lang::IllegalArgumentException );
69     void SAL_CALL getSym( void );
70     void SAL_CALL acceptSym( const rtl::OUString& pSymTlb );
71     void SAL_CALL skipSpaces( void );
72     void SAL_CALL type( void );
73     void SAL_CALL subtype( void );
74     void SAL_CALL trailer( void );
75     rtl::OUString SAL_CALL pName( );
76     rtl::OUString SAL_CALL pValue( );
77     rtl::OUString SAL_CALL quotedPValue( );
78     rtl::OUString SAL_CALL nonquotedPValue( );
79     void SAL_CALL comment( void );
80     sal_Bool SAL_CALL isInRange( const rtl::OUString& aChr, const rtl::OUString& aRange );
81 
82 private:
83     ::osl::Mutex                             m_aMutex;
84     rtl::OUString                            m_MediaType;
85     rtl::OUString                            m_MediaSubtype;
86     rtl::OUString                            m_ContentType;
87     std::map< rtl::OUString, rtl::OUString > m_ParameterMap;
88     sal_Int32                                m_nPos;
89     rtl::OUString                            m_nxtSym;
90 };
91 
92 #endif
93 
94