bump product version to 7.2.5.1
[LibreOffice.git] / ucb / source / ucp / tdoc / tdoc_documentcontentfactory.cxx
blob84d59df3d378a722a08f3db20bf567eb82ba3a6f
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 *************************************************************************/
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <cppuhelper/factory.hxx>
29 #include <cppuhelper/supportsservice.hxx>
30 #include <cppuhelper/weak.hxx>
32 #include "tdoc_documentcontentfactory.hxx"
34 using namespace com::sun::star;
35 using namespace tdoc_ucp;
38 // DocumentContentFactory Implementation.
41 DocumentContentFactory::DocumentContentFactory(
42 const uno::Reference< uno::XComponentContext >& rxContext )
43 : m_xContext( rxContext )
48 // virtual
49 DocumentContentFactory::~DocumentContentFactory()
54 // XServiceInfo methods.
57 // virtual
58 OUString SAL_CALL DocumentContentFactory::getImplementationName()
60 return "com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory";
63 // virtual
64 sal_Bool SAL_CALL
65 DocumentContentFactory::supportsService( const OUString& ServiceName )
67 return cppu::supportsService(this, ServiceName);
70 // virtual
71 uno::Sequence< OUString > SAL_CALL
72 DocumentContentFactory::getSupportedServiceNames()
74 return { "com.sun.star.frame.TransientDocumentsDocumentContentFactory" };
78 // XTransientDocumentsDocumentContentFactory methods.
81 // virtual
82 uno::Reference< ucb::XContent > SAL_CALL
83 DocumentContentFactory::createDocumentContent(
84 const uno::Reference< frame::XModel >& Model )
86 uno::Reference< frame::XTransientDocumentsDocumentContentFactory > xDocFac;
87 try
89 xDocFac.set( m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.ucb.TransientDocumentsContentProvider", m_xContext),
90 uno::UNO_QUERY );
92 catch ( uno::Exception const & )
94 // handled below.
97 if ( xDocFac.is() )
98 return xDocFac->createDocumentContent( Model );
100 throw uno::RuntimeException(
101 "Unable to obtain document content factory!",
102 static_cast< cppu::OWeakObject * >( this ) );
106 // Service factory implementation.
108 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
109 ucb_tdoc_DocumentContentFactory_get_implementation(
110 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
112 return cppu::acquire(new DocumentContentFactory(context));
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */