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_SD_SOURCE_UI_SLIDESORTER_INC_VIEW_SLSFONTPROVIDER_HXX
21 #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_VIEW_SLSFONTPROVIDER_HXX
23 #include <tools/SdGlobalResourceContainer.hxx>
27 namespace vcl
{ class Font
; }
29 namespace sd
{ namespace slidesorter
{ namespace view
{
31 /** This simple singleton class provides fonts that are scaled so that they
32 have a fixed height on the given device regardless of its map mode.
35 : public SdGlobalResource
38 /** Return the single instance of this class. Throws a RuntimeException
39 when no instance can be created.
41 static FontProvider
& Instance();
43 /** Call this method to tell an object to release its currently used
44 font. The next call to GetFont() will then create a new one.
45 Typically called after a DataChange event when for instance a system
46 font has been modified.
51 static FontProvider
* mpInstance
;
53 /** The font that was created by a previous call to GetFont(). It is
54 replaced by another one only when GetFont() is called with a device
55 with a different map mode or by a call to Invalidate().
57 std::shared_ptr
<vcl::Font
> maFont
;
60 virtual ~FontProvider() override
;
62 FontProvider (const FontProvider
&) = delete;
63 FontProvider
& operator= (const FontProvider
&) = delete;
66 } } } // end of namespace ::sd::slidesorter::view
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */