summaryrefslogtreecommitdiffstats
path: root/include/i18nutil/paper.hxx
blob: b84d7b3af074efa7af81cc9f93f0e32067f681a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef INCLUDED_I18NUTIL_PAPER_HXX
#define INCLUDED_I18NUTIL_PAPER_HXX

#include <i18nutil/i18nutildllapi.h>
#include <rtl/string.hxx>
#include <tools/long.hxx>

namespace com::sun::star::lang
{
struct Locale;
}

//!! The values of the following enumerators must correspond to the array position
//!! of the respective paper size in the file i18nutil/source/utility/paper.cxx
//!! Thus don't reorder the enum values here without changing the code there as well.

//!! Also the RID_STR_PAPERNAMES array in vcl/inc/print.hrc and the
//!! PaperIndex array in Printer::GetPaperName() in
//!! vcl/source/gdi/print.cxx are parallel to this enum.
enum Paper : unsigned
{
    PAPER_A0,
    PAPER_A1,
    PAPER_A2,
    PAPER_A3,
    PAPER_A4,
    PAPER_A5,
    PAPER_B4_ISO,
    PAPER_B5_ISO,
    PAPER_LETTER,
    PAPER_LEGAL,
    PAPER_TABLOID,
    PAPER_USER,
    PAPER_B6_ISO,
    PAPER_ENV_C4,
    PAPER_ENV_C5,
    PAPER_ENV_C6,
    PAPER_ENV_C65,
    PAPER_ENV_DL,
    PAPER_SLIDE_DIA,
    PAPER_SCREEN_4_3,
    PAPER_C,
    PAPER_D,
    PAPER_E,
    PAPER_EXECUTIVE,
    PAPER_FANFOLD_LEGAL_DE,
    PAPER_ENV_MONARCH,
    PAPER_ENV_PERSONAL,
    PAPER_ENV_9,
    PAPER_ENV_10,
    PAPER_ENV_11,
    PAPER_ENV_12,
    PAPER_KAI16,
    PAPER_KAI32,
    PAPER_KAI32BIG,
    PAPER_B4_JIS,
    PAPER_B5_JIS,
    PAPER_B6_JIS,
    PAPER_LEDGER,
    PAPER_STATEMENT,
    PAPER_QUARTO,
    PAPER_10x14,
    PAPER_ENV_14,
    PAPER_ENV_C3,
    PAPER_ENV_ITALY,
    PAPER_FANFOLD_US,
    PAPER_FANFOLD_DE,
    PAPER_POSTCARD_JP,
    PAPER_9x11,
    PAPER_10x11,
    PAPER_15x11,
    PAPER_ENV_INVITE,
    PAPER_A_PLUS,
    PAPER_B_PLUS,
    PAPER_LETTER_PLUS,
    PAPER_A4_PLUS,
    PAPER_DOUBLEPOSTCARD_JP,
    PAPER_A6,
    PAPER_12x11,
    PAPER_A7,
    PAPER_A8,
    PAPER_A9,
    PAPER_A10,
    PAPER_B0_ISO,
    PAPER_B1_ISO,
    PAPER_B2_ISO,
    PAPER_B3_ISO,
    PAPER_B7_ISO,
    PAPER_B8_ISO,
    PAPER_B9_ISO,
    PAPER_B10_ISO,
    PAPER_ENV_C2,
    PAPER_ENV_C7,
    PAPER_ENV_C8,
    PAPER_ARCHA,
    PAPER_ARCHB,
    PAPER_ARCHC,
    PAPER_ARCHD,
    PAPER_ARCHE,
    PAPER_SCREEN_16_9,
    PAPER_SCREEN_16_10,
    PAPER_16K_195x270,
    PAPER_16K_197x273,
    PAPER_WIDESCREEN, //PowerPoint Widescreen
    PAPER_ONSCREENSHOW_4_3, //PowerPoint On-screen Show (4:3)
    PAPER_ONSCREENSHOW_16_9, //PowerPoint On-screen Show (16:9)
    PAPER_ONSCREENSHOW_16_10 //PowerPoint On-screen Show (16:10)
};

// defined for 'equal size' test with the implementation array
#define NUM_PAPER_ENTRIES (PAPER_ONSCREENSHOW_16_10 - PAPER_A0 + 1)

class I18NUTIL_DLLPUBLIC PaperInfo
{
    Paper m_eType;
    tools::Long m_nPaperWidth; // width in 100thMM
    tools::Long m_nPaperHeight; // height in 100thMM
public:
    PaperInfo(Paper eType);
    PaperInfo(tools::Long nPaperWidth, tools::Long nPaperHeight);

    Paper getPaper() const { return m_eType; }
    tools::Long getWidth() const { return m_nPaperWidth; }
    tools::Long getHeight() const { return m_nPaperHeight; }
    bool sloppyEqual(const PaperInfo& rOther) const;
    void doSloppyFit(bool bAlsoTryRotated = false);

    static PaperInfo getSystemDefaultPaper();
    static PaperInfo getDefaultPaperForLocale(const css::lang::Locale& rLocale);

    static Paper fromPSName(const OString& rName);
    static OString toPSName(Paper eType);

    static tools::Long sloppyFitPageDimension(tools::Long nDimension);
};

#endif // INCLUDED_I18NUTIL_PAPER_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */