Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include "view/SlsFontProvider.hxx"
22 :
23 : #include "controller/SlideSorterController.hxx"
24 :
25 : #include <sfx2/app.hxx>
26 : #include <com/sun/star/uno/RuntimeException.hpp>
27 :
28 :
29 : using namespace ::sd::slidesorter;
30 :
31 : namespace sd { namespace slidesorter { namespace view {
32 :
33 : FontProvider* FontProvider::mpInstance = NULL;
34 :
35 0 : FontProvider& FontProvider::Instance (void)
36 : {
37 0 : if (mpInstance == NULL)
38 : {
39 : ::osl::GetGlobalMutex aMutexFunctor;
40 0 : ::osl::MutexGuard aGuard (aMutexFunctor());
41 0 : if (mpInstance == NULL)
42 : {
43 : // Create an instance of the class and register it at the
44 : // SdGlobalResourceContainer so that it is eventually released.
45 0 : FontProvider* pInstance = new FontProvider();
46 0 : SdGlobalResourceContainer::Instance().AddResource (
47 0 : ::std::auto_ptr<SdGlobalResource>(pInstance));
48 : OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
49 0 : mpInstance = pInstance;
50 0 : }
51 : }
52 : else
53 : {
54 : OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
55 : }
56 :
57 : // We throw an exception when for some strange reason no instance of
58 : // this class exists.
59 0 : if (mpInstance == NULL)
60 : throw ::com::sun::star::uno::RuntimeException("com.sun.star.document.IndexedPropertyValues",
61 0 : NULL);
62 :
63 0 : return *mpInstance;
64 : }
65 :
66 :
67 :
68 :
69 0 : FontProvider::FontProvider (void)
70 : : maFont(),
71 0 : maMapMode()
72 : {
73 0 : }
74 :
75 :
76 :
77 :
78 0 : FontProvider::~FontProvider (void)
79 : {
80 0 : }
81 :
82 :
83 :
84 :
85 0 : void FontProvider::Invalidate (void)
86 : {
87 0 : maFont.reset();
88 0 : }
89 :
90 :
91 :
92 : } } } // end of namespace ::sd::slidesorter::view
93 :
94 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|