tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / ucb / source / ucp / tdoc / tdoc_documentcontentfactory.cxx
blob74b29ac6e7f3b9786f9fbdf54df3a676e1f3ea76
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 <cppuhelper/supportsservice.hxx>
28 #include <cppuhelper/weak.hxx>
29 #include <utility>
31 #include "tdoc_documentcontentfactory.hxx"
33 using namespace com::sun::star;
34 using namespace tdoc_ucp;
37 // DocumentContentFactory Implementation.
40 DocumentContentFactory::DocumentContentFactory(
41 uno::Reference< uno::XComponentContext > xContext )
42 : m_xContext(std::move( xContext ))
47 // virtual
48 DocumentContentFactory::~DocumentContentFactory()
53 // XServiceInfo methods.
56 // virtual
57 OUString SAL_CALL DocumentContentFactory::getImplementationName()
59 return u"com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory"_ustr;
62 // virtual
63 sal_Bool SAL_CALL
64 DocumentContentFactory::supportsService( const OUString& ServiceName )
66 return cppu::supportsService(this, ServiceName);
69 // virtual
70 uno::Sequence< OUString > SAL_CALL
71 DocumentContentFactory::getSupportedServiceNames()
73 return { u"com.sun.star.frame.TransientDocumentsDocumentContentFactory"_ustr };
77 // XTransientDocumentsDocumentContentFactory methods.
80 // virtual
81 uno::Reference< ucb::XContent > SAL_CALL
82 DocumentContentFactory::createDocumentContent(
83 const uno::Reference< frame::XModel >& Model )
85 uno::Reference< frame::XTransientDocumentsDocumentContentFactory > xDocFac;
86 try
88 xDocFac.set( m_xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.ucb.TransientDocumentsContentProvider"_ustr, m_xContext),
89 uno::UNO_QUERY );
91 catch ( uno::Exception const & )
93 // handled below.
96 if ( xDocFac.is() )
97 return xDocFac->createDocumentContent( Model );
99 throw uno::RuntimeException(
100 u"Unable to obtain document content factory!"_ustr,
101 getXWeak() );
105 // Service factory implementation.
107 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
108 ucb_tdoc_DocumentContentFactory_get_implementation(
109 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
111 return cppu::acquire(new DocumentContentFactory(context));
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */