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