5.5. Outline Preview (outline-preview.rsl)
object Lecture is
components: Pages:Page* and drawSurface:DrawSurface;
end Lecture;
object Page is
components: drawSurface:DrawSurface, scrolling:boolean,
lectureElements:LectureElement*;
operations: GetSlides;
end Page;
operation GetSlides is
inputs: page:Page;
outputs: slides:Slide*;
end GetSlides;
object Slide is
components: LectureElement*;
end Slide;
object LectureElement is
components: visibleInLecture:VisibleInLecture,
visibleInOutline:VisibleInOutline, expanded:Expanded,
content:Content, name:Name, depth:Depth,
children:LectureElement*, parentElement:LectureElement;
end LectureElement;
object VisibleInLecture is boolean;
object VisibleInOutline is boolean;
object Content is string;
object Depth is integer;
object Expanded is boolean;
object Name is string;
object UserDefined is boolean;
object SlideBreak
components: UserDefined and LectureElement;
description: (*
A SlideBreak is either user defined or generated and linked to the
OutlineElement that exists after it
*);
end SlideBreak;
object SelectedSlide is Slide;
object OutlinePreview
components: focusedLectureElement:LectureElement,
outlineDepth:integer;
description: (*
The OutlinePreview is linked to a Lecture, has a selectedslide, and has
an outline depth.
*);
end OutlinePreview;
(*------------------------------------------------------------------------------
--------------------------------------------------------------------------------
------------------------------------------------------------------------------*)
op ChangeDepth is
inputs: preview:OutlinePreview, newDepth:integer, lecture:Lecture;
outputs: preview':OutlinePreview, lecture':Lecture;
precondition: ;
postcondition:
(*
* The depth of the outline becomes the given depth.
* The returned OutlinePreview has the same lecture
*)
(preview'.focusedLectureElement = preview.focusedLectureElement)
and
(preview'.outlineDepth = newDepth)
and
(
forall (top':Page) (
(top' in lecture'.Pages iff (top' in lecture.Pages)) and
(
forall (slide':Slide | slide' in GetSlides(top')) (
forall (lecEl':LectureElement | (lecEl' in slide')) (
(((lecEl'.visibleInLecture = true) and (lecEl'.expanded = true))
iff (lecEl'.depth <= newDepth))
and
((lecEl'.visibleInOutline = true)
iff (lecEl'.depth = newDepth + 1))
and
(((lecEl'.visibleInLecture = false) and (lecEl'.expanded = false)
and (lecEl'.visibleInOutline = false)) iff (lecEl'.depth > newDepth))
)
)
)
)
)
and
(lecture'.drawSurface = lecture.drawSurface);
end ChangeDepth;
op Expand is
inputs: el:LectureElement, lecture:Lecture;
outputs: lecture':Lecture;
precondition:
(*
* The specified outline element is in the outline preview and is not
* already expanded.
*)
exists (top':Page) ( (top' in lecture.Pages) and (el in top'.lectureElements));
postcondition:
(*
* The specified outline element is expanded in the outline preview.
*)
forall (top':Page) (
(top' in lecture'.Pages iff (top' in lecture.Pages)) and
(
forall (slide':Slide | slide' in GetSlides(top')) (
(forall (lecEl':LectureElement | (lecEl' in slide') and (lecEl' = el))
(lecEl'.expanded = true))
and
(forall (lecEl':LectureElement | (lecEl' in slide') and (lecEl'.parentElement = el))
(lecEl'.visibleInOutline = true))
)
)
);
end Expand;
function RecursiveHideInOutline(lectureElement:LectureElement, slide:Slide) = (
forall (lecEl':LectureElement | (lecEl' in slide) and (lecEl'.parentElement = lectureElement)) (
(lecEl'.visibleInOutline = false)
and
(lecEl'.visibleInLecture= false)
and
(RecursiveHideInOutline(lecEl', slide))
)
);
op Collapse is
inputs: el:LectureElement, lecture:Lecture;
outputs: lecture':Lecture;
precondition:
(*
* The lecture element exists in the lecture.
*)
exists (top':Page) ((top' in lecture.Pages) and (el in top'.lectureElements));
postcondition:
(*
* The specified outline element is expanded in the outline preview.
*)
forall (top':Page) (
(top' in lecture'.Pages iff (top' in lecture.Pages)) and
(
forall (slide':Slide | slide' in GetSlides(top')) (
forall (lecEl':LectureElement | (lecEl' in slide') and (lecEl' = el)) (
(lecEl'.expanded = false)
and
(RecursiveHideInOutline(lecEl',slide'))
)
)
)
);
end Collapse;
op ShowInLecture is
inputs: el:LectureElement, lecture:Lecture;
outputs: lecture':Lecture;
precondition:
(*
* The lecture element exists in the lecture.
*)
exists (top':Page) ( (top' in lecture.Pages) and (el in top'.lectureElements));
postcondition:
(*
* The specified outline element is shown in the lecture.
*)
forall (top':Page) (
(top' in lecture'.Pages iff (top' in lecture.Pages)) and
(
forall (slide':Slide | slide' in GetSlides(top')) (
(forall (lecEl':LectureElement | (lecEl' in slide') and (lecEl'.parentElement = el))
(lecEl'.visibleInLecture = true))
)
)
);
end ShowInLecture;
function RecursiveHideInLecture(lectureElement:LectureElement, slide:Slide) = (
forall (lecEl':LectureElement | (lecEl' in slide) and (lecEl'.parentElement = lectureElement)) (
(lecEl'.visibleInLecture = false)
and
(RecursiveHideInLecture(lecEl', slide))
)
);
op HideInLecture is
inputs: el:LectureElement, lecture:Lecture;
outputs: lecture':Lecture;
precondition:
(*
* The lecture element exists in the lecture.
*)
exists (top':Page) ((top' in lecture.Pages) and (el in top'.lectureElements));
postcondition:
(*
* The specified outline element is expanded in the outline preview.
*)
forall (top':Page) (
(top' in lecture'.Pages iff (top' in lecture.Pages)) and
(
forall (slide':Slide | slide' in GetSlides(top')) (
forall (lecEl':LectureElement | (lecEl' in slide') and (lecEl' = el)) (
(lecEl'.expanded = false)
and
(RecursiveHideInLecture(lecEl',slide'))
)
)
)
);
end HideInLecture;
op RemoveSlideBreak(OutlinePreview, SlideBreak, Lecture)->(OutlinePreview, Lecture);
op AddSlideBreak(OutlinePreview, LectureElement, SlideBreak, Lecture)->(OutlinePreview, Lecture);
op SelectSlide(OutlinePreview, Lecture, Slide)->(OutlinePreview, Lecture);
op NextSlide(OutlinePreview, Lecture)->(OutlinePreview, Lecture);
op PrevSlide(OutlinePreview, Lecture)->(OutlinePreview, Lecture);
Prev: userinteraction.rsl
| Next: main-view.rsl
| Up: formalspec
| Top: index