
%% Style file for mdframed for package option `framemethod=tikz`
%%
%% This package may be distributed under the terms of the LaTeX Project
%% Public License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
\def\mdframedIpackagename{md-frame-1}
\ProvidesFile{md-frame-1.mdf}%
      [\mdfmaindate\ %
       \mdversion: \mdframedIpackagename]
\def\mdf@tikz@settings{%
%%  \mdf@testdraftmode%
  \tikzset{mdfbox/.style={anchor=south west,%
                          inner sep=0pt,%
                          outer sep=0pt,%
                          \mdf@fontcolor,%
                         }%
          }% anchor der Ausgabebox ist unten links
  \tikzset{mdfcorners/.style={rounded corners=\mdf@roundcorner@length}}%
  \tikzset{mdfbackground/.style={fill=\mdf@backgroundcolor,%
                                 draw=none,%
                                }%
          }%
  \tikzset{mdfframetitlebackground/.style=%
                   {%
                    fill=\mdf@frametitlebackgroundcolor,%
                    draw=none,%
                    rounded corners={max(\mdf@roundcorner@length%
                                         -\mdf@innerlinewidth@length%
                                        -.5\mdf@middlelinewidth@length,0)%
                                    }%
                   }%
          }%
  \tikzset{mdfouterline/.style={}}%
  \ifdimgreater{\mdf@outerlinewidth@length}{\z@}
    {\tikzset{mdfouterline/.append style={%
      draw=\mdf@outerlinecolor,%
      line width=2\mdf@outerlinewidth@length+\mdf@middlelinewidth@length}}}{}%
  \tikzset{mdfinnerline/.style={}}%
  \ifdimgreater{\mdf@innerlinewidth@length}{\z@}
    {\tikzset{mdfinnerline/.append style={%
      draw=\mdf@innerlinecolor,%
      line width=2\mdf@innerlinewidth@length+\mdf@middlelinewidth@length}}}{}%
  \tikzset{mdfshadow/.style={drop shadow={%
                               shadow xshift=\mdf@shadowsize@length-2pt,
                               shadow yshift=-\mdf@shadowsize@length+2pt,
                               fill=\mdf@shadowcolor,
                               every shadow }}}%
  \mdf@tikzset@local%
  \tikzset{mdfmiddleline/.style={}}%
  \ifdimgreater{\mdf@middlelinewidth@length}{\z@}
    {\tikzset{mdfmiddleline/.append style={%
      preaction={draw=\mdf@middlelinecolor,%
                 line width=\mdf@middlelinewidth@length},%
      line width=\mdf@middlelinewidth@length,%
      tikzsetting}}%
    }{}%
}%
\newrobustcmd*\mdf@tikzbox@tfl[1]{%three or four borders
    \clip(0,0)rectangle(\mdfboundingboxwidth,\mdfboundingboxheight);%
    \begin{scope}[mdfcorners]%
       \clip[preaction=mdfouterline]%
            [postaction=mdfbackground]%
            [postaction=mdfinnerline]#1;%
    \end{scope}%
    \path[mdfmiddleline,mdfcorners]#1;
  }%

\newrobustcmd*\mdf@tikzbox@otl[2]{%one or two borders
    \clip(0,0)rectangle(\mdfboundingboxwidth,\mdfboundingboxheight);%
    \begin{scope}
       \path[mdfouterline,mdfcorners]#1;%
       \clip[postaction=mdfbackground]#2;%
       \path[mdfinnerline,mdfcorners]#1;%
    \end{scope}%
    \path[mdfmiddleline,mdfcorners]#1;}%
\newrobustcmd*\mdf@drawframe@whole{%
  \mdf@test@ltrb{\mdf@tikzbox@tfl{(O)--(O|-P)--(P)--(P|-O)--cycle}}{}%
  \mdf@test@ltb{\mdf@tikzbox@tfl{(P|-O)--(O)--(O|-P)--(P)}}{}%
  \mdf@test@trb{\mdf@tikzbox@tfl{(O|-P)--(P)--(P|-O)--(O)}}{}%
  \mdf@test@ltr{\mdf@tikzbox@tfl{(O)--(O|-P)--(P)--(P|-O)}}{}%
  \mdf@test@lrb{\mdf@tikzbox@tfl{(P-|O)--(O)--(O-|P)--(P)}}{}%
  \mdf@test@lb{\mdf@tikzbox@otl{(P|-O)--(O)--(O|-P)}%
                          {(P)--(P|-O)[mdfcorners]--(O)--(O|-P)}%
          }{}%
  \mdf@test@rb{\mdf@tikzbox@otl{(P)--(P|-O)--(O)}%
                          {(O|-P)--(P)[mdfcorners]--(P|-O)--(O)}%
          }{}%
  \mdf@test@tr{\mdf@tikzbox@otl{(O-|P)--(P)--(P-|O)}%
                          {(O)--(O|-P)[mdfcorners]--(P)--(P|-O)}%
          }{}%
  \mdf@test@lt{\mdf@tikzbox@otl{(O)--(O|-P)--(P)}%
                          {(P|-O)--(O)[mdfcorners]--(O|-P)--(P)}%
          }{}%
  \mdf@test@lr{\mdf@tikzbox@otl{(O)--(O|-P)(P)--(P|-O)}%
                          {(O)rectangle(P)}%
          }{}%
  \mdf@test@tb{\mdf@tikzbox@otl{(O)--(O-|P)(O|-P)--(P)}%
                          {(O)rectangle(P)}%
          }{}%
  \mdf@test@l{\mdf@tikzbox@otl{(O)--(O|-P)}%
                          {(O)rectangle(P)}%
          }{}%
  \mdf@test@r{\mdf@tikzbox@otl{(O-|P)--(P)}%
                          {(O)rectangle(P)}%
          }{}%
  \mdf@test@t{\mdf@tikzbox@otl{(O|-P)--(P)}%
                          {(O)rectangle(P)}%
          }{}%
  \mdf@test@b{\mdf@tikzbox@otl{(O)--(O-|P)}%
                          {(O)rectangle(P)}%
          }{}%
  \mdf@test@noline{\path[mdfbackground,mdfcorners](O)rectangle(P);}{}%
}
\newrobustcmd*\mdf@predtikzcalc{%
 %%width
 \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@one}%
 \mdf@dolist{\mdf@advancelength@add{\mdfboundingboxwidth}}%
   {innerleftmargin,innerrightmargin}%
 \ifbool{mdf@leftline}{%
   \mdf@dolist{\mdf@advancelength@add{\mdfboundingboxwidth}}%
      {innerlinewidth,middlelinewidth,outerlinewidth}}{}%
 \ifbool{mdf@rightline}{%
   \mdf@dolist{\mdf@advancelength@add{\mdfboundingboxwidth}}%
      {innerlinewidth,middlelinewidth,outerlinewidth}}{}%
 %%height
 \setlength\mdfboundingboxheight%
        {\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}%
 \mdf@dolist{\mdf@advancelength@add{\mdfboundingboxheight}}%
     {innertopmargin,innerbottommargin}%
 \ifbool{mdf@topline}{%
   \mdf@dolist{\mdf@advancelength@add{\mdfboundingboxheight}}%
     {innerlinewidth,middlelinewidth,outerlinewidth}}{}%
 \ifbool{mdf@bottomline}{%
   \mdf@dolist{\mdf@advancelength@add{\mdfboundingboxheight}}%
     {innerlinewidth,middlelinewidth,outerlinewidth}}{}%
}

\newrobustcmd*\mdf@innertikzcalc{%
  \pgfmathsetlengthmacro\mdf@Ax{+\mdf@innerleftmargin@length}%
  \pgfmathsetlengthmacro\mdf@Ay{+\mdf@innerbottommargin@length}%
  \pgfmathsetlengthmacro\mdf@Ox{+0pt}%
  \pgfmathsetlengthmacro\mdf@Oy{+0pt}%
  \pgfmathsetlengthmacro\mdf@Px{+\mdfboundingboxwidth}%
  \pgfmathsetlengthmacro\mdf@Py{+\mdfboundingboxheight}%
  \ifbool{mdf@leftline}%
    {%
     \pgfmathsetlengthmacro\mdf@Ax%
        {\mdf@Ax+\mdf@outerlinewidth@length+%
         \mdf@middlelinewidth@length+\mdf@innerlinewidth@length}%
     \pgfmathsetlengthmacro\mdf@Ox%
       {\mdf@Ox+\mdf@outerlinewidth@length+0.5\mdf@middlelinewidth@length}%
    }{}%
  \ifbool{mdf@rightline}%
    {%
     \pgfmathsetlengthmacro\mdf@Px%
       {\mdf@Px-\mdf@outerlinewidth@length-0.5\mdf@middlelinewidth@length}%
    }{}%
  \ifbool{mdf@bottomline}%
    {%
     \pgfmathsetlengthmacro\mdf@Ay%
       {\mdf@Ay+\mdf@outerlinewidth@length+\mdf@middlelinewidth@length%
        +\mdf@innerlinewidth@length}%
     \pgfmathsetlengthmacro\mdf@Oy%
       {\mdf@Oy+\mdf@outerlinewidth@length+0.5\mdf@middlelinewidth@length}%
    }{}%
  \ifbool{mdf@topline}%
    {%
     \pgfmathsetlengthmacro\mdf@Py%
       {\mdf@Py-\mdf@outerlinewidth@length-0.5\mdf@middlelinewidth@length}%
    }{}%
}
\tikzset{mdfframetitlerule/.style={%
   draw=none,
   fill=\mdf@frametitlerulecolor,
  }%
}
\def\mdf@@frametitlerule{%
  \ifbool{mdf@frametitlerule}{%
   \vbox{\hsize0pt
     \par\unskip\vskip\mdf@frametitlebelowskip@length
     \noindent\rlap{\hspace*{-\mdf@innerleftmargin@length}%
     \begingroup%
     \pgfmathsetlength{\dimen@}{\mdfframetitleboxwidth
                                +\mdf@innerleftmargin@length
                                +\mdf@innerrightmargin@length}%
     \tikz\draw[mdfframetitlerule] (0,0)%
               rectangle (\dimen@,\mdf@frametitlerulewidth@length);
     \endgroup}
   }%
  }{%
   \vbox{\hsize0pt
     \par\unskip\vskip\mdf@frametitlebelowskip@length
     \noindent\rlap{}
   }%
  }%
  \iftoggle{mdf@notfirstframetitle}%
    {%
      \par\unskip\vskip\mdf@splittopskip@length%
    }%
    {%
      \par\unskip\vskip\mdf@innertopmargin@length%
    }%
}%

\def\mdf@putbox@single{%
  \ifvoid\mdf@splitbox@one
  \else%
   \mdf@makebox@out{%
    \mdf@makeboxalign@left%
    \mdf@tikz@settings%
    \mdf@predtikzcalc%
    \mdf@makebox@in[\mdfboundingboxwidth]{%
    \null%
    \begin{tikzpicture}[remember picture]%
      \mdf@innertikzcalc
      \coordinate(O)at(\mdf@Ox,\mdf@Oy);%
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
      \ifbool{mdf@shadow}
         {\path[mdfshadow,mdfcorners](O) rectangle (P);}{}%
      \begin{scope}
        \begin{scope}[use as bounding box]
          \mdf@drawframe@whole
          \drawbrackgroundframetitle@single
        \end{scope}
      \node[mdfbox] (mdfframe) at(\mdf@Ax,\mdf@Ay){\box\mdf@splitbox@one};
      \end{scope}
      %HIER KOMMT EIN WEITERES MAKRO
      \mdf@extra%
      \mdf@singleextra%
      \mdfcreateextratikz
    \end{tikzpicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi%
}%

\def\drawbrackgroundframetitle@single{%
 \ifdefempty{\mdf@frametitle}{}{%
   \drawbrackgroundframetitle@@single%
 }%
}%
\def\drawbrackgroundframetitle@@single{%
 \begin{scope}%background frame title
   \ifbool{mdf@leftline}{
    \pgfmathsetlengthmacro\mdf@Ox%
       {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}%
    }{}%
   \ifbool{mdf@rightline}{%
    \pgfmathsetlengthmacro\mdf@Px%
       {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}%
    }{}%
   \ifbool{mdf@topline}{%
    \pgfmathsetlengthmacro\mdf@Py%
       {\mdf@Py-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}%
    }{}%
    \pgfmathsetlengthmacro\mdf@Fy%
       {\mdf@Py-\mdfframetitleboxtotalheight}%
    \path[mdfframetitlebackground]%
     (\mdf@Ox,\mdf@Fy)--(\mdf@Ox,\mdf@Py)--(\mdf@Px,\mdf@Py)--(\mdf@Px,\mdf@Fy);
 \end{scope}
}
\def\drawbrackgroundframetitle@first{%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@topline}{%
         \pgfmathsetlengthmacro\mdf@Py%
            {\mdf@Py-\mdf@innerlinewidth@length-.5\mdf@middlelinewidth@length}
         }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
         \path[mdfframetitlebackground]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
     }%
     {%
      \ifdefempty{\mdf@frametitle}{}%
        {%
         \ifdimgreater{\mdfboundingboxheight}{\mdfframetitleboxtotalheight}%
         {%
          \drawbrackgroundframetitle@@first
          \pgfmathsetlength{\global\mdfframetitleboxtotalheight}{-\p@}%
         }{\mdf@PackageWarning%
              {You got a page break inside the frame title\MessageBreak
               Currently this isn't well supported}%
           \drawbrackgroundframetitle@@first
           \pgfmathsetlength{\global\mdfframetitleboxtotalheight}%
                            {\mdfframetitleboxtotalheight
                                    -\mdfboundingboxheight
                             -\mdf@innerlinewidth@length
                             -0.5\mdf@middlelinewidth@length%
                             +\mdf@frametitlebelowskip@length
                             +\mdf@splitbottomskip@length
%%                             +\mdf@splittopskip@length
%%                             -\dp\strutbox%
                            }%
          }%
        }%
     }%
 }%
}%
\def\drawbrackgroundframetitle@@first{%
 \begin{scope}%background frame title
        \ifbool{mdf@leftline}{%
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@topline}{%
         \pgfmathsetlengthmacro\mdf@Py%
            {\mdf@Py-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {max(0,\mdf@Py-\mdfframetitleboxtotalheight)}
         \path[mdfframetitlebackground]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}%
}%
\def\mdf@putbox@first{%
  \ifvoid\mdf@splitbox@two
  \else%
   \mdf@makebox@out{%
    \mdf@makeboxalign@left%
    %Special for first frame -- used other savebox
    \let\mdf@splitbox@one\mdf@splitbox@two%
    \mdf@tikz@settings%
    %Special for first frame -- no innerbottommargin but splitbottomskip
    \let\mdf@innerbottommargin@length\mdf@splitbottomskip@length
    \mdf@predtikzcalc%calc with all lines
    %Special for first frame -- no bottom line without everyline true
    % if every line false -- test if bottomline is in use and remove the width
    \ifbool{mdf@everyline}{}{%
     \ifbool{mdf@bottomline}{%
       \mdf@dolist{\mdf@advancelength@sub{\mdfboundingboxheight}}%
        {innerlinewidth,middlelinewidth,outerlinewidth}}{}%
    }%
    \ifdimgreater{\pagegoal-\maxdimen}{0pt}{}{\enlargethispage{\baselineskip}}%
    \mdf@makebox@in[\mdfboundingboxwidth]{%
    \null%
    \begin{tikzpicture}[remember picture]
      \mdf@innertikzcalc
      %Special for first frame -- no bottom line without everyline true
      \ifbool{mdf@everyline}{}{%
        \ifbool{mdf@bottomline}%
          {%
           \pgfmathsetlengthmacro\mdf@Ay%
             {\mdf@Ay-\mdf@outerlinewidth@length-\mdf@middlelinewidth@length%
               -\mdf@innerlinewidth@length}%
           \pgfmathsetlengthmacro\mdf@Oy%
             {\mdf@Oy-\mdf@outerlinewidth@length
               -0.5\mdf@middlelinewidth@length}%
          }{}%
      }%
      \coordinate(O)at(\mdf@Ox,\mdf@Oy);%
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
      \ifbool{mdf@shadow}
       {\path[mdfshadow] (O) -- (O|-P) to[mdfcorners] (P) -- (P|-O) -- (O);}{}%
      \begin{scope}
        \begin{scope}[use as bounding box]
          %Special for first frame
          \ifbool{mdf@everyline}{}{%
             \mdfsetup{bottomline=false}%
          }
      \mdf@drawframe@whole
      \drawbrackgroundframetitle@first
     \end{scope}
      \node[mdfbox] (mdfframe) at(\mdf@Ax,\mdf@Ay){\box\mdf@splitbox@two};%
     \end{scope}
     %HIER KOMMT EIN WEITERES MAKRO
     \mdf@extra%
     \mdf@firstextra%
     \mdfcreateextratikz%
    \end{tikzpicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
\def\drawbrackgroundframetitle@middle{%
 \ifdefempty{\mdf@frametitle}{}%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@everyline}%
          {%
           \ifbool{mdf@topline}{%
            \pgfmathsetlengthmacro\mdf@Py%
               {\mdf@Py-\mdf@innerlinewidth@length%
                       -.5\mdf@middlelinewidth@length}
            }{}%
          }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
         \path[mdfframetitlebackground]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
     }%
     {%
      \ifdimless{\mdfframetitleboxtotalheight}{\z@}
        {}%
        {%
         \drawbrackgroundframetitle@@middle%
         \pgfmathsetlength{\global\mdfframetitleboxtotalheight}{-\p@}%
        }%
     }%
   }%
}%
\def\drawbrackgroundframetitle@@middle{%
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{%
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}
         \path[mdfframetitlebackground,rounded corners=\z@]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
}%
\def\drawbrackgroundframetitle@@middle{%
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}
         \path[mdfframetitlebackground,rounded corners=\z@]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
}%
\def\mdf@putbox@middle{%
  \ifvoid\mdf@splitbox@two
  \else%
  \mdf@makebox@out{%
    \mdf@makeboxalign@left%
    \mdf@tikz@settings%
    %Special for middle frame -- used other savebox
    \let\mdf@splitbox@one\mdf@splitbox@two%
     %Special for middle frame -- no innertopmargin -- done by splittopskip
     % in box and no bottommargin instead splitbottomskip
    \setlength{\mdf@innertopmargin@length}{\z@}%
    \let\mdf@innerbottommargin@length\mdf@splitbottomskip@length
    \mdf@predtikzcalc%
    %Special for middle frame -- remove topline and bottomline if no everyline
    \ifbool{mdf@everyline}{}{%
       \ifbool{mdf@topline}{%
         \mdf@dolist{\mdf@advancelength@sub{\mdfboundingboxheight}}%
           {innerlinewidth,middlelinewidth,outerlinewidth}}{}%
       \ifbool{mdf@bottomline}{%
         \mdf@dolist{\mdf@advancelength@sub{\mdfboundingboxheight}}%
           {innerlinewidth,middlelinewidth,outerlinewidth}}{}%
    }%
    \mdf@makebox@in[\mdfboundingboxwidth]{%
    \null%
    \begin{tikzpicture}[remember picture]
      \mdf@innertikzcalc%
      %Special for middle frame
      \ifbool{mdf@everyline}{}{%
        \ifbool{mdf@bottomline}%
          {%
           \pgfmathsetlengthmacro\mdf@Ay%
             {\mdf@Ay-\mdf@outerlinewidth@length-\mdf@middlelinewidth@length%
               -\mdf@innerlinewidth@length}%
           \pgfmathsetlengthmacro\mdf@Oy%
             {\mdf@Oy-\mdf@outerlinewidth@length
               -0.5\mdf@middlelinewidth@length}%
          }{}%
      \ifbool{mdf@topline}%
        {%
         \pgfmathsetlengthmacro\mdf@Py%
           {\mdf@Py-\mdf@outerlinewidth@length-0.5\mdf@middlelinewidth@length}%
        }{}%
      }{}%
      \coordinate(O)at(\mdf@Ox,\mdf@Oy);%
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
      \ifbool{mdf@shadow}{\path[mdfshadow](O) rectangle (P);}{}%
      \begin{scope}
        \begin{scope}[use as bounding box]
           %%Special for middle frame
           \ifbool{mdf@everyline}{}{\mdfsetup{topline=false,bottomline=false}}%
           \mdf@drawframe@whole
           \drawbrackgroundframetitle@middle
        \end{scope}
        \node[mdfbox] (mdfframe) at(\mdf@Ax,\mdf@Ay){\box\mdf@splitbox@two};%
      \end{scope}
      \mdf@extra%
      \mdf@middleextra%
      %HIER KOMMT EIN WEITERES MAKRO
      \mdfcreateextratikz
    \end{tikzpicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
\def\drawbrackgroundframetitle@second{%
 \ifdefempty{\mdf@frametitle}{}%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@everyline}%
          {%
           \ifbool{mdf@topline}{%
            \pgfmathsetlengthmacro\mdf@Py%
               {\mdf@Py-\mdf@innerlinewidth@length%
                       -.5\mdf@middlelinewidth@length}
            }{}%
          }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
         \path[mdfframetitlebackground]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
     }%
     {%
       \ifdimless{\mdfframetitleboxtotalheight}{\z@}
         {}%
         {%
          \drawbrackgroundframetitle@@second%
         }%
     }%
   }%
}%
\def\drawbrackgroundframetitle@@second{%
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{%
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}%
         }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}%
         \path[mdfframetitlebackground,rounded corners=\z@]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
}%
\def\mdf@putbox@second{%
  \ifvoid\mdf@splitbox@one
  \else%
   \mdf@makebox@out{%
    \mdf@makeboxalign@left%
    \mdf@tikz@settings%
     %Special for middle frame -- no innertopmargin -- done by splittopskip
    \setlength{\mdf@innertopmargin@length}{\z@}%
    \mdf@predtikzcalc%
    %Special for second frame -- no top line without everyline true
    \ifbool{mdf@everyline}{}{%
     \ifbool{mdf@topline}{%
       \mdf@dolist{\mdf@advancelength@sub{\mdfboundingboxheight}}%
        {innerlinewidth,middlelinewidth,outerlinewidth}}{}%
    }%
    \mdf@makebox@in[\mdfboundingboxwidth]{%
    \null%
    \begin{tikzpicture}[remember picture]
      \mdf@innertikzcalc
      %Special for second frame
      \ifbool{mdf@everyline}{}{%
       \ifbool{mdf@topline}%
        {%
         \pgfmathsetlengthmacro\mdf@Py%
           {\mdf@Py+\mdf@outerlinewidth@length+0.5\mdf@middlelinewidth@length}%
        }{}%
      }%
      \coordinate(O)at(\mdf@Ox,\mdf@Oy);%
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
      \ifbool{mdf@shadow}
         {%
           \path[mdfshadow] (O|-P) to[mdfcorners] (O) to[mdfcorners] (P|-O)
            -- (P) -- (O|-P);%
         }{}%
      \begin{scope}
        \begin{scope}[use as bounding box]
          \ifbool{mdf@everyline}{}{\mdfsetup{topline=false}}%
          \mdf@drawframe@whole
          \drawbrackgroundframetitle@second
        \end{scope}
        \node[mdfbox] (mdfframe) at (\mdf@Ax,\mdf@Ay){\box\mdf@splitbox@one};%
      \end{scope}
      \mdf@extra%
      \mdf@secondextra%
      %HIER KOMMT EIN WEITERES MAKRO
      \mdfcreateextratikz
    \end{tikzpicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi%
}%

\tikzset{mdfsubtitleaboverule/.style={%
   draw=none,
   fill=\mdf@subtitleabovelinecolor,
  }%
}

\tikzset{mdfsubtitlebelowrule/.style={%
   draw=none,
   fill=\mdf@subtitlebelowlinecolor,
  }%
}

\tikzset{mdfsubtitlebackground/.style={%
   draw=\mdf@subtitlebackgroundcolor,
   fill=\mdf@subtitlebackgroundcolor,
  }%
}

\tikzset{mdfsubsubtitleaboverule/.style={%
   draw=none,
   fill=\mdf@subsubtitleabovelinecolor,
  }%
}

\tikzset{mdfsubsubtitlebelowrule/.style={%
   draw=none,
   fill=\mdf@subsubtitlebelowlinecolor,
  }%
}

\tikzset{mdfsubsubtitlebackground/.style={%
   draw=none,
   fill=\mdf@subsubtitlebackgroundcolor,
  }%
}

\def\mdf@drawsubtitleaboveline{%
 \rlap{%
  \hspace*{-\mdf@innerleftmargin@length}%
  \tikz\draw[mdfsubsubtitleaboverule](0,0) rectangle
     (\mdf@templength,\mdf@subtitleabovelinewidth@length);%
 }%
}
\def\mdf@drawsubtitlebelowline{%
 \rlap{%
  \hspace*{-\mdf@innerleftmargin@length}%
  \tikz\draw[mdfsubsubtitleaboverule](0,0) rectangle
     (\mdf@templength,\mdf@subtitlebelowlinewidth@length);%
 }%
}
\def\mdf@drawsubtitlebackground{%
 \rlap{%
 \hspace*{-\mdf@innerleftmargin@length}%
 \tikz\draw[overlay,mdfsubtitlebackground](0,0) rectangle
    (\mdf@templength,-\mdfsubtitleheight);%
 }%
}

 \endinput
