LibreOffice Module drawinglayer (master) 1
emfpfont.cxx
Go to the documentation of this file.
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#include <sal/log.hxx>
21#include <rtl/ustrbuf.hxx>
22#include "emfpfont.hxx"
23
24namespace emfplushelper
25{
26 static OUString FontStyleToString(sal_uInt32 style)
27 {
28 OUStringBuffer sStyle;
29
30 if (style & FontStyleBold)
31 sStyle = "\n\t\t\tFontStyleBold";
32
33 if (style & FontStyleItalic)
34 sStyle.append("\n\t\t\tFontStyleItalic");
35
36 if (style & FontStyleUnderline)
37 sStyle.append("\n\t\t\tFontStyleUnderline");
38
39 if (style & FontStyleStrikeout)
40 sStyle.append("\n\t\t\tFontStyleStrikeout");
41
42 return sStyle.makeStringAndClear();
43 }
44
46 {
47 sal_uInt32 header;
48 sal_uInt32 reserved;
49 sal_uInt32 length;
51 SAL_WARN_IF((header >> 12) != 0xdbc01, "drawinglayer.emf", "Invalid header - not 0xdbc01");
52 SAL_INFO("drawinglayer.emf", "EMF+\tHeader: 0x" << std::hex << (header >> 12));
53 SAL_INFO("drawinglayer.emf", "EMF+\tVersion: 0x" << (header & 0x1fff));
54 SAL_INFO("drawinglayer.emf", "EMF+\tSize: " << std::dec << emSize);
55 SAL_INFO("drawinglayer.emf", "EMF+\tUnit: " << UnitTypeToString(sizeUnit) << " (0x" << std::hex << sizeUnit << ")" << std::dec);
56 SAL_INFO("drawinglayer.emf", "EMF+\tFlags: " << FontStyleToString(fontFlags) << " (0x" << std::hex << fontFlags << ")");
57 SAL_INFO("drawinglayer.emf", "EMF+\tReserved: 0x" << reserved << std::dec);
58 SAL_INFO("drawinglayer.emf", "EMF+\tLength: " << length);
59
60 if (length <= 0 || length >= 0x4000)
61 return;
62
63 rtl_uString *pStr = rtl_uString_alloc(length);
64 sal_Unicode *chars = pStr->buffer;
65
66 for (sal_uInt32 i = 0; i < length; ++i)
67 {
68 s.ReadUtf16(chars[i]);
69 }
70
71 family = OUString(pStr, SAL_NO_ACQUIRE);
72 SAL_INFO("drawinglayer.emf", "EMF+\tFamily: " << family);
73 }
74}
75
76/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr sal_Int8 header[]
SvStream & ReadFloat(float &rFloat)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
SvStream & ReadUtf16(sal_Unicode &rUtf16)
SvStream & ReadInt32(sal_Int32 &rInt32)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_INFO(area, stream)
const sal_uInt32 FontStyleBold
Definition: emfpfont.hxx:26
OUString UnitTypeToString(sal_uInt16 nType)
const sal_uInt32 FontStyleItalic
Definition: emfpfont.hxx:27
static OUString FontStyleToString(sal_uInt32 style)
Definition: emfpfont.cxx:26
const sal_uInt32 FontStyleUnderline
Definition: emfpfont.hxx:28
const sal_uInt32 FontStyleStrikeout
Definition: emfpfont.hxx:29
int i
void Read(SvMemoryStream &s)
Definition: emfpfont.cxx:45
sal_uInt16 sal_Unicode