Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / ucb / source / ucp / file / filid.cxx
blob0f234ca5899ebca64b9893ac4a4ba19dd8588b14
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "filid.hxx"
21 #include "shell.hxx"
23 using namespace fileaccess;
24 using namespace com::sun::star;
25 using namespace com::sun::star::ucb;
28 FileContentIdentifier::FileContentIdentifier(
29 shell* pMyShell,
30 const rtl::OUString& aUnqPath,
31 sal_Bool IsNormalized )
32 : m_pMyShell( pMyShell )
34 if( IsNormalized )
36 m_pMyShell->getUrlFromUnq( aUnqPath,m_aContentId );
37 m_aNormalizedId = aUnqPath;
38 m_pMyShell->getScheme( m_aProviderScheme );
40 else
42 m_pMyShell->getUnqFromUrl( aUnqPath,m_aNormalizedId );
43 m_aContentId = aUnqPath;
44 m_pMyShell->getScheme( m_aProviderScheme );
48 FileContentIdentifier::~FileContentIdentifier()
53 void SAL_CALL
54 FileContentIdentifier::acquire(
55 void )
56 throw()
58 OWeakObject::acquire();
62 void SAL_CALL
63 FileContentIdentifier::release(
64 void )
65 throw()
67 OWeakObject::release();
71 uno::Any SAL_CALL
72 FileContentIdentifier::queryInterface(
73 const uno::Type& rType )
74 throw( uno::RuntimeException )
76 uno::Any aRet = cppu::queryInterface( rType,
77 (static_cast< lang::XTypeProvider* >(this)),
78 (static_cast< XContentIdentifier* >(this)) );
79 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
83 uno::Sequence< sal_Int8 > SAL_CALL
84 FileContentIdentifier::getImplementationId()
85 throw( uno::RuntimeException )
87 static cppu::OImplementationId* pId = NULL;
88 if ( !pId )
90 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
91 if ( !pId )
93 static cppu::OImplementationId id( sal_False );
94 pId = &id;
97 return (*pId).getImplementationId();
101 uno::Sequence< uno::Type > SAL_CALL
102 FileContentIdentifier::getTypes(
103 void )
104 throw( uno::RuntimeException )
106 static cppu::OTypeCollection* pCollection = NULL;
107 if ( !pCollection ) {
108 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
109 if ( !pCollection )
111 static cppu::OTypeCollection collection(
112 getCppuType( static_cast< uno::Reference< lang::XTypeProvider >* >( 0 ) ),
113 getCppuType( static_cast< uno::Reference< XContentIdentifier >* >( 0 ) ) );
114 pCollection = &collection;
117 return (*pCollection).getTypes();
121 rtl::OUString
122 SAL_CALL
123 FileContentIdentifier::getContentIdentifier(
124 void )
125 throw( uno::RuntimeException )
127 return m_aContentId;
131 rtl::OUString SAL_CALL
132 FileContentIdentifier::getContentProviderScheme(
133 void )
134 throw( uno::RuntimeException )
136 return m_aProviderScheme;
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */