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 #ifndef INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_CACHEDPRIMITIVEBASE_HXX
21 #define INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_CACHEDPRIMITIVEBASE_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/rendering/XCanvas.hpp>
26 #include <cppcanvas/canvas.hxx>
27 #include <boost/utility.hpp>
31 namespace basegfx
{ class B2DHomMatrix
; }
34 /* Definition of internal::CachedPrimitiveBase class */
40 /** Base class providing cached re-rendering, if XCanvas
41 returns XCachedPrimitive
43 Derive from this class and implement private render()
44 method to perform the actual primitive rendering. Return
45 cached primitive into given reference. Next time this
46 class' public render() method gets called, the cached
47 representation is taken.
49 class CachedPrimitiveBase
: public Action
,
50 private ::boost::noncopyable
56 Canvas on which this primitive is to appear
58 @param bOnlyRedrawWithSameTransform
59 When true, this class only reuses the cached
60 primitive, if the overall transformation stays the
61 same. Otherwise, repaints are always performed via the
64 CachedPrimitiveBase( const CanvasSharedPtr
& rCanvas
,
65 bool bOnlyRedrawWithSameTransform
);
66 virtual ~CachedPrimitiveBase() {}
68 virtual bool render( const ::basegfx::B2DHomMatrix
& rTransformation
) const SAL_OVERRIDE
;
74 virtual bool renderPrimitive( ::com::sun::star::uno::Reference
<
75 ::com::sun::star::rendering::XCachedPrimitive
>& rCachedPrimitive
,
76 const ::basegfx::B2DHomMatrix
& rTransformation
) const = 0;
78 CanvasSharedPtr mpCanvas
;
79 mutable ::com::sun::star::uno::Reference
<
80 ::com::sun::star::rendering::XCachedPrimitive
> mxCachedPrimitive
;
81 mutable ::basegfx::B2DHomMatrix maLastTransformation
;
82 const bool mbOnlyRedrawWithSameTransform
;
87 #endif // INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_CACHEDPRIMITIVEBASE_HXX
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */