fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucbhelper / source / provider / contentidentifier.cxx
blobb95d3f4fc95bf4ba8339b5d452bf1c052835dcba
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 .
21 /**************************************************************************
22 TODO
23 **************************************************************************
25 *************************************************************************/
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <ucbhelper/contentidentifier.hxx>
28 #include <cppuhelper/typeprovider.hxx>
29 #include <cppuhelper/queryinterface.hxx>
30 #include <osl/mutex.hxx>
32 using namespace com::sun::star::uno;
33 using namespace com::sun::star::lang;
34 using namespace com::sun::star::ucb;
37 namespace ucbhelper
43 // struct ContentIdentifier_Impl.
48 struct ContentIdentifier_Impl
50 OUString m_aContentId;
51 OUString m_aProviderScheme;
52 osl::Mutex m_aMutex;
54 ContentIdentifier_Impl( const OUString& rURL );
59 // ContentIdentifier_Impl Implementation.
63 ContentIdentifier_Impl::ContentIdentifier_Impl(const OUString& rURL )
65 // Normalize URL scheme ( it's case insensitive ).
67 // The content provider scheme is the part before the first ':'
68 // within the content id.
69 sal_Int32 nPos = rURL.indexOf( ':', 0 );
70 if ( nPos != -1 )
72 OUString aScheme( rURL.copy( 0, nPos ) );
73 m_aProviderScheme = aScheme.toAsciiLowerCase();
74 m_aContentId = rURL.replaceAt( 0, nPos, aScheme );
80 // ContentIdentifier Implementation.
84 ContentIdentifier::ContentIdentifier( const OUString& rURL )
86 m_pImpl = new ContentIdentifier_Impl( rURL );
90 // virtual
91 ContentIdentifier::~ContentIdentifier()
93 delete m_pImpl;
98 // XInterface methods.
103 // virtual
104 void SAL_CALL ContentIdentifier::acquire() throw()
106 OWeakObject::acquire();
110 // virtual
111 void SAL_CALL ContentIdentifier::release() throw()
113 OWeakObject::release();
117 // virtual
118 Any SAL_CALL
119 ContentIdentifier::queryInterface( const Type & rType )
120 throw ( RuntimeException, std::exception )
122 Any aRet = cppu::queryInterface( rType,
123 static_cast< XTypeProvider * >( this ),
124 static_cast< XContentIdentifier * >( this ) );
126 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
131 // XTypeProvider methods.
135 // virtual
136 Sequence< sal_Int8 > SAL_CALL
137 ContentIdentifier::getImplementationId()
138 throw( RuntimeException, std::exception )
140 return css::uno::Sequence<sal_Int8>();
144 // virtual
145 Sequence< com::sun::star::uno::Type > SAL_CALL
146 ContentIdentifier::getTypes()
147 throw( RuntimeException, std::exception )
149 static cppu::OTypeCollection* pCollection = NULL;
150 if ( !pCollection )
152 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
153 if ( !pCollection )
155 static cppu::OTypeCollection collection(
156 cppu::UnoType<XTypeProvider>::get(),
157 cppu::UnoType<XContentIdentifier>::get() );
158 pCollection = &collection;
161 return (*pCollection).getTypes();
166 // XContentIdentifier methods.
170 // virtual
171 OUString SAL_CALL ContentIdentifier::getContentIdentifier()
172 throw( RuntimeException, std::exception )
174 return m_pImpl->m_aContentId;
178 // virtual
179 OUString SAL_CALL ContentIdentifier::getContentProviderScheme()
180 throw( RuntimeException, std::exception )
182 return m_pImpl->m_aProviderScheme;
185 } /* namespace ucbhelper */
187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */