LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / canvas / inc / base / cachedprimitivebase.hxx
blobffdee6ee26f7fbf1c63c8d6d6ff8282b41d4a900
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 .
20 #pragma once
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 <cppuhelper/compbase.hxx>
27 #include <cppuhelper/basemutex.hxx>
29 #include <canvas/canvastoolsdllapi.h>
31 namespace com::sun::star::rendering { class XCanvas; }
33 /* Definition of CachedPrimitiveBase class */
35 namespace canvas
37 typedef cppu::WeakComponentImplHelper< css::rendering::XCachedPrimitive,
38 css::lang::XServiceInfo > CachedPrimitiveBase_Base;
40 /** Base class, providing common functionality for implementers of
41 the XCachedPrimitive interface.
43 class CANVASTOOLS_DLLPUBLIC CachedPrimitiveBase:
44 public cppu::BaseMutex, public CachedPrimitiveBase_Base
46 public:
48 /** Create an XCachedPrimitive for given target canvas
50 @param rUsedViewState
51 The viewstate the original object was rendered with
53 @param rTarget
54 The target canvas the repaint should happen on.
56 CachedPrimitiveBase( const css::rendering::ViewState& rUsedViewState,
57 const css::uno::Reference< css::rendering::XCanvas >& rTarget );
59 /// Dispose all internal references
60 virtual void SAL_CALL disposing() override;
62 // XCachedPrimitive
63 virtual ::sal_Int8 SAL_CALL redraw( const css::rendering::ViewState& aState ) override;
65 // XServiceInfo
66 virtual OUString SAL_CALL getImplementationName( ) override;
67 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
68 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
70 protected:
71 virtual ~CachedPrimitiveBase() override; // we're a ref-counted UNO class. _We_ destroy ourselves.
73 private:
74 CachedPrimitiveBase( const CachedPrimitiveBase& ) = delete;
75 CachedPrimitiveBase& operator=( const CachedPrimitiveBase& ) = delete;
77 /** Actually perform the requested redraw.
79 Clients must override this method, instead of the public
80 redraw() one.
82 @param rNewState
83 The viewstate to redraw with
85 @param rOldState
86 The viewstate this cache object was created with.
88 @param rTargetCanvas
89 Target canvas to render to.
91 @param bSameViewTransform
92 When true, rNewState and rOldState have the same transformation.
94 virtual ::sal_Int8 doRedraw( const css::rendering::ViewState& rNewState,
95 const css::rendering::ViewState& rOldState,
96 const css::uno::Reference< css::rendering::XCanvas >& rTargetCanvas,
97 bool bSameViewTransform ) = 0;
99 css::rendering::ViewState maUsedViewState;
100 css::uno::Reference< css::rendering::XCanvas > mxTarget;
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */