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