Hi,
Here are 3 patches that together make the code for adding the
scan-button to the sanedlg.
These patches are submitted under the LGPLv3+/MPL-licence.
M.V.G.
Rob Snelders
On 20-10-11 09:39, Stephan Bergmann wrote:
On 10/19/2011 10:30 PM, Rob Snelders wrote:
I tried to add the XScannerManager2. But when I try with this patch then
the menu-items are disabled. I have tried to search where the problem
was but I canĀ“t find it. Can you help me?
Hi Rob,
The new file offapi/com/sun/star/scanner/XScannerManager2.idl is missing
from the patch (I guess you did not git add it before you created the
git diff).
Then, as Markus already pointed out, the ScannerManager class needs to
be adapted, to derive from XScannerManager2.
Further, I noted that when configureScannerAndScan in scanunx.cxx calls
the SaneDlg constructor, it should pass "listener.is()" instead of
"(listener != NULL)" for bScanEnabled. While the latter (happens to)
work as well, the former is much cleaner and the preferred idiom when
working with com::sun::star::uno::Reference.
And finally, the scanwin.cxx case does not support the new feature at
all, right? Then we should at least change the end of the changed line
in that file from "const uno::Reference< lang::XEventListener >&
rxListener )" to "const uno::Reference< lang::XEventListener >& )", to
avoid warnings about unused parameters. Better yet, the button should be
hidden. (Or even better yet, the new functionality should be
implemented...)
If you provide the missing XScannerManager2.idl, I can tweak the above
issues in the patch for you, if you like.
-Stephan
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice
From e000495fa09833d57f3897a4e08acc43df6f6e60 Mon Sep 17 00:00:00 2001
From: Rob Snelders <programming@ertai.nl>
Date: Wed, 19 Oct 2011 22:19:16 +0200
Subject: [PATCH] Added a scanbutton to the scan-dialog
---
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
From 12b2f27d8104c6a29b0a89a2f37bc369146d64d7 Mon Sep 17 00:00:00 2001
From: Rob Snelders <programming@ertai.nl>
Date: Thu, 20 Oct 2011 20:01:48 +0200
Subject: [PATCH] - Added-a-scan-button-to-the-SaneDlg
---
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
From b9b319a3822e9bf1bb8d5218013346f3429ecb30 Mon Sep 17 00:00:00 2001
From: Rob Snelders <programming@ertai.nl>
Date: Thu, 20 Oct 2011 20:34:10 +0200
Subject: [PATCH] making sure the scanwin doesn't give a new warning
---
extensions/source/scanner/scanunx.cxx | 2 +-
extensions/source/scanner/scanwin.cxx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx
index efa2a28..342f011 100644
--- a/extensions/source/scanner/scanunx.cxx
+++ b/extensions/source/scanner/scanunx.cxx
@@ -304,7 +304,7 @@ sal_Bool ScannerManager::configureScannerAndScan( ScannerContext& scanner_contex
);
pHolder->m_bBusy = true;
- SaneDlg aDlg( NULL, pHolder->m_aSane, istener.is() );
+ SaneDlg aDlg( NULL, pHolder->m_aSane, listener.is() );
sal_Bool bRet = (sal_Bool)aDlg.Execute();
bool bScan = aDlg.getDoScan();
pHolder->m_bBusy = false;
diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx
index a57b1c8..7a7c86b 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::configureScannerAndScan( ScannerContext& rContext, const
uno::Reference< lang::XEventListener >& rxListener )
+sal_Bool SAL_CALL ScannerManager::configureScannerAndScan( ScannerContext& rContext, const
uno::Reference< lang::XEventListener >& )
throw( ScannerException )
{
osl::MutexGuard aGuard( maProtector );
--
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.