Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / file / filid.cxx
blob50200af6c656408e4dc872fd8d1a10fc53566d87
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "filid.hxx"
30 #include "shell.hxx"
32 using namespace fileaccess;
33 using namespace com::sun::star;
34 using namespace com::sun::star::ucb;
37 FileContentIdentifier::FileContentIdentifier(
38 shell* pMyShell,
39 const rtl::OUString& aUnqPath,
40 sal_Bool IsNormalized )
41 : m_pMyShell( pMyShell ),
42 m_bNormalized( IsNormalized )
44 if( IsNormalized )
46 m_pMyShell->getUrlFromUnq( aUnqPath,m_aContentId );
47 m_aNormalizedId = aUnqPath;
48 m_pMyShell->getScheme( m_aProviderScheme );
50 else
52 m_pMyShell->getUnqFromUrl( aUnqPath,m_aNormalizedId );
53 m_aContentId = aUnqPath;
54 m_pMyShell->getScheme( m_aProviderScheme );
58 FileContentIdentifier::~FileContentIdentifier()
63 void SAL_CALL
64 FileContentIdentifier::acquire(
65 void )
66 throw()
68 OWeakObject::acquire();
72 void SAL_CALL
73 FileContentIdentifier::release(
74 void )
75 throw()
77 OWeakObject::release();
81 uno::Any SAL_CALL
82 FileContentIdentifier::queryInterface(
83 const uno::Type& rType )
84 throw( uno::RuntimeException )
86 uno::Any aRet = cppu::queryInterface( rType,
87 (static_cast< lang::XTypeProvider* >(this)),
88 (static_cast< XContentIdentifier* >(this)) );
89 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
93 uno::Sequence< sal_Int8 > SAL_CALL
94 FileContentIdentifier::getImplementationId()
95 throw( uno::RuntimeException )
97 static cppu::OImplementationId* pId = NULL;
98 if ( !pId )
100 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
101 if ( !pId )
103 static cppu::OImplementationId id( sal_False );
104 pId = &id;
107 return (*pId).getImplementationId();
111 uno::Sequence< uno::Type > SAL_CALL
112 FileContentIdentifier::getTypes(
113 void )
114 throw( uno::RuntimeException )
116 static cppu::OTypeCollection* pCollection = NULL;
117 if ( !pCollection ) {
118 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
119 if ( !pCollection )
121 static cppu::OTypeCollection collection(
122 getCppuType( static_cast< uno::Reference< lang::XTypeProvider >* >( 0 ) ),
123 getCppuType( static_cast< uno::Reference< XContentIdentifier >* >( 0 ) ) );
124 pCollection = &collection;
127 return (*pCollection).getTypes();
131 rtl::OUString
132 SAL_CALL
133 FileContentIdentifier::getContentIdentifier(
134 void )
135 throw( uno::RuntimeException )
137 return m_aContentId;
141 rtl::OUString SAL_CALL
142 FileContentIdentifier::getContentProviderScheme(
143 void )
144 throw( uno::RuntimeException )
146 return m_aProviderScheme;
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */