merge the formfield patch from ooo-build
[ooovba.git] / extensions / source / scanner / sanedlg.hxx
blob7af3488aa1e5ad569393bcfe3be2a79eb7d7b140
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sanedlg.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SVT_SANEDLG_HXX
31 #define _SVT_SANEDLG_HXX
33 #include <vcl/dialog.hxx>
34 #include <tools/config.hxx>
35 #include <vcl/lstbox.hxx>
36 #ifndef _SV_BUTTON_HXX
37 #include <vcl/button.hxx>
38 #endif
39 #include <vcl/fixed.hxx>
40 #include <vcl/group.hxx>
41 #include <vcl/field.hxx>
42 #include <vcl/edit.hxx>
43 #include <svtools/svtreebx.hxx>
45 #include <sane.hxx>
47 class SaneDlg : public ModalDialog
49 private:
50 enum DragDirection { TopLeft, Top, TopRight, Right, BottomRight, Bottom,
51 BottomLeft, Left };
53 Sane& mrSane;
54 Bitmap maPreviewBitmap;
55 Rectangle maPreviewRect;
56 Point maTopLeft, maBottomRight;
57 Point maMinTopLeft, maMaxBottomRight;
58 BOOL mbDragEnable;
59 BOOL mbIsDragging;
60 int mnDragMode;
61 BOOL mbDragDrawn;
62 DragDirection meDragDirection;
64 MapMode maMapMode;
66 Link maOldLink;
68 OKButton maOKButton;
69 CancelButton maCancelButton;
70 PushButton maDeviceInfoButton;
71 PushButton maPreviewButton;
72 PushButton maButtonOption;
74 FixedText maOptionsTxt;
75 FixedText maOptionTitle;
76 FixedText maOptionDescTxt;
77 FixedText maVectorTxt;
79 FixedText maScanLeftTxt;
80 MetricField maLeftField;
81 FixedText maScanTopTxt;
82 MetricField maTopField;
83 FixedText maRightTxt;
84 MetricField maRightField;
85 FixedText maBottomTxt;
86 MetricField maBottomField;
88 FixedText maDeviceBoxTxt;
89 ListBox maDeviceBox;
90 FixedText maReslTxt;
91 NumericBox maReslBox;
92 FixedText maAdvancedTxt;
93 CheckBox maAdvancedBox;
95 NumericField maVectorBox;
96 ListBox maQuantumRangeBox;
97 ListBox maStringRangeBox;
99 FixedLine maPreviewBox;
100 FixedLine maAreaBox;
102 CheckBox maBoolCheckBox;
104 Edit maStringEdit;
105 Edit maNumericEdit;
107 SvTreeListBox maOptionBox;
109 int mnCurrentOption;
110 int mnCurrentElement;
111 double* mpRange;
112 double mfMin, mfMax;
114 DECL_LINK( ClickBtnHdl, Button* );
115 DECL_LINK( SelectHdl, ListBox* );
116 DECL_LINK( ModifyHdl, Edit* );
117 DECL_LINK( ReloadSaneOptionsHdl, Sane* );
118 DECL_LINK( OptionsBoxSelectHdl, SvTreeListBox* );
120 void SaveState();
121 BOOL LoadState();
123 void InitDevices();
124 void InitFields();
125 void AcquirePreview();
126 void DisableOption();
127 void EstablishBoolOption();
128 void EstablishStringOption();
129 void EstablishStringRange();
130 void EstablishQuantumRange();
131 void EstablishNumericOption();
132 void EstablishButtonOption();
134 void DrawRectangles( Point&, Point& );
135 void DrawDrag();
136 Point GetPixelPos( const Point& );
137 Point GetLogicPos( const Point& );
138 void UpdateScanArea( BOOL );
140 // helper
141 BOOL SetAdjustedNumericalValue( const char* pOption, double fValue, int nElement = 0 );
143 virtual void Paint( const Rectangle& );
144 virtual void MouseMove( const MouseEvent& rMEvt );
145 virtual void MouseButtonDown( const MouseEvent& rMEvt );
146 virtual void MouseButtonUp( const MouseEvent& rMEvt );
147 public:
148 SaneDlg( Window*, Sane& );
149 ~SaneDlg();
151 virtual short Execute();
155 #endif