Shared worksheets
=================

- Excel's feature description
  - http://office.microsoft.com/en-us/assistance/HA010130571033.aspx

- Proposal
  - switch to shared workbook
    - implies Edit -> Changes -> Record on
  - on save do
    - Merge Documents...
    - resolve conflicts
      - using the existing version dialog (but present just the conflicting
	changes!)
    - actual save

- Potential troubles
  - locking
    - OOo does not have an API to lock a certain file on demand
  - older OOo versions that are not aware of the shared documents
    - they open the file and take the lock
    - we have to provide the user with 'Save As' if we cannot obtain the lock
      (we could issue a 'Waiting for other users to save the changes...'
      dialog box with [Save As] and [Cancel] buttons.)

-----------------------------------------------------------

Change tracking in OOo - Calc

- Edit -> Changes
  - track changes in the document (who + what)
  - Record              - FID_CHG_RECORD
    - ScDocument::StartChangeTracking()
    - sc/inc/document.hxx,
      sc/source/core/data/documen2.cxx
    - creates new ScChangeTrack()
  - Protect Records,,,  - SID_CHG_PROTECT
  - Show...             - FID_CHG_SHOW
  - Accept or Reject... - FID_CHG_ACCEPT
  - Comments...         - FID_CHG_COMMENT
  - Merge Document...   - SID_DOCUMENT_MERGE

- Edit -> Compare documents...
  - SID_DOCUMENT_COMPARE
  - generates a set of changes (even if the document does not have change
    tracking on) & enables change tracking
  - sc/source/ui/docshell/docsh4.cxx
    - search for SID_DOCUMENT_COMPARE
      - handles even SID_DOCUMENT_MERGE
    - ScDocShell::ExecuteChangeProtectionDialog()
      - ask for passwd (if set)
    - get pOtherDocSh - ScDocShell for the second document
    - call ScDocShell::CompareDocument() or ScDocShell::MergeDocument() (in
      the merge case)
      - sc/source/ui/docshell/docsh3.cxx
      - ScDocShell::CompareDocument()
        - creates a new change track and calls ScDocument::CompareDocument()
	- sc/source/core/data/documen4.cxx
      - ScDocShell::MergeDocument()
        - does the work by itself
        - sc/source/ui/docshell/docsh3.cxx

- ScChangeTrack
  - sc/inc/chgtrack.hxx
  - sc/source/core/tool/chgtrack.cxx

-----------------------------------------------------------

Change tracking in OOo - Writer

- Edit -> Compare documents...
  - SID_DOCUMENT_COMPARE
  - sw/source/ui/uiview/view2.cxx
    sw/source/ui/uiview/viewstat.cxx

-----------------------------------------------------------

Change tracking in OOo - common

- Change tracking dialog
  - sc/source/ui/inc/acredlin.hxx
  - sc/source/ui/miscdlgs/acredlin.cxx

- Locking
  - not shared between 32bit and 64bit version?! FIXME?

-----------------------------------------------------------

Common loading notes

- a (~random) backtrace from loading:
    __cxa_throw
    SvxUnoDrawMSFactory::createInstance
    SvxFmMSFactory::createInstance
    SwXTextDocument::createInstance
    SvXMLImport::startDocument
    SwXMLImport::startDocument
    OOo2OasisTransformer::startDocument
    sax_expatwrap::SaxExpatParser::parseStream
    ReadThroughComponent
    ReadThroughComponent
    XMLReader::Read
    SwReader::Read
    SwDocShell::Load
    SfxObjectShell::LoadOwnFormat
    SfxObjectShell::DoLoad
    SfxBaseModel::load
    SfxFrameLoader_Impl::load
    framework::LoadEnv::impl_loadContent
    framework::LoadEnv::startLoading
    framework::LoadEnv::loadComponentFromURL
    framework::Desktop::loadComponentFromURL
    SfxApplication::OpenDocExec_Impl
    SfxDispatcher::Call_Impl
    SfxDispatcher::Execute
    SfxApplication::OpenDocExec_Impl
    SfxDispatcher::Call_Impl
    SfxDispatcher::PostMsgHandler
    SfxHintPoster::LinkStubDoEvent_Impl
    ImplWindowFrameProc
    SalDisplay::DispatchInternalEvent
    SalX11Display::Yield
    DisplayYield
    SalXLib::Yield
    Application::Yield
    Application::Execute
    _ZN7desktop7Desktop4MainEv
    ImplSVMain
    SVMain
    sal_main
    __libc_start_main
    _start

- framework::LoadEnv
  - the doc says
    - implements general mechainsm for loading documents
    - An instance of this class can be used inside the API calls
      XComponentLoader::loadComponentFromURL() and XDispatch::dispatch()
      (of course in its derived interfaces too :-)).
  - include framework/source/inc/loadenv/loadenv.hxx
  - implementation framework/source/loadenv/loadenv.cxx
  - methods
    - loadComponentFromURL() - loading
      - impl_detectTypeAndFilter() - type detection
        - filter::config::TypeDetection
      - impl_loadContent()

- filter::config::TypeDetection
  - methods
    - queryTypeByDescriptor()

- Detectors
  - "com.sun.star.comp.chart.FormatDetector"  - sch/source/ui/unoidl/schdet.cxx
  - "com.sun.star.comp.draw.FormatDetector"   - sd/source/ui/unoidl/sddetect.cxx
  - "com.sun.star.comp.calc.FormatDetector"   - sc/source/ui/unoobj/scdetect.cxx
  - "com.sun.star.comp.math.FormatDetector"   - starmath/source/smdetect.cxx
  - "com.sun.star.comp.writer.FormatDetector" - sw/source/ui/uno/swdetect.cxx
