xref: /trunk/main/ucb/source/core/identify.cxx (revision 2f86921c)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_ucb.hxx"
26 
27 /**************************************************************************
28                                 TODO
29  **************************************************************************
30 
31  *************************************************************************/
32 
33 #include "identify.hxx"
34 
35 using namespace rtl;
36 using namespace com::sun::star::uno;
37 using namespace com::sun::star::lang;
38 using namespace com::sun::star::ucb;
39 
40 //=========================================================================
41 //
42 // ContentIdentifier Implementation.
43 //
44 //=========================================================================
45 
ContentIdentifier(const Reference<XMultiServiceFactory> & rxSMgr,const OUString & ContentId)46 ContentIdentifier::ContentIdentifier(
47                         const Reference< XMultiServiceFactory >& rxSMgr,
48                         const OUString& ContentId )
49 : m_xSMgr( rxSMgr ),
50   m_aContentId( ContentId )
51 {
52 }
53 
54 //=========================================================================
55 // virtual
~ContentIdentifier()56 ContentIdentifier::~ContentIdentifier()
57 {
58 }
59 
60 //=========================================================================
61 //
62 // XInterface methods.
63 //
64 //=========================================================================
65 
66 XINTERFACE_IMPL_2( ContentIdentifier,
67                    XTypeProvider,
68                    XContentIdentifier );
69 
70 //=========================================================================
71 //
72 // XTypeProvider methods.
73 //
74 //=========================================================================
75 
76 XTYPEPROVIDER_IMPL_2( ContentIdentifier,
77                       XTypeProvider,
78                       XContentIdentifier );
79 
80 //=========================================================================
81 //
82 // XContentIdentifier methods.
83 //
84 //=========================================================================
85 
86 // virtual
getContentIdentifier()87 OUString SAL_CALL ContentIdentifier::getContentIdentifier()
88     throw( RuntimeException )
89 {
90     return m_aContentId;
91 }
92 
93 //=========================================================================
94 // virtual
getContentProviderScheme()95 OUString SAL_CALL ContentIdentifier::getContentProviderScheme()
96     throw( RuntimeException )
97 {
98     if ( !m_aProviderScheme.getLength() && m_aContentId.getLength() )
99     {
100         // The content provider scheme is the part before the first ':'
101         // within the content id.
102         sal_Int32 nPos = m_aContentId.indexOf( ':', 0 );
103         if ( nPos != -1 )
104         {
105             OUString aScheme( m_aContentId.copy( 0, nPos ) );
106             m_aProviderScheme = aScheme.toAsciiLowerCase();
107         }
108     }
109 
110     return m_aProviderScheme;
111 }
112 
113