LibreOffice Module sw (master) 1
envlop.hxx
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#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_ENVLOP_HXX
20#define INCLUDED_SW_SOURCE_UIBASE_INC_ENVLOP_HXX
21
22#include <sfx2/tabdlg.hxx>
23#include <vcl/weld.hxx>
24#include <vcl/customweld.hxx>
25#include "envimg.hxx"
26
27#define GetFieldVal(rField) (rField).Denormalize((rField).GetValue(FieldUnit::TWIP))
28#define SetFieldVal(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FieldUnit::TWIP)
29
30inline int getfieldval(const weld::MetricSpinButton& rField)
31{
32 return rField.denormalize(rField.get_value(FieldUnit::TWIP));
33}
34
35inline void setfieldval(weld::MetricSpinButton& rField, int lValue)
36{
37 rField.set_value(rField.normalize(lValue), FieldUnit::TWIP);
38}
39
40class SwEnvDlg;
41class SwEnvPage;
42class SwEnvFormatPage;
43class SwWrtShell;
44class Printer;
45
47{
48private:
50
51 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
52 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
53
54public:
56 void SetDialog(SwEnvDlg* pDialog) { m_pDialog = pDialog; }
57};
58
59class SwEnvDlg final : public SfxTabDialogController
60{
61 friend class SwEnvPage;
62 friend class SwEnvFormatPage;
63 friend class SwEnvPrtPage;
64 friend class SwEnvPreview;
65
69 std::unique_ptr<SfxItemSet> m_pAddresseeSet;
70 std::unique_ptr<SfxItemSet> m_pSenderSet;
71
72 std::unique_ptr<weld::Button> m_xModify;
73
74 virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override;
75 virtual short Ok() override;
76
77public:
78 SwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt,
79 bool bInsert);
80 virtual ~SwEnvDlg() override;
81};
82
83class SwEnvPage final : public SfxTabPage
84{
87 OUString m_sActDBName;
88
90 std::unique_ptr<weld::TextView> m_xAddrEdit;
91 std::unique_ptr<weld::ComboBox> m_xDatabaseLB;
92 std::unique_ptr<weld::ComboBox> m_xTableLB;
93 std::unique_ptr<weld::ComboBox> m_xDBFieldLB;
94 std::unique_ptr<weld::Button> m_xInsertBT;
95 std::unique_ptr<weld::CheckButton> m_xSenderBox;
96 std::unique_ptr<weld::TextView> m_xSenderEdit;
97 std::unique_ptr<weld::CustomWeld> m_xPreview;
98
99 DECL_LINK(DatabaseHdl, weld::ComboBox&, void);
100 DECL_LINK(FieldHdl, weld::Button&, void);
101 DECL_LINK(SenderHdl, weld::Toggleable&, void);
102
103 void InitDatabaseBox();
104
106
107public:
108 SwEnvPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
109 void Init(SwEnvDlg* pDialog);
110 virtual ~SwEnvPage() override;
111
112 static std::unique_ptr<SfxTabPage>
113 Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
114
115 virtual void ActivatePage(const SfxItemSet& rSet) override;
116 virtual DeactivateRC DeactivatePage(SfxItemSet* pSet) override;
117 void FillItem(SwEnvItem& rItem);
118 virtual bool FillItemSet(SfxItemSet* rSet) override;
119 virtual void Reset(const SfxItemSet* rSet) override;
120};
121
122#endif
123
124/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxItemSet * pSet
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
Definition: envlop1.cxx:143
SwEnvItem m_aEnvItem
Definition: envlop.hxx:66
std::unique_ptr< SfxItemSet > m_pSenderSet
Definition: envlop.hxx:70
virtual ~SwEnvDlg() override
Definition: envlop1.cxx:137
std::unique_ptr< weld::Button > m_xModify
Definition: envlop.hxx:72
VclPtr< Printer > m_pPrinter
Definition: envlop.hxx:68
virtual short Ok() override
Definition: envlop1.cxx:159
SwWrtShell * m_pSh
Definition: envlop.hxx:67
SwEnvDlg(weld::Window *pParent, const SfxItemSet &rSet, SwWrtShell *pWrtSh, Printer *pPrt, bool bInsert)
Definition: envlop1.cxx:119
std::unique_ptr< SfxItemSet > m_pAddresseeSet
Definition: envlop.hxx:69
DECL_LINK(FieldHdl, weld::Button &, void)
SwWrtShell * m_pSh
Definition: envlop.hxx:86
std::unique_ptr< weld::ComboBox > m_xDBFieldLB
Definition: envlop.hxx:93
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: envlop1.cxx:302
SwEnvDlg * GetParentSwEnvDlg()
Definition: envlop.hxx:105
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: envlop1.cxx:324
SwEnvPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: envlop1.cxx:180
std::unique_ptr< weld::CheckButton > m_xSenderBox
Definition: envlop.hxx:95
SwEnvDlg * m_pDialog
Definition: envlop.hxx:85
std::unique_ptr< weld::ComboBox > m_xTableLB
Definition: envlop.hxx:92
std::unique_ptr< weld::TextView > m_xAddrEdit
Definition: envlop.hxx:90
OUString m_sActDBName
Definition: envlop.hxx:87
DECL_LINK(DatabaseHdl, weld::ComboBox &, void)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: envlop1.cxx:309
std::unique_ptr< weld::TextView > m_xSenderEdit
Definition: envlop.hxx:96
std::unique_ptr< weld::ComboBox > m_xDatabaseLB
Definition: envlop.hxx:91
std::unique_ptr< weld::Button > m_xInsertBT
Definition: envlop.hxx:94
void InitDatabaseBox()
Definition: envlop1.cxx:273
virtual ~SwEnvPage() override
Definition: envlop1.cxx:224
std::unique_ptr< weld::CustomWeld > m_xPreview
Definition: envlop.hxx:97
void FillItem(SwEnvItem &rItem)
Definition: envlop1.cxx:317
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: envlop1.cxx:297
void Init(SwEnvDlg *pDialog)
Definition: envlop1.cxx:207
SwEnvPreview m_aPreview
Definition: envlop.hxx:89
DECL_LINK(SenderHdl, weld::Toggleable &, void)
virtual void Reset(const SfxItemSet *rSet) override
Definition: envlop1.cxx:331
SwEnvDlg * m_pDialog
Definition: envlop.hxx:49
void SetDialog(SwEnvDlg *pDialog)
Definition: envlop.hxx:56
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: envlop1.cxx:56
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: envlop1.cxx:49
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
sal_Int64 normalize(sal_Int64 nValue) const
sal_Int64 denormalize(sal_Int64 nValue) const
void set_value(sal_Int64 nValue, FieldUnit eValueUnit)
sal_Int64 get_value(FieldUnit eDestUnit) const
int getfieldval(const weld::MetricSpinButton &rField)
Definition: envlop.hxx:30
void setfieldval(weld::MetricSpinButton &rField, int lValue)
Definition: envlop.hxx:35
DeactivateRC