Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/unx/generic/print/prtsetup.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
20
#pragma once
21
22
#include <vcl/idle.hxx>
23
#include <vcl/weld/Builder.hxx>
24
#include <vcl/weld/ComboBox.hxx>
25
#include <vcl/weld/DialogController.hxx>
26
#include <vcl/weld/Entry.hxx>
27
#include <vcl/weld/Notebook.hxx>
28
#include <vcl/weld/TreeView.hxx>
29
#include <vcl/weld/weld.hxx>
30
#include <ppdparser.hxx>
31
#include <printerinfomanager.hxx>
32
33
class RTSPaperPage;
34
class RTSDevicePage;
35
36
class RTSDialog : public weld::GenericDialogController
37
{
38
    friend class RTSPaperPage;
39
    friend class RTSDevicePage;
40
41
    ::psp::PrinterInfo m_aJobData;
42
43
    bool m_bDataModified;
44
45
    // controls
46
    std::unique_ptr<weld::Notebook> m_xTabControl;
47
    std::unique_ptr<weld::Button> m_xOKButton;
48
    std::unique_ptr<weld::Button> m_xCancelButton;
49
50
    // pages
51
    std::unique_ptr<RTSPaperPage> m_xPaperPage;
52
    std::unique_ptr<RTSDevicePage> m_xDevicePage;
53
54
    DECL_LINK(ActivatePage, const OUString&, void);
55
    DECL_LINK(ClickButton, weld::Button&, void);
56
57
    // helper functions
58
    void insertAllPPDValues(weld::ComboBox&, const psp::PPDParser*, const psp::PPDKey*);
59
60
public:
61
    RTSDialog(const ::psp::PrinterInfo& rJobData, weld::Window* pParent);
62
    virtual ~RTSDialog() override;
63
64
0
    const ::psp::PrinterInfo& getSetup() const { return m_aJobData; }
65
66
0
    void SetDataModified(bool bModified) { m_bDataModified = bModified; }
67
0
    bool GetDataModified() const { return m_bDataModified; }
68
};
69
70
class RTSPaperPage
71
{
72
private:
73
    std::unique_ptr<weld::Builder> m_xBuilder;
74
75
    RTSDialog* m_pParent;
76
77
    std::unique_ptr<weld::Widget> m_xContainer;
78
79
    std::unique_ptr<weld::CheckButton> m_xCbFromSetup;
80
81
    std::unique_ptr<weld::Label> m_xPaperText;
82
    std::unique_ptr<weld::ComboBox> m_xPaperBox;
83
84
    std::unique_ptr<weld::Label> m_xOrientText;
85
    std::unique_ptr<weld::ComboBox> m_xOrientBox;
86
87
    std::unique_ptr<weld::Label> m_xDuplexText;
88
    std::unique_ptr<weld::ComboBox> m_xDuplexBox;
89
90
    std::unique_ptr<weld::Label> m_xSlotText;
91
    std::unique_ptr<weld::ComboBox> m_xSlotBox;
92
93
    DECL_LINK(SelectHdl, weld::ComboBox&, void);
94
    DECL_LINK(CheckBoxHdl, weld::Toggleable&, void);
95
96
public:
97
    RTSPaperPage(weld::Widget* pPage, RTSDialog* pDialog);
98
    ~RTSPaperPage();
99
100
    void update();
101
102
0
    sal_Int32 getOrientation() const { return m_xOrientBox->get_active(); }
103
};
104
105
class RTSDevicePage
106
{
107
private:
108
    std::unique_ptr<weld::Builder> m_xBuilder;
109
110
    const psp::PPDValue* m_pCustomValue;
111
    RTSDialog* m_pParent;
112
113
    std::unique_ptr<weld::Widget> m_xContainer;
114
    std::unique_ptr<weld::TreeView> m_xPPDKeyBox;
115
    std::unique_ptr<weld::TreeView> m_xPPDValueBox;
116
    std::unique_ptr<weld::Entry> m_xCustomEdit;
117
118
    std::unique_ptr<weld::ComboBox> m_xSpaceBox;
119
    std::unique_ptr<weld::ComboBox> m_xDepthBox;
120
121
    void FillValueBox(const ::psp::PPDKey*);
122
    void ValueBoxChanged(const ::psp::PPDKey*);
123
124
    Idle m_aReselectCustomIdle;
125
126
    DECL_LINK(SelectHdl, weld::TreeView&, void);
127
    DECL_LINK(ModifyHdl, weld::Entry&, void);
128
    DECL_LINK(ComboChangedHdl, weld::ComboBox&, void);
129
    DECL_LINK(ImplHandleReselectHdl, Timer*, void);
130
131
public:
132
    RTSDevicePage(weld::Widget* pPage, RTSDialog* pDialog);
133
    ~RTSDevicePage();
134
135
    sal_uLong getDepth() const;
136
    sal_uLong getColorDevice() const;
137
};
138
139
int SetupPrinterDriver(weld::Window* pParent, ::psp::PrinterInfo& rJobData);
140
141
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */