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_ENVELP_LABFMT_HXX
20 : #define INCLUDED_SW_SOURCE_UI_ENVELP_LABFMT_HXX
21 :
22 : #include "swuilabimp.hxx"
23 : #include "labimg.hxx"
24 : #include <vcl/msgbox.hxx>
25 : class SwLabFmtPage;
26 :
27 : // class SwLabPreview -------------------------------------------------------
28 :
29 0 : class SwLabPreview : public Window
30 : {
31 : Color aGrayColor;
32 :
33 : OUString aHDistStr;
34 : OUString aVDistStr;
35 : OUString aWidthStr;
36 : OUString aHeightStr;
37 : OUString aLeftStr;
38 : OUString aUpperStr;
39 : OUString aColsStr;
40 : OUString aRowsStr;
41 : OUString aPWidthStr;
42 : OUString aPHeightStr;
43 :
44 : long lHDistWidth;
45 : long lVDistWidth;
46 : long lHeightWidth;
47 : long lLeftWidth;
48 : long lUpperWidth;
49 : long lColsWidth;
50 : long lPWidthWidth;
51 : long lPHeightWidth;
52 :
53 : long lXWidth;
54 : long lXHeight;
55 :
56 : SwLabItem aItem;
57 :
58 : virtual void Paint(const Rectangle&) SAL_OVERRIDE;
59 :
60 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
61 :
62 : void DrawArrow(const Point& rP1, const Point& rP2, bool bArrow);
63 :
64 : public:
65 :
66 : SwLabPreview(Window* pParent);
67 :
68 : void UpdateItem(const SwLabItem& rItem);
69 : };
70 :
71 : // class SwLabFmtPage -------------------------------------------------------
72 :
73 : class SwLabFmtPage : public SfxTabPage
74 : {
75 : FixedText* m_pMakeFI;
76 : FixedText* m_pTypeFI;
77 : SwLabPreview* m_pPreview;
78 : MetricField* m_pHDistField;
79 : MetricField* m_pVDistField;
80 : MetricField* m_pWidthField;
81 : MetricField* m_pHeightField;
82 : MetricField* m_pLeftField;
83 : MetricField* m_pUpperField;
84 : NumericField* m_pColsField;
85 : NumericField* m_pRowsField;
86 : MetricField* m_pPWidthField;
87 : MetricField* m_pPHeightField;
88 : PushButton* m_pSavePB;
89 :
90 : Timer aPreviewTimer;
91 : bool bModified;
92 :
93 : SwLabItem aItem;
94 :
95 : SwLabFmtPage(Window* pParent, const SfxItemSet& rSet);
96 : virtual ~SwLabFmtPage();
97 :
98 : DECL_LINK(ModifyHdl, void *);
99 : DECL_LINK(PreviewHdl, void *);
100 : DECL_LINK( LoseFocusHdl, Control * );
101 : DECL_LINK(SaveHdl, void *);
102 :
103 : void ChangeMinMax();
104 :
105 : using TabPage::ActivatePage;
106 : using TabPage::DeactivatePage;
107 :
108 : public:
109 :
110 : static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
111 :
112 : virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
113 : virtual int DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
114 : void FillItem(SwLabItem& rItem);
115 : virtual bool FillItemSet(SfxItemSet& rSet) SAL_OVERRIDE;
116 : virtual void Reset(const SfxItemSet& rSet) SAL_OVERRIDE;
117 :
118 0 : SwLabDlg* GetParentSwLabDlg() {return (SwLabDlg*)GetParentDialog();}
119 : };
120 :
121 0 : class SwSaveLabelDlg : public ModalDialog
122 : {
123 : ComboBox* m_pMakeCB;
124 : Edit* m_pTypeED;
125 : OKButton* m_pOKPB;
126 :
127 : bool bSuccess;
128 : SwLabFmtPage* pLabPage;
129 : SwLabRec& rLabRec;
130 :
131 : DECL_LINK(OkHdl, void *);
132 : DECL_LINK(ModifyHdl, void *);
133 :
134 : public:
135 : SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec);
136 :
137 0 : void SetLabel(const OUString& rMake, const OUString& rType)
138 : {
139 0 : m_pMakeCB->SetText(rMake);
140 0 : m_pTypeED->SetText(rType);
141 0 : }
142 : bool GetLabel(SwLabItem& rItem);
143 : };
144 : #endif
145 :
146 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|