Line data Source code
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_UI_INC_ENVLOP_HXX
20 : #define INCLUDED_SW_SOURCE_UI_INC_ENVLOP_HXX
21 :
22 : #include <svtools/svmedit.hxx>
23 : #include <sfx2/tabdlg.hxx>
24 :
25 : #include <vcl/fixed.hxx>
26 :
27 : #include <vcl/edit.hxx>
28 :
29 : #include <vcl/lstbox.hxx>
30 :
31 : #include <vcl/button.hxx>
32 :
33 : #include "envimg.hxx"
34 :
35 : #define GetFldVal(rField) (rField).Denormalize((rField).GetValue(FUNIT_TWIP))
36 : #define SetFldVal(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP)
37 :
38 : class SwEnvPage;
39 : class SwEnvFmtPage;
40 : class SwWrtShell;
41 : class Printer;
42 :
43 : // class SwEnvPreview ---------------------------------------------------------
44 0 : class SwEnvPreview : public Window
45 : {
46 : void Paint(const Rectangle&) SAL_OVERRIDE;
47 :
48 : public:
49 :
50 : SwEnvPreview(Window * pParent, WinBits nStyle);
51 :
52 : protected:
53 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
54 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
55 : };
56 :
57 : // class SwEnvDlg -----------------------------------------------------------
58 : class SwEnvDlg : public SfxTabDialog
59 : {
60 : friend class SwEnvPage;
61 : friend class SwEnvFmtPage;
62 : friend class SwEnvPrtPage;
63 : friend class SwEnvPreview;
64 :
65 : SwEnvItem aEnvItem;
66 : SwWrtShell *pSh;
67 : Printer *pPrinter;
68 : SfxItemSet *pAddresseeSet;
69 : SfxItemSet *pSenderSet;
70 : sal_uInt16 m_nEnvPrintId;
71 :
72 : virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) SAL_OVERRIDE;
73 : virtual short Ok() SAL_OVERRIDE;
74 :
75 : public:
76 : SwEnvDlg(Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, sal_Bool bInsert);
77 : virtual ~SwEnvDlg();
78 : };
79 :
80 : // class SwEnvPage ----------------------------------------------------------
81 : class SwEnvPage : public SfxTabPage
82 : {
83 : VclMultiLineEdit* m_pAddrEdit;
84 : ListBox* m_pDatabaseLB;
85 : ListBox* m_pTableLB;
86 : ListBox* m_pDBFieldLB;
87 : PushButton* m_pInsertBT;
88 : CheckBox* m_pSenderBox;
89 : VclMultiLineEdit* m_pSenderEdit;
90 : SwEnvPreview* m_pPreview;
91 :
92 : SwWrtShell* pSh;
93 : OUString sActDBName;
94 :
95 : SwEnvPage(Window* pParent, const SfxItemSet& rSet);
96 : virtual ~SwEnvPage();
97 :
98 : DECL_LINK( DatabaseHdl, ListBox * );
99 : DECL_LINK(FieldHdl, void *);
100 : DECL_LINK(SenderHdl, void *);
101 :
102 : void InitDatabaseBox();
103 :
104 0 : SwEnvDlg* GetParentSwEnvDlg() {return (SwEnvDlg*)GetParentDialog();}
105 :
106 : using SfxTabPage::ActivatePage;
107 : using SfxTabPage::DeactivatePage;
108 :
109 : public:
110 :
111 : static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
112 :
113 : virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
114 : virtual int DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
115 : void FillItem(SwEnvItem& rItem);
116 : virtual bool FillItemSet(SfxItemSet& rSet) SAL_OVERRIDE;
117 : virtual void Reset(const SfxItemSet& rSet) SAL_OVERRIDE;
118 : };
119 :
120 : #endif
121 :
122 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|