Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/emfio/inc/emfreader.hxx
Line
Count
Source
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
#pragma once
20
21
#include "mtftools.hxx"
22
23
namespace emfio
24
{
25
    class EmfReader : public MtfTools
26
    {
27
    private:
28
        sal_uInt32   mnRecordCount;
29
30
        bool        mbRecordPath : 1;
31
        bool        mbEMFPlus : 1;
32
        bool        mbEMFPlusDualMode : 1;
33
        /// Another format is read already, can ignore actual EMF data.
34
        bool mbReadOtherGraphicFormat = false;
35
        basegfx::B2DTuple maSizeHint;
36
        bool mbEnableEMFPlus = true;
37
38
        bool        ReadHeader();
39
        // reads and converts the rectangle
40
        static tools::Rectangle ReadRectangle(sal_Int32, sal_Int32, sal_Int32, sal_Int32);
41
42
    public:
43
        EmfReader(SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile);
44
        ~EmfReader();
45
46
        bool ReadEnhWMF();
47
        void ReadGDIComment(sal_uInt32 nCommentId);
48
        /// Parses EMR_COMMENT_MULTIFORMATS.
49
        void ReadMultiformatsComment();
50
9.84k
        void SetSizeHint(const basegfx::B2DTuple& rSizeHint) { maSizeHint = rSizeHint; }
51
76
        void SetEnableEMFPlus(bool bEnableEMFPlus) { mbEnableEMFPlus = bEnableEMFPlus; }
52
53
    private:
54
        template <class T> void ReadAndDrawPolyPolygon(sal_uInt32 nNextPos);
55
        template <class T> void ReadAndDrawPolyLine(sal_uInt32 nNextPos);
56
        template <class T> tools::Polygon ReadPolygon(sal_uInt32 nStartIndex, sal_uInt32 nPoints, sal_uInt32 nNextPos);
57
        template <class T> tools::Polygon ReadPolygonWithSkip(const bool skipFirst, sal_uInt32 nNextPos);
58
59
        tools::Rectangle ReadRectangle();
60
        void ReadEMFPlusComment(sal_uInt32 length, bool& bHaveDC);
61
    };
62
}
63
64
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */