[PATCH] Added a scanbutton to the scan-dialog
Rob Snelders
programming at ertai.nl
Wed Oct 19 13:19:16 PDT 2011
---
extensions/inc/pch/precompiled_extensions.hxx | 1 +
extensions/source/scanner/sanedlg.cxx | 16 ++++++++++++++--
extensions/source/scanner/sanedlg.hrc | 1 +
extensions/source/scanner/sanedlg.hxx | 7 ++++++-
extensions/source/scanner/sanedlg.src | 7 +++++++
extensions/source/scanner/scanner.cxx | 10 ++++++++--
extensions/source/scanner/scanner.hxx | 3 ++-
extensions/source/scanner/scanunx.cxx | 9 +++++++--
extensions/source/scanner/scanwin.cxx | 2 +-
extensions/source/scanner/scn.component | 4 ++--
offapi/UnoApi_offapi.mk | 2 ++
sd/inc/pch/precompiled_sd.hxx | 1 +
sd/source/ui/inc/DrawViewShell.hxx | 4 ++--
sd/source/ui/view/drviews8.cxx | 2 +-
sd/source/ui/view/drviewsa.cxx | 4 ++--
sw/inc/pch/precompiled_sw.hxx | 1 +
sw/inc/swmodule.hxx | 6 +++---
sw/source/ui/app/swmodule.cxx | 8 ++++----
sw/source/ui/uiview/uivwimp.cxx | 12 +++++++-----
sw/source/ui/uiview/view.cxx | 4 ++--
20 files changed, 74 insertions(+), 30 deletions(-)
diff --git a/extensions/inc/pch/precompiled_extensions.hxx b/extensions/inc/pch/precompiled_extensions.hxx
index 4582abb..abf2a4d 100644
--- a/extensions/inc/pch/precompiled_extensions.hxx
+++ b/extensions/inc/pch/precompiled_extensions.hxx
@@ -272,6 +272,7 @@
#include "com/sun/star/resource/XResourceBundleLoader.hpp"
#include "com/sun/star/scanner/ScannerException.hpp"
#include "com/sun/star/scanner/XScannerManager.hpp"
+#include "com/sun/star/scanner/XScannerManager2.hpp"
#include "com/sun/star/script/ContextInformation.hpp"
#include "com/sun/star/script/FailReason.hpp"
#include "com/sun/star/script/FinishEngineEvent.hpp"
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 39b8862..acec566 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -48,16 +48,18 @@ ResId SaneResId( sal_uInt32 nID )
return ResId( nID, *pResMgr );
}
-SaneDlg::SaneDlg( Window* pParent, Sane& rSane ) :
+SaneDlg::SaneDlg( Window* pParent, Sane& rSane, sal_Bool bScanEnabled ) :
ModalDialog( pParent, SaneResId( RID_SANE_DIALOG ) ),
mrSane( rSane ),
mbIsDragging( sal_False ),
+ mbScanEnabled( bScanEnabled ),
mbDragDrawn( sal_False ),
maMapMode( MAP_APPFONT ),
maOKButton( this, SaneResId( RID_SCAN_OK ) ),
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 +90,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 +100,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 ) );
@@ -189,6 +193,7 @@ void SaneDlg::InitFields()
maReslBox.Clear();
maMinTopLeft = Point( 0, 0 );
maMaxBottomRight = Point( PREVIEW_WIDTH, PREVIEW_HEIGHT );
+ maScanButton.Show( mbScanEnabled );
if( ! mrSane.IsOpen() )
return;
@@ -476,13 +481,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 +1383,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..b43e2a1 100644
--- a/extensions/source/scanner/sanedlg.hxx
+++ b/extensions/source/scanner/sanedlg.hxx
@@ -53,6 +53,7 @@ private:
Point maMinTopLeft, maMaxBottomRight;
sal_Bool mbDragEnable;
sal_Bool mbIsDragging;
+ sal_Bool mbScanEnabled;
int mnDragMode;
sal_Bool mbDragDrawn;
DragDirection meDragDirection;
@@ -65,6 +66,7 @@ private:
CancelButton maCancelButton;
PushButton maDeviceInfoButton;
PushButton maPreviewButton;
+ PushButton maScanButton;
PushButton maButtonOption;
FixedText maOptionsTxt;
@@ -107,6 +109,8 @@ private:
double* mpRange;
double mfMin, mfMax;
+ sal_Bool doScan;
+
DECL_LINK( ClickBtnHdl, Button* );
DECL_LINK( SelectHdl, ListBox* );
DECL_LINK( ModifyHdl, Edit* );
@@ -141,10 +145,11 @@ private:
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
public:
- SaneDlg( Window*, Sane& );
+ SaneDlg( Window*, Sane&, sal_Bool );
~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.cxx b/extensions/source/scanner/scanner.cxx
index e833c4f..6992b75 100644
--- a/extensions/source/scanner/scanner.cxx
+++ b/extensions/source/scanner/scanner.cxx
@@ -90,7 +90,7 @@ SEQ( sal_Int8 ) SAL_CALL ScannerManager::getMaskDIB() throw()
OUString ScannerManager::getImplementationName_Static() throw()
{
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.scanner.ScannerManager" ) );
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.scanner.ScannerManager2" ) );
}
// -----------------------------------------------------------------------------
@@ -99,9 +99,15 @@ SEQ( OUString ) ScannerManager::getSupportedServiceNames_Static() throw ()
{
SEQ( OUString ) aSNS( 1 );
- aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.scanner.ScannerManager" ) );
+ aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.scanner.ScannerManager2" ) );
return aSNS;
}
+sal_Bool SAL_CALL ScannerManager::configureScanner( ScannerContext& rContext )
+ throw( ScannerException )
+{
+ return configureScannerAndScan( rContext, NULL );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/scanner/scanner.hxx b/extensions/source/scanner/scanner.hxx
index abe2ae3..434e492 100644
--- a/extensions/source/scanner/scanner.hxx
+++ b/extensions/source/scanner/scanner.hxx
@@ -83,7 +83,8 @@ 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 ) throw( ScannerException );
+ virtual sal_Bool SAL_CALL configureScannerAndScan( 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..9980fd4 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::configureScannerAndScan( ScannerContext& scanner_context,
+ const REF( com::sun::star::lang::XEventListener )& listener ) throw( ScannerException )
{
osl::MutexGuard aGuard( theSaneProtector::get() );
sanevec &rSanes = theSanes::get().m_aSanes;
@@ -303,10 +304,14 @@ sal_Bool ScannerManager::configureScanner( ScannerContext& scanner_context ) thr
);
pHolder->m_bBusy = true;
- SaneDlg aDlg( NULL, pHolder->m_aSane );
+ SaneDlg aDlg( NULL, pHolder->m_aSane, (listener != NULL) );
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..a57b1c8 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::configureScannerAndScan( ScannerContext& rContext, const uno::Reference< lang::XEventListener >& rxListener )
throw( ScannerException )
{
osl::MutexGuard aGuard( maProtector );
diff --git a/extensions/source/scanner/scn.component b/extensions/source/scanner/scn.component
index d7daf3a..53b88c9 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.ScannerManager">
- <service name="com.sun.star.scanner.ScannerManager"/>
+ <implementation name="com.sun.star.scanner.ScannerManager2">
+ <service name="com.sun.star.scanner.ScannerManager2"/>
</implementation>
</component>
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index a956fb0..e3bc6e2 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -850,6 +850,7 @@ $(eval $(call gb_UnoApiTarget_add_idlfiles_noheader,offapi,offapi/com/sun/star/s
))
$(eval $(call gb_UnoApiTarget_add_idlfiles_noheader,offapi,offapi/com/sun/star/scanner,\
ScannerManager \
+ ScannerManager2 \
))
$(eval $(call gb_UnoApiTarget_add_idlfiles_noheader,offapi,offapi/com/sun/star/script/browse,\
BrowseNode \
@@ -2957,6 +2958,7 @@ $(eval $(call gb_UnoApiTarget_add_idlfiles,offapi,offapi/com/sun/star/scanner,\
ScannerContext \
ScannerException \
XScannerManager \
+ XScannerManager2 \
))
$(eval $(call gb_UnoApiTarget_add_idlfiles,offapi,offapi/com/sun/star/script,\
LibraryNotLoadedException \
diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx
index d691226..e5cc132 100644
--- a/sd/inc/pch/precompiled_sd.hxx
+++ b/sd/inc/pch/precompiled_sd.hxx
@@ -294,6 +294,7 @@
#include "com/sun/star/registry/XRegistryKey.hpp"
#include "com/sun/star/rendering/XSpriteCanvas.hpp"
#include "com/sun/star/scanner/XScannerManager.hpp"
+#include "com/sun/star/scanner/XScannerManager2.hpp"
#include "com/sun/star/sdbc/XResultSet.hpp"
#include "com/sun/star/sdbc/XRow.hpp"
#include "com/sun/star/style/LineSpacing.hpp"
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 5e7a345..57b3238 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -36,7 +36,7 @@
#include "TabControl.hxx"
#include "pres.hxx"
#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/scanner/XScannerManager.hpp>
+#include <com/sun/star/scanner/XScannerManager2.hpp>
#include <unotools/caserotate.hxx>
class SdPage;
@@ -451,7 +451,7 @@ private:
SdPage* pPage,
const sal_Int32 nInsertPosition = -1);
- ::com::sun::star::uno::Reference< ::com::sun::star::scanner::XScannerManager > mxScannerManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::scanner::XScannerManager2 > mxScannerManager;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > mxScannerListener;
TransferableClipboardListener* mpClipEvtLstnr;
sal_Bool mbPastePossible;
diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx
index b12c10e..726e9be 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->configureScannerAndScan( aContext, mxScannerListener );
}
}
catch(...)
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 5f7c07e..fb384b2 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -393,8 +393,8 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind)
if( xMgr.is() )
{
- mxScannerManager = ::com::sun::star::uno::Reference< ::com::sun::star::scanner::XScannerManager >(
- xMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.scanner.ScannerManager" )) ),
+ mxScannerManager = ::com::sun::star::uno::Reference< ::com::sun::star::scanner::XScannerManager2 >(
+ xMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.scanner.ScannerManager2" )) ),
::com::sun::star::uno::UNO_QUERY );
if( mxScannerManager.is() )
diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx
index d577822..53136b3 100644
--- a/sw/inc/pch/precompiled_sw.hxx
+++ b/sw/inc/pch/precompiled_sw.hxx
@@ -272,6 +272,7 @@
#include "com/sun/star/packages/zip/ZipIOException.hpp"
#include "com/sun/star/scanner/ScannerContext.hpp"
#include "com/sun/star/scanner/XScannerManager.hpp"
+#include "com/sun/star/scanner/XScannerManager2.hpp"
#include "com/sun/star/script/XEventAttacher.hpp"
#include "com/sun/star/script/XEventAttacherManager.hpp"
#include "com/sun/star/script/XLibraryContainer.hpp"
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index dd2b27c..7639237 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -72,7 +72,7 @@ struct SwDBData;
#define VIEWOPT_DEST_VIEW_ONLY 3 //ViewOptions are set only at ::com::sun::star::sdbcx::View, not at the appl.
namespace com{ namespace sun{ namespace star{ namespace scanner{
- class XScannerManager;
+ class XScannerManager2;
}}}}
class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::ConfigurationListener
@@ -113,7 +113,7 @@ class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::C
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XLinguServiceEventListener > xLngSvcEvtListener;
::com::sun::star::uno::Reference<
- ::com::sun::star::scanner::XScannerManager > m_xScannerManager;
+ ::com::sun::star::scanner::XScannerManager2 > m_xScannerManager;
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser;
@@ -242,7 +242,7 @@ public:
void CreateLngSvcEvtListener();
::com::sun::star::uno::Reference<
- ::com::sun::star::scanner::XScannerManager >
+ ::com::sun::star::scanner::XScannerManager2 >
GetScannerManager();
::com::sun::star::uno::Reference<
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index 0e50081..fdde311 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -65,7 +65,7 @@
#include <svx/extrusioncolorcontrol.hxx>
#include <svx/fontworkgallery.hxx>
#include <svx/modctrl.hxx>
-#include <com/sun/star/scanner/XScannerManager.hpp>
+#include <com/sun/star/scanner/XScannerManager2.hpp>
#include <com/sun/star/container/XSet.hpp>
#include <comphelper/processfactory.hxx>
#include <docsh.hxx>
@@ -215,7 +215,7 @@ SwModule::SwModule( SfxObjectFactory* pWebFact,
// at the view options.
GetColorConfig();
}
-uno::Reference< scanner::XScannerManager >
+uno::Reference< scanner::XScannerManager2 >
SwModule::GetScannerManager()
{
if (!m_xScannerManager.is())
@@ -225,10 +225,10 @@ SwModule::GetScannerManager()
if( xMgr.is() )
{
m_xScannerManager =
- uno::Reference< scanner::XScannerManager >(
+ uno::Reference< scanner::XScannerManager2 >(
xMgr->createInstance(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.scanner.ScannerManager")) ),
+ "com.sun.star.scanner.ScannerManager2")) ),
uno::UNO_QUERY );
}
}
diff --git a/sw/source/ui/uiview/uivwimp.cxx b/sw/source/ui/uiview/uivwimp.cxx
index aff53fe..cbd8a81 100644
--- a/sw/source/ui/uiview/uivwimp.cxx
+++ b/sw/source/ui/uiview/uivwimp.cxx
@@ -33,7 +33,7 @@
#include "globals.hrc"
#include <tools/shl.hxx>
-#include <com/sun/star/scanner/XScannerManager.hpp>
+#include <com/sun/star/scanner/XScannerManager2.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -131,19 +131,21 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq )
case SID_TWAIN_SELECT:
{
sal_Bool bDone = sal_False;
- Reference< XScannerManager > xScanMgr = SW_MOD()->GetScannerManager();
+ Reference< XScannerManager2 > xScanMgr = SW_MOD()->GetScannerManager();
if( xScanMgr.is() )
{
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->configureScannerAndScan( aContext, xLstner );
}
}
catch(...)
@@ -164,7 +166,7 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq )
{
sal_Bool bDone = sal_False;
- Reference< XScannerManager > xScanMgr = SW_MOD()->GetScannerManager();
+ Reference< XScannerManager2 > xScanMgr = SW_MOD()->GetScannerManager();
if( xScanMgr.is() )
{
SwScannerEventListener& rListener = GetScannerEventListener();
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 14eaf04..8fe2a81 100755
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -98,7 +98,7 @@
#include <editeng/unolingu.hxx>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/scanner/ScannerContext.hpp>
-#include <com/sun/star/scanner/XScannerManager.hpp>
+#include <com/sun/star/scanner/XScannerManager2.hpp>
#include <toolkit/unohlp.hxx>
#include <rtl/ustrbuf.hxx>
#include <xmloff/xmluconv.hxx>
@@ -1684,7 +1684,7 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
void SwView::ScannerEventHdl( const EventObject& /*rEventObject*/ )
{
- uno::Reference< XScannerManager > xScanMgr = SW_MOD()->GetScannerManager();
+ uno::Reference< XScannerManager2 > xScanMgr = SW_MOD()->GetScannerManager();
if( xScanMgr.is() )
{
const ScannerContext aContext( xScanMgr->getAvailableScanners().getConstArray()[ 0 ] );
--
1.7.0.4
--------------060900050307000006040702
Content-Type: text/x-patch;
name="0002-Added-a-scan-button-to-the-SaneDlg.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="0002-Added-a-scan-button-to-the-SaneDlg.patch"
More information about the LibreOffice
mailing list