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 .
20 #include <osl/diagnose.h>
21 #include <vcl/window.hxx>
22 #include <vcl/canvastools.hxx>
24 #include <cppcanvas/vclfactory.hxx>
26 #include "implbitmapcanvas.hxx"
27 #include "implspritecanvas.hxx"
28 #include "implbitmap.hxx"
29 #include <implrenderer.hxx>
31 using namespace ::com::sun::star
;
35 CanvasSharedPtr
VCLFactory::createCanvas( const uno::Reference
< rendering::XCanvas
>& xCanvas
)
37 return std::make_shared
<internal::ImplCanvas
>( xCanvas
);
40 BitmapCanvasSharedPtr
VCLFactory::createBitmapCanvas( const uno::Reference
< rendering::XBitmapCanvas
>& xCanvas
)
42 return std::make_shared
<internal::ImplBitmapCanvas
>( xCanvas
);
45 SpriteCanvasSharedPtr
VCLFactory::createSpriteCanvas( const vcl::Window
& rVCLWindow
)
47 return std::make_shared
<internal::ImplSpriteCanvas
>(
48 rVCLWindow
.GetOutDev()->GetSpriteCanvas() );
51 SpriteCanvasSharedPtr
VCLFactory::createSpriteCanvas( const uno::Reference
< rendering::XSpriteCanvas
>& xCanvas
)
53 return std::make_shared
<internal::ImplSpriteCanvas
>( xCanvas
);
56 BitmapSharedPtr
VCLFactory::createBitmap( const CanvasSharedPtr
& rCanvas
,
57 const ::BitmapEx
& rBmpEx
)
59 OSL_ENSURE( rCanvas
&& rCanvas
->getUNOCanvas().is(),
60 "VCLFactory::createBitmap(): Invalid canvas" );
63 return BitmapSharedPtr();
65 uno::Reference
< rendering::XCanvas
> xCanvas( rCanvas
->getUNOCanvas() );
67 return BitmapSharedPtr();
69 return std::make_shared
<internal::ImplBitmap
>( rCanvas
,
70 vcl::unotools::xBitmapFromBitmapEx(rBmpEx
) );
73 RendererSharedPtr
VCLFactory::createRenderer( const CanvasSharedPtr
& rCanvas
,
74 const ::GDIMetaFile
& rMtf
,
75 const Renderer::Parameters
& rParms
)
77 return std::make_shared
<internal::ImplRenderer
>( rCanvas
,
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */