Add Marathi autocorrect
[LibreOffice.git] / sw / source / uibase / inc / envlop.hxx
blob302184f83b87d3335572e0f91e03d3be7f524cea
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_ENVLOP_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_ENVLOP_HXX
22 #include <sfx2/tabdlg.hxx>
23 #include <vcl/weld.hxx>
24 #include <vcl/customweld.hxx>
25 #include "envimg.hxx"
27 #define GetFieldVal(rField) (rField).Denormalize((rField).GetValue(FieldUnit::TWIP))
28 #define SetFieldVal(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FieldUnit::TWIP)
30 inline int getfieldval(const weld::MetricSpinButton& rField)
32 return rField.denormalize(rField.get_value(FieldUnit::TWIP));
35 inline void setfieldval(weld::MetricSpinButton& rField, int lValue)
37 rField.set_value(rField.normalize(lValue), FieldUnit::TWIP);
40 class SwEnvDlg;
41 class SwEnvPage;
42 class SwEnvFormatPage;
43 class SwWrtShell;
44 class Printer;
46 class SwEnvPreview final : public weld::CustomWidgetController
48 private:
49 SwEnvDlg* m_pDialog;
51 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
52 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
54 public:
55 SwEnvPreview();
56 void SetDialog(SwEnvDlg* pDialog) { m_pDialog = pDialog; }
59 class SwEnvDlg final : public SfxTabDialogController
61 friend class SwEnvPage;
62 friend class SwEnvFormatPage;
63 friend class SwEnvPrtPage;
64 friend class SwEnvPreview;
66 SwEnvItem m_aEnvItem;
67 SwWrtShell* m_pSh;
68 VclPtr<Printer> m_pPrinter;
69 std::unique_ptr<SfxItemSet> m_pAddresseeSet;
70 std::unique_ptr<SfxItemSet> m_pSenderSet;
72 std::unique_ptr<weld::Button> m_xModify;
74 virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override;
75 virtual short Ok() override;
77 public:
78 SwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt,
79 bool bInsert);
80 virtual ~SwEnvDlg() override;
83 class SwEnvPage final : public SfxTabPage
85 SwEnvDlg* m_pDialog;
86 SwWrtShell* m_pSh;
87 OUString m_sActDBName;
89 SwEnvPreview m_aPreview;
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;
99 DECL_LINK(DatabaseHdl, weld::ComboBox&, void);
100 DECL_LINK(FieldHdl, weld::Button&, void);
101 DECL_LINK(SenderHdl, weld::Toggleable&, void);
103 void InitDatabaseBox();
105 SwEnvDlg* GetParentSwEnvDlg() { return m_pDialog; }
107 public:
108 SwEnvPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
109 void Init(SwEnvDlg* pDialog);
110 virtual ~SwEnvPage() override;
112 static std::unique_ptr<SfxTabPage>
113 Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
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;
122 #endif
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */