+#include "paper-column.hh"
+#include "paper-score.hh"
+#include "molecule.hh"
+#include "paper-outputter.hh"
+#include "paper-column.hh"
+#include "system.hh"
+#include "group-interface.hh"
+
+void
+Spanner::do_break_processing ()
+{
+ //break_into_pieces
+ Item * left = spanned_drul_[LEFT];
+ Item * right = spanned_drul_[RIGHT];
+
+ if (!left || !right)
+ return;
+
+ /*
+ Check if our parent in X-direction spans equally wide
+ or wider than we do.
+ */
+ for (int a = X_AXIS; a < NO_AXES; a ++)
+ {
+ if (Spanner* parent = dynamic_cast<Spanner*> (get_parent ((Axis)a)))
+ {
+ if (!parent->spanned_rank_iv ().contains_b (this->spanned_rank_iv ()))
+ {
+ programming_error (to_str ("Spanner `%s' is not fully contained in parent spanner `%s'.",
+ name ().ch_C (),
+ parent->name ().ch_C ()));
+ }
+ }
+ }
+
+ if (line_l () || broken_b ())
+ return;
+
+ if (left == right)
+ {
+ /*
+ If we have a spanner spanning one column, we must break it
+ anyway because it might provide a parent for another item. */
+ Direction d = LEFT;
+ do
+ {
+ Item* bound = left->find_prebroken_piece (d);
+ if (!bound)
+ programming_error ("no broken bound");
+ else if (bound->line_l ())
+ {
+ Spanner * span_p = dynamic_cast<Spanner*> (clone ());
+ span_p->set_bound (LEFT, bound);
+ span_p->set_bound (RIGHT, bound);
+
+ assert (span_p->line_l ());
+ span_p->line_l ()->typeset_grob (span_p);
+ broken_into_l_arr_.push (span_p);
+ }
+ }
+ while ((flip (&d))!= LEFT);
+ }
+ else
+ {
+ Link_array<Item> break_points = pscore_l_->line_l_->broken_col_range (left,right);
+
+ break_points.insert (left,0);
+ break_points.push (right);
+
+ for (int i=1; i < break_points.size (); i++)
+ {
+ Drul_array<Item*> bounds;
+ bounds[LEFT] = break_points[i-1];
+ bounds[RIGHT] = break_points[i];
+ Direction d = LEFT;
+ do
+ {
+ if (!bounds[d]->line_l ())
+ bounds[d] = bounds[d]->find_prebroken_piece (- d);
+ }
+ while ((flip (&d))!= LEFT);
+
+ if (!bounds[LEFT] || ! bounds[RIGHT])
+ {
+ programming_error ("bounds of this piece aren't breakable. ");
+ continue;
+ }