-void LyXParagraph::SetLabelWidthString(string const & s)
-{
- LyXParagraph *par = FirstPhysicalPar();
-
- par->labelwidthstring = s;
-}
-
-
-void LyXParagraph::SetOnlyLayout(char new_layout)
-{
- LyXParagraph
- *par = FirstPhysicalPar(),
- *ppar = 0,
- *npar = 0;
-
- par->layout = new_layout;
- /* table stuff -- begin*/
- if (table)
- par->layout = 0;
- /* table stuff -- end*/
- if (par->pextra_type == PEXTRA_NONE) {
- if (par->Previous()) {
- ppar = par->Previous()->FirstPhysicalPar();
- while(ppar
- && ppar->Previous()
- && (ppar->depth > par->depth))
- ppar = ppar->Previous()->FirstPhysicalPar();
- }
- if (par->Next()) {
- npar = par->Next()->NextAfterFootnote();
- while(npar
- && npar->Next()
- && (npar->depth > par->depth))
- npar = npar->Next()->NextAfterFootnote();
- }
- if (ppar && (ppar->pextra_type != PEXTRA_NONE)) {
- string
- p1 = ppar->pextra_width,
- p2 = ppar->pextra_widthp;
- ppar->SetPExtraType(ppar->pextra_type,
- p1.c_str(),p2.c_str());
- }
- if ((par->pextra_type == PEXTRA_NONE) &&
- npar && (npar->pextra_type != PEXTRA_NONE)) {
- string
- p1 = npar->pextra_width,
- p2 = npar->pextra_widthp;
- npar->SetPExtraType(npar->pextra_type,
- p1.c_str(),p2.c_str());
- }
- }
-}
-
-
-void LyXParagraph::SetLayout(char new_layout)
-{
- LyXParagraph
- *par = FirstPhysicalPar(),
- *ppar = 0,
- *npar = 0;
-
- par->layout = new_layout;
- par->labelwidthstring.clear();
- par->align = LYX_ALIGN_LAYOUT;
- //par->depth = 0;
- par->added_space_top = VSpace(VSpace::NONE);
- par->added_space_bottom = VSpace(VSpace::NONE);
- /* table stuff -- begin*/
- if (table)
- par->layout = 0;
- /* table stuff -- end*/
- if (par->pextra_type == PEXTRA_NONE) {
- if (par->Previous()) {
- ppar = par->Previous()->FirstPhysicalPar();
- while(ppar
- && ppar->Previous()
- && (ppar->depth > par->depth))
- ppar = ppar->Previous()->FirstPhysicalPar();
- }
- if (par->Next()) {
- npar = par->Next()->NextAfterFootnote();
- while(npar
- && npar->Next()
- && (npar->depth > par->depth))
- npar = npar->Next()->NextAfterFootnote();
- }
- if (ppar && (ppar->pextra_type != PEXTRA_NONE)) {
- string
- p1 = ppar->pextra_width,
- p2 = ppar->pextra_widthp;
- ppar->SetPExtraType(ppar->pextra_type,
- p1.c_str(),p2.c_str());
- }
- if ((par->pextra_type == PEXTRA_NONE) &&
- npar && (npar->pextra_type != PEXTRA_NONE)) {
- string
- p1 = npar->pextra_width,
- p2 = npar->pextra_widthp;
- npar->SetPExtraType(npar->pextra_type,
- p1.c_str(),p2.c_str());
- }
- }
-}
-
-
-/* if the layout of a paragraph contains a manual label, the beginning of the
-* main body is the beginning of the second word. This is what the par-
-* function returns. If the layout does not contain a label, the main
-* body always starts with position 0. This differentiation is necessary,
-* because there cannot be a newline or a blank <= the beginning of the
-* main body in TeX. */
-
-int LyXParagraph::BeginningOfMainBody()
-{
- if (FirstPhysicalPar() != this)
- return -1;
-
- int i = 0;
-
-// while (i < last && !(i > 1 && GetChar(i-1)==' ')
-// && GetChar(i)!=LYX_META_NEWLINE)
-// i++;
-// Unroll the first two cycles of this loop
-// and remember the previous character to remove unnecessary GetChar() calls
-
- if (i < last
- && GetChar(i) != LYX_META_NEWLINE) {