DIRECTORY TableBase, TableOps; TableOpsImpl: CEDAR PROGRAM EXPORTS TableOps = { OPEN TableBase, TableOps; DeleteRow: PUBLIC PROCEDURE [table: RefTable, deleteTopGrid, deleteBottomGrid: GridNumber] = { }; DeleteCol: PUBLIC PROCEDURE [table: RefTable, deleteLeftGrid, deleteRightGrid: GridNumber] = { }; InsertRow: PUBLIC PROCEDURE [table: RefTable, rowGrid: GridNumber, where: BeforeOrAfter] = { }; InsertCol: PUBLIC PROCEDURE [table: RefTable, colGrid: GridNumber, where: BeforeOrAfter] = { }; TransposeTable: PUBLIC PROCEDURE [table: RefTable] = { }; }. จTableOpsImpl.Mesa Created by Rick Beach, December 13, 1984 2:56:29 pm PST delete between deleteTopGrid (exclusive) and deleteBottomGrid (inclusive) Prepare the new tableGrid EnumerateTableByRows[DeleteBox] Install new tableGrid DeleteBox[box] deltaGrid _ deleteBottomGrid-deleteTopGrid ASSERT box.top < box.bottom AND deleteTopGrid < deleteBottomGrid IF box.top >= deleteTopGrid AND box.bottom <= deleteBottomGrid THEN don't copy this box ELSE { IF box.top > deleteTopGrid THEN { IF box.top <= deleteBottomGrid THEN box.top _ deleteTopGrid ELSE box.top _ box.top - deltaGrid } IF box.bottom > deleteTopGrid THEN { IF box.bottom <= deleteBottomGrid THEN box.bottom _ deleteTopGrid ELSE box.bottom _ box.bottom - deltaGrid } insert box in new tableGrid } analagous to DeleteRowStructure insert a new row, either before or after rowGrid Prepare a new tableGrid EnumerateTable[InsertBox] Install new tableGrid worry about rowGrids _ rowGrids + 1; rowGridPosition vector changes; rowConstraints need relabelling InsertBox[box] SELECT where FROM before => { IF box.top > rowGrid THEN box.top _ box.top + 1 IF box.bottom >= rowGrid THEN box.bottom _ box.bottom + 1 } after => { IF box.top >= rowGrid THEN box.top _ box.top + 1 IF box.bottom > rowGrid THEN box.bottom _ box.bottom + 1 } ENDCASE => ERROR; insert box in new tableGrid insert a new row, either before or after rowGrid Prepare a new tableGrid EnumerateTable[InsertBox] Install new tableGrid worry about rowGrids _ rowGrids + 1; rowGridPosition vector changes; rowConstraints need relabelling InsertBox[box] SELECT where FROM before => { IF box.top > rowGrid THEN box.top _ box.top + 1 IF box.bottom >= rowGrid THEN box.bottom _ box.bottom + 1 } after => { IF box.top >= rowGrid THEN box.top _ box.top + 1 IF box.bottom > rowGrid THEN box.bottom _ box.bottom + 1 } ENDCASE => ERROR; insert box in new tableGrid transpose rows and columns Prepare a new tableGrid EnumerateTable[TransposeBox] Install new tableGrid worry about switching rowGrids and colGrids switching rowGridPosition and colGridPosition vectors relabel rowConstraints and colConstraints Transpose[box] box.top <-> box.left box.bottom <-> box.right insert box in new tableGrid สา˜™J™7—unitšฯk ˜ J˜ J˜ —šœœ˜Jšœ ˜—Kšœ˜J™šฯn œœC˜^J™IJ™J™J™J™J™™J™*J™@J™W™™!™J™J™#—J™—™$™!J™J™(—J™—J™J™—J™—Jšœ˜—šž œœC˜^J™Jšœ˜—šž œœA˜\J™0J™J™J™J™™ J™J™J™—J™™™™ J™/J™9J™—™ J™0J™8J™—J™—J™—Jšœ˜—šž œœA˜\J™0J™J™J™J™™ J™J™J™—J™™™™ J™/J™9J™—™ J™0J™8J™—J™—J™—Jšœ˜—šžœœ˜6J™J™J™J™J™™ J™J™5J™)—J™™J™J™J™—Jšœ˜J˜—J˜—…—. จ