Can somebody add this patch to the git?
-------- Original Message --------
Subject: Re: [Libreoffice] patch for scan-diialog
Date: Thu, 06 Oct 2011 17:59:04 +0200
From: Rob Snelders <rob@ertai.nl>
To: Miklos Vajna <vmiklos@frugalware.org>
CC: libreoffice@lists.freedesktop.org
Here is the patch.
M.V.G.
Rob Snelders
On 06-10-11 01:28, Miklos Vajna wrote:
On Wed, Oct 05, 2011 at 09:57:43PM +0200, Rob Snelders<programming@ertai.nl> wrote:
I created a patch for the scan-dialog for Linux. It allows to scan a
image directly from the scan-dialog without needing to select first the
dialog and then the "request"-menuitem.
The patch is submitted under the LGPLv3+/MPL-licence.
Forgot to attach the patch?
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice
From 2e6180eb49ec4886550ea105cf7149d6ff307c3e Mon Sep 17 00:00:00 2001
From: Rob Snelders <programming@ertai.nl>
Date: Wed, 5 Oct 2011 21:52:08 +0200
Subject: [PATCH] Added a scan-button to the SaneDlg
---
extensions/source/scanner/sanedlg.cxx | 12 +++++++++++-
extensions/source/scanner/sanedlg.hrc | 1 +
extensions/source/scanner/sanedlg.hxx | 4 ++++
extensions/source/scanner/sanedlg.src | 7 +++++++
extensions/source/scanner/scanner.hxx | 2 +-
extensions/source/scanner/scanunx.cxx | 7 ++++++-
extensions/source/scanner/scanwin.cxx | 2 +-
offapi/com/sun/star/scanner/XScannerManager.idl | 5 +++--
sd/source/ui/view/drviews8.cxx | 2 +-
sw/source/ui/uiview/uivwimp.cxx | 6 ++++--
10 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 39b8862..2e55050 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -58,6 +58,7 @@ SaneDlg::SaneDlg( Window* pParent, Sane& rSane ) :
maCancelButton( this, SaneResId( RID_SCAN_CANCEL ) ),
maDeviceInfoButton( this, SaneResId( RID_DEVICEINFO_BTN ) ),
maPreviewButton( this, SaneResId( RID_PREVIEW_BTN ) ),
+ maScanButton( this, SaneResId( RID_SCAN_BTN ) ),
maButtonOption( this, SaneResId( RID_SCAN_BUTTON_OPTION_BTN ) ),
maOptionsTxt( this, SaneResId( RID_SCAN_OPTION_TXT ) ),
maOptionTitle( this, SaneResId( RID_SCAN_OPTIONTITLE_TXT ) ),
@@ -88,6 +89,7 @@ SaneDlg::SaneDlg( Window* pParent, Sane& rSane ) :
maOptionBox( this, SaneResId( RID_SCAN_OPTION_BOX ) ),
mpRange( 0 )
{
+ doScan = sal_False;
if( Sane::IsSane() )
{
InitDevices(); // opens first sane device
@@ -97,6 +99,7 @@ SaneDlg::SaneDlg( Window* pParent, Sane& rSane ) :
maDeviceInfoButton.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) );
maPreviewButton.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) );
+ maScanButton.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) );
maButtonOption.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) );
maDeviceBox.SetSelectHdl( LINK( this, SaneDlg, SelectHdl ) );
maOptionBox.SetSelectHdl( LINK( this, SaneDlg, OptionsBoxSelectHdl ) );
@@ -476,13 +479,15 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
ReloadSaneOptionsHdl( NULL );
}
}
- if( pButton == &maOKButton )
+ if( pButton == &maOKButton || pButton == &maScanButton )
{
double fRes = (double)maReslBox.GetValue();
SetAdjustedNumericalValue( "resolution", fRes );
UpdateScanArea( sal_True );
SaveState();
EndDialog( mrSane.IsOpen() ? 1 : 0 );
+ if (pButton == &maScanButton)
+ doScan = sal_True;
}
else if( pButton == &maCancelButton )
{
@@ -1376,4 +1381,9 @@ sal_Bool SaneDlg::SetAdjustedNumericalValue(
return sal_True;
}
+sal_Bool SaneDlg::getDoScan()
+{
+ return doScan;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/scanner/sanedlg.hrc b/extensions/source/scanner/sanedlg.hrc
index ca89312..1e468c9 100644
--- a/extensions/source/scanner/sanedlg.hrc
+++ b/extensions/source/scanner/sanedlg.hrc
@@ -62,6 +62,7 @@
#define RID_SCAN_BITMAP_MINUS 32
#define RID_SCAN_ADVANCED_BOX 33
#define RID_SCAN_ADVANCED_TXT 34
+#define RID_SCAN_BTN 35
#define RID_SANE_DEVICEINFO_TXT 1001
#define RID_SANE_SCANERROR_TXT 1002
diff --git a/extensions/source/scanner/sanedlg.hxx b/extensions/source/scanner/sanedlg.hxx
index c3f72ea..a008655 100644
--- a/extensions/source/scanner/sanedlg.hxx
+++ b/extensions/source/scanner/sanedlg.hxx
@@ -65,6 +65,7 @@ private:
CancelButton maCancelButton;
PushButton maDeviceInfoButton;
PushButton maPreviewButton;
+ PushButton maScanButton;
PushButton maButtonOption;
FixedText maOptionsTxt;
@@ -107,6 +108,8 @@ private:
double* mpRange;
double mfMin, mfMax;
+ sal_Bool doScan;
+
DECL_LINK( ClickBtnHdl, Button* );
DECL_LINK( SelectHdl, ListBox* );
DECL_LINK( ModifyHdl, Edit* );
@@ -145,6 +148,7 @@ public:
~SaneDlg();
virtual short Execute();
+ sal_Bool getDoScan();
};
diff --git a/extensions/source/scanner/sanedlg.src b/extensions/source/scanner/sanedlg.src
index 961f0ed..fc17d3e 100644
--- a/extensions/source/scanner/sanedlg.src
+++ b/extensions/source/scanner/sanedlg.src
@@ -59,6 +59,13 @@ ModalDialog RID_SANE_DIALOG
Size = MAP_APPFONT ( 55 , 22 ) ;
Text [ en-US ] = "Create\nPreview" ;
};
+ PushButton RID_SCAN_BTN
+ {
+ HelpID = "extensions:PushButton:RID_SANE_DIALOG:RID_SCAN_BTN";
+ Pos = MAP_APPFONT ( THIRD_COLUMN , 98 ) ;
+ Size = MAP_APPFONT ( 55 , 14 ) ;
+ Text [ en-US ] = "Scan" ;
+ };
FixedLine RID_PREVIEW_BOX
{
Pos = MAP_APPFONT ( PREVIEW_UPPER_LEFT - 5 , PREVIEW_UPPER_TOP - 8 ) ;
diff --git a/extensions/source/scanner/scanner.hxx b/extensions/source/scanner/scanner.hxx
index abe2ae3..9d8b98f 100644
--- a/extensions/source/scanner/scanner.hxx
+++ b/extensions/source/scanner/scanner.hxx
@@ -83,7 +83,7 @@ public:
// XScannerManager
virtual SEQ( ScannerContext ) SAL_CALL getAvailableScanners() throw();
- virtual sal_Bool SAL_CALL configureScanner( ScannerContext& scanner_context
) throw( ScannerException );
+ virtual sal_Bool SAL_CALL configureScanner( ScannerContext& scanner_context,
const REF( com::sun::star::lang::XEventListener )& rxListener ) throw( ScannerException );
virtual void SAL_CALL startScan( const ScannerContext& scanner_context,
const REF( com::sun::star::lang::XEventListener )& rxListener ) throw( ScannerException );
virtual ScanError SAL_CALL getError( const ScannerContext& scanner_context )
throw( ScannerException );
virtual REF( AWT::XBitmap ) SAL_CALL getBitmap( const ScannerContext& scanner_context )
throw( ScannerException );
diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx
index 1f481f6..2a3486e 100644
--- a/extensions/source/scanner/scanunx.cxx
+++ b/extensions/source/scanner/scanunx.cxx
@@ -278,7 +278,8 @@ SEQ( ScannerContext ) ScannerManager::getAvailableScanners() throw()
// -----------------------------------------------------------------------------
-sal_Bool ScannerManager::configureScanner( ScannerContext& scanner_context ) throw(
ScannerException )
+sal_Bool ScannerManager::configureScanner( ScannerContext& scanner_context,
+ const REF( com::sun::star::lang::XEventListener )&
listener ) throw( ScannerException )
{
osl::MutexGuard aGuard( theSaneProtector::get() );
sanevec &rSanes = theSanes::get().m_aSanes;
@@ -305,8 +306,12 @@ sal_Bool ScannerManager::configureScanner( ScannerContext& scanner_context )
thr
pHolder->m_bBusy = true;
SaneDlg aDlg( NULL, pHolder->m_aSane );
sal_Bool bRet = (sal_Bool)aDlg.Execute();
+ sal_Bool bScan = aDlg.getDoScan();
pHolder->m_bBusy = false;
+ if ( bScan )
+ startScan( scanner_context, listener );
+
return bRet;
}
diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx
index 5f6d47e..732e2ce 100644
--- a/extensions/source/scanner/scanwin.cxx
+++ b/extensions/source/scanner/scanwin.cxx
@@ -1004,7 +1004,7 @@ SEQ( ScannerContext ) SAL_CALL ScannerManager::getAvailableScanners() throw()
// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL ScannerManager::configureScanner( ScannerContext& rContext )
+sal_Bool SAL_CALL ScannerManager::configureScanner( ScannerContext& rContext, const
uno::Reference< lang::XEventListener >& rxListener )
throw( ScannerException )
{
osl::MutexGuard aGuard( maProtector );
diff --git a/offapi/com/sun/star/scanner/XScannerManager.idl
b/offapi/com/sun/star/scanner/XScannerManager.idl
index 71da4ed..2bb599c 100644
--- a/offapi/com/sun/star/scanner/XScannerManager.idl
+++ b/offapi/com/sun/star/scanner/XScannerManager.idl
@@ -52,10 +52,11 @@ published interface XScannerManager: com::sun::star::uno::XInterface
//-------------------------------------------------------------------------
/** produce some kind of User Interface to let the user have a preview,
- configure the scan area, etc., it
+ configure the scan area, etc., it, and scan it
returns FALSE if user cancelled this process
*/
- boolean configureScanner( [inout] com::sun::star::scanner::ScannerContext scanner_context )
+ boolean configureScanner( [inout] com::sun::star::scanner::ScannerContext scanner_context,
+ [in] com::sun::star::lang::XEventListener listener )
raises( com::sun::star::scanner::ScannerException );
//-------------------------------------------------------------------------
diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx
index b12c10e..015b320 100644
--- a/sd/source/ui/view/drviews8.cxx
+++ b/sd/source/ui/view/drviews8.cxx
@@ -360,7 +360,7 @@ void DrawViewShell::FuTemp01(SfxRequest& rReq)
if( aContexts.getLength() )
{
::com::sun::star::scanner::ScannerContext aContext(
aContexts.getConstArray()[ 0 ] );
- mxScannerManager->configureScanner( aContext );
+ mxScannerManager->configureScanner( aContext, mxScannerListener );
}
}
catch(...)
diff --git a/sw/source/ui/uiview/uivwimp.cxx b/sw/source/ui/uiview/uivwimp.cxx
index aff53fe..5ae8885 100644
--- a/sw/source/ui/uiview/uivwimp.cxx
+++ b/sw/source/ui/uiview/uivwimp.cxx
@@ -137,13 +137,15 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq )
{
try
{
- const Sequence< ScannerContext >
+ SwScannerEventListener& rListener = GetScannerEventListener();
+ const Sequence< ScannerContext >
aContexts( xScanMgr->getAvailableScanners() );
if( aContexts.getLength() )
{
+ Reference< XEventListener > xLstner = &rListener;
ScannerContext aContext( aContexts.getConstArray()[ 0 ] );
- bDone = xScanMgr->configureScanner( aContext );
+ bDone = xScanMgr->configureScanner( aContext, xLstner );
}
}
catch(...)
--
1.7.0.4
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.