Notes on postit use:

+++ sc/inc/postit.hxx	2006-07-03 17:40:57.000000000 +0100
+++ sc/inc/document.hxx	2006-07-03 17:27:26.000000000 +0100
+++ sc/inc/dociter.hxx	2006-07-04 09:43:00.000000000 +0100
+++ sc/inc/column.hxx	2006-07-04 09:21:13.000000000 +0100
+++ sc/inc/cell.hxx	2006-07-04 18:22:00.000000000 +0100

+++ sc/source/ui/view/printfun.cxx
    + pDoc->GetCell( ScAddress ) + GetNotePtr on cell ...
    + ScHorizontalCellIterator ... (also have ScAddress)

+++ sc/source/ui/view/output.cxx
    + All calls: - use CellInfo
*** AA
AA	+ document.cxx :: ScTableInfo 'FillInfo' method
AA	+ update fillinfo copy constructors etc.

+++ sc/source/ui/unoobj/docuno.cxx
    + ScAnnotationsObj uses ScCellIterator ...
AA	+ add GetNotePtr to that

+ other ScCellIterator fixups:
	+ do we need an ScNoteIterator ? [ easyish ? ]
    +++ sc/source/ui/unoobj/cellsuno.cxx
    +++ sc/source/ui/navipi/content.cxx
    +++ sc/source/ui/docshell/docsh.cxx
    +++ sc/source/ui/docshell/dbdocfun.cxx
    +++ sc/source/filter/xml/xmlexprt.cxx
    +++ sc/source/filter/excel/xetable.cxx
    +++ sc/source/core/data/dociter.cxx

+++ sc/source/core/tool/interpr2.cxx
    + has ScAddress

+++ sc/source/core/data/table6.cxx
    + col/row etc.
AA: + need ScTable::GetNote ().

+++ sc/source/core/data/column.cxx
+++ sc/source/core/data/column3.cxx
+++ sc/source/core/data/column2.cxx
    + hard core, but has doc/column [etc.]

+++ sc/source/core/data/cell.cxx
    + should remove all note logic ...
    + copy constructors ...

+ Currently touched only for 'Delete' ptr. [hmm]
    +++ sc/source/ui/undo/undocell.cxx
	+ needs native storage for notes [ parallel to cell ]
	+ [ ScPostIt ** arrays ? ]
    +++ sc/source/ui/docshell/docfunc.cxx
	+ have ScAddress etc.
AA:	    + Was this used for PostIt setting ?
		+ if so, it won't work now :-)
		+ Audit PutCell usage ...
    +++ sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
	+ ScMyCellInfo - (in .hxx) - unclear ...
    +++ sc/source/core/tool/chgtrack.cxx
	+ ScChangeActionContent : ScChangeAction
	    ScBigRange: row/col/tab all there ...
    +++ sc/source/core/data/validat.cxx
	+ IsDataValid - no note necessary


+ old cell methods:
	// these may live somewhere else more logically
	void			SetNote( const ScPostIt& rNote, ScDocument* pDoc );
	BOOL			GetNote( ScPostIt& rNote, ScDocument* pDoc ) const;
	const ScPostIt*	GetNotePtr( ScDocument *pDoc) const;
	void	    	DeleteNote(ScDocument* pDoc);

+ implement new methods.
    + do we need an 'ScNoteCell ?' - hash on address ?


+ ScDocument::GetNotePtr (...
    + NULL cell -> NULL
    + check / set 'special ...'
+ FIXME:
    + we shouldn't copy 'special' [ we can't use it ... ]
    + SetNote should cope with set to itself elegantly ;-)
      + should create & insert an ScNote cell if absent ...
	+ SetNoteInternal ...
    + Cell's Delete:
	+ *should* have ScDocument *
	    ... pDoc->DeleteNote(pCell) [etc.]
    + Hmm - compromise ...
    + URGH !!! - SetNoteInternal
	+ need to pass the ScNoteTracker - 

+ For this semantic:
    + Column::DeleteNote:
	+ we need to remove the cell itself ...

+ Need DeleteNote ...

	BOOL bEmpty = rNote.IsEmpty();

	SCSIZE nIndex;
	if (Search(nRow, nIndex))
	{
		ScBaseCell* pCell = pItems[nIndex].pCell;
		if (bEmpty && pCell->GetCellType() == CELLTYPE_NOTE && !pCell->GetBroadcaster())
			DeleteAtIndex(nIndex);
		else
			pCell->SetNote(rNote, pDocument);
	}
	else
	{
		if (!bEmpty)
		{
				fprintf (stderr, "inline me!\n");
				ScNoteCell *foo = new ScNoteCell(rNote);
				fprintf (stderr, "don't inline me!\n");
				Insert(nRow, foo);
				fprintf (stderr, "don't inline me!\n");
		}
	}

ScNoteCell - can disappear ...

++ Move 'LoadNote' to Document ... (?)

void ScBaseCell::LoadNote( SvStream& rStream, ScDocument* pDoc )
{
		fprintf (stderr, "LoadNote ran... - FIXME unimplemented ... special = %d\n", bSpecial);

/*	pNote = new ScPostIt(pDoc);
	rStream >> *pNote;
*/
}

TODO:
    + fix Ekie & Dr's comments ...
    + Bin all 'ScNoteCell' constructors -
      that consume ScPostIts ...
	+ Rename ScNostCell - ScPlaceholderCell
	    + ScDepTargetCell ... / whatever.
    + FIXME: do we need all those 'Doc' pointers on
             construction ? [urk?]

    + Add the pDocument to 'Delete' ...
      remove from the hash ... or Column->Delete (?)

* Test:
    + change tracking
    + Excel import / export
    + load/save etc.
    + add assertions to check doc / pool is empty at end
    + Functions:
	+ test ScColumn::SwapRow ..


* TODO:

    * Catch all remaning cases of failure
    * Catch all 'CloneCell' calls - that are unhandled ...
    * All 'DeleteCell's handled except:

Audit classes:
    + no elegant sharing possible ... - just brute force add
      the Note information ...
    + These have no 'Format' work => not used for Notes
	+ ScUndoEnterValue
	    + sc/source/ui/view/viewfunc.cxx (ScViewFunc::EnterData)
		+ build list of Notes (?)
	+ ScUndoPutCell
	    + Should ScDocFunc::PutCell take a 'Note' pointer ?
		+ it does no 'format' stuff so ... (?)
	    + sc/source/ui/docshell/docfunc.cxx (ScDocFunc::PutCell)
    + This guy needs hacking ...
	+ ScUndoEnterData
	    + sc/source/ui/view/viewfunc.cxx (ScViewFunc::EnterData)
		+ build list of Notes (?)
	    + sc/source/ui/docshell/docfunc.cxx (ScDocFunc::SetNormalString)
		+ likewise.

+ FIXME: 
    + PostIt * pointers not being re-written when cut/pasting across documents
	+ Does a 'PostIt' really need a 'Doc' pointer anymore ?
	+ how did that get re-written in the past anyway ?
	    + urk !? [ noo ... ]
    + Add debug assertion on 'Insert' ?
    + *somehow* the PostIt *pDocument isn't getting re-written [urgh!?]
	+ set this in the 'SetNote' method on Document ?


  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                    
no file:
24291 michael   15   0  144m  56m  39m S    0  2.8   0:01.86 soffice.bin               # before
24340 michael   15   0  161m  55m  40m S    0  2.8   0:01.58 soffice.bin               # after

1 million ScCellValues:
24195 michael   15   0  183m  88m  41m S   14  4.4   0:08.94 soffice.bin                # before
24082 michael   15   0  186m  82m  42m S    7  4.1   0:07.03 soffice.bin                # after          


pDocShell->GetDocument()->GetDrawLayer() != 0 - is true ...

* We can store data in 2 places:
    + the draw layer for [xyz]?
    + the pNoteItemPool if not ...
	+ the note itself has the data to do this,
	    + lazy/code-re-use to store otherwise.


#0  0xb25670a3 in _STL::vector<ImplXMLShapeExportInfo, _STL::allocator<ImplXMLShapeExportInfo> >::size () from ./libxo680li.so
#1  0xb191eb66 in ScXMLExport::WriteAnnotation (this=0x889c9a0, rMyCell=@0xbf84e000) at /data/OpenOffice/ood680-m1/sc/source/filter/xml/xmlexprt.cxx:2822
#2  0xb192169d in ScXMLExport::WriteCell (this=0x889c9a0, aCell=@0xbf84e000) at /data/OpenOffice/ood680-m1/sc/source/filter/xml/xmlexprt.cxx:2505
#3  0xb192a298 in ScXMLExport::_ExportContent (this=0x889c9a0) at /data/OpenOffice/ood680-m1/sc/source/filter/xml/xmlexprt.cxx:1686
#4  0xb243e546 in SvXMLExport::ImplExportContent () from ./libxo680li.so
...
(gdb) p rMyCell
$1 = (ScMyCell &) @0xbf84e000: {xAnnotation = {<com::sun::star::uno::BaseReference> = {_pInterface = 0x92fc854}, <No data fields>}, 
  xNoteShape = {<com::sun::star::uno::BaseReference> = {_pInterface = 0x92fca60}, <No data fields>}, aCellAddress = {Sheet = 0, Column = 0, Row = 0}, 
  aMergeRange = {Sheet = 0, StartColumn = 0, StartRow = 0, EndColumn = 0, EndRow = 0}, aMatrixRange = {Sheet = 0, StartColumn = 0, StartRow = 0, 
    EndColumn = 0, EndRow = 0}, sStringValue = {pData = 0x9302010}, sAnnotationText = {pData = 0x92fe7d8}, aAreaLink = {sFilter = {pData = 0xb7674ed8}, 
    sFilterOptions = {pData = 0xb7674ed8}, sURL = {pData = 0xb7674ed8}, sSourceStr = {pData = 0xb7674ed8}, aDestRange = {Sheet = 0, StartColumn = 0, 
      StartRow = 0, EndColumn = 0, EndRow = 0}, nRefresh = 0}, aShapeList = {<_STL::_List_base<ScMyShape,_STL::allocator<ScMyShape> >> = {
      _M_node = {<_STL::allocator<_STL::_List_node<ScMyShape> >> = {<No data fields>}, _M_data = 0x8eb7300}}, <No data fields>}, 
  aDetectiveObjVec = {<_STL::_Vector_base<ScMyDetectiveObj,_STL::allocator<ScMyDetectiveObj> >> = {_M_start = 0x0, _M_finish = 0x0, 
      _M_end_of_storage = {<_STL::allocator<ScMyDetectiveObj>> = {<No data fields>}, _M_data = 0x0}}, <No data fields>}, 
  aDetectiveOpVec = {<_STL::_Vector_base<ScMyDetectiveOp,_STL::allocator<ScMyDetectiveOp> >> = {_M_start = 0x0, _M_finish = 0x0, 
      _M_end_of_storage = {<_STL::allocator<ScMyDetectiveOp>> = {<No data fields>}, _M_data = 0x0}}, <No data fields>}, fValue = -7.2094253395936799e-66, 
  nValidationIndex = -1, nStyleIndex = -1, nNumberFormat = 0, nType = com::sun::star::table::CellContentType_TEXT, bIsAutoStyle = 0 '\0', 
  bHasShape = 0 '\0', bIsMergedBase = 0 '\0', bIsCovered = 0 '\0', bHasAreaLink = 0 '\0', bHasEmptyDatabase = 0 '\0', bHasDetectiveObj = 0 '\0', 
  bHasDetectiveOp = 0 '\0', bIsEditCell = 0 '\0', bKnowWhetherIsEditCell = 0 '\0', bHasStringValue = 1 '\001', bHasDoubleValue = 0 '\0', bHasXText = 0 '\0', 
  bIsMatrixBase = 0 '\0', bIsMatrixCovered = 0 '\0', bHasAnnotation = 1 '\001'}
(gdb) p rMyCell.xNoteShape
$2 = {<com::sun::star::uno::BaseReference> = {_pInterface = 0x92fca60}, <No data fields>}



** ScMyNoteShapesContainer
    + only note shapes in here [ !? why not on the Cell !? ]

    + copied from:

void ScMySharedData::AddNoteObj(const uno::Reference<drawing::XShape>& xShape, const ScAddress& rPos)
{
    if (!pNoteShapes)
        pNoteShapes = new ScMyNoteShapesContainer();
    ScMyNoteShape aNote;
    aNote.xShape = xShape;
    aNote.aPos = rPos;
    pNoteShapes->AddNewNote(aNote);
}

    + used to collect auto-styles .. xmlexprt.cxx:

                    while (aNoteShapeItr != aNoteShapeEndItr)
                    {
                        if (static_cast<sal_Int32>(aNoteShapeItr->aPos.Tab()) == nTable)
                            GetShapeExport()->collectShapeAutoStyles(aNoteShapeItr->xShape);
                        ++aNoteShapeItr;
                    }


+ AddNoteObj - called by:
    + CollectShapesAutoStyles
	[ done already ? ]

    + This is broken ... [!?]

+ try pasting a shape too ? :-)

