Current File : //var/www/prestashop/modules/mbeshipping/vendor/dompdf/dompdf/src/FrameReflower/Table.php
<?php
/**
 * @package dompdf
 * @link    http://dompdf.github.com/
 * @author  Benj Carson <benjcarson@digitaljunkies.ca>
 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
 */
namespace Dompdf\FrameReflower;

use Dompdf\FrameDecorator\Block as BlockFrameDecorator;
use Dompdf\FrameDecorator\Table as TableFrameDecorator;
use Dompdf\Helpers;

/**
 * Reflows tables
 *
 * @access  private
 * @package dompdf
 */
class Table extends AbstractFrameReflower
{
    /**
     * Frame for this reflower
     *
     * @var TableFrameDecorator
     */
    protected $_frame;

    /**
     * Cache of results between call to get_min_max_width and assign_widths
     *
     * @var array
     */
    protected $_state;

    /**
     * Table constructor.
     * @param TableFrameDecorator $frame
     */
    function __construct(TableFrameDecorator $frame)
    {
        $this->_state = null;
        parent::__construct($frame);
    }

    /**
     * State is held here so it needs to be reset along with the decorator
     */
    public function reset(): void
    {
        parent::reset();
        $this->_state = null;
    }

    protected function _assign_widths()
    {
        $style = $this->_frame->get_style();

        // Find the min/max width of the table and sort the columns into
        // absolute/percent/auto arrays
        $delta = $this->_state["width_delta"];
        $min_width = $this->_state["min_width"];
        $max_width = $this->_state["max_width"];
        $percent_used = $this->_state["percent_used"];
        $absolute_used = $this->_state["absolute_used"];
        $auto_min = $this->_state["auto_min"];

        $absolute =& $this->_state["absolute"];
        $percent =& $this->_state["percent"];
        $auto =& $this->_state["auto"];

        // Determine the actual width of the table (excluding borders and
        // padding)
        $cb = $this->_frame->get_containing_block();
        $columns =& $this->_frame->get_cellmap()->get_columns();

        $width = $style->width;
        $min_table_width = $this->resolve_min_width($cb["w"]) - $delta;

        if ($width !== "auto") {
            $preferred_width = (float) $style->length_in_pt($width, $cb["w"]) - $delta;

            if ($preferred_width < $min_table_width) {
                $preferred_width = $min_table_width;
            }

            if ($preferred_width > $min_width) {
                $width = $preferred_width;
            } else {
                $width = $min_width;
            }

        } else {
            if ($max_width + $delta < $cb["w"]) {
                $width = $max_width;
            } else if ($cb["w"] - $delta > $min_width) {
                $width = $cb["w"] - $delta;
            } else {
                $width = $min_width;
            }

            if ($width < $min_table_width) {
                $width = $min_table_width;
            }

        }

        // Store our resolved width
        $style->width = $width;

        $cellmap = $this->_frame->get_cellmap();

        if ($cellmap->is_columns_locked()) {
            return;
        }

        // If the whole table fits on the page, then assign each column it's max width
        if ($width == $max_width) {
            foreach (array_keys($columns) as $i) {
                $cellmap->set_column_width($i, $columns[$i]["max-width"]);
            }

            return;
        }

        // Determine leftover and assign it evenly to all columns
        if ($width > $min_width) {
            // We have three cases to deal with:
            //
            // 1. All columns are auto or absolute width.  In this case we
            // distribute extra space across all auto columns weighted by the
            // difference between their max and min width, or by max width only
            // if the width of the table is larger than the max width for all
            // columns.
            //
            // 2. Only absolute widths have been specified, no auto columns.  In
            // this case we distribute extra space across all columns weighted
            // by their absolute width.
            //
            // 3. Percentage widths have been specified.  In this case we normalize
            // the percentage values and try to assign widths as fractions of
            // the table width. Absolute column widths are fully satisfied and
            // any remaining space is evenly distributed among all auto columns.

            // Case 1:
            if ($percent_used == 0 && count($auto)) {
                foreach ($absolute as $i) {
                    $w = $columns[$i]["min-width"];
                    $cellmap->set_column_width($i, $w);
                }

                if ($width < $max_width) {
                    $increment = $width - $min_width;
                    $table_delta = $max_width - $min_width;

                    foreach ($auto as $i) {
                        $min = $columns[$i]["min-width"];
                        $max = $columns[$i]["max-width"];
                        $col_delta = $max - $min;
                        $w = $min + $increment * ($col_delta / $table_delta);
                        $cellmap->set_column_width($i, $w);
                    }
                } else {
                    $increment = $width - $max_width;
                    $auto_max = $max_width - $absolute_used;

                    foreach ($auto as $i) {
                        $max = $columns[$i]["max-width"];
                        $f = $auto_max > 0 ? $max / $auto_max : 1 / count($auto);
                        $w = $max + $increment * $f;
                        $cellmap->set_column_width($i, $w);
                    }
                }
                return;
            }

            // Case 2:
            if ($percent_used == 0 && !count($auto)) {
                $increment = $width - $absolute_used;

                foreach ($absolute as $i) {
                    $min = $columns[$i]["min-width"];
                    $abs = $columns[$i]["absolute"];
                    $f = $absolute_used > 0 ? $abs / $absolute_used : 1 / count($absolute);
                    $w = $min + $increment * $f;
                    $cellmap->set_column_width($i, $w);
                }
                return;
            }

            // Case 3:
            if ($percent_used > 0) {
                // Scale percent values if the total percentage is > 100 or
                // there are no auto values to take up slack
                if ($percent_used > 100 || count($auto) == 0) {
                    $scale = 100 / $percent_used;
                } else {
                    $scale = 1;
                }

                // Account for the minimum space used by the unassigned auto
                // columns, by the columns with absolute widths, and the
                // percentage columns following the current one
                $used_width = $auto_min + $absolute_used;

                foreach ($absolute as $i) {
                    $w = $columns[$i]["min-width"];
                    $cellmap->set_column_width($i, $w);
                }

                $percent_min = 0;

                foreach ($percent as $i) {
                    $percent_min += $columns[$i]["min-width"];
                }

                // First-come, first served
                foreach ($percent as $i) {
                    $min = $columns[$i]["min-width"];
                    $percent_min -= $min;
                    $slack = $width - $used_width - $percent_min;

                    $columns[$i]["percent"] *= $scale;
                    $w = min($columns[$i]["percent"] * $width / 100, $slack);

                    if ($w < $min) {
                        $w = $min;
                    }

                    $cellmap->set_column_width($i, $w);
                    $used_width += $w;
                }

                // This works because $used_width includes the min-width of each
                // unassigned column
                if (count($auto) > 0) {
                    $increment = ($width - $used_width) / count($auto);

                    foreach ($auto as $i) {
                        $w = $columns[$i]["min-width"] + $increment;
                        $cellmap->set_column_width($i, $w);
                    }
                }
                return;
            }
        } else {
            // We are over-constrained:
            // Each column gets its minimum width
            foreach (array_keys($columns) as $i) {
                $cellmap->set_column_width($i, $columns[$i]["min-width"]);
            }
        }
    }

    /**
     * Determine the frame's height based on min/max height
     *
     * @return float
     */
    protected function _calculate_height()
    {
        $frame = $this->_frame;
        $style = $frame->get_style();
        $cb = $frame->get_containing_block();

        $height = $style->length_in_pt($style->height, $cb["h"]);

        $cellmap = $frame->get_cellmap();
        $cellmap->assign_frame_heights();
        $rows = $cellmap->get_rows();

        // Determine our content height
        $content_height = 0.0;
        foreach ($rows as $r) {
            $content_height += $r["height"];
        }

        if ($height === "auto") {
            $height = $content_height;
        }

        // Handle min/max height
        // https://www.w3.org/TR/CSS21/visudet.html#min-max-heights
        $min_height = $this->resolve_min_height($cb["h"]);
        $max_height = $this->resolve_max_height($cb["h"]);
        $height = Helpers::clamp($height, $min_height, $max_height);

        // Use the content height or the height value, whichever is greater
        if ($height <= $content_height) {
            $height = $content_height;
        } else {
            // FIXME: Borders and row positions are not properly updated by this
            // $cellmap->set_frame_heights($height, $content_height);
        }

        return $height;
    }

    /**
     * @param BlockFrameDecorator|null $block
     */
    function reflow(BlockFrameDecorator $block = null)
    {
        /** @var TableFrameDecorator */
        $frame = $this->_frame;

        // Check if a page break is forced
        $page = $frame->get_root();
        $page->check_forced_page_break($frame);

        // Bail if the page is full
        if ($page->is_full()) {
            return;
        }

        // Let the page know that we're reflowing a table so that splits
        // are suppressed (simply setting page-break-inside: avoid won't
        // work because we may have an arbitrary number of block elements
        // inside tds.)
        $page->table_reflow_start();

        $this->determine_absolute_containing_block();

        // Counters and generated content
        $this->_set_content();

        // Collapse vertical margins, if required
        $this->_collapse_margins();

        // Table layout algorithm:
        // http://www.w3.org/TR/CSS21/tables.html#auto-table-layout

        if (is_null($this->_state)) {
            $this->get_min_max_width();
        }

        $cb = $frame->get_containing_block();
        $style = $frame->get_style();

        // This is slightly inexact, but should be okay.  Add half the
        // border-spacing to the table as padding.  The other half is added to
        // the cells themselves.
        if ($style->border_collapse === "separate") {
            list($h, $v) = $style->border_spacing;

            $v = (float)$style->length_in_pt($v) / 2;
            $h = (float)$style->length_in_pt($h) / 2;

            $style->padding_left = (float)$style->length_in_pt($style->padding_left, $cb["w"]) + $h;
            $style->padding_right = (float)$style->length_in_pt($style->padding_right, $cb["w"]) + $h;
            $style->padding_top = (float)$style->length_in_pt($style->padding_top, $cb["w"]) + $v;
            $style->padding_bottom = (float)$style->length_in_pt($style->padding_bottom, $cb["w"]) + $v;
        }

        $this->_assign_widths();

        // Adjust left & right margins, if they are auto
        $delta = $this->_state["width_delta"];
        $width = $style->width;
        $left = $style->length_in_pt($style->margin_left, $cb["w"]);
        $right = $style->length_in_pt($style->margin_right, $cb["w"]);

        $diff = (float) $cb["w"] - (float) $width - $delta;

        if ($left === "auto" && $right === "auto") {
            if ($diff < 0) {
                $left = 0;
                $right = $diff;
            } else {
                $left = $right = $diff / 2;
            }
        } else {
            if ($left === "auto") {
                $left = max($diff - $right, 0);
            }
            if ($right === "auto") {
                $right = max($diff - $left, 0);
            }
        }

        $style->margin_left = $left;
        $style->margin_right = $right;

        $frame->position();
        list($x, $y) = $frame->get_position();

        // Determine the content edge
        $offset_x = (float)$left + (float)$style->length_in_pt([
            $style->padding_left,
            $style->border_left_width
        ], $cb["w"]);
        $offset_y = (float)$style->length_in_pt([
            $style->margin_top,
            $style->border_top_width,
            $style->padding_top
        ], $cb["w"]);
        $content_x = $x + $offset_x;
        $content_y = $y + $offset_y;

        if (isset($cb["h"])) {
            $h = $cb["h"];
        } else {
            $h = null;
        }

        $cellmap = $frame->get_cellmap();
        $col =& $cellmap->get_column(0);
        $col["x"] = $offset_x;

        $row =& $cellmap->get_row(0);
        $row["y"] = $offset_y;

        $cellmap->assign_x_positions();

        // Set the containing block of each child & reflow
        foreach ($frame->get_children() as $child) {
            $child->set_containing_block($content_x, $content_y, $width, $h);
            $child->reflow();

            if (!$page->in_nested_table()) {
                // Check if a split has occurred
                $page->check_page_break($child);
    
                if ($page->is_full()) {
                    break;
                }
            }
        }

        // Stop reflow if a page break has occurred before the frame, in which
        // case it has been reset, including its position
        if ($page->is_full() && $frame->get_position("x") === null) {
            $page->table_reflow_end();
            return;
        }

        // Assign heights to our cells:
        $style->height = $this->_calculate_height();

        $page->table_reflow_end();

        if ($block && $frame->is_in_flow()) {
            $block->add_frame_to_line($frame);

            if ($frame->is_block_level()) {
                $block->add_line();
            }
        }
    }

    public function get_min_max_width(): array
    {
        if (!is_null($this->_min_max_cache)) {
            return $this->_min_max_cache;
        }

        $style = $this->_frame->get_style();
        $cellmap = $this->_frame->get_cellmap();

        $this->_frame->normalize();

        // Add the cells to the cellmap (this will calculate column widths as
        // frames are added)
        $cellmap->add_frame($this->_frame);

        // Find the min/max width of the table and sort the columns into
        // absolute/percent/auto arrays
        $this->_state = [];
        $this->_state["min_width"] = 0;
        $this->_state["max_width"] = 0;

        $this->_state["percent_used"] = 0;
        $this->_state["absolute_used"] = 0;
        $this->_state["auto_min"] = 0;

        $this->_state["absolute"] = [];
        $this->_state["percent"] = [];
        $this->_state["auto"] = [];

        $columns =& $cellmap->get_columns();
        foreach (array_keys($columns) as $i) {
            $this->_state["min_width"] += $columns[$i]["min-width"];
            $this->_state["max_width"] += $columns[$i]["max-width"];

            if ($columns[$i]["absolute"] > 0) {
                $this->_state["absolute"][] = $i;
                $this->_state["absolute_used"] += $columns[$i]["absolute"];
            } else if ($columns[$i]["percent"] > 0) {
                $this->_state["percent"][] = $i;
                $this->_state["percent_used"] += $columns[$i]["percent"];
            } else {
                $this->_state["auto"][] = $i;
                $this->_state["auto_min"] += $columns[$i]["min-width"];
            }
        }

        // Account for margins, borders, padding, and border spacing
        $cb_w = $this->_frame->get_containing_block("w");
        $lm = (float) $style->length_in_pt($style->margin_left, $cb_w);
        $rm = (float) $style->length_in_pt($style->margin_right, $cb_w);

        $dims = [
            $style->border_left_width,
            $style->border_right_width,
            $style->padding_left,
            $style->padding_right
        ];

        if ($style->border_collapse !== "collapse") {
            list($dims[]) = $style->border_spacing;
        }

        $delta = (float) $style->length_in_pt($dims, $cb_w);

        $this->_state["width_delta"] = $delta;

        $min_width = $this->_state["min_width"] + $delta + $lm + $rm;
        $max_width = $this->_state["max_width"] + $delta + $lm + $rm;

        return $this->_min_max_cache = [
            $min_width,
            $max_width,
            "min" => $min_width,
            "max" => $max_width
        ];
    }
}
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!