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 
30 inline int getfieldval(const weld::MetricSpinButton& rField)
31 {
32  return rField.denormalize(rField.get_value(FieldUnit::TWIP));
33 }
34 
35 inline void setfieldval(weld::MetricSpinButton& rField, int lValue)
36 {
37  rField.set_value(rField.normalize(lValue), FieldUnit::TWIP);
38 }
39 
40 class SwEnvDlg;
41 class SwEnvPage;
42 class SwEnvFormatPage;
43 class SwWrtShell;
44 class Printer;
45 
47 {
48 private:
50 
51  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
52  virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
53 
54 public:
55  SwEnvPreview();
56  void SetDialog(SwEnvDlg* pDialog) { m_pDialog = pDialog; }
57 };
58 
60 {
61 friend class SwEnvPage;
62 friend class SwEnvFormatPage;
63 friend class SwEnvPrtPage;
64 friend class SwEnvPreview;
65 
69  std::unique_ptr<SfxItemSet> pAddresseeSet;
70  std::unique_ptr<SfxItemSet> 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 
77 public:
78  SwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert);
79  virtual ~SwEnvDlg() override;
80 };
81 
82 class SwEnvPage : public SfxTabPage
83 {
86  OUString m_sActDBName;
87 
89  std::unique_ptr<weld::TextView> m_xAddrEdit;
90  std::unique_ptr<weld::ComboBox> m_xDatabaseLB;
91  std::unique_ptr<weld::ComboBox> m_xTableLB;
92  std::unique_ptr<weld::ComboBox> m_xDBFieldLB;
93  std::unique_ptr<weld::Button> m_xInsertBT;
94  std::unique_ptr<weld::CheckButton> m_xSenderBox;
95  std::unique_ptr<weld::TextView> m_xSenderEdit;
96  std::unique_ptr<weld::CustomWeld> m_xPreview;
97 
98  DECL_LINK(DatabaseHdl, weld::ComboBox&, void);
99  DECL_LINK(FieldHdl, weld::Button&, void);
100  DECL_LINK(SenderHdl, weld::Button&, void);
101 
102  void InitDatabaseBox();
103 
105 
108 
109 public:
110  SwEnvPage(TabPageParent pParent, const SfxItemSet& rSet);
111  void Init(SwEnvDlg* pDialog);
112  virtual ~SwEnvPage() override;
113 
114  static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rSet);
115 
116  virtual void ActivatePage(const SfxItemSet& rSet) override;
117  virtual DeactivateRC DeactivatePage(SfxItemSet* pSet) override;
118  void FillItem(SwEnvItem& rItem);
119  virtual bool FillItemSet(SfxItemSet* rSet) override;
120  virtual void Reset(const SfxItemSet* rSet) override;
121 };
122 
123 #endif
124 
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: envlop1.cxx:313
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: envlop1.cxx:306
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: envlop1.cxx:328
const SfxItemSet * pSet
std::unique_ptr< weld::TextView > m_xSenderEdit
Definition: envlop.hxx:95
std::unique_ptr< weld::ComboBox > m_xTableLB
Definition: envlop.hxx:91
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: envlop1.cxx:59
std::unique_ptr< weld::ComboBox > m_xDatabaseLB
Definition: envlop.hxx:90
virtual short Ok() override
Definition: envlop1.cxx:162
virtual void ActivatePage(const SfxItemSet &)
std::unique_ptr< weld::Button > m_xModify
Definition: envlop.hxx:72
SwEnvPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: envlop1.cxx:183
SwEnvDlg(weld::Window *pParent, const SfxItemSet &rSet, SwWrtShell *pWrtSh, Printer *pPrt, bool bInsert)
Definition: envlop1.cxx:122
virtual ~SwEnvPage() override
Definition: envlop1.cxx:227
int normalize(int nValue) const
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet)
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: envlop1.cxx:52
std::unique_ptr< SfxItemSet > pAddresseeSet
Definition: envlop.hxx:69
void InitDatabaseBox()
Definition: envlop1.cxx:277
VclPtr< Printer > pPrinter
Definition: envlop.hxx:68
std::unique_ptr< weld::CheckButton > m_xSenderBox
Definition: envlop.hxx:94
SwEnvPreview m_aPreview
Definition: envlop.hxx:88
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: envlop1.cxx:301
DECL_LINK(DatabaseHdl, weld::ComboBox &, void)
std::unique_ptr< SfxItemSet > pSenderSet
Definition: envlop.hxx:70
void SetDialog(SwEnvDlg *pDialog)
Definition: envlop.hxx:56
SwWrtShell * pSh
Definition: envlop.hxx:67
void set_value(int nValue, FieldUnit eValueUnit)
SwEnvDlg * GetParentSwEnvDlg()
Definition: envlop.hxx:104
SwEnvDlg * m_pDialog
Definition: envlop.hxx:49
SwWrtShell * m_pSh
Definition: envlop.hxx:85
OUString m_sActDBName
Definition: envlop.hxx:86
void FillItem(SwEnvItem &rItem)
Definition: envlop1.cxx:321
SwEnvItem aEnvItem
Definition: envlop.hxx:66
std::unique_ptr< weld::ComboBox > m_xDBFieldLB
Definition: envlop.hxx:92
std::unique_ptr< weld::Button > m_xInsertBT
Definition: envlop.hxx:93
std::unique_ptr< weld::CustomWeld > m_xPreview
Definition: envlop.hxx:96
DeactivateRC
int get_value(FieldUnit eDestUnit) const
virtual ~SwEnvDlg() override
Definition: envlop1.cxx:140
int getfieldval(const weld::MetricSpinButton &rField)
Definition: envlop.hxx:30
virtual void Reset(const SfxItemSet *rSet) override
Definition: envlop1.cxx:335
void Init(SwEnvDlg *pDialog)
Definition: envlop1.cxx:210
int denormalize(int nValue) const
SwEnvDlg * m_pDialog
Definition: envlop.hxx:84
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
Definition: envlop1.cxx:146
void setfieldval(weld::MetricSpinButton &rField, int lValue)
Definition: envlop.hxx:35
std::unique_ptr< weld::TextView > m_xAddrEdit
Definition: envlop.hxx:89