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 GetFieldVal(rField) (rField).Denormalize((rField).GetValue(FUNIT_TWIP))
36 : #define SetFieldVal(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP)
37 :
38 : class SwEnvPage;
39 : class SwEnvFormatPage;
40 : class SwWrtShell;
41 : class Printer;
42 :
43 0 : class SwEnvPreview : public vcl::Window
44 : {
45 : void Paint(vcl::RenderContext& rRenderContext, 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 SwEnvFormatPage;
60 : friend class SwEnvPrtPage;
61 : friend class SwEnvPreview;
62 :
63 : SwEnvItem aEnvItem;
64 : SwWrtShell *pSh;
65 : VclPtr<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 : virtual void dispose() SAL_OVERRIDE;
77 : };
78 :
79 : class SwEnvPage : public SfxTabPage
80 : {
81 : VclPtr<VclMultiLineEdit> m_pAddrEdit;
82 : VclPtr<ListBox> m_pDatabaseLB;
83 : VclPtr<ListBox> m_pTableLB;
84 : VclPtr<ListBox> m_pDBFieldLB;
85 : VclPtr<PushButton> m_pInsertBT;
86 : VclPtr<CheckBox> m_pSenderBox;
87 : VclPtr<VclMultiLineEdit> m_pSenderEdit;
88 : VclPtr<SwEnvPreview> m_pPreview;
89 :
90 : SwWrtShell* pSh;
91 : OUString sActDBName;
92 :
93 : DECL_LINK( DatabaseHdl, ListBox * );
94 : DECL_LINK(FieldHdl, void *);
95 : DECL_LINK(SenderHdl, void *);
96 :
97 : void InitDatabaseBox();
98 :
99 0 : SwEnvDlg* GetParentSwEnvDlg() {return static_cast<SwEnvDlg*>(GetParentDialog());}
100 :
101 : using SfxTabPage::ActivatePage;
102 : using SfxTabPage::DeactivatePage;
103 :
104 : public:
105 : SwEnvPage(vcl::Window* pParent, const SfxItemSet& rSet);
106 : virtual ~SwEnvPage();
107 : virtual void dispose() SAL_OVERRIDE;
108 :
109 : static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet);
110 :
111 : virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
112 : virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
113 : void FillItem(SwEnvItem& rItem);
114 : virtual bool FillItemSet(SfxItemSet* rSet) SAL_OVERRIDE;
115 : virtual void Reset(const SfxItemSet* rSet) SAL_OVERRIDE;
116 : };
117 :
118 : #endif
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|