Education Project/Effort/Improve Scanner Use

From Apache OpenOffice Wiki
< Education Project‎ | Effort
Revision as of 12:03, 30 March 2008 by Ericb (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Draft :

Current Scanner implementation is .. hmm

Improve it is mandatory

Todo: analyse current implementation


  • document the existing extensions/source/scanner implementation
  • define tasks in the Team: (ericb, valeuf, Dyrcona )
  • document everything
  • play with Image Capture SDK  : create a little application,
  • test all features
  • design: classes, naming conventions, API description
  • define source code changes for new scanmacosx.cxx file, and it's compilation
  • file an issue about the new feature
  • define new specs
  • create a cws : explain the steps
  • start with new implementation (code and debug )
  • define tests to validate new features


Imprpove Scanner Use on Mac OS X
Task week A week B week C week D week E week F Status Assigned to Comments
Write specs

Current design in code location


[FIXME]: Twain interface should work on Mac OS X version of, and configure does accept 
command line options. Tests scheduled

Products built

All : scanner , scnserv

Windows( WNT) : scanwin

Other ( UNX or OS2 ) :

sane, sandlg scanunx and grid

Code documentation

See extensions/source/scanner source code documentation


  • Class description
  • Methods description
  • some diagrams (inheritance)
  • source code

important: the documentation above has been generated using Doxygen, made with current code (from DEV300_m0)

Does not contain : libscn generation + build process, and Design about the Mac OS X lib


scanner.cxx: uses libsane (3rd part library, must be installed separately). All system calls in libscn extension, are using SANE macros constants, while Apple does provide Twain blob for all scanners.

grid.*  : defines the look of the dialog box + the implementation.

To be done: thre is an existing Image Capture device, using Twain on Mac OS X. The idea is to bind with Image Capture device instead of the heavy SANE thing.

The Apple Image Capture SDK does contain code sample ( Model View Controler paradigm in objective C ( to be modified in objc++ )

Interface description

Draft about scanwin.cxx

3 classes : ScannerManager / Twain / ImpTwain. Diagram help to understand the link between this 3 classes :

ImplTwain == the real stuff

Twain == empty box, calling the Impl* one

There is some method of ScannerManager which are define in scanwin.cxx and scanunx.cxx :

* DestroyData
* getAvailableScanners
* configureScanner 
* startScan
* getError

This method are using for the data acquisition. First step will be to have the method getAvailableScanners which works correctly. But there is some little problem !

How function getAvailableScanners in scannwin.cxx ?

(I'm not sure about the next !)

In scanunx.cxx aRet.getArray()[0].ScannerName = ::rtl::OUString::createFromAscii( "SANE" ); aRet.getArray()[0].InternalData = 0;

In scanwin.cxx aRet.getArray()[0].ScannerName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TWAIN" ) ); aRet.getArray()[0].InternalData = 0;

aRet is an implementation (object) of TwainHandler class. We can find the method getArray in TwainHANDLER.cpp (normal, TwainHANDLER is define in this file !!).

I don't find the definition of getArray in extensions/source/scanner/... But in TwainHANDLER we can understand this method can return information from aRet.

So for this time I'm not sure to understand when we initialize aRet.

Different Questions

Moved into the discussion (click me)

View problems

If I understand well, uno construct the window. But under mac we have to use cocoa ? At end of scanwin.cxx there is some method which derivate from uno, so I think it's for construct the interface. So now I have to understand how do the same things with cocoa (Dyrcona : I need your help !!!!).

ericb: the planI propose does consist in create an AquaImageView, including the minimal methods to make it work

The controler will instantiate a view, and will do the job

The handler will take over the Twain part

More precisely we have to create :

  • AquaImageView.h [basic implementation done]

Class AquaImageView, inheriting of NSView class

  • [basic implementation done]

AquaImageView implementation

Methods : drawRect: (NSRect)rect

Note: similar to and the Apple SDK code

  • AquaScannerControler.h [work in progress]
  • [work in progress]

  • scanmacosx.cxx [not started]

This part will use most of the scanwin.cxx implementation. We need to define all classes, methods to replace the TwainHandler, and adapt it to both Apple code and existing UNO implementation


The complete interface is defined in (list to be confirmed ):

In source code :







offapi/com/sun/star/awt ( lot of references )

+Includes :

  • grid.cxx

cstdio, cmath, grid.hxx, /* stl, for ::std::sort */ algorithm ,

+ (from grid.hxx) : vcl/window.hxx, vcl/button.hxx, vcl/listbox.hxx, vcl/dialog.hxx

Dialog boxes

The dialog boxes are defined in :



Implementation description


Important Links

Mac port Links

This work is part of

Debug using Xcode (click me)

Aqua Roadmap

Mac OS X side

Links :

Accessing Hardware from Applications

Twain Mac

TN2088 / Twain Data Sources for Mac OS X

PDF : How use TWAIN (Direct link with a PDF)

Some specification to use TWAIN with Mac OS (Direct link with a pdf)

Image Capture Services Programming Guide for Carbon


Apple Image SDK

Other :

Twain 2.0 specifications (draft)

Sane Project

Supported devices

Mac OS X Sane


Ericb 23:40, 5 October 2006 (CEST)

Personal tools