xref: /trunk/main/dtrans/source/cnttype/mcnttype.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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(  );
55     virtual ::rtl::OUString SAL_CALL getMediaSubtype(  );
56     virtual ::rtl::OUString SAL_CALL getFullMediaType(  );
57 
58     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getParameters(  );
59 
60     virtual sal_Bool SAL_CALL hasParameter( const ::rtl::OUString& aName );
61 
62     virtual ::rtl::OUString SAL_CALL getParameterValue( const ::rtl::OUString& aName );
63 
64 private:
65     void SAL_CALL init( const rtl::OUString& aCntType );
66     void SAL_CALL getSym( void );
67     void SAL_CALL acceptSym( const rtl::OUString& pSymTlb );
68     void SAL_CALL skipSpaces( void );
69     void SAL_CALL type( void );
70     void SAL_CALL subtype( void );
71     void SAL_CALL trailer( void );
72     rtl::OUString SAL_CALL pName( );
73     rtl::OUString SAL_CALL pValue( );
74     rtl::OUString SAL_CALL quotedPValue( );
75     rtl::OUString SAL_CALL nonquotedPValue( );
76     void SAL_CALL comment( void );
77     sal_Bool SAL_CALL isInRange( const rtl::OUString& aChr, const rtl::OUString& aRange );
78 
79 private:
80     ::osl::Mutex                             m_aMutex;
81     rtl::OUString                            m_MediaType;
82     rtl::OUString                            m_MediaSubtype;
83     rtl::OUString                            m_ContentType;
84     std::map< rtl::OUString, rtl::OUString > m_ParameterMap;
85     sal_Int32                                m_nPos;
86     rtl::OUString                            m_nxtSym;
87 };
88 
89 #endif
90