Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "filid.hxx"
30 : : #include "shell.hxx"
31 : :
32 : : using namespace fileaccess;
33 : : using namespace com::sun::star;
34 : : using namespace com::sun::star::ucb;
35 : :
36 : :
37 : 100842 : FileContentIdentifier::FileContentIdentifier(
38 : : shell* pMyShell,
39 : : const rtl::OUString& aUnqPath,
40 : : sal_Bool IsNormalized )
41 : 100842 : : m_pMyShell( pMyShell )
42 : : {
43 [ + + ]: 100842 : if( IsNormalized )
44 : : {
45 [ + - ]: 6782 : m_pMyShell->getUrlFromUnq( aUnqPath,m_aContentId );
46 : 6782 : m_aNormalizedId = aUnqPath;
47 [ + - ]: 6782 : m_pMyShell->getScheme( m_aProviderScheme );
48 : : }
49 : : else
50 : : {
51 [ + - ]: 94060 : m_pMyShell->getUnqFromUrl( aUnqPath,m_aNormalizedId );
52 : 94060 : m_aContentId = aUnqPath;
53 [ + - ]: 94060 : m_pMyShell->getScheme( m_aProviderScheme );
54 : : }
55 : 100842 : }
56 : :
57 : 100613 : FileContentIdentifier::~FileContentIdentifier()
58 : : {
59 [ - + ]: 201226 : }
60 : :
61 : :
62 : : void SAL_CALL
63 : 420462 : FileContentIdentifier::acquire(
64 : : void )
65 : : throw()
66 : : {
67 : 420462 : OWeakObject::acquire();
68 : 420462 : }
69 : :
70 : :
71 : : void SAL_CALL
72 : 420233 : FileContentIdentifier::release(
73 : : void )
74 : : throw()
75 : : {
76 : 420233 : OWeakObject::release();
77 : 420233 : }
78 : :
79 : :
80 : : uno::Any SAL_CALL
81 : 12 : FileContentIdentifier::queryInterface(
82 : : const uno::Type& rType )
83 : : throw( uno::RuntimeException )
84 : : {
85 : : uno::Any aRet = cppu::queryInterface( rType,
86 : : (static_cast< lang::XTypeProvider* >(this)),
87 [ + - ]: 12 : (static_cast< XContentIdentifier* >(this)) );
88 [ - + ][ + - ]: 12 : return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
89 : : }
90 : :
91 : :
92 : : uno::Sequence< sal_Int8 > SAL_CALL
93 : 0 : FileContentIdentifier::getImplementationId()
94 : : throw( uno::RuntimeException )
95 : : {
96 : : static cppu::OImplementationId* pId = NULL;
97 [ # # ]: 0 : if ( !pId )
98 : : {
99 [ # # ][ # # ]: 0 : osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
100 [ # # ]: 0 : if ( !pId )
101 : : {
102 [ # # ][ # # ]: 0 : static cppu::OImplementationId id( sal_False );
103 : 0 : pId = &id;
104 [ # # ]: 0 : }
105 : : }
106 : 0 : return (*pId).getImplementationId();
107 : : }
108 : :
109 : :
110 : : uno::Sequence< uno::Type > SAL_CALL
111 : 0 : FileContentIdentifier::getTypes(
112 : : void )
113 : : throw( uno::RuntimeException )
114 : : {
115 : : static cppu::OTypeCollection* pCollection = NULL;
116 [ # # ]: 0 : if ( !pCollection ) {
117 [ # # ][ # # ]: 0 : osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
118 [ # # ]: 0 : if ( !pCollection )
119 : : {
120 : : static cppu::OTypeCollection collection(
121 [ # # ]: 0 : getCppuType( static_cast< uno::Reference< lang::XTypeProvider >* >( 0 ) ),
122 [ # # ][ # # ]: 0 : getCppuType( static_cast< uno::Reference< XContentIdentifier >* >( 0 ) ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
123 : 0 : pCollection = &collection;
124 [ # # ]: 0 : }
125 : : }
126 : 0 : return (*pCollection).getTypes();
127 : : }
128 : :
129 : :
130 : : rtl::OUString
131 : : SAL_CALL
132 : 198470 : FileContentIdentifier::getContentIdentifier(
133 : : void )
134 : : throw( uno::RuntimeException )
135 : : {
136 : 198470 : return m_aContentId;
137 : : }
138 : :
139 : :
140 : : rtl::OUString SAL_CALL
141 : 24936 : FileContentIdentifier::getContentProviderScheme(
142 : : void )
143 : : throw( uno::RuntimeException )
144 : : {
145 : 24936 : return m_aProviderScheme;
146 : : }
147 : :
148 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|