fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / ucp / tdoc / tdoc_documentcontentfactory.cxx
blob2318d3af2ddbe8fb42cf6896551a6c0bdd5b381a
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/factory.hxx"
28 #include <cppuhelper/supportsservice.hxx>
30 #include "tdoc_documentcontentfactory.hxx"
32 using namespace com::sun::star;
33 using namespace tdoc_ucp;
38 // DocumentContentFactory Implementation.
43 DocumentContentFactory::DocumentContentFactory(
44 const uno::Reference< lang::XMultiServiceFactory >& xSMgr )
45 : m_xSMgr( xSMgr )
50 // virtual
51 DocumentContentFactory::~DocumentContentFactory()
57 // XServiceInfo methods.
61 // virtual
62 OUString SAL_CALL DocumentContentFactory::getImplementationName()
63 throw ( uno::RuntimeException, std::exception )
65 return getImplementationName_Static();
68 // virtual
69 sal_Bool SAL_CALL
70 DocumentContentFactory::supportsService( const OUString& ServiceName )
71 throw ( uno::RuntimeException, std::exception )
73 return cppu::supportsService(this, ServiceName);
76 // virtual
77 uno::Sequence< OUString > SAL_CALL
78 DocumentContentFactory::getSupportedServiceNames()
79 throw ( uno::RuntimeException, std::exception )
81 return getSupportedServiceNames_Static();
85 // static
86 OUString DocumentContentFactory::getImplementationName_Static()
88 return OUString(
89 "com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory" );
93 // static
94 uno::Sequence< OUString >
95 DocumentContentFactory::getSupportedServiceNames_Static()
97 uno::Sequence< OUString > aSNS( 1 );
98 aSNS.getArray()[ 0 ]
99 = "com.sun.star.frame.TransientDocumentsDocumentContentFactory";
100 return aSNS;
105 // XTransientDocumentsDocumentContentFactory methods.
109 // virtual
110 uno::Reference< ucb::XContent > SAL_CALL
111 DocumentContentFactory::createDocumentContent(
112 const uno::Reference< frame::XModel >& Model )
113 throw ( lang::IllegalArgumentException, uno::RuntimeException, std::exception )
115 uno::Reference< frame::XTransientDocumentsDocumentContentFactory > xDocFac;
118 xDocFac
119 = uno::Reference< frame::XTransientDocumentsDocumentContentFactory >(
120 m_xSMgr->createInstance(
121 OUString(
122 "com.sun.star.ucb.TransientDocumentsContentProvider" )
124 uno::UNO_QUERY );
126 catch ( uno::Exception const & )
128 // handled below.
131 if ( xDocFac.is() )
132 return xDocFac->createDocumentContent( Model );
134 throw uno::RuntimeException(
135 OUString(
136 "Unable to obtain document content factory!" ),
137 static_cast< cppu::OWeakObject * >( this ) );
142 // Service factory implementation.
146 static uno::Reference< uno::XInterface > SAL_CALL
147 DocumentContentFactory_CreateInstance(
148 const uno::Reference< lang::XMultiServiceFactory> & rSMgr )
149 throw( uno::Exception )
151 lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >(
152 new DocumentContentFactory( rSMgr ) );
153 return uno::Reference< uno::XInterface >::query( pX );
157 // static
158 uno::Reference< lang::XSingleServiceFactory >
159 DocumentContentFactory::createServiceFactory(
160 const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr )
162 return uno::Reference< lang::XSingleServiceFactory >(
163 cppu::createOneInstanceFactory(
164 rxServiceMgr,
165 DocumentContentFactory::getImplementationName_Static(),
166 DocumentContentFactory_CreateInstance,
167 DocumentContentFactory::getSupportedServiceNames_Static() ) );
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */