bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / slidesorter / inc / view / SlsFontProvider.hxx
blobd4b781736392c0af7983162e69a142885d976235
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 #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"
25 #include <boost/shared_ptr.hpp>
26 #include <vcl/mapmod.hxx>
28 namespace vcl { class Font; }
30 namespace sd { namespace slidesorter { namespace view {
32 /** This simple singleton class provides fonts that are scaled so that they
33 have a fixed height on the given device regardless of its map mode.
35 class FontProvider
36 : public SdGlobalResource
38 public:
39 typedef boost::shared_ptr<vcl::Font> SharedFontPointer;
41 /** Return the single instance of this class. Throws a RuntimeException
42 when no instance can be created.
44 static FontProvider& Instance();
46 /** Call this method to tell an object to release its currently used
47 font. The next call to GetFont() will then create a new one.
48 Typically called after a DataChange event when for instance a system
49 font has been modified.
51 void Invalidate();
53 private:
54 static FontProvider* mpInstance;
56 /** The font that was created by a previous call to GetFont(). It is
57 replaced by another one only when GetFont() is called with a device
58 with a different map mode or by a call to Invalidate().
60 SharedFontPointer maFont;
61 /** The mape mode for which maFont was created.
63 MapMode maMapMode;
65 FontProvider();
66 virtual ~FontProvider();
68 FontProvider (const FontProvider&) SAL_DELETED_FUNCTION;
69 FontProvider& operator= (const FontProvider&) SAL_DELETED_FUNCTION;
72 } } } // end of namespace ::sd::slidesorter::view
74 #endif
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */