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