PhoenixLecture  2.0.0
Set of tools to make lectures
updateNextPrev.cpp
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 
8 #include "updateNextPrev.h"
9 
11 
15 void updateNextPrev(POutoutMode & outputMode, PLatexObj & obj, PLatexObj* & lastSec){
16  if(!isSection(obj)){return;}
17  if(lastSec != NULL){
18  PLatexMenu & prevMenu = obj.getPrevSec(); //Prev menu before obj is given by lastSec
19  prevMenu.setLink(lastSec->getLink());
20 
21 // prevMenu.setText(lastSec->getName());
22  prevMenu.setText(getSectionTitle(outputMode, *lastSec));
23 
24  PLatexMenu & nextMenu = lastSec->getNextSec(); //Next menu after lastSec is given by obj
25  nextMenu.setLink(obj.getLink());
26 
27 // nextMenu.setText(obj.getName());
28  nextMenu.setText(getSectionTitle(outputMode, obj));
29  }
30 
31  lastSec = &obj;
32 
33  PVecLatexObj & vecObj = obj.getVecContent();
34  for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
35  updateNextPrev(outputMode, *it, lastSec);
36  }
37 }
38 
40 
43 void updateNextPrev(POutoutMode & outputMode, PLatexObj & obj){
44  PLatexObj* lastSec = &obj;
45  PVecLatexObj & vecObj = obj.getVecContent();
46  for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
47  updateNextPrev(outputMode, *it, lastSec);
48  }
49 }
50 
51 
52 
Describe a menu entry.
Definition: PLatexObj.h:17
void setText(const PString &text)
Sets the text of the PLatexMenu.
Definition: PLatexObj.cpp:48
void setLink(const PString &link)
Sets the link of the PLatexMenu.
Definition: PLatexObj.cpp:41
Describe a latex object.
Definition: PLatexObj.h:40
const PLatexMenu & getNextSec() const
Gets the nextSec of the PLatexObj.
Definition: PLatexObj.cpp:480
const std::vector< PLatexObj > & getVecContent() const
Gets the vecContent of the PLatexObj.
Definition: PLatexObj.cpp:410
const PString & getLink() const
Gets the link of the PLatexObj.
Definition: PLatexObj.cpp:368
const PLatexMenu & getPrevSec() const
Gets the prevSec of the PLatexObj.
Definition: PLatexObj.cpp:466
bool isSection(const PLatexObj &obj)
Say if the PLatexObj is a part, charpter, section, subsection or subsubsection.
PString getSectionTitle(POutoutMode &outputMode, const PLatexObj &obj)
Get the title of a part/chapter/section etc.
std::vector< PLatexObj > PVecLatexObj
Vector of obj.
Output mode of the html backend.
void updateNextPrev(POutoutMode &outputMode, PLatexObj &obj, PLatexObj *&lastSec)
Update the next and previous section for the menu.