1*46dbaceeSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*46dbaceeSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*46dbaceeSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*46dbaceeSAndrew Rist * distributed with this work for additional information 6*46dbaceeSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*46dbaceeSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*46dbaceeSAndrew Rist * "License"); you may not use this file except in compliance 9*46dbaceeSAndrew Rist * with the License. You may obtain a copy of the License at 10*46dbaceeSAndrew Rist * 11*46dbaceeSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*46dbaceeSAndrew Rist * 13*46dbaceeSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*46dbaceeSAndrew Rist * software distributed under the License is distributed on an 15*46dbaceeSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*46dbaceeSAndrew Rist * KIND, either express or implied. See the License for the 17*46dbaceeSAndrew Rist * specific language governing permissions and limitations 18*46dbaceeSAndrew Rist * under the License. 19*46dbaceeSAndrew Rist * 20*46dbaceeSAndrew Rist *************************************************************/ 21*46dbaceeSAndrew Rist 22*46dbaceeSAndrew Rist 23cdf0e10cSrcweir #ifndef _SVT_SANEDLG_HXX 24cdf0e10cSrcweir #define _SVT_SANEDLG_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <vcl/dialog.hxx> 27cdf0e10cSrcweir #include <tools/config.hxx> 28cdf0e10cSrcweir #include <vcl/lstbox.hxx> 29cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX 30cdf0e10cSrcweir #include <vcl/button.hxx> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #include <vcl/fixed.hxx> 33cdf0e10cSrcweir #include <vcl/group.hxx> 34cdf0e10cSrcweir #include <vcl/field.hxx> 35cdf0e10cSrcweir #include <vcl/edit.hxx> 36cdf0e10cSrcweir #include <svtools/svtreebx.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <sane.hxx> 39cdf0e10cSrcweir 40cdf0e10cSrcweir class SaneDlg : public ModalDialog 41cdf0e10cSrcweir { 42cdf0e10cSrcweir private: 43cdf0e10cSrcweir enum DragDirection { TopLeft, Top, TopRight, Right, BottomRight, Bottom, 44cdf0e10cSrcweir BottomLeft, Left }; 45cdf0e10cSrcweir 46cdf0e10cSrcweir Sane& mrSane; 47cdf0e10cSrcweir Bitmap maPreviewBitmap; 48cdf0e10cSrcweir Rectangle maPreviewRect; 49cdf0e10cSrcweir Point maTopLeft, maBottomRight; 50cdf0e10cSrcweir Point maMinTopLeft, maMaxBottomRight; 51cdf0e10cSrcweir sal_Bool mbDragEnable; 52cdf0e10cSrcweir sal_Bool mbIsDragging; 53cdf0e10cSrcweir int mnDragMode; 54cdf0e10cSrcweir sal_Bool mbDragDrawn; 55cdf0e10cSrcweir DragDirection meDragDirection; 56cdf0e10cSrcweir 57cdf0e10cSrcweir MapMode maMapMode; 58cdf0e10cSrcweir 59cdf0e10cSrcweir Link maOldLink; 60cdf0e10cSrcweir 61cdf0e10cSrcweir OKButton maOKButton; 62cdf0e10cSrcweir CancelButton maCancelButton; 63cdf0e10cSrcweir PushButton maDeviceInfoButton; 64cdf0e10cSrcweir PushButton maPreviewButton; 65cdf0e10cSrcweir PushButton maButtonOption; 66cdf0e10cSrcweir 67cdf0e10cSrcweir FixedText maOptionsTxt; 68cdf0e10cSrcweir FixedText maOptionTitle; 69cdf0e10cSrcweir FixedText maOptionDescTxt; 70cdf0e10cSrcweir FixedText maVectorTxt; 71cdf0e10cSrcweir 72cdf0e10cSrcweir FixedText maScanLeftTxt; 73cdf0e10cSrcweir MetricField maLeftField; 74cdf0e10cSrcweir FixedText maScanTopTxt; 75cdf0e10cSrcweir MetricField maTopField; 76cdf0e10cSrcweir FixedText maRightTxt; 77cdf0e10cSrcweir MetricField maRightField; 78cdf0e10cSrcweir FixedText maBottomTxt; 79cdf0e10cSrcweir MetricField maBottomField; 80cdf0e10cSrcweir 81cdf0e10cSrcweir FixedText maDeviceBoxTxt; 82cdf0e10cSrcweir ListBox maDeviceBox; 83cdf0e10cSrcweir FixedText maReslTxt; 84cdf0e10cSrcweir NumericBox maReslBox; 85cdf0e10cSrcweir FixedText maAdvancedTxt; 86cdf0e10cSrcweir CheckBox maAdvancedBox; 87cdf0e10cSrcweir 88cdf0e10cSrcweir NumericField maVectorBox; 89cdf0e10cSrcweir ListBox maQuantumRangeBox; 90cdf0e10cSrcweir ListBox maStringRangeBox; 91cdf0e10cSrcweir 92cdf0e10cSrcweir FixedLine maPreviewBox; 93cdf0e10cSrcweir FixedLine maAreaBox; 94cdf0e10cSrcweir 95cdf0e10cSrcweir CheckBox maBoolCheckBox; 96cdf0e10cSrcweir 97cdf0e10cSrcweir Edit maStringEdit; 98cdf0e10cSrcweir Edit maNumericEdit; 99cdf0e10cSrcweir 100cdf0e10cSrcweir SvTreeListBox maOptionBox; 101cdf0e10cSrcweir 102cdf0e10cSrcweir int mnCurrentOption; 103cdf0e10cSrcweir int mnCurrentElement; 104cdf0e10cSrcweir double* mpRange; 105cdf0e10cSrcweir double mfMin, mfMax; 106cdf0e10cSrcweir 107cdf0e10cSrcweir DECL_LINK( ClickBtnHdl, Button* ); 108cdf0e10cSrcweir DECL_LINK( SelectHdl, ListBox* ); 109cdf0e10cSrcweir DECL_LINK( ModifyHdl, Edit* ); 110cdf0e10cSrcweir DECL_LINK( ReloadSaneOptionsHdl, Sane* ); 111cdf0e10cSrcweir DECL_LINK( OptionsBoxSelectHdl, SvTreeListBox* ); 112cdf0e10cSrcweir 113cdf0e10cSrcweir void SaveState(); 114cdf0e10cSrcweir sal_Bool LoadState(); 115cdf0e10cSrcweir 116cdf0e10cSrcweir void InitDevices(); 117cdf0e10cSrcweir void InitFields(); 118cdf0e10cSrcweir void AcquirePreview(); 119cdf0e10cSrcweir void DisableOption(); 120cdf0e10cSrcweir void EstablishBoolOption(); 121cdf0e10cSrcweir void EstablishStringOption(); 122cdf0e10cSrcweir void EstablishStringRange(); 123cdf0e10cSrcweir void EstablishQuantumRange(); 124cdf0e10cSrcweir void EstablishNumericOption(); 125cdf0e10cSrcweir void EstablishButtonOption(); 126cdf0e10cSrcweir 127cdf0e10cSrcweir void DrawRectangles( Point&, Point& ); 128cdf0e10cSrcweir void DrawDrag(); 129cdf0e10cSrcweir Point GetPixelPos( const Point& ); 130cdf0e10cSrcweir Point GetLogicPos( const Point& ); 131cdf0e10cSrcweir void UpdateScanArea( sal_Bool ); 132cdf0e10cSrcweir 133cdf0e10cSrcweir // helper 134cdf0e10cSrcweir sal_Bool SetAdjustedNumericalValue( const char* pOption, double fValue, int nElement = 0 ); 135cdf0e10cSrcweir 136cdf0e10cSrcweir virtual void Paint( const Rectangle& ); 137cdf0e10cSrcweir virtual void MouseMove( const MouseEvent& rMEvt ); 138cdf0e10cSrcweir virtual void MouseButtonDown( const MouseEvent& rMEvt ); 139cdf0e10cSrcweir virtual void MouseButtonUp( const MouseEvent& rMEvt ); 140cdf0e10cSrcweir public: 141cdf0e10cSrcweir SaneDlg( Window*, Sane& ); 142cdf0e10cSrcweir ~SaneDlg(); 143cdf0e10cSrcweir 144cdf0e10cSrcweir virtual short Execute(); 145cdf0e10cSrcweir }; 146cdf0e10cSrcweir 147cdf0e10cSrcweir 148cdf0e10cSrcweir #endif 149