[PATCH] - Added-a-scan-button-to-the-SaneDlg
Rob Snelders
programming at ertai.nl
Thu Oct 20 11:01:48 PDT 2011
---
extensions/source/scanner/sanedlg.cxx | 8 ++--
extensions/source/scanner/sanedlg.hxx | 8 ++--
extensions/source/scanner/scanner.cxx | 2 +-
extensions/source/scanner/scanner.hxx | 4 +-
extensions/source/scanner/scanunx.cxx | 6 +-
extensions/source/scanner/scn.component | 2 +-
offapi/com/sun/star/scanner/ScannerManager2.idl | 54 ++++++++++++++++++++
offapi/com/sun/star/scanner/XScannerManager2.idl | 58 ++++++++++++++++++++++
8 files changed, 127 insertions(+), 15 deletions(-)
create mode 100644 offapi/com/sun/star/scanner/ScannerManager2.idl
create mode 100644 offapi/com/sun/star/scanner/XScannerManager2.idl
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index acec566..a3785ab 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -48,7 +48,7 @@ ResId SaneResId( sal_uInt32 nID )
return ResId( nID, *pResMgr );
}
-SaneDlg::SaneDlg( Window* pParent, Sane& rSane, sal_Bool bScanEnabled ) :
+SaneDlg::SaneDlg( Window* pParent, Sane& rSane, bool bScanEnabled ) :
ModalDialog( pParent, SaneResId( RID_SANE_DIALOG ) ),
mrSane( rSane ),
mbIsDragging( sal_False ),
@@ -90,7 +90,7 @@ SaneDlg::SaneDlg( Window* pParent, Sane& rSane, sal_Bool bScanEnabled ) :
maOptionBox( this, SaneResId( RID_SCAN_OPTION_BOX ) ),
mpRange( 0 )
{
- doScan = sal_False;
+ doScan = false;
if( Sane::IsSane() )
{
InitDevices(); // opens first sane device
@@ -489,7 +489,7 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
SaveState();
EndDialog( mrSane.IsOpen() ? 1 : 0 );
if (pButton == &maScanButton)
- doScan = sal_True;
+ doScan = true;
}
else if( pButton == &maCancelButton )
{
@@ -1383,7 +1383,7 @@ sal_Bool SaneDlg::SetAdjustedNumericalValue(
return sal_True;
}
-sal_Bool SaneDlg::getDoScan()
+bool SaneDlg::getDoScan()
{
return doScan;
}
diff --git a/extensions/source/scanner/sanedlg.hxx b/extensions/source/scanner/sanedlg.hxx
index b43e2a1..b7fe581 100644
--- a/extensions/source/scanner/sanedlg.hxx
+++ b/extensions/source/scanner/sanedlg.hxx
@@ -53,7 +53,7 @@ private:
Point maMinTopLeft, maMaxBottomRight;
sal_Bool mbDragEnable;
sal_Bool mbIsDragging;
- sal_Bool mbScanEnabled;
+ bool mbScanEnabled;
int mnDragMode;
sal_Bool mbDragDrawn;
DragDirection meDragDirection;
@@ -109,7 +109,7 @@ private:
double* mpRange;
double mfMin, mfMax;
- sal_Bool doScan;
+ bool doScan;
DECL_LINK( ClickBtnHdl, Button* );
DECL_LINK( SelectHdl, ListBox* );
@@ -145,11 +145,11 @@ private:
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
public:
- SaneDlg( Window*, Sane&, sal_Bool );
+ SaneDlg( Window*, Sane&, bool );
~SaneDlg();
virtual short Execute();
- sal_Bool getDoScan();
+ bool getDoScan();
};
diff --git a/extensions/source/scanner/scanner.cxx b/extensions/source/scanner/scanner.cxx
index 6992b75..2258de7 100644
--- a/extensions/source/scanner/scanner.cxx
+++ b/extensions/source/scanner/scanner.cxx
@@ -59,7 +59,7 @@ ScannerManager::~ScannerManager()
ANY SAL_CALL ScannerManager::queryInterface( const Type& rType ) throw( RuntimeException )
{
const ANY aRet( cppu::queryInterface( rType,
- static_cast< XScannerManager* >( this ),
+ static_cast< XScannerManager2* >( this ),
static_cast< AWT::XBitmap* >( this ) ) );
return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) );
diff --git a/extensions/source/scanner/scanner.hxx b/extensions/source/scanner/scanner.hxx
index 434e492..f1b5ab5 100644
--- a/extensions/source/scanner/scanner.hxx
+++ b/extensions/source/scanner/scanner.hxx
@@ -39,7 +39,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/EventObject.hpp>
-#include <com/sun/star/scanner/XScannerManager.hpp>
+#include <com/sun/star/scanner/XScannerManager2.hpp>
#include <com/sun/star/scanner/ScannerException.hpp>
using namespace cppu;
@@ -61,7 +61,7 @@ using ::rtl::OUString;
// - ScannerManager -
// ------------------
-class ScannerManager : public OWeakObject, XScannerManager, AWT::XBitmap
+class ScannerManager : public OWeakObject, XScannerManager2, AWT::XBitmap
{
protected:
diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx
index 9980fd4..efa2a28 100644
--- a/extensions/source/scanner/scanunx.cxx
+++ b/extensions/source/scanner/scanunx.cxx
@@ -159,7 +159,7 @@ class ScannerThread : public osl::Thread
{
boost::shared_ptr<SaneHolder> m_pHolder;
REF( com::sun::star::lang::XEventListener ) m_xListener;
- ScannerManager* m_pManager; // just for the disposing call
+ ScannerManager* m_pManager; // just for the disposing call
public:
virtual void run();
@@ -304,9 +304,9 @@ sal_Bool ScannerManager::configureScannerAndScan( ScannerContext& scanner_contex
);
pHolder->m_bBusy = true;
- SaneDlg aDlg( NULL, pHolder->m_aSane, (listener != NULL) );
+ SaneDlg aDlg( NULL, pHolder->m_aSane, istener.is() );
sal_Bool bRet = (sal_Bool)aDlg.Execute();
- sal_Bool bScan = aDlg.getDoScan();
+ bool bScan = aDlg.getDoScan();
pHolder->m_bBusy = false;
if ( bScan )
diff --git a/extensions/source/scanner/scn.component b/extensions/source/scanner/scn.component
index 53b88c9..4e8ccf5 100644
--- a/extensions/source/scanner/scn.component
+++ b/extensions/source/scanner/scn.component
@@ -28,7 +28,7 @@
<component loader="com.sun.star.loader.SharedLibrary"
xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.scanner.ScannerManager2">
+ <implementation name="com.sun.star.scanner.ScannerManager2">
<service name="com.sun.star.scanner.ScannerManager2"/>
</implementation>
</component>
diff --git a/offapi/com/sun/star/scanner/ScannerManager2.idl b/offapi/com/sun/star/scanner/ScannerManager2.idl
new file mode 100644
index 0000000..5a18e42
--- /dev/null
+++ b/offapi/com/sun/star/scanner/ScannerManager2.idl
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef __com_sun_star_scanner_ScannerManager2_idl__
+#define __com_sun_star_scanner_ScannerManager2_idl__
+
+#include <com/sun/star/scanner/XScannerManager2.idl>
+
+
+//=============================================================================
+
+module com { module sun { module star { module scanner {
+
+//=============================================================================
+// DOCUMENTATION CHANGED FOR ScannerManager
+/** ScannerManager provides a simple method to access scanner devices
+ (or other image producing devices)
+*/
+published service ScannerManager2
+{
+ interface com::sun::star::scanner::XScannerManager2;
+
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
diff --git a/offapi/com/sun/star/scanner/XScannerManager2.idl b/offapi/com/sun/star/scanner/XScannerManager2.idl
new file mode 100644
index 0000000..0bb79f5
--- /dev/null
+++ b/offapi/com/sun/star/scanner/XScannerManager2.idl
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __com_sun_star_scanner_XScannerManager2_idl__
+#define __com_sun_star_scanner_XScannerManager2_idl__
+
+#include <com/sun/star/scanner/ScannerManager.idl>
+
+//=============================================================================
+
+module com { module sun { module star { module scanner {
+
+//=============================================================================
+
+/**
+ Extension of <type>XScannerManager</type>.
+*/
+published interface XScannerManager2: com::sun::star::scanner::XScannerManager
+{
+ //-------------------------------------------------------------------------
+ /** produce some kind of User Interface to let the user have a preview,
+ configure the scan area, etc., it, and scan it
+ returns FALSE if user cancelled this process
+ */
+ boolean configureScannerAndScan( [inout] com::sun::star::scanner::ScannerContext scanner_context,
+ [in] com::sun::star::lang::XEventListener listener )
+ raises( com::sun::star::scanner::ScannerException );
+
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
--
1.7.0.4
--------------060900050307000006040702
Content-Type: text/x-patch;
name="0001-making-sure-the-scanwin-doesn-t-give-a-new-warning.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0001-making-sure-the-scanwin-doesn-t-give-a-new-warning.patc";
filename*1="h"
More information about the LibreOffice
mailing list