1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 /**************************************************************************
23 **************************************************************************
25 *************************************************************************/
27 #include <cppuhelper/factory.hxx>
28 #include <cppuhelper/supportsservice.hxx>
30 #include "tdoc_documentcontentfactory.hxx"
32 using namespace com::sun::star
;
33 using namespace tdoc_ucp
;
36 // DocumentContentFactory Implementation.
39 DocumentContentFactory::DocumentContentFactory(
40 const uno::Reference
< lang::XMultiServiceFactory
>& xSMgr
)
47 DocumentContentFactory::~DocumentContentFactory()
52 // XServiceInfo methods.
56 OUString SAL_CALL
DocumentContentFactory::getImplementationName()
58 return getImplementationName_Static();
63 DocumentContentFactory::supportsService( const OUString
& ServiceName
)
65 return cppu::supportsService(this, ServiceName
);
69 uno::Sequence
< OUString
> SAL_CALL
70 DocumentContentFactory::getSupportedServiceNames()
72 return getSupportedServiceNames_Static();
77 OUString
DocumentContentFactory::getImplementationName_Static()
80 "com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory";
85 uno::Sequence
< OUString
>
86 DocumentContentFactory::getSupportedServiceNames_Static()
88 uno::Sequence
< OUString
> aSNS
{ "com.sun.star.frame.TransientDocumentsDocumentContentFactory" };
93 // XTransientDocumentsDocumentContentFactory methods.
97 uno::Reference
< ucb::XContent
> SAL_CALL
98 DocumentContentFactory::createDocumentContent(
99 const uno::Reference
< frame::XModel
>& Model
)
101 uno::Reference
< frame::XTransientDocumentsDocumentContentFactory
> xDocFac
;
104 xDocFac
.set( m_xSMgr
->createInstance("com.sun.star.ucb.TransientDocumentsContentProvider"),
107 catch ( uno::Exception
const & )
113 return xDocFac
->createDocumentContent( Model
);
115 throw uno::RuntimeException(
116 "Unable to obtain document content factory!",
117 static_cast< cppu::OWeakObject
* >( this ) );
121 // Service factory implementation.
123 /// @throws uno::Exception
124 static uno::Reference
< uno::XInterface
>
125 DocumentContentFactory_CreateInstance(
126 const uno::Reference
< lang::XMultiServiceFactory
> & rSMgr
)
128 return static_cast<lang::XServiceInfo
*>(new DocumentContentFactory(rSMgr
));
133 uno::Reference
< lang::XSingleServiceFactory
>
134 DocumentContentFactory::createServiceFactory(
135 const uno::Reference
< lang::XMultiServiceFactory
>& rxServiceMgr
)
137 return cppu::createOneInstanceFactory(
139 DocumentContentFactory::getImplementationName_Static(),
140 DocumentContentFactory_CreateInstance
,
141 DocumentContentFactory::getSupportedServiceNames_Static() );
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */