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 ************************************************************************/
32 using namespace fileaccess
;
33 using namespace com::sun::star
;
34 using namespace com::sun::star::ucb
;
37 FileContentIdentifier::FileContentIdentifier(
39 const rtl::OUString
& aUnqPath
,
40 sal_Bool IsNormalized
)
41 : m_pMyShell( pMyShell
),
42 m_bNormalized( IsNormalized
)
46 m_pMyShell
->getUrlFromUnq( aUnqPath
,m_aContentId
);
47 m_aNormalizedId
= aUnqPath
;
48 m_pMyShell
->getScheme( m_aProviderScheme
);
52 m_pMyShell
->getUnqFromUrl( aUnqPath
,m_aNormalizedId
);
53 m_aContentId
= aUnqPath
;
54 m_pMyShell
->getScheme( m_aProviderScheme
);
58 FileContentIdentifier::~FileContentIdentifier()
64 FileContentIdentifier::acquire(
68 OWeakObject::acquire();
73 FileContentIdentifier::release(
77 OWeakObject::release();
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
;
100 osl::Guard
< osl::Mutex
> aGuard( osl::Mutex::getGlobalMutex() );
103 static cppu::OImplementationId
id( sal_False
);
107 return (*pId
).getImplementationId();
111 uno::Sequence
< uno::Type
> SAL_CALL
112 FileContentIdentifier::getTypes(
114 throw( uno::RuntimeException
)
116 static cppu::OTypeCollection
* pCollection
= NULL
;
117 if ( !pCollection
) {
118 osl::Guard
< osl::Mutex
> aGuard( osl::Mutex::getGlobalMutex() );
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();
133 FileContentIdentifier::getContentIdentifier(
135 throw( uno::RuntimeException
)
141 rtl::OUString SAL_CALL
142 FileContentIdentifier::getContentProviderScheme(
144 throw( uno::RuntimeException
)
146 return m_aProviderScheme
;
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */