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_file.hxx"
26 #include "filid.hxx"
27 #include "shell.hxx"
28
29 using namespace fileaccess;
30 using namespace com::sun::star;
31 using namespace com::sun::star::ucb;
32
33
FileContentIdentifier(shell * pMyShell,const rtl::OUString & aUnqPath,sal_Bool IsNormalized)34 FileContentIdentifier::FileContentIdentifier(
35 shell* pMyShell,
36 const rtl::OUString& aUnqPath,
37 sal_Bool IsNormalized )
38 : m_pMyShell( pMyShell ),
39 m_bNormalized( IsNormalized )
40 {
41 if( IsNormalized )
42 {
43 m_pMyShell->getUrlFromUnq( aUnqPath,m_aContentId );
44 m_aNormalizedId = aUnqPath;
45 m_pMyShell->getScheme( m_aProviderScheme );
46 }
47 else
48 {
49 m_pMyShell->getUnqFromUrl( aUnqPath,m_aNormalizedId );
50 m_aContentId = aUnqPath;
51 m_pMyShell->getScheme( m_aProviderScheme );
52 }
53 }
54
~FileContentIdentifier()55 FileContentIdentifier::~FileContentIdentifier()
56 {
57 }
58
59
60 void SAL_CALL
acquire(void)61 FileContentIdentifier::acquire(
62 void )
63 throw()
64 {
65 OWeakObject::acquire();
66 }
67
68
69 void SAL_CALL
release(void)70 FileContentIdentifier::release(
71 void )
72 throw()
73 {
74 OWeakObject::release();
75 }
76
77
78 uno::Any SAL_CALL
queryInterface(const uno::Type & rType)79 FileContentIdentifier::queryInterface(
80 const uno::Type& rType )
81 {
82 uno::Any aRet = cppu::queryInterface( rType,
83 SAL_STATIC_CAST( lang::XTypeProvider*, this),
84 SAL_STATIC_CAST( XContentIdentifier*, this) );
85 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
86 }
87
88
89 uno::Sequence< sal_Int8 > SAL_CALL
getImplementationId()90 FileContentIdentifier::getImplementationId()
91 {
92 static cppu::OImplementationId* pId = NULL;
93 if ( !pId )
94 {
95 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
96 if ( !pId )
97 {
98 static cppu::OImplementationId id( sal_False );
99 pId = &id;
100 }
101 }
102 return (*pId).getImplementationId();
103 }
104
105
106 uno::Sequence< uno::Type > SAL_CALL
getTypes(void)107 FileContentIdentifier::getTypes(
108 void )
109 {
110 static cppu::OTypeCollection* pCollection = NULL;
111 if ( !pCollection ) {
112 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
113 if ( !pCollection )
114 {
115 static cppu::OTypeCollection collection(
116 getCppuType( static_cast< uno::Reference< lang::XTypeProvider >* >( 0 ) ),
117 getCppuType( static_cast< uno::Reference< XContentIdentifier >* >( 0 ) ) );
118 pCollection = &collection;
119 }
120 }
121 return (*pCollection).getTypes();
122 }
123
124
125 rtl::OUString
126 SAL_CALL
getContentIdentifier(void)127 FileContentIdentifier::getContentIdentifier(
128 void )
129 {
130 return m_aContentId;
131 }
132
133
134 rtl::OUString SAL_CALL
getContentProviderScheme(void)135 FileContentIdentifier::getContentProviderScheme(
136 void )
137 {
138 return m_aProviderScheme;
139 }
140