Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "filid.hxx"
21 : #include "shell.hxx"
22 :
23 : using namespace fileaccess;
24 : using namespace com::sun::star;
25 : using namespace com::sun::star::ucb;
26 :
27 :
28 0 : FileContentIdentifier::FileContentIdentifier(
29 : shell* pMyShell,
30 : const OUString& aUnqPath,
31 : sal_Bool IsNormalized )
32 0 : : m_pMyShell( pMyShell )
33 : {
34 0 : if( IsNormalized )
35 : {
36 0 : m_pMyShell->getUrlFromUnq( aUnqPath,m_aContentId );
37 0 : m_aNormalizedId = aUnqPath;
38 0 : m_pMyShell->getScheme( m_aProviderScheme );
39 : }
40 : else
41 : {
42 0 : m_pMyShell->getUnqFromUrl( aUnqPath,m_aNormalizedId );
43 0 : m_aContentId = aUnqPath;
44 0 : m_pMyShell->getScheme( m_aProviderScheme );
45 : }
46 0 : }
47 :
48 0 : FileContentIdentifier::~FileContentIdentifier()
49 : {
50 0 : }
51 :
52 :
53 : void SAL_CALL
54 0 : FileContentIdentifier::acquire(
55 : void )
56 : throw()
57 : {
58 0 : OWeakObject::acquire();
59 0 : }
60 :
61 :
62 : void SAL_CALL
63 0 : FileContentIdentifier::release(
64 : void )
65 : throw()
66 : {
67 0 : OWeakObject::release();
68 0 : }
69 :
70 :
71 : uno::Any SAL_CALL
72 0 : FileContentIdentifier::queryInterface(
73 : const uno::Type& rType )
74 : throw( uno::RuntimeException, std::exception )
75 : {
76 : uno::Any aRet = cppu::queryInterface( rType,
77 : (static_cast< lang::XTypeProvider* >(this)),
78 0 : (static_cast< XContentIdentifier* >(this)) );
79 0 : return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
80 : }
81 :
82 :
83 : uno::Sequence< sal_Int8 > SAL_CALL
84 0 : FileContentIdentifier::getImplementationId()
85 : throw( uno::RuntimeException, std::exception )
86 : {
87 0 : return css::uno::Sequence<sal_Int8>();
88 : }
89 :
90 :
91 : uno::Sequence< uno::Type > SAL_CALL
92 0 : FileContentIdentifier::getTypes(
93 : void )
94 : throw( uno::RuntimeException, std::exception )
95 : {
96 : static cppu::OTypeCollection* pCollection = NULL;
97 0 : if ( !pCollection ) {
98 0 : osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
99 0 : if ( !pCollection )
100 : {
101 : static cppu::OTypeCollection collection(
102 0 : getCppuType( static_cast< uno::Reference< lang::XTypeProvider >* >( 0 ) ),
103 0 : getCppuType( static_cast< uno::Reference< XContentIdentifier >* >( 0 ) ) );
104 0 : pCollection = &collection;
105 0 : }
106 : }
107 0 : return (*pCollection).getTypes();
108 : }
109 :
110 :
111 : OUString
112 : SAL_CALL
113 0 : FileContentIdentifier::getContentIdentifier(
114 : void )
115 : throw( uno::RuntimeException, std::exception )
116 : {
117 0 : return m_aContentId;
118 : }
119 :
120 :
121 : OUString SAL_CALL
122 0 : FileContentIdentifier::getContentProviderScheme(
123 : void )
124 : throw( uno::RuntimeException, std::exception )
125 : {
126 0 : return m_aProviderScheme;
127 : }
128 :
129 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|