GetOldSelArea Method

Build 1501 on 14/Nov/2017  This topic last edited on: 23/Mar/2016, at 12:15

Description

Returns the object related to the selection area as it was before you resized it.

Syntax

Dim r As Drawing.Rectangle = Page.GetOldSelArea()

Example

  Public Overridable Sub OnAction(ByVal action As IEditorialEvent.Actions) Implements IEditorialEvent.OnAction

    Dim r As Drawing.Rectangle = Page.GetOldSelArea()

    If (action = IEditorialEvent.Actions.Size) Then

      If Fred.GetQualifier = 1 Then AlignArticleParts(r) ' align article parts (if any article)

----

 Public Sub AlignArticleParts(ByVal r)

    ' r = old area

    ' iaction = 1 for resize, 2 for move

    ' aligns the rest of article to the head or jumphead

    Dim iCount = Page.GetSelectionCount

    Dim headnameId As Integer = Fred.GetTypeIdFromName(headname)

    Dim jumpheadnameId As Integer = Fred.GetTypeIdFromName(jumpheadname)

    Dim subheadnameid As Integer = Fred.GetTypeIdFromName(subheadname)

    Dim kickernameid As Integer = Fred.GetTypeIdFromName(kickername)

 

    Dim iSelTypeId As Integer = Page.ObjGetTypeId

    Dim iSelTxtId = Page.GetSelectedTxtId

 

    If iSelTxtId = 0 Then Return ' if current frame is not linked, exit

 

    '... get all selected objects into a02

    ' if we resized head

    If iCount = 1 And (iSelTypeId = headnameId Or iSelTypeId = jumpheadnameId Or iSelTypeId = subheadnameid Or iSelTypeId = kickernameid) Then

      ' verify how headline was resized - only if the bottom edge is moved, need to adjust

      Dim x = Page.GetSelectionX

      Dim y = Page.GetSelectionY

      Dim w = Page.GetSelectionWidth

      Dim h = Page.GetSelectionHeight

      If h = r.height And y = r.y Then Return ' y and h didn't change, nothing to do

      FredApp.DisableDraw = True

      Dim iSelId = Page.GetSelectedId   ' remember head/jumphead element id

      Page.ObjSelectArticle(Fred.GetCurArticleId) ' select entire article

      Dim ao2 = PushSelectionEx(False)

      ' head is already resized, and we don't know the initial height, so we can only align to the existing

      ' head can be shorter

 

      Dim hDelta = y + h - (r.y + r.height) '- GetBodyDistHead()

      If hDelta <> 0 Then

        For t = 1 To ao2(0, 0)

          If ao2(t, 10) <> iSelTypeId Then  ' don't move the resized element

            If IsBelow(x, y, w, h, ao2(t, 1), ao2(t, 2), ao2(t, 3), ao2(t, 4)) Then ' but move all below elements

              Page.ObjSelectId(ao2(t, 0), False)

              Page.ObjMove(0, hDelta)

            End If

          End If

        Next

      End If

      FredApp.DisableDraw = False

      Page.ObjSelectId(iSelId, False)

    End If

 

  End Sub

Context

Page designer