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 .
22 #include <com/sun/star/uno/Reference.hxx>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/rendering/XCachedPrimitive.hpp>
25 #include <com/sun/star/rendering/ViewState.hpp>
26 #include <comphelper/compbase.hxx>
28 #include <canvas/canvastoolsdllapi.h>
30 namespace com::sun::star::rendering
{ class XCanvas
; }
32 /* Definition of CachedPrimitiveBase class */
36 typedef comphelper::WeakComponentImplHelper
< css::rendering::XCachedPrimitive
,
37 css::lang::XServiceInfo
> CachedPrimitiveBase_Base
;
39 /** Base class, providing common functionality for implementers of
40 the XCachedPrimitive interface.
42 class CANVASTOOLS_DLLPUBLIC CachedPrimitiveBase
:
43 public CachedPrimitiveBase_Base
47 /** Create an XCachedPrimitive for given target canvas
50 The viewstate the original object was rendered with
53 The target canvas the repaint should happen on.
55 CachedPrimitiveBase( css::rendering::ViewState rUsedViewState
,
56 css::uno::Reference
< css::rendering::XCanvas
> xTarget
);
58 /// Dispose all internal references
59 virtual void disposing(std::unique_lock
<std::mutex
>& rGuard
) override
;
62 virtual ::sal_Int8 SAL_CALL
redraw( const css::rendering::ViewState
& aState
) override
;
65 virtual OUString SAL_CALL
getImplementationName( ) override
;
66 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
67 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
70 virtual ~CachedPrimitiveBase() override
; // we're a ref-counted UNO class. _We_ destroy ourselves.
73 CachedPrimitiveBase( const CachedPrimitiveBase
& ) = delete;
74 CachedPrimitiveBase
& operator=( const CachedPrimitiveBase
& ) = delete;
76 /** Actually perform the requested redraw.
78 Clients must override this method, instead of the public
82 The viewstate to redraw with
85 The viewstate this cache object was created with.
88 Target canvas to render to.
90 @param bSameViewTransform
91 When true, rNewState and rOldState have the same transformation.
93 virtual ::sal_Int8
doRedraw( const css::rendering::ViewState
& rNewState
,
94 const css::rendering::ViewState
& rOldState
,
95 const css::uno::Reference
< css::rendering::XCanvas
>& rTargetCanvas
,
96 bool bSameViewTransform
) = 0;
98 css::rendering::ViewState maUsedViewState
;
99 css::uno::Reference
< css::rendering::XCanvas
> mxTarget
;
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */