Calc Drawing Layer
==================

[ i.e. How to get objects and cells to interact nicely ]

Overview:
--------
  - Calc allows objects (images, embedded documents, etc.) to be placed 
    anywhere -- within a single cell, overlapping many cells, etc.
  - Objects can be "anchored" to the Page or to a Cell
    - "Anchor to Cell" ~~ "whenever the cell moves, move the object so that
      it's still within the cell."
      - Buggy; see http://www.openoffice.org/issues/show_bug.cgi?id=47088
    - "Anchor to Page" ~~ "don't move the object, even if
      columns/rows/fonts/etc. are resized"
  - To support both Page and Cell anchoring, Objects are not kept within a
    Sc*Cell data structure.
  - Instead, we "magically" infer the row that the object belongs to by using
    it's position

Implementation:
--------------
  - Drawing Layer implemented within ScDrawLayer <sc/inc/drwlayer.hxx>
  - ScDrawLayer logically contains a collection of 
    SdrPage <svx/svdpage.hxx> objects
    - via indirect base type method SdrModel::GetPage() <svx/svdmodel.hxx>
  - SdrPage contains a collection of SdrObject instances
    - Iterated over via SdrObjListIter
  - Key Point: SdrObjects know their location on the Drawing Layer via
    SdrObject::GetSnapRect() and/or SdrObject::GetLogicRect().
    - This location is in Millimeters!
  - Meanwhile, the rest of Calc stores everything in Twips -- e.g.
    ScDocument::FastGetRowHeight(), ScDocument::GetColWidth() return
    measurements in Twips, not in mm.
    - Necessitates converting Twips -> MM and MM -> Twips to determine 
      what row/column (i.e. cell) an Object is anchored to.
  - See ScDrawLayer::MoveAreaTwips() for an example.
  - Not all of Calc is in Twips; ScDrawLayer::MoveAreaTwips() needs to do
    MM->Twips to get object position, then do Twips->MM conversion to store
    Undo information.

Measuring:
---------
  - When drawing/moving/etc., the Mouse position (0,0) is the top-left corner
    of cell A1 (i.e. the row & column headers are ignored).
  - Measurements passed to ScHeaderControl::MouseButtonUp() are in Pixels
  - Pixels converted to Twips in ScRowBar::SetEntrySize() via
    nPixels/pViewData->GetPPTY(); GetPPTY() is based on
    ScGlobal::nScreenPPTY and the Zoom scale
  - For 100% scale on my laptop, ScGlobal::nScreenPPTY = 0.086.
  - So 430 pixels is 5000 Twips

