1.7.2 Environment Envelop

<..configure ooffice latex..>+
 \HAssign\BegEnd:N=0
 \HAssign\BegEnd:D=0
-_-_-

<..begin env section..>
 \ifvmode \IgnorePar\fi \EndP
 \ifnum \BegEnd:D=0
    <.sectioned env.>%
 \else
    <.boxed env.>%
 \fi
 \gHAdvance\BegEnd:D by 1
-_-_-

<..end env section..>
 \gHAdvance\BegEnd:D by -1
 \ifvmode \IgnorePar\fi\EndP
 \ifnum \BegEnd:D=0
    <.end sectioned env.>%
 \else
    <.end boxed env.>%
 \fi
-_-_-

<..sectioned env..>
 \gHAdvance\BegEnd:N by 1
 \HCode{<text:section
         text:style-name="begin-end-env"
         text:name="begin-end-env-\BegEnd:N"
        >%
        <text:p text:style-name="begin-env-p" ></text:p>}%
-_-_-

<..end sectioned env..>
 \HCode{<text:p text:style-name="end-env-p" ></text:p></text:section>}%
-_-_-

<..boxed env..>
 \gHAdvance\BegEnd:N by 1
 \hbox{\HCode{<text:p><draw:frame
                 draw:name="begin-end-env-\BegEnd:N"
                  draw:style-name="env-frame"
                  text:anchor-type="as-char"
 %                 fo:min-width="0.14in"
                  svg:width="90\%"
                  draw:z-index="0"
        >
        <draw:text-box
 %           fo:min-height="0.14in"
        >}}%
-_-_-

<..end boxed env..>
 \hbox{\HCode{</draw:text-box>
 </draw:frame></text:p> }}%
-_-_-

<..configure ooffice latex..>+
 \NewConfigureOO{begin-end-env}
 \ConfigureOO{begin-end-env}{\Hnewline
 <style:style style:name="begin-env-p" style:family="paragraph">\Hnewline
    <style:paragraph-properties  fo:margin-top="2mm"
                      fo:margin-bottom="0mm"
                      fo:line-height="0.1mm" />\Hnewline
 </style:style>\Hnewline
 <style:style style:name="end-env-p" style:family="paragraph">\Hnewline
    <style:paragraph-properties  fo:margin-bottom="2mm"
                      fo:margin-top="0mm"
                      fo:line-height="0.1mm" />\Hnewline
 </style:style>\Hnewline
 }
-_-_-

The indirect use of paragraphs is due to OpenOffice not recognizing vertical spaces around sections.

<style:style style:name="begin-end-env"  
             style:family="section">\Hnewline  
  <style:text-properties  fo:margin-top="0.4cm"  
                     fo:margin-bottom="0.4cm" />\Hnewline  
</style:style>\Hnewline

<..configure ooffice latex..>+
 \NewConfigureOO{env-frame}
 \ConfigureOO{env-frame}{\Hnewline
 <style:style
     style:name="env-frame"
     style:family="graphic"
 >\Hnewline
   <style:graphic-properties
      style:vertical-pos="top"
      style:vertical-rel="baseline"
      style:horizontal-pos="from-left"
      style:horizontal-rel="paragraph-content"
      fo:padding="0in"
      fo:border="none"
      style:shadow="none"
   />\Hnewline
 </style:style>\Hnewline
 }
-_-_-

 
     style:parent-style-name="EnvFrame"
 
 
 <style:style
     style:name="EnvFrame"
     style:family="graphic"
 >\Hnewline
    <style:graphic-properties
         text:anchor-type="paragraph"
 %        style:wrap="parallel"
 %        style:number-wrapped-paragraphs="no-limit"
         style:wrap-contour="false"
         style:vertical-pos="top"
         style:vertical-rel="paragraph-content"
         style:horizontal-pos="center"
         style:horizontal-rel="paragraph-content"
         fo:padding="0in"
         fo:border="0.0in"/> \Hnewline
 </style:style> \Hnewline