home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osp1.exe / src / basecntr / iodbcobj.cpp < prev    next >
Text File  |  1997-04-02  |  44KB  |  1,214 lines

  1. //====START_GENERATED_PROLOG======================================
  2. //
  3. //
  4. //   COMPONENT_NAME: odbasecntr
  5. //
  6. //   CLASSES: none
  7. //
  8. //   ORIGINS: 82,27
  9. //
  10. //
  11. //   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  12. //   All Rights Reserved
  13. //   Licensed Materials - Property of IBM
  14. //   US Government Users Restricted Rights - Use, duplication or
  15. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16. //       
  17. //   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. //   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19. //   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  20. //   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  21. //   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  22. //   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  23. //   OR PERFORMANCE OF THIS SOFTWARE.
  24. //
  25. //====END_GENERATED_PROLOG========================================
  26. //
  27. /* @(#) 1.37 com/src/samples/basecntr/iodbcobj.cpp, odbasepart, od96os2, odos29714c 3/28/97 10:56:26 [4/2/97 17:20:15] */
  28.  
  29. /*
  30.  *  This file was generated by the SOM Compiler.
  31.  *  Generated using:
  32.  *     SOM incremental update: Development
  33.  */
  34.  
  35.  
  36. #define SOM_Module_iodbcobj_Source
  37.  
  38. #define VARIABLE_MACROS
  39. #define METHOD_MACROS
  40. #define SOM_DONT_IMPORT_CLASS_ALink
  41. #define SOM_DONT_IMPORT_CLASS_ALinkedList
  42. #define SOM_DONT_IMPORT_CLASS_BCIterator
  43.  
  44. #ifndef _ALTPOINT_
  45. #include <AltPoint.h>
  46. #endif
  47.  
  48. #ifndef SOM_ODStorageUnit_xh
  49. #include <StorageU.xh>
  50. #endif
  51.  
  52. #ifndef SOM_ODStorageUnitCursor_xh
  53. #include <SUCursor.xh>
  54. #endif
  55.  
  56. #ifndef SOM_ODFrame_xh
  57. #include <Frame.xh>
  58. #endif
  59.  
  60. #ifndef SOM_ODFacet_xh
  61. #include <Facet.xh>
  62. #endif
  63.  
  64. #ifndef SOM_ODTransform_xh
  65. #include <Trnsform.xh>
  66. #endif
  67.  
  68. #ifndef SOM_ODShape_xh
  69. #include <Shape.xh>
  70. #endif
  71.  
  72. #ifndef SOM_ODFrameFacetIterator_xh
  73. #include <FrFaItr.xh>
  74. #endif
  75.  
  76. #ifndef SOM_ODSession_xh
  77. #include <ODSessn.xh>
  78. #endif
  79.  
  80. #include <StdProps.xh>
  81. #include <TempObj.h>
  82. #include <ODDebug.h>
  83. #include <StorUtil.h>
  84. #include <ODMath.h>
  85. #include <StdTypIO.h>
  86. #include <bcmain.h>         // Remove include when kODFrameList is made public.
  87.  
  88. #include <iodbcobj.xih>
  89.  
  90. #ifndef _ALinkedList_
  91. #include <iodbcutl.xh>
  92. #endif
  93.  
  94. #if defined(_PLATFORM_UNIX_)
  95. #define min(a,b) (a)<(b) ? (a) : (b)
  96. #define max(a,b) (a)>(b) ? (a) : (b)
  97. #endif
  98.  
  99. extern ODFacet* FirstFacet (Environment *ev, ODFrame *frame);
  100.  
  101. void ComputeRectAfterResize (ODRect *rect, ODULong resizeFlags,
  102.                              ODPoint *endPt)
  103. {
  104.     ODRect boundingRect = *rect;
  105.  
  106.     if (resizeFlags & COBJ_RESIZE_LEFT)
  107.     {
  108.        rect->left = min(boundingRect.right, endPt->x);
  109.        rect->right = max(boundingRect.right, endPt->x);
  110.     }
  111.     else if (resizeFlags & COBJ_RESIZE_RIGHT)
  112.     {
  113.        rect->left = min(boundingRect.left, endPt->x);
  114.        rect->right = max(boundingRect.left, endPt->x);
  115.     }
  116.  
  117. #if defined(_PLATFORM_WIN32_) || defined(_PLATFORM_UNIX_)
  118.     if (resizeFlags & COBJ_RESIZE_TOP)
  119.     {
  120.        rect->top = min(boundingRect.bottom, endPt->y);
  121.        rect->bottom = max(boundingRect.bottom, endPt->y);
  122.     }
  123.     else if (resizeFlags & COBJ_RESIZE_BOTTOM)
  124.     {
  125.        rect->top = min(boundingRect.top, endPt->y);
  126.        rect->bottom = max(boundingRect.top, endPt->y);
  127.     }
  128. #elif defined(_PLATFORM_OS2_)
  129.     if (resizeFlags & COBJ_RESIZE_TOP)
  130.     {
  131.        rect->top = max(boundingRect.bottom, endPt->y);
  132.        rect->bottom = min(boundingRect.bottom, endPt->y);
  133.     }
  134.     else if (resizeFlags & COBJ_RESIZE_BOTTOM)
  135.     {
  136.        rect->top = max(boundingRect.top, endPt->y);
  137.        rect->bottom = min(boundingRect.top, endPt->y);
  138.     }
  139. #endif
  140.  
  141. }
  142.  
  143. SOM_Scope void  SOMLINK ContentObjectWriteContents(ContentObject *somSelf,
  144.                                                     Environment *ev,
  145.                                                    ODStorageUnit* toSU,
  146.                                                    BCTransferKind writeKind,
  147.                                                    BCCloneInfo* cloneInfo)
  148. {
  149.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  150.     ContentObjectMethodDebug("ContentObject","ContentObjectWriteContents");
  151.  
  152.    ODRect bbox = _boundingRect;
  153.    if (cloneInfo->refPoint) {
  154.       bbox.left -= cloneInfo->refPoint->x;
  155.       bbox.right -= cloneInfo->refPoint->x;
  156.       bbox.top -= cloneInfo->refPoint->y;
  157.       bbox.bottom -= cloneInfo->refPoint->y;
  158.    }
  159.  
  160. #ifdef _PLATFORM_OS2_
  161.    // Modify rectangle coordinates as if the origin was at top-left.
  162.    somSelf->ChangeRectBias(ev, &bbox);
  163. #endif
  164.  
  165.    ODSetRectProp (ev, toSU, kODNULL, kODNULL, &bbox);
  166.    //PRINT("write contents %lx\n", somSelf);
  167.    //_extTransform->WriteTo (ev, toSU);
  168.  
  169.    ODSetULongProp (ev, toSU, kODNULL, kODNULL, _linkStatus);
  170.  
  171. }
  172.  
  173. SOM_Scope void  SOMLINK ContentObjectReadContents(ContentObject *somSelf,
  174.                                                    Environment *ev,
  175.                                                   ODStorageUnit* fromSU,
  176.                                                   BCTransferKind readKind,
  177.                                                   BCCloneInfo* cloneInfo)
  178. {
  179.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  180.     ContentObjectMethodDebug("ContentObject","ContentObjectReadContents");
  181.  
  182.    _containingFrame = cloneInfo->myFrame;
  183.    ODGetRectProp (ev, fromSU, kODNULL, kODNULL, &_boundingRect);
  184.  
  185. #ifdef _PLATFORM_OS2_
  186.    // Reverse the coordinate modification applied in WriteContents
  187.    somSelf->ChangeRectBias(ev, &_boundingRect);
  188. #endif
  189.  
  190.    if (cloneInfo->refPoint) {
  191.       _boundingRect.left += cloneInfo->refPoint->x;
  192.       _boundingRect.right += cloneInfo->refPoint->x;
  193.       _boundingRect.top += cloneInfo->refPoint->y;
  194.       _boundingRect.bottom += cloneInfo->refPoint->y;
  195.    }
  196.  
  197.    //PRINT("read contents %lx\n", somSelf);
  198.    //_extTransform->ReadFrom (ev, fromSU);
  199.  
  200.    _linkStatus = ODGetULongProp (ev, fromSU, kODNULL, kODNULL);
  201. }
  202.  
  203. SOM_Scope void  SOMLINK ContentObjectDeleteContents(ContentObject *somSelf,
  204.                                                      Environment *ev,
  205.                                                     ODULong type)
  206. {
  207.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  208.     ContentObjectMethodDebug("ContentObject","ContentObjectDeleteContents");
  209.  
  210.    memset(&_boundingRect, 0, sizeof(ODRect));
  211.    _containingFrame = NULL;
  212.    _selectionState = 0;
  213.    _linkStatus = kODNotInLink;
  214. }
  215.  
  216. SOM_Scope void  SOMLINK ContentObjectMoveBy(ContentObject *somSelf,
  217.                                              Environment *ev,
  218.                                             ODPoint* offset)
  219. {
  220.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  221.     ContentObjectMethodDebug("ContentObject","ContentObjectMoveBy");
  222.  
  223.    _boundingRect.left += offset->x;
  224.    _boundingRect.right += offset->x;
  225.    _boundingRect.top += offset->y;
  226.    _boundingRect.bottom += offset->y;
  227. }
  228.  
  229.  
  230. SOM_Scope void  SOMLINK ContentObjectResize(ContentObject *somSelf,
  231.                                              Environment *ev,
  232.                                             ODPoint* endPt,
  233.                                             ODULong resizeFlags)
  234. {
  235.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  236.     ContentObjectMethodDebug("ContentObject","ContentObjectResize");
  237.  
  238.     ComputeRectAfterResize (&_boundingRect, resizeFlags, endPt);
  239.  
  240. }
  241.  
  242. SOM_Scope void  SOMLINK ContentObjectMoveToFront(ContentObject *somSelf,
  243.                                              Environment *ev)
  244. {
  245.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  246.     ContentObjectMethodDebug("ContentObject","ContentObjectMoveToFront");
  247.  
  248. }
  249.  
  250.  
  251. SOM_Scope void  SOMLINK ContentObjectMoveToBack(ContentObject *somSelf,
  252.                                              Environment *ev)
  253. {
  254.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  255.     ContentObjectMethodDebug("ContentObject","ContentObjectMoveToBack");
  256.  
  257. }
  258.  
  259. SOM_Scope ContentObject*  SOMLINK ContentObjectCreateNewView(ContentObject *somSelf,
  260.                                              Environment *ev, ODFrame *viewFrame)
  261. {
  262.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  263.     ContentObjectMethodDebug("ContentObject","ContentObjectCreateNewView");
  264.  
  265.     ContentObject *newObj = new ContentObject();
  266.     newObj->_set_boundingRect(ev, &_boundingRect);
  267.     newObj->_set_containingFrame (ev, viewFrame);
  268.     newObj->SetExtTransform (ev, _extTransform);
  269.  
  270.     return newObj;
  271. }
  272.  
  273.  
  274. SOM_Scope void  SOMLINK ContentObjectChangeExtTransform (ContentObject *somSelf,
  275.                                         Environment *ev, ODTransform *xform, ODULong xformFlags)
  276. {
  277.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  278.     ContentObjectMethodDebug("ContentObject","ContentObjectChangeExtTransform");
  279.  
  280.     switch (xformFlags) {
  281.     case EXTXFORM_REPLACE:
  282.        _extTransform->CopyFrom (ev, xform);
  283.        break;
  284.     case EXTXFORM_PRECOMPOSE:
  285.        _extTransform->PreCompose (ev, xform);
  286.        break;
  287.     case EXTXFORM_POSTCOMPOSE:
  288.        _extTransform->PostCompose (ev, xform);
  289.        break;
  290.     default:
  291.       break;
  292.     } /* endswitch */
  293.  
  294. }
  295.  
  296. SOM_Scope void  SOMLINK ContentObjectSetExtTransform (ContentObject *somSelf,
  297.                                         Environment *ev, ODTransform *extTransform)
  298. {
  299.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  300.     ContentObjectMethodDebug("ContentObject","ContentObjectSetExtTransform");
  301.  
  302.     _extTransform->CopyFrom (ev, extTransform);
  303. }
  304.  
  305. //-----------------------------------------------------------------------------
  306. //  ContentObject->ChangePointBias
  307. //
  308. //  Changes the coordinates of the given point from a coordinate system with a
  309. //  a bottom-left origin to one with a top-left origin, and vice-versa.
  310. //  
  311. //  point:           Point to be modified. It should be specified in 
  312. //                   content coordinates this ContentObject's containing part.
  313. //-----------------------------------------------------------------------------
  314. SOM_Scope void  SOMLINK ContentObjectChangePointBias ( ContentObject *somSelf,
  315.                                                        Environment   *ev, 
  316.                                                        ODPoint       *point)
  317. {
  318.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  319.     ContentObjectMethodDebug("ContentObject","ContentObjectChangePointBias");
  320.  
  321.     // Get the height of the container's content.
  322.     ODPoint extent(0,0);
  323.     __get_containingFrame(ev)->GetContentExtent(ev, &extent);
  324.  
  325.     // Translate the point.
  326.     point->y = extent.y - point->y;
  327. }
  328.  
  329. //-----------------------------------------------------------------------------
  330. //  ContentObject->ChangeRectBias
  331. //
  332. //  Changes the coordinates of the given rectangle from a coordinate system 
  333. //  with a bottom-left origin to one with a top-left origin, and vice-versa.
  334. //  
  335. //  rect:            Rectangle to be modified. It should be specified in 
  336. //                   content coordinates of this ContentObject's containing part.
  337. //-----------------------------------------------------------------------------
  338. SOM_Scope void  SOMLINK ContentObjectChangeRectBias ( ContentObject *somSelf,
  339.                                                       Environment   *ev,
  340.                                                       ODRect        *rect)
  341. {
  342.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  343.     ContentObjectMethodDebug("ContentObject","ContentObjectChangeRectBias");
  344.  
  345.     // Get the height of the container's content.
  346.     ODPoint extent(0,0);
  347.     __get_containingFrame(ev)->GetContentExtent(ev, &extent);
  348.  
  349.     // Modify the rectangle's coordinates.
  350.     rect->top = extent.y - rect->top;
  351.     rect->bottom = extent.y - rect->bottom;
  352. }
  353.  
  354. //-----------------------------------------------------------------------------
  355. //  ContentObject->ChangeTransformBias
  356. //
  357. //  Changes the offset of the given transform from a coordinate system 
  358. //  with a bottom-left origin to one with a top-left origin, and vice-versa.
  359. //  
  360. //  xform:           External transform to be modified. The offset of this
  361. //                   transform should specify the position of this 
  362. //                   ContentObject in its containing part's content.
  363. //-----------------------------------------------------------------------------
  364. SOM_Scope void  SOMLINK ContentObjectChangeTransformBias ( ContentObject *somSelf,
  365.                                                            Environment   *ev,
  366.                                                            ODTransform   *xform)
  367. {
  368.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  369.     ContentObjectMethodDebug("ContentObject","ContentObjectChangeTransformBias");
  370.  
  371.     // Get the offset from the transform. 
  372.     ODPoint offset(0,0);
  373.     xform->GetOffset(ev, &offset);
  374.  
  375.     // Get the height of the container's content.
  376.     ODPoint extent(0,0);
  377.     __get_containingFrame(ev)->GetContentExtent(ev, &extent);
  378.  
  379.     // Get the height of this object.
  380.     ODULong myHeight = somSelf->GetHeight(ev);
  381.  
  382.     // The new Y offset will be the container height minus 
  383.     // the current Y offset, minus the height of this object.
  384.     offset.y = extent.y - offset.y - myHeight;                                 
  385.     xform->SetOffset(ev, &offset);
  386. }
  387.  
  388. //-----------------------------------------------------------------------------
  389. //  ContentObject->GetHeight
  390. //
  391. //  Determines the height of this ContentObject.
  392. //-----------------------------------------------------------------------------
  393. SOM_Scope ODULong  SOMLINK ContentObjectGetHeight ( ContentObject *somSelf,
  394.                                                     Environment   *ev)
  395. {
  396.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  397.     ContentObjectMethodDebug("ContentObject","ContentObjectGetHeight");
  398.  
  399.     // Get the bounding rectangle of this object.
  400.     ODRect bbox = __get_boundingRect(ev);
  401.  
  402.     // Determine the height of this object.
  403.     return abs(bbox.top - bbox.bottom);
  404. }
  405.  
  406. SOM_Scope void  SOMLINK ContentObjectsomInit(ContentObject *somSelf)
  407. {
  408.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  409.     ContentObjectMethodDebug("ContentObject","ContentObjectsomInit");
  410.  
  411.     ContentObject_parent_ODObject_somInit(somSelf);
  412.  
  413.    _objType = COBJ_BASECLASS;
  414.    memset(&_boundingRect, 0, sizeof(ODRect));
  415.    _containingFrame = NULL;
  416.    _selectionState = 0;
  417.  
  418.    Environment *ev = somGetGlobalEnvironment();
  419.    _extTransform = new ODTransform();
  420.    _extTransform->InitTransform(ev);
  421.  
  422.    _linkStatus = kODNotInLink;
  423. }
  424.  
  425. SOM_Scope void  SOMLINK ContentObjectsomUninit(ContentObject *somSelf)
  426. {
  427.     ContentObjectData *somThis = ContentObjectGetData(somSelf);
  428.     ContentObjectMethodDebug("ContentObject","ContentObjectsomUninit");
  429.  
  430.     if (_extTransform) {
  431.        Environment *ev = somGetGlobalEnvironment();
  432.        _extTransform->Release(ev);
  433.     }
  434.     ContentObject_parent_ODObject_somUninit(somSelf);
  435. }
  436.  
  437.  
  438. SOM_Scope void  SOMLINK ContentFramesomInit(ContentFrame *somSelf)
  439. {
  440.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  441.     ContentFrameMethodDebug("ContentFrame","ContentFramesomInit");
  442.  
  443.     ContentFrame_parent_ContentObject_somInit(somSelf);
  444.  
  445.     __set_objType(somGetGlobalEnvironment(), COBJ_FRAMECLASS);
  446.     _myFrame = kODNULL;
  447. }
  448.  
  449. SOM_Scope void  SOMLINK ContentFramesomUninit(ContentFrame *somSelf)
  450. {
  451.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  452.     ContentFrameMethodDebug("ContentFrame","ContentFramesomUninit");
  453.  
  454.     ContentFrame_parent_ContentObject_somUninit(somSelf);
  455. }
  456.  
  457. SOM_Scope void  SOMLINK ContentFrame_set_selectionState(ContentFrame *somSelf,
  458.                                                          Environment *ev,
  459.                                                         ODULong selectionState)
  460. {
  461.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  462.     ContentFrameMethodDebug("ContentFrame","ContentFrame_set_selectionState");
  463.  
  464.     ContentFrame_parent_ContentObject__set_selectionState(somSelf,
  465.                                                           ev,
  466.                                                           selectionState);
  467.    ODFacet *theFacet = NULL;
  468.  
  469.    ODFrameFacetIterator* ffitr  =
  470.                        _myFrame->CreateFacetIterator(ev);
  471.    for (theFacet = (ODFacet *)ffitr->First(ev);
  472.                     ffitr->IsNotComplete(ev);
  473.                     theFacet = (ODFacet *)ffitr->Next(ev))
  474.    {
  475.  
  476.       if (selectionState) {
  477.           // Show selected state
  478.           theFacet->SetSelected(ev, kODTrue);
  479.           theFacet->ChangeHighlight(ev, kODFullHighlight);
  480.       }
  481.       else {
  482.           // Show deselected state
  483.           theFacet->SetSelected(ev, kODFalse);
  484.           theFacet->ChangeHighlight(ev, kODNoHighlight);
  485.       }
  486.    }
  487.  
  488.    delete ffitr;
  489.  
  490. }
  491.  
  492. SOM_Scope ODRect  SOMLINK ContentFrame_get_boundingRect(ContentFrame *somSelf,
  493.                                                           Environment *ev)
  494. {
  495.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  496.     ContentFrameMethodDebug("ContentFrame","ContentFrame_get_boundingRect");
  497.  
  498.    ODRect tempRect;
  499.  
  500.    TempODShape shape = _myFrame->AcquireFrameShape(ev, kODNULL);
  501.    TempODShape newShape = shape->Copy(ev);
  502.    ODFrameFacetIterator* ffitr  =
  503.                        _myFrame->CreateFacetIterator(ev);
  504.    ODFacet *facet = ffitr->First(ev);
  505.  
  506.    if(facet) {
  507.       TempODTransform tf = facet->AcquireExternalTransform (ev, kODNULL);
  508.       newShape->Transform(ev, tf);
  509.       newShape->GetBoundingBox (ev, &tempRect);
  510.    } else {
  511.       // This method may be called during internalization before we
  512.       // have a facet. In that case return the already internalized
  513.       // ContentObject's boundingRect.
  514.       tempRect = ContentFrame_parent_ContentObject__get_boundingRect(somSelf, ev);
  515.    }
  516.  
  517.    delete ffitr;
  518.    return tempRect;
  519. }
  520.  
  521. SOM_Scope ODFrame*  SOMLINK ContentFrame_get_containingFrame(ContentFrame *somSelf,
  522.                                                                Environment *ev)
  523. {
  524.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  525.     ContentFrameMethodDebug("ContentFrame","ContentFrame_get_containingFrame");
  526.  
  527.     if(_myFrame) {
  528.        TempODFrame tf = _myFrame->AcquireContainingFrame(ev);
  529.        return tf;
  530.     }else{
  531.        return ContentFrame_parent_ContentObject__get_containingFrame(somSelf, ev);
  532.     }
  533. }
  534.  
  535. SOM_Scope void  SOMLINK ContentFrame_set_containingFrame(ContentFrame *somSelf,
  536.                                                           Environment *ev,
  537.                                                          ODFrame* containingFrame)
  538. {
  539.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  540.     ContentFrameMethodDebug("ContentFrame","ContentFrame_set_containingFrame");
  541.  
  542.     ContentFrame_parent_ContentObject__set_containingFrame(somSelf,
  543.                                                            ev,
  544.                                                            containingFrame);
  545.     _myFrame->SetContainingFrame(ev, containingFrame);
  546. }
  547.  
  548. SOM_Scope ODULong  SOMLINK ContentFrame_get_linkStatus(ContentFrame *somSelf,
  549.                                                                Environment *ev)
  550. {
  551.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  552.     ContentFrameMethodDebug("ContentFrame","ContentFrame_get_linkStatus");
  553.  
  554.     return _myFrame->GetLinkStatus (ev);
  555. }
  556.  
  557. SOM_Scope void  SOMLINK ContentFrame_set_linkStatus(ContentFrame *somSelf,
  558.                                                           Environment *ev,
  559.                                                          ODULong linkStatus)
  560. {
  561.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  562.     ContentFrameMethodDebug("ContentFrame","ContentFrame_set_linkStatus");
  563.  
  564.     ContentFrame_parent_ContentObject__set_linkStatus(somSelf, ev, linkStatus);
  565.  
  566.     _myFrame->ChangeLinkStatus (ev, linkStatus);
  567. }
  568.  
  569. SOM_Scope void  SOMLINK ContentFrameWriteContents(ContentFrame *somSelf,
  570.                                                    Environment *ev,
  571.                                                   ODStorageUnit* toSU,
  572.                                                   BCTransferKind writeKind,
  573.                                                   BCCloneInfo* cloneInfo)
  574. {
  575.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  576.     ContentFrameMethodDebug("ContentFrame","ContentFrameWriteContents");
  577.  
  578.     TempODPart myPart = _myFrame->AcquirePart(ev);
  579.     ODDraft *fromDraft = myPart->GetStorageUnit(ev)->GetDraft(ev);
  580.     ODID frameID = _myFrame->GetStorageUnit (ev) ->GetID (ev);
  581.  
  582.     if (writeKind == EXTERNALIZE)
  583.        _myFrame->Externalize(ev);
  584.     else
  585.        frameID = fromDraft->Clone(ev, cloneInfo->key, frameID, 0, frameID);
  586.  
  587.     // Write contents to frame list standard part kind.
  588.     if(toSU->Exists(ev, kODPropContents, kODFrameList, 0) && (cloneInfo->frameListInfo)) {
  589.        somSelf->WriteContentsToFrameList(ev, toSU, writeKind, cloneInfo, frameID);
  590.     }
  591.  
  592.     // Call parent 
  593.     ContentFrame_parent_ContentObject_WriteContents(somSelf,
  594.                                                     ev,
  595.                                                     toSU,
  596.                                                     writeKind,
  597.                                                     cloneInfo);
  598.  
  599.     ODSetStrongSURefProp (ev, toSU, kODNULL, kODNULL, frameID);
  600.  
  601.     // Store the transform
  602.     ODFacet *firstFacet = FirstFacet (ev, _myFrame);
  603.     TempODTransform extTransform =
  604.               firstFacet->AcquireExternalTransform(ev, kODNULL);
  605.  
  606.     TempODTransform saveTransform = extTransform->Copy(ev);
  607.  
  608.     if (cloneInfo->refPoint) {
  609.        ODPoint pt( -(cloneInfo->refPoint->x), -(cloneInfo->refPoint->y));
  610.        saveTransform->MoveBy (ev, &pt);
  611.     }
  612.  
  613. #ifdef _PLATFORM_OS2_
  614.     // Modify the transform as if the origin was at top-left.
  615.     somSelf->ChangeTransformBias(ev, saveTransform);
  616. #endif
  617.  
  618.     ODMatrix m;
  619.     saveTransform->GetMatrix(ev, &m);
  620.  
  621.     ODSetMatrixProp (ev, toSU, kODNULL, kODNULL, &m);
  622.  
  623.     // Set parent's attributes which are needed later during
  624.     // internalization.
  625.     ODRect rect = __get_boundingRect(ev);
  626.     __set_boundingRect(ev, &rect);
  627.  
  628. }
  629.  
  630. SOM_Scope void  SOMLINK ContentFrameWriteContentsToFrameList(ContentFrame *somSelf,
  631.                                                   Environment *ev,
  632.                                                   ODStorageUnit* toSU,
  633.                                                   BCTransferKind writeKind,
  634.                                                   BCCloneInfo* cloneInfo,
  635.                                                   ODID frameID)
  636. {
  637.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  638.     ContentFrameMethodDebug("ContentFrame","ContentFrameWriteContentsToFrameList");
  639.  
  640.     // First, store the current storage unit position.
  641.     ODStorageUnitCursor *saveCursor = toSU->CreateCursorWithFocus(ev);
  642.     ODULong saveOffset = toSU->GetOffset(ev);
  643.  
  644.     // Move to the end of the kODFrameList value.
  645.     toSU->FocusWithCursor(ev, cloneInfo->frameListInfo->cursor);
  646.     toSU->SetOffset(ev, toSU->GetSize(ev));
  647.  
  648.     // Calculate the bounding box to write into kODFrameList for this frame.
  649.     ODRect bbox = __get_boundingRect(ev);
  650.  
  651. #ifdef _PLATFORM_OS2_
  652.     // The bounding box must be defined assuming top-left origin coordinates.
  653.     somSelf->ChangeRectBias(ev, &bbox);
  654. #endif
  655.  
  656.     // Normalize it to aggregate bounding box coordinates.
  657.     bbox.Offset(-(cloneInfo->frameListInfo->offset.x),
  658.                 -(cloneInfo->frameListInfo->offset.y));
  659.     
  660.     // Store the bounding box and a strong reference to the frame.
  661.     ODSetRectProp(ev, toSU, kODNULL, kODNULL, &bbox);
  662.     ODSetStrongSURefProp (ev, toSU, kODNULL, kODNULL, frameID);
  663.  
  664.     // Restore the focus.
  665.     toSU->FocusWithCursor(ev, saveCursor);
  666.     toSU->SetOffset(ev, saveOffset);
  667.     saveCursor->somFree();
  668.  
  669. }
  670.  
  671. SOM_Scope void  SOMLINK ContentFrameReadContents(ContentFrame *somSelf,
  672.                                                   Environment *ev,
  673.                                                  ODStorageUnit* fromSU,
  674.                                                  BCTransferKind readKind,
  675.                                                  BCCloneInfo* cloneInfo)
  676. {
  677.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  678.     ContentFrameMethodDebug("ContentFrame","ContentFrameReadContents");
  679.  
  680.    ODDraft *fromDraft = fromSU->GetDraft(ev);
  681.    TempODPart tPart = kODNULL;
  682.    ODDraft *toDraft = kODNULL;
  683.    ODStorageUnitRef aSURef;
  684.    ODFrame *embeddedFrame;
  685.    ODID id;
  686.    ODMatrix m;
  687.    ODRect bbox;
  688.  
  689.    if (_myFrame)
  690.       tPart = _myFrame->AcquirePart(ev);
  691.    else
  692.       tPart = cloneInfo->myFrame->AcquirePart(ev);
  693.    toDraft = tPart->GetStorageUnit(ev)->GetDraft(ev);
  694.  
  695.    if(!cloneInfo->frameListInfo) {         // Read from kODPropEmbeddedFrames
  696.  
  697.       // Call parent.
  698.       ContentFrame_parent_ContentObject_ReadContents(somSelf,
  699.                                                      ev,
  700.                                                      fromSU,
  701.                                                      readKind,
  702.                                                      cloneInfo);
  703.    
  704.       // Read in the frame ID.
  705.       id = ODGetStrongSURefProp (ev, fromSU, kODNULL, kODNULL);
  706.    
  707.       // Read in the matrix of the external transform
  708.       ODGetMatrixProp (ev, fromSU, kODNULL, kODNULL, &m);
  709.  
  710.    } else {                                // Read from kODFrameList
  711.  
  712.       // Read in the bounding box.
  713.       ODGetRectProp(ev, fromSU, kODNULL, kODNULL, &bbox);
  714.  
  715.       // Read in the frame ID.
  716.       id = ODGetStrongSURefProp (ev, fromSU, kODNULL, kODNULL);
  717.  
  718.    }
  719.  
  720.    if (id != kODNULLID) {
  721.       if (readKind == INTERNALIZE)
  722.          _myFrame = fromDraft->AcquireFrame(ev, id);
  723.  
  724.       else {
  725.          ODID frameID = fromDraft ->Clone (ev, cloneInfo->key, id, 0,0);
  726.          _myFrame = toDraft->AcquireFrame (ev, frameID);
  727.       }
  728.  
  729.       if (cloneInfo->myFrame)
  730.       {
  731.          if (readKind != INTERNALIZE)
  732.             __set_containingFrame (ev, cloneInfo->myFrame);
  733.          else
  734.          {
  735.             TempODFrame f = _myFrame->AcquireContainingFrame (ev);
  736.              if (f != cloneInfo->myFrame)
  737.              {
  738.                 __set_containingFrame (ev, cloneInfo->myFrame);
  739.                 PRINT ("** Setting parent in INTERNALIZE\n");
  740.              }
  741.          }
  742.       } // end if setting containing frame
  743.    } // end if id
  744.  
  745.  
  746.    // Create external transform
  747.    ODTransform *embedTransform = _myFrame->CreateTransform (ev);
  748.  
  749.    if(!cloneInfo->frameListInfo) {
  750.  
  751.       // Use the information read from the kODPropEmbeddedFrames property
  752.  
  753.       embedTransform->SetMatrix (ev, &m);
  754.  
  755. #ifdef _PLATFORM_OS2_
  756.       // Undo the transformation done in WriteContents
  757.       somSelf->ChangeTransformBias(ev, embedTransform);
  758. #endif
  759.  
  760.       // Take care of CLONE_SELECTED case
  761.       if (cloneInfo->refPoint) {
  762.          embedTransform->MoveBy (ev, cloneInfo->refPoint);
  763.       }
  764.  
  765.    } else {
  766.  
  767.       // Use the information read from the kODFrameList kind.
  768.  
  769.       ODPoint refPoint;
  770.       if (cloneInfo->refPoint) {
  771.  
  772.          // Place the frame according to where the mouse click occurred.
  773.          refPoint = *(cloneInfo->refPoint);
  774. #ifdef _PLATFORM_OS2_
  775.          // The following calculations assume all points are defined
  776.          // in top-left origin coordinates.
  777.          somSelf->ChangePointBias(ev, &refPoint);
  778. #endif
  779.  
  780.       } else {
  781.          // Place the frame in the same place it was in the source document.
  782.          refPoint = cloneInfo->frameListInfo->offset;
  783.  
  784.       }
  785.       bbox.Offset(refPoint);
  786.       ODPoint frameOffset = bbox.TopLeft();
  787.       embedTransform->SetOffset(ev, &frameOffset);
  788.  
  789. #ifdef _PLATFORM_OS2_
  790.       // Change to bottom-left origin coordinates.
  791.       somSelf->ChangeTransformBias(ev, embedTransform);
  792. #endif
  793.  
  794.    }
  795.  
  796.    // Create facet
  797.    TempODShape embedShape = _myFrame-> AcquireFrameShape (ev, kODNULL);
  798.    ODFacet *containerFacet = FirstFacet (ev, cloneInfo->myFrame);
  799.  
  800.    ODFacet *embedFacet = containerFacet->CreateEmbeddedFacet (ev,
  801.                          _myFrame, embedShape, embedTransform,
  802.                          kODNULL, kODNULL, kODNULL, kODFrameInFront);
  803.  
  804.    embedFacet->Invalidate (ev, kODNULL, kODNULL);
  805.  
  806. }
  807.  
  808. SOM_Scope void  SOMLINK ContentFrameDeleteContents(ContentFrame *somSelf,
  809.                                                     Environment *ev,
  810.                                                    ODULong type)
  811. {
  812.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  813.     ContentFrameMethodDebug("ContentFrame","ContentFrameDeleteContents");
  814.  
  815.     ContentFrame_parent_ContentObject_DeleteContents(somSelf,
  816.                                                                                ev,
  817.                                                                                type);
  818.  
  819.    switch  (type) {
  820.       case FRAME_REMOVED:
  821.  
  822.          // set containing frame to NULL so that all of its open
  823.          // windows get closed
  824.          _myFrame->SetContainingFrame (ev, kODNULL);
  825.          _myFrame->Remove(ev);
  826.  
  827.          break;
  828.       case FRAME_CLOSED:
  829.          _myFrame->Close(ev);
  830.          break;
  831.       case OBJECT_DELETED:
  832.       {
  833.         ODFacet* theFacet            = kODNULL;
  834.         ODFrameFacetIterator* facets = kODNULL;
  835.         ALinkedList *children        = kODNULL;
  836.  
  837.         facets = _myFrame->CreateFacetIterator(ev);
  838.         children = new ALinkedList();
  839.  
  840.         for (theFacet = (ODFacet*)facets->First(ev);
  841.                    facets && facets->IsNotComplete(ev);
  842.                    theFacet = (ODFacet*)facets->Next(ev))
  843.             children->AddLast (ev, theFacet);
  844.  
  845.         for (ALink *link = children->First(ev);
  846.                  link->Content(ev); link = link->Next(ev))
  847.         {
  848.            ODFacet *childFacet = (ODFacet *) link->Content(ev);
  849.            childFacet->GetContainingFacet(ev)->RemoveFacet(ev,childFacet);
  850.            delete childFacet;
  851.         }
  852.  
  853.         delete facets;
  854.         delete children;
  855.         _myFrame->SetContainingFrame (ev, kODNULL);
  856.         _myFrame->Remove(ev);
  857.       }
  858.       break;
  859.  
  860.       case OBJECT_DRAGGED:
  861.       {
  862.         ODFacet* theFacet            = kODNULL;
  863.         ODFrameFacetIterator* facets = kODNULL;
  864.         ALinkedList *children        = kODNULL;
  865.         ODBoolean isInLimbo = _myFrame->IsInLimbo(ev);
  866.         TempODFrame parentFrame = _myFrame->AcquireContainingFrame(ev);
  867.  
  868.         facets = _myFrame->CreateFacetIterator(ev);
  869.         children = new ALinkedList();
  870.  
  871.         // this code executes in drag source after the part is at drop side
  872.         // if frame is not in limbo then a new frame was created at the destination
  873.         // else it was simply reparented. In later case, remove facets that belonged
  874.         // to the source frame
  875.  
  876.         for (theFacet = (ODFacet*)facets->First(ev);
  877.                    facets && facets->IsNotComplete(ev);
  878.                    theFacet = (ODFacet*)facets->Next(ev))
  879.         {
  880.            if (isInLimbo)
  881.               children->AddLast (ev, theFacet);
  882.            else
  883.            {
  884.               if (theFacet->GetContainingFacet(ev)->GetFrame(ev) != parentFrame)
  885.                  children->AddLast (ev, theFacet);
  886.               else
  887.                  PRINT("**** Skipping %lx\n", theFacet);
  888.            }
  889.         }
  890.  
  891.         for (ALink *link = children->First(ev);
  892.                  link->Content(ev); link = link->Next(ev))
  893.         {
  894.            ODFacet *childFacet = (ODFacet *) link->Content(ev);
  895.            childFacet->GetContainingFacet(ev)->RemoveFacet(ev,childFacet);
  896.            delete childFacet;
  897.         }
  898.  
  899.         delete facets;
  900.         delete children;
  901.  
  902.         if (isInLimbo)
  903.         {
  904.            _myFrame->SetContainingFrame(ev, kODNULL);
  905.            _myFrame->Remove(ev);
  906.            PRINT("**** Deleting the frame\n");
  907.         }
  908.         else
  909.         {
  910.            _myFrame->Release(ev);
  911.            PRINT("**** Releasing the frame, someone has it\n");
  912.         }
  913.  
  914.       }
  915.       break;
  916.    }
  917.    _myFrame = 0;
  918.  
  919. }
  920.  
  921. SOM_Scope void  SOMLINK ContentFrameMoveBy(ContentFrame *somSelf,
  922.                                             Environment *ev,
  923.                                            ODPoint* offset)
  924. {
  925.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  926.     ContentFrameMethodDebug("ContentFrame","ContentFrameMoveBy");
  927.  
  928.     ContentFrame_parent_ContentObject_MoveBy(somSelf,
  929.                                              ev,
  930.                                              offset);
  931.  
  932.    ODFrameFacetIterator *ffitr = _myFrame->CreateFacetIterator(ev);
  933.    ODFacet *facet;
  934.  
  935.    for (facet = (ODFacet *)ffitr->First(ev);
  936.                  ffitr->IsNotComplete(ev);
  937.         facet = (ODFacet *)ffitr->Next(ev))
  938.    {
  939.       TempODTransform tf = facet->AcquireExternalTransform(ev, kODNULL);
  940.       TempODTransform ft = tf->Copy(ev);
  941.       ft->MoveBy(ev, offset);
  942.       facet->ChangeGeometry (ev, kODNULL, ft, kODNULL);
  943.       facet->Invalidate(ev,kODNULL,kODNULL);
  944.    }
  945.    delete ffitr;
  946.  
  947. }
  948.  
  949.  
  950. SOM_Scope void  SOMLINK ContentFrameResize(ContentFrame *somSelf,
  951.                                             Environment *ev,
  952.                                            ODPoint* endPt,
  953.                                            ODULong resizeFlags)
  954. {
  955.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  956.     ContentFrameMethodDebug("ContentFrame","ContentFrameResize");
  957.  
  958.     ContentFrame_parent_ContentObject_Resize(somSelf, ev, endPt, resizeFlags);
  959.  
  960.     // Get new and old bounding box and find scaling factor
  961.     ODRect rect, oldRect;
  962.     rect = oldRect = somSelf->_get_boundingRect (ev);
  963.     ComputeRectAfterResize (&rect, resizeFlags, endPt);
  964.  
  965.     ODPoint scalePt;
  966.     scalePt.x = ODFixedDivide (abs (rect.right-rect.left), abs (oldRect.right-oldRect.left));
  967.     scalePt.y = ODFixedDivide (abs (rect.bottom-rect.top), abs (oldRect.bottom-oldRect.top));
  968.  
  969.     // scale the existing shape with the scaling factor
  970.     TempODShape frameShape = _myFrame->AcquireFrameShape (ev, kODNULL);
  971.     ODRect frameRect;
  972.     frameShape->GetBoundingBox (ev, &frameRect);
  973.  
  974.     frameRect.right = frameRect.left +
  975.                          ODFixedMultiply (scalePt.x, abs (frameRect.right-frameRect.left));
  976. #if defined(_PLATFORM_WIN32_) || defined(_PLATFORM_UNIX_)
  977.     frameRect.bottom = frameRect.top +
  978.                          ODFixedMultiply (scalePt.y, abs (frameRect.bottom-frameRect.top));
  979. #elif defined(_PLATFORM_OS2_)
  980.     frameRect.top = frameRect.bottom +
  981.                          ODFixedMultiply (scalePt.y, abs (frameRect.top-frameRect.bottom));
  982. #endif
  983.  
  984.    // change frame shape with new shape
  985.    ODShape* newShape = _myFrame->CreateShape(ev);
  986.    newShape->SetRectangle (ev, &frameRect);
  987.    _myFrame->ChangeFrameShape(ev, newShape, kODNULL);
  988.  
  989.    // If the part engaged in frame negotiation in its FrameShapeChanged,
  990.    // the frame shape may be different than what we just requested. In that
  991.    // case, the containing part's RequestFrameShape would have taken care of 
  992.    // updating the transform, the active shape and of invalidating the facet. 
  993.    TempODShape finalFrameShape = _myFrame->AcquireFrameShape (ev, kODNULL);
  994.    if(!newShape->IsSameAs(ev, finalFrameShape)){
  995.  
  996.       return;
  997.    }
  998.    
  999.  
  1000.    // find the offset for new transform
  1001.    ODPoint delta;
  1002.    delta.x = rect.left - oldRect.left;
  1003. #if defined(_PLATFORM_WIN32_) || defined(_PLATFORM_UNIX_)
  1004.    delta.y = rect.top - oldRect.top;
  1005. #elif defined(_PLATFORM_OS2_)
  1006.    delta.y = rect.bottom - oldRect.bottom;
  1007. #endif
  1008.  
  1009.    // change facet's geometry with new shape and transform
  1010.    ODFacet *theFacet = kODNULL;
  1011.    ODFrameFacetIterator* ffitr  = _myFrame->CreateFacetIterator(ev);
  1012.  
  1013.    for (theFacet = (ODFacet *)ffitr->First(ev);
  1014.                     ffitr->IsNotComplete(ev);
  1015.                     theFacet = (ODFacet *)ffitr->Next(ev))
  1016.    {
  1017.  
  1018.       TempODShape facetShape = newShape->Copy (ev);
  1019.       TempODTransform newTr = kODNULL;
  1020.  
  1021.       if (delta.x || delta.y)
  1022.       {
  1023.          TempODTransform extTr = theFacet->AcquireExternalTransform (ev, kODNULL);
  1024.          newTr = extTr->Copy(ev);
  1025.          newTr->MoveBy (ev, &delta);
  1026.       }
  1027.  
  1028.       // notify facet that its shape changed
  1029.       theFacet->ChangeGeometry (ev, facetShape, newTr, kODNULL);
  1030.       theFacet->Invalidate(ev, kODNULL, kODNULL);
  1031.    }
  1032.  
  1033.    delete ffitr;
  1034. }
  1035.  
  1036.  
  1037. SOM_Scope void  SOMLINK ContentFrameMoveToFront(ContentFrame *somSelf,
  1038.                                              Environment *ev)
  1039. {
  1040.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  1041.     ContentFrameMethodDebug("ContentFrame","ContentFrameMoveToFront");
  1042.  
  1043.     ODFrameFacetIterator* ffitr  = kODNULL;
  1044.     ODFacet* theFacet            = kODNULL;
  1045.  
  1046.     // Iterate over SelectedFrames and raise all facets to front
  1047.     ffitr = _myFrame->CreateFacetIterator(ev);
  1048.  
  1049.     // Iterate over each facet of the selected frame
  1050.     for (theFacet = (ODFacet *)ffitr->First(ev);
  1051.                     ffitr->IsNotComplete(ev);
  1052.                     theFacet = (ODFacet *)ffitr->Next(ev))
  1053.        theFacet->GetContainingFacet(ev)->MoveBefore(ev,theFacet,kODNULL);
  1054.  
  1055.     delete ffitr;
  1056.     _myFrame->Invalidate (ev, kODNULL, kODNULL);
  1057. }
  1058.  
  1059.  
  1060. SOM_Scope void  SOMLINK ContentFrameMoveToBack(ContentFrame *somSelf,
  1061.                                              Environment *ev)
  1062. {
  1063.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  1064.     ContentFrameMethodDebug("ContentFrame","ContentFrameMoveToBack");
  1065.  
  1066.     ODFrameFacetIterator* ffitr  = kODNULL;
  1067.     ODFacet* theFacet            = kODNULL;
  1068.  
  1069.     // Iterate over SelectedFrames and raise all facets to front
  1070.     ffitr = _myFrame->CreateFacetIterator(ev);
  1071.  
  1072.     // Iterate over each facet of the selected frame
  1073.     for (theFacet = (ODFacet *)ffitr->First(ev);
  1074.                     ffitr->IsNotComplete(ev);
  1075.                     theFacet = (ODFacet *)ffitr->Next(ev))
  1076.        theFacet->GetContainingFacet(ev)->MoveBehind(ev,theFacet,kODNULL);
  1077.  
  1078.     delete ffitr;
  1079.     _myFrame->Invalidate (ev, kODNULL, kODNULL);
  1080. }
  1081.  
  1082. SOM_Scope ODTransform*  SOMLINK ContentFrame_get_extTransform (ContentFrame *somSelf,
  1083.                                              Environment *ev)
  1084. {
  1085.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  1086.     ContentFrameMethodDebug("ContentFrame","ContentFrame_get_extTransform");
  1087.  
  1088.     ODFacet *myFacet = FirstFacet (ev, _myFrame);
  1089.     if (myFacet) {
  1090.        TempODTransform xform = myFacet->AcquireExternalTransform (ev, kODNULL);
  1091.        return xform;
  1092.     } else
  1093.        return ContentFrame_parent_ContentObject__get_extTransform(somSelf, ev);
  1094. }
  1095.  
  1096. SOM_Scope void  SOMLINK ContentFrameSetExtTransform (ContentFrame *somSelf,
  1097.                                              Environment *ev, ODTransform *extTransform)
  1098. {
  1099.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  1100.     ContentFrameMethodDebug("ContentFrame","ContentFrameSetExtTransform");
  1101.  
  1102.    ODFrameFacetIterator *ffitr = _myFrame->CreateFacetIterator(ev);
  1103.    ODFacet *facet;
  1104.  
  1105.    for (facet = (ODFacet *)ffitr->First(ev);
  1106.                  ffitr->IsNotComplete(ev);
  1107.         facet = (ODFacet *)ffitr->Next(ev))
  1108.    {
  1109.       TempODTransform ft = extTransform->Copy(ev);
  1110.       facet->ChangeGeometry (ev, kODNULL, ft, kODNULL);
  1111.       facet->Invalidate(ev,kODNULL,kODNULL);
  1112.    }
  1113.    delete ffitr;
  1114.  
  1115.    ContentFrame_parent_ContentObject_SetExtTransform(somSelf, ev, extTransform);
  1116. }
  1117.  
  1118. SOM_Scope void  SOMLINK ContentFrameChangeExtTransform (ContentFrame *somSelf,
  1119.                                     Environment *ev, ODTransform *xform, ODULong xformFlags)
  1120. {
  1121.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  1122.     ContentFrameMethodDebug("ContentFrame","ContentFrameChangeExtTransform");
  1123.  
  1124.    ODFrameFacetIterator *ffitr = _myFrame->CreateFacetIterator(ev);
  1125.    ODFacet *facet;
  1126.  
  1127.    for (facet = (ODFacet *)ffitr->First(ev);
  1128.                  ffitr->IsNotComplete(ev);
  1129.         facet = (ODFacet *)ffitr->Next(ev))
  1130.    {
  1131.       TempODTransform tf = facet->AcquireExternalTransform(ev, kODNULL);
  1132.       TempODTransform ft = tf->Copy(ev);
  1133.  
  1134.       switch (xformFlags) {
  1135.       case EXTXFORM_REPLACE:
  1136.          ft->CopyFrom (ev, xform);
  1137.          break;
  1138.       case EXTXFORM_PRECOMPOSE:
  1139.          ft->PreCompose (ev, xform);
  1140.          break;
  1141.       case EXTXFORM_POSTCOMPOSE:
  1142.          ft->PostCompose (ev, xform);
  1143.          break;
  1144.       default:
  1145.         break;
  1146.       } /* endswitch */
  1147.  
  1148.       facet->ChangeGeometry (ev, kODNULL, ft, kODNULL);
  1149.       facet->Invalidate(ev,kODNULL,kODNULL);
  1150.    }
  1151.    delete ffitr;
  1152.  
  1153.    ContentFrame_parent_ContentObject_ChangeExtTransform(somSelf, ev, xform, xformFlags);
  1154.  
  1155. }
  1156.  
  1157. SOM_Scope ContentObject*  SOMLINK ContentFrameCreateNewView (ContentFrame *somSelf,
  1158.                                     Environment *ev, ODFrame *viewFrame)
  1159. {
  1160.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  1161.     ContentFrameMethodDebug("ContentFrame","ContentFrameCreateNewView");
  1162.  
  1163.     TempODPart embeddedPart = _myFrame->AcquirePart(ev);
  1164.  
  1165.     TempODShape embShape = _myFrame->AcquireFrameShape (ev, kODNULL);
  1166.     TempODShape newShape = embShape->Copy (ev);
  1167.     ODStorageUnit *su = embeddedPart->GetStorageUnit(ev);
  1168.  
  1169.     ODFrame* newFrame = su->GetDraft(ev)->CreateFrame(ev,
  1170.                                  (viewFrame->GetStorageUnit(ev)) ? kODFrameObject :
  1171.                                  kODNonPersistentFrameObject,
  1172.                                  viewFrame, newShape,
  1173.                                  (ODCanvas*)kODNULL, // biasCanvas
  1174.                                  embeddedPart,
  1175.                                  su->GetSession(ev)->Tokenize(ev, kODViewAsFrame),
  1176.                                  su->GetSession(ev)->Tokenize(ev, kODPresDefault),
  1177.                                  kODFalse, _myFrame->IsOverlaid(ev));
  1178.  
  1179.     // attach a source frame
  1180.     embeddedPart->AttachSourceFrame(ev, newFrame, _myFrame);
  1181.  
  1182.     ContentFrame *contFrame = new ContentFrame();
  1183.     contFrame->_set_myFrame(ev, newFrame);
  1184.  
  1185.     ODFacet *myFacet = FirstFacet (ev, _myFrame);
  1186.     if (myFacet) {
  1187.        TempODTransform xform = myFacet->AcquireExternalTransform (ev, kODNULL);
  1188.         contFrame->SetExtTransform (ev, xform);
  1189.     }
  1190.  
  1191.     return (ContentObject *) contFrame;
  1192. }
  1193.  
  1194. //-----------------------------------------------------------------------------
  1195. //  ContentFrame->GetHeight
  1196. //
  1197. //  Determines the height of this ContentFrame without the need for a
  1198. //  facet to be present.
  1199. //-----------------------------------------------------------------------------
  1200. SOM_Scope ODULong  SOMLINK ContentFrameGetHeight (ContentFrame *somSelf,
  1201.                                                   Environment  *ev)
  1202. {
  1203.     ContentFrameData *somThis = ContentFrameGetData(somSelf);
  1204.     ContentFrameMethodDebug("ContentFrame","ContentFrameGetHeight");
  1205.  
  1206.     // Get the bounding rectangle of this ContentFrame.
  1207.     TempODShape frameShape = _myFrame->AcquireFrameShape(ev, kODNULL);
  1208.     ODRect frameRect;
  1209.     frameShape->GetBoundingBox (ev, &frameRect);
  1210.  
  1211.     // Determine the height of this object.
  1212.     return abs(frameRect.top - frameRect.bottom);
  1213. }
  1214.