%%
%% This is file `xcoffins.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xcoffins.dtx  (with options: `package')
%% 
%% EXPERIMENTAL CODE
%% 
%% Do not distribute this file without also distributing the
%% source files specified above.
%% 
%% Do not distribute a modified version of this file.
%% 
%% File: xcoffins.dtx Copyright(C) 2010-2012,2014 The LaTeX3 Project
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
%% license or (at your option) any later version.  The latest version
%% of this license is in the file
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% This file is part of the "l3experimental bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% The released version of this bundle is available from CTAN.
%%
%% -----------------------------------------------------------------------
%%
%% The development version of the bundle can be found at
%%
%%    http://www.latex-project.org/svnroot/experimental/trunk/
%%
%% for those people who are interested.
%%
%%%%%%%%%%%
%% NOTE: %%
%%%%%%%%%%%
%%
%%   Snapshots taken from the repository represent work in progress and may
%%   not work or may contain conflicting material!  We therefore ask
%%   people _not_ to put them into distributions, archives, etc. without
%%   prior consultation with the LaTeX Project Team.
%%
%% -----------------------------------------------------------------------
%%
\RequirePackage{xparse}
\GetIdInfo$Id: xcoffins.dtx 4728 2014-05-04 13:25:37Z joseph $
  {L3 Experimental design-level coffins}
\ProvidesExplPackage
  {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\keys_define:nn { coffin }
  {
    coffin1-hpole     .tl_set:N        = \l__coffin_A_hpole_tl          ,
    coffin1-hpole     .value_required:                                 ,
    coffin1-vpole     .tl_set:N        = \l__coffin_A_vpole_tl          ,
    coffin1-vpole     .value_required:                                 ,
    coffin2-hpole     .tl_set:N        = \l__coffin_B_hpole_tl          ,
    coffin2-hpole     .value_required:                                 ,
    coffin2-vpole     .tl_set:N        = \l__coffin_B_vpole_tl          ,
    coffin2-vpole     .value_required:                                 ,
    grow-bounding-box .bool_set:N      = \l__coffin_bound_box_grow_bool ,
    grow-bounding-box .default:n       = true                          ,
    hoffset           .dim_set:N       = \l__coffin_hoffset_dim         ,
    hoffset           .value_required:                                 ,
    voffset           .dim_set:N       = \l__coffin_voffset_dim         ,
    voffset           .value_required:
  }
\keys_set:nn { coffin }
  {
    coffin1-hpole     = H    ,
    coffin1-vpole     = l    ,
    coffin2-hpole     = H    ,
    coffin2-vpole     = l    ,
    grow-bounding-box = true ,
    hoffset           = 0 pt ,
    voffset           = 0 pt
  }
\cs_new_protected:Npn \__coffin_design_names:N #1
  {
    \dim_set:Nn \l__coffin_height_dim { \coffin_ht:N #1 }
    \dim_set:Nn \l__coffin_depth_dim  { \coffin_dp:N #1 }
    \dim_set:Nn \l__coffin_width_dim  { \coffin_wd:N #1 }
    \dim_set:Nn \l__coffin_totalheight_dim
      { \l__coffin_height_dim + \l__coffin_depth_dim }
    \cs_set_eq:NN \Height \l__coffin_height_dim
    \cs_set_eq:NN \Depth \l__coffin_depth_dim
    \cs_set_eq:NN \Width \l__coffin_width_dim
    \cs_set_eq:NN \TotalHeight \l__coffin_totalheight_dim
  }
\dim_new:N \l__coffin_height_dim
\dim_new:N \l__coffin_depth_dim
\dim_new:N \l__coffin_width_dim
\dim_new:N \l__coffin_totalheight_dim
\NewDocumentCommand \NewCoffin { m }
  { \coffin_new:N #1 }
\NewDocumentCommand \SetHorizontalCoffin { m +m }
  { \hcoffin_set:Nn #1 {#2} }
\NewDocumentCommand \SetVerticalCoffin { m m +m }
  { \vcoffin_set:Nnn #1 {#2} {#3} }
\NewDocumentCommand \SetHorizontalPole { m m m }
  {
    \group_begin:
      \__coffin_design_names:N #1
    \use:x
      {
        \group_end:
        \coffin_set_horizontal_pole:Nnn #1
          { \exp_not:n {#2} } { \dim_eval:n {#3} }
      }
  }
\NewDocumentCommand \SetVerticalPole { m m m }
  {
    \group_begin:
      \__coffin_design_names:N #1
    \use:x
      {
        \group_end:
        \coffin_set_vertical_pole:Nnn #1
          { \exp_not:n {#2} } { \dim_eval:n {#3} }
      }
  }
\NewDocumentCommand \JoinCoffins
  {
    o
    s
    m
    > { \SplitArgument { 1 } { , } } O { H , l }
    m
    > { \SplitArgument { 1 } { , } } O { H , l }
    > { \SplitArgument { 1 } { , } } D ( ) { 0 pt , 0 pt }
  }
  {
    \IfNoValueTF {#1}
      {
        \IfBooleanTF #2
          { \coffin_attach:NnnNnnnn #3 #4 #5 #6 #7 }
          { \coffin_join:NnnNnnnn #3 #4 #5 #6 #7 }
      }
      {
        \group_begin:
          \keys_set:nn { coffin } {#1}
          \tl_set:Nx \l__coffin_tmp_tl
            {
              \group_end:
              \bool_if:NTF \l__coffin_bound_box_grow_bool
                { \coffin_join:NnnNnnnn }
                { \coffin_attach:NnnNnnnn }
              \exp_not:N #3
              { \exp_not:o { \l__coffin_A_hpole_tl } }
              { \exp_not:o { \l__coffin_A_vpole_tl } }
              \exp_not:N #5
              { \exp_not:o { \l__coffin_B_hpole_tl } }
              { \exp_not:o { \l__coffin_B_vpole_tl } }
              { \dim_use:N \l__coffin_hoffset_dim }
              { \dim_use:N \l__coffin_voffset_dim }
            }
        \l__coffin_tmp_tl
      }
  }
\NewDocumentCommand \TypesetCoffin
  {
     m
     > { \SplitArgument { 1 } { , } } O { H , l }
     > { \SplitArgument { 1 } { , } } D ( ) { 0 pt , 0 pt }
  }
  { \coffin_typeset:Nnnnn #1 #2 #3 }
\NewDocumentCommand \RotateCoffin  { m m }
  { \coffin_rotate:Nn #1 {#2} }
\NewDocumentCommand \ResizeCoffin  { m m m }
  { \coffin_resize:Nnn #1 {#2} {#3} }
\NewDocumentCommand \ScaleCoffin  { m m m }
  { \coffin_scale:Nnn #1 {#2} {#3} }
\NewDocumentCommand \CoffinDepth { m }
  { \coffin_dp:N #1 }
\NewDocumentCommand \CoffinHeight { m }
  { \coffin_ht:N #1 }
\NewDocumentCommand \CoffinTotalHeight { m }
  { \__dim_eval:w \coffin_ht:N #1 + \coffin_dp:N #1 \__dim_eval_end: }
\NewDocumentCommand \CoffinWidth { m }
  { \coffin_wd:N #1 }
\NewDocumentCommand \DisplayCoffinHandles { m m }
  { \coffin_if_exist:NT #1 { \coffin_display_handles:Nn #1 {#2} } }
\NewDocumentCommand \MarkCoffinHandle
  { m > { \SplitArgument { 1 } { , } } O { H , l } m }
  {  \coffin_if_exist:NT #1 { \coffin_mark_handle:Nnnn #1 #2 {#3} } }
\NewDocumentCommand \ShowCoffinStructure { m }
  { \coffin_show_structure:N #1 }
%% 
%%
%% End of file `xcoffins.sty'.
