Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / inc / quartz / common.h
blob8e3f28669628dbadbb9f07164fcb3e3c74025ee6
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_VCL_INC_QUARTZ_COMMON_H
21 #define INCLUDED_VCL_INC_QUARTZ_COMMON_H
23 #include <iostream>
25 #include <premac.h>
26 #ifdef MACOSX
27 #include <ApplicationServices/ApplicationServices.h>
28 #else
29 #include <CoreGraphics/CoreGraphics.h>
30 #include <CoreText/CoreText.h>
31 #endif
32 #include <postmac.h>
34 #include <sal/types.h>
36 // CoreFoundation designers, in their wisdom, decided that CFRelease of NULL
37 // cause a Crash, yet few API can return NULL when asking for the creation
38 // of an object, which force us to peper the code with egly if construct everywhere
39 // and open the door to very nasty crash on rare occasion
40 // this macro hide the mess
41 #define SafeCFRelease(a) do { if(a) { CFRelease(a); (a)=NULL; } } while(false)
43 #define round_to_long(a) ((a) >= 0 ? ((long)((a) + 0.5)) : ((long)((a) - 0.5)))
45 #include "vcl/salgtype.hxx"
47 std::ostream &operator <<(std::ostream& s, CTFontRef pFont);
49 #endif // INCLUDED_VCL_INC_QUARTZ_COMMON_H
51 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */