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_UIBASE_INC_ENVLOP_HXX
20 : #define INCLUDED_SW_SOURCE_UIBASE_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 0 : class SwEnvPreview : public vcl::Window
44 : {
45 : void Paint(const Rectangle&) SAL_OVERRIDE;
46 :
47 : public:
48 :
49 : SwEnvPreview(vcl::Window * pParent, WinBits nStyle);
50 :
51 : protected:
52 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
53 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
54 : };
55 :
56 : class SwEnvDlg : public SfxTabDialog
57 : {
58 : friend class SwEnvPage;
59 : friend class SwEnvFmtPage;
60 : friend class SwEnvPrtPage;
61 : friend class SwEnvPreview;
62 :
63 : SwEnvItem aEnvItem;
64 : SwWrtShell *pSh;
65 : Printer *pPrinter;
66 : SfxItemSet *pAddresseeSet;
67 : SfxItemSet *pSenderSet;
68 : sal_uInt16 m_nEnvPrintId;
69 :
70 : virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) SAL_OVERRIDE;
71 : virtual short Ok() SAL_OVERRIDE;
72 :
73 : public:
74 : SwEnvDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert);
75 : virtual ~SwEnvDlg();
76 : };
77 :
78 : class SwEnvPage : public SfxTabPage
79 : {
80 : VclMultiLineEdit* m_pAddrEdit;
81 : ListBox* m_pDatabaseLB;
82 : ListBox* m_pTableLB;
83 : ListBox* m_pDBFieldLB;
84 : PushButton* m_pInsertBT;
85 : CheckBox* m_pSenderBox;
86 : VclMultiLineEdit* m_pSenderEdit;
87 : SwEnvPreview* m_pPreview;
88 :
89 : SwWrtShell* pSh;
90 : OUString sActDBName;
91 :
92 : SwEnvPage(vcl::Window* pParent, const SfxItemSet& rSet);
93 : virtual ~SwEnvPage();
94 :
95 : DECL_LINK( DatabaseHdl, ListBox * );
96 : DECL_LINK(FieldHdl, void *);
97 : DECL_LINK(SenderHdl, void *);
98 :
99 : void InitDatabaseBox();
100 :
101 0 : SwEnvDlg* GetParentSwEnvDlg() {return (SwEnvDlg*)GetParentDialog();}
102 :
103 : using SfxTabPage::ActivatePage;
104 : using SfxTabPage::DeactivatePage;
105 :
106 : public:
107 :
108 : static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet);
109 :
110 : virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
111 : virtual int DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
112 : void FillItem(SwEnvItem& rItem);
113 : virtual bool FillItemSet(SfxItemSet* rSet) SAL_OVERRIDE;
114 : virtual void Reset(const SfxItemSet* rSet) SAL_OVERRIDE;
115 : };
116 :
117 : #endif
118 :
119 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|