xref: /aoo41x/main/ucb/source/ucp/file/filid.cxx (revision 2f86921c)
1*2f86921cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2f86921cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2f86921cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2f86921cSAndrew Rist  * distributed with this work for additional information
6*2f86921cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2f86921cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2f86921cSAndrew Rist  * "License"); you may not use this file except in compliance
9*2f86921cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2f86921cSAndrew Rist  *
11*2f86921cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2f86921cSAndrew Rist  *
13*2f86921cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2f86921cSAndrew Rist  * software distributed under the License is distributed on an
15*2f86921cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2f86921cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*2f86921cSAndrew Rist  * specific language governing permissions and limitations
18*2f86921cSAndrew Rist  * under the License.
19*2f86921cSAndrew Rist  *
20*2f86921cSAndrew Rist  *************************************************************/
21*2f86921cSAndrew Rist 
22*2f86921cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_ucb.hxx"
26cdf0e10cSrcweir #include "filid.hxx"
27cdf0e10cSrcweir #include "shell.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir using namespace fileaccess;
30cdf0e10cSrcweir using namespace com::sun::star;
31cdf0e10cSrcweir using namespace com::sun::star::ucb;
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
FileContentIdentifier(shell * pMyShell,const rtl::OUString & aUnqPath,sal_Bool IsNormalized)34cdf0e10cSrcweir FileContentIdentifier::FileContentIdentifier(
35cdf0e10cSrcweir 	shell* pMyShell,
36cdf0e10cSrcweir 	const rtl::OUString& aUnqPath,
37cdf0e10cSrcweir 	sal_Bool IsNormalized )
38cdf0e10cSrcweir 	: m_pMyShell( pMyShell ),
39cdf0e10cSrcweir 	  m_bNormalized( IsNormalized )
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 	if( IsNormalized )
42cdf0e10cSrcweir 	{
43cdf0e10cSrcweir         m_pMyShell->getUrlFromUnq( aUnqPath,m_aContentId );
44cdf0e10cSrcweir         m_aNormalizedId = aUnqPath;
45cdf0e10cSrcweir         m_pMyShell->getScheme( m_aProviderScheme );
46cdf0e10cSrcweir 	}
47cdf0e10cSrcweir 	else
48cdf0e10cSrcweir 	{
49cdf0e10cSrcweir 		m_pMyShell->getUnqFromUrl( aUnqPath,m_aNormalizedId );
50cdf0e10cSrcweir 		m_aContentId = aUnqPath;
51cdf0e10cSrcweir 		m_pMyShell->getScheme( m_aProviderScheme );
52cdf0e10cSrcweir 	}
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
~FileContentIdentifier()55cdf0e10cSrcweir FileContentIdentifier::~FileContentIdentifier()
56cdf0e10cSrcweir {
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 
60cdf0e10cSrcweir void SAL_CALL
acquire(void)61cdf0e10cSrcweir FileContentIdentifier::acquire(
62cdf0e10cSrcweir 	void )
63cdf0e10cSrcweir 	throw()
64cdf0e10cSrcweir {
65cdf0e10cSrcweir 	OWeakObject::acquire();
66cdf0e10cSrcweir }
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
69cdf0e10cSrcweir void SAL_CALL
release(void)70cdf0e10cSrcweir FileContentIdentifier::release(
71cdf0e10cSrcweir 				void )
72cdf0e10cSrcweir   throw()
73cdf0e10cSrcweir {
74cdf0e10cSrcweir   OWeakObject::release();
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 
78cdf0e10cSrcweir uno::Any SAL_CALL
queryInterface(const uno::Type & rType)79cdf0e10cSrcweir FileContentIdentifier::queryInterface(
80cdf0e10cSrcweir 	const uno::Type& rType )
81cdf0e10cSrcweir 	throw( uno::RuntimeException )
82cdf0e10cSrcweir {
83cdf0e10cSrcweir 	uno::Any aRet = cppu::queryInterface( rType,
84cdf0e10cSrcweir 										  SAL_STATIC_CAST( lang::XTypeProvider*, this),
85cdf0e10cSrcweir 										  SAL_STATIC_CAST( XContentIdentifier*, this) );
86cdf0e10cSrcweir 	return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
87cdf0e10cSrcweir }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 
90cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL
getImplementationId()91cdf0e10cSrcweir FileContentIdentifier::getImplementationId()
92cdf0e10cSrcweir 	throw( uno::RuntimeException )
93cdf0e10cSrcweir {
94cdf0e10cSrcweir 	static cppu::OImplementationId* pId = NULL;
95cdf0e10cSrcweir 	if ( !pId )
96cdf0e10cSrcweir     {
97cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
98cdf0e10cSrcweir 		if ( !pId )
99cdf0e10cSrcweir 		{
100cdf0e10cSrcweir 			static cppu::OImplementationId id( sal_False );
101cdf0e10cSrcweir 			pId = &id;
102cdf0e10cSrcweir 		}
103cdf0e10cSrcweir     }
104cdf0e10cSrcweir 	return (*pId).getImplementationId();
105cdf0e10cSrcweir }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 
108cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL
getTypes(void)109cdf0e10cSrcweir FileContentIdentifier::getTypes(
110cdf0e10cSrcweir 	void )
111cdf0e10cSrcweir 	throw( uno::RuntimeException )
112cdf0e10cSrcweir {
113cdf0e10cSrcweir 	static cppu::OTypeCollection* pCollection = NULL;
114cdf0e10cSrcweir 	if ( !pCollection ) {
115cdf0e10cSrcweir 		osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
116cdf0e10cSrcweir 		if ( !pCollection )
117cdf0e10cSrcweir 		{
118cdf0e10cSrcweir 			static cppu::OTypeCollection collection(
119cdf0e10cSrcweir 				getCppuType( static_cast< uno::Reference< lang::XTypeProvider >* >( 0 ) ),
120cdf0e10cSrcweir 				getCppuType( static_cast< uno::Reference< XContentIdentifier >* >( 0 ) ) );
121cdf0e10cSrcweir 			pCollection = &collection;
122cdf0e10cSrcweir 		}
123cdf0e10cSrcweir 	}
124cdf0e10cSrcweir 	return (*pCollection).getTypes();
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 
128cdf0e10cSrcweir rtl::OUString
129cdf0e10cSrcweir SAL_CALL
getContentIdentifier(void)130cdf0e10cSrcweir FileContentIdentifier::getContentIdentifier(
131cdf0e10cSrcweir 	void )
132cdf0e10cSrcweir 	throw( uno::RuntimeException )
133cdf0e10cSrcweir {
134cdf0e10cSrcweir 	return m_aContentId;
135cdf0e10cSrcweir }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 
138cdf0e10cSrcweir rtl::OUString SAL_CALL
getContentProviderScheme(void)139cdf0e10cSrcweir FileContentIdentifier::getContentProviderScheme(
140cdf0e10cSrcweir 	void )
141cdf0e10cSrcweir 	throw( uno::RuntimeException )
142cdf0e10cSrcweir {
143cdf0e10cSrcweir 	return m_aProviderScheme;
144cdf0e10cSrcweir }
145