1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ucb.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <com/sun/star/ucb/XCommandProcessor.hpp>
35 #include <com/sun/star/ucb/XContentProvider.hpp>
36 #include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
37 #include <com/sun/star/ucb/XContentProviderManager.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/lang/XComponent.hpp>
40 #include <com/sun/star/lang/XInitialization.hpp>
41 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
42 #include <com/sun/star/lang/XTypeProvider.hpp>
43 #include <rtl/ustrbuf.hxx>
44 #include <cppuhelper/weak.hxx>
45 #include <osl/mutex.hxx>
46 #include <osl/interlck.h>
47 #include <ucbhelper/macros.hxx>
48 #include "providermap.hxx"
50 //=========================================================================
52 #define UCB_SERVICE_NAME "com.sun.star.ucb.UniversalContentBroker"
54 //=========================================================================
56 namespace cppu
{ class OInterfaceContainerHelper
; }
58 namespace com
{ namespace sun
{ namespace star
{ namespace ucb
{
60 struct GlobalTransferCommandArgument
;
63 class UniversalContentBroker
:
64 public cppu::OWeakObject
,
65 public com::sun::star::lang::XTypeProvider
,
66 public com::sun::star::lang::XComponent
,
67 public com::sun::star::lang::XServiceInfo
,
68 public com::sun::star::lang::XInitialization
,
69 public com::sun::star::ucb::XContentProviderManager
,
70 public com::sun::star::ucb::XContentProvider
,
71 public com::sun::star::ucb::XContentIdentifierFactory
,
72 public com::sun::star::ucb::XCommandProcessor
75 UniversalContentBroker( const com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>& rXSMgr
);
76 virtual ~UniversalContentBroker();
90 throw( com::sun::star::uno::RuntimeException
);
92 addEventListener( const com::sun::star::uno::Reference
<
93 com::sun::star::lang::XEventListener
>& Listener
)
94 throw( com::sun::star::uno::RuntimeException
);
96 removeEventListener( const com::sun::star::uno::Reference
<
97 com::sun::star::lang::XEventListener
>& Listener
)
98 throw( com::sun::star::uno::RuntimeException
);
101 virtual void SAL_CALL
102 initialize( const com::sun::star::uno::Sequence
<
103 com::sun::star::uno::Any
>& aArguments
)
104 throw( com::sun::star::uno::Exception
,
105 com::sun::star::uno::RuntimeException
);
107 // XContentProviderManager
108 virtual com::sun::star::uno::Reference
<
109 com::sun::star::ucb::XContentProvider
> SAL_CALL
110 registerContentProvider( const com::sun::star::uno::Reference
<
111 com::sun::star::ucb::XContentProvider
>&
113 const rtl::OUString
& Scheme
,
114 sal_Bool ReplaceExisting
)
115 throw( com::sun::star::ucb::DuplicateProviderException
,
116 com::sun::star::uno::RuntimeException
);
117 virtual void SAL_CALL
118 deregisterContentProvider( const com::sun::star::uno::Reference
<
119 com::sun::star::ucb::XContentProvider
>&
121 const rtl::OUString
& Scheme
)
122 throw( com::sun::star::uno::RuntimeException
);
123 virtual com::sun::star::uno::Sequence
<
124 com::sun::star::ucb::ContentProviderInfo
> SAL_CALL
125 queryContentProviders()
126 throw( com::sun::star::uno::RuntimeException
);
127 virtual com::sun::star::uno::Reference
<
128 com::sun::star::ucb::XContentProvider
> SAL_CALL
129 queryContentProvider( const rtl::OUString
& Identifier
)
130 throw( com::sun::star::uno::RuntimeException
);
133 virtual com::sun::star::uno::Reference
<
134 com::sun::star::ucb::XContent
> SAL_CALL
135 queryContent( const com::sun::star::uno::Reference
<
136 com::sun::star::ucb::XContentIdentifier
>& Identifier
)
137 throw( com::sun::star::ucb::IllegalIdentifierException
,
138 com::sun::star::uno::RuntimeException
);
139 virtual sal_Int32 SAL_CALL
140 compareContentIds( const com::sun::star::uno::Reference
<
141 com::sun::star::ucb::XContentIdentifier
>& Id1
,
142 const com::sun::star::uno::Reference
<
143 com::sun::star::ucb::XContentIdentifier
>& Id2
)
144 throw( com::sun::star::uno::RuntimeException
);
146 // XContentIdentifierFactory
147 virtual com::sun::star::uno::Reference
<
148 com::sun::star::ucb::XContentIdentifier
> SAL_CALL
149 createContentIdentifier( const rtl::OUString
& ContentId
)
150 throw( com::sun::star::uno::RuntimeException
);
153 virtual sal_Int32 SAL_CALL
154 createCommandIdentifier()
155 throw( com::sun::star::uno::RuntimeException
);
156 virtual com::sun::star::uno::Any SAL_CALL
157 execute( const com::sun::star::ucb::Command
& aCommand
,
159 const com::sun::star::uno::Reference
<
160 com::sun::star::ucb::XCommandEnvironment
>& Environment
)
161 throw( com::sun::star::uno::Exception
,
162 com::sun::star::ucb::CommandAbortedException
,
163 com::sun::star::uno::RuntimeException
);
164 virtual void SAL_CALL
165 abort( sal_Int32 CommandId
)
166 throw( com::sun::star::uno::RuntimeException
);
169 com::sun::star::uno::Reference
< com::sun::star::ucb::XContentProvider
>
170 queryContentProvider( const rtl::OUString
& Identifier
,
171 sal_Bool bResolved
);
173 com::sun::star::uno::Reference
< com::sun::star::ucb::XCommandInfo
>
178 const com::sun::star::ucb::GlobalTransferCommandArgument
& rArg
,
179 const com::sun::star::uno::Reference
<
180 com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
181 throw( com::sun::star::uno::Exception
);
183 com::sun::star::uno::Reference
<
184 com::sun::star::lang::XMultiServiceFactory
> m_xSMgr
;
185 ProviderMap_Impl m_aProviders
;
187 cppu::OInterfaceContainerHelper
* m_pDisposeEventListeners
;
188 oslInterlockedCount m_nInitCount
; //@@@ see initialize() method
189 sal_Int32 m_nCommandId
;
192 #endif /* !_UCB_HXX */