Feature: Labelprint für Kistenetiketten hinzugefügt
This commit is contained in:
@@ -888,7 +888,7 @@ class Calculation extends CalculationLocale
|
||||
}
|
||||
}
|
||||
if ($matrix1Rows < $matrix2Rows) {
|
||||
$x = ($matrix1Rows === 1) ? $matrix1[0] : array_fill(0, $matrix1Columns, null);
|
||||
$x = ($matrix1Rows === 1) ? $matrix1[0] : array_fill(0, $matrix2Columns, null);
|
||||
for ($i = $matrix1Rows; $i < $matrix2Rows; ++$i) {
|
||||
$matrix1[$i] = $x;
|
||||
}
|
||||
@@ -1095,6 +1095,10 @@ class Calculation extends CalculationLocale
|
||||
$this->branchPruner->initialiseForLoop();
|
||||
|
||||
$opCharacter = $formula[$index]; // Get the first character of the value at the current index position
|
||||
if ($opCharacter === "\xe2") { // intersection or union
|
||||
$opCharacter .= $formula[++$index];
|
||||
$opCharacter .= $formula[++$index];
|
||||
}
|
||||
|
||||
// Check for two-character operators (e.g. >=, <=, <>)
|
||||
if ((isset(self::COMPARISON_OPERATORS[$opCharacter])) && (strlen($formula) > $index) && isset($formula[$index + 1], self::COMPARISON_OPERATORS[$formula[$index + 1]])) {
|
||||
@@ -1115,7 +1119,7 @@ class Calculation extends CalculationLocale
|
||||
++$index;
|
||||
} elseif ($opCharacter === '+' && !$expectingOperator) { // Positive (unary plus rather than binary operator plus) can be discarded?
|
||||
++$index; // Drop the redundant plus symbol
|
||||
} elseif ((($opCharacter === '~') || ($opCharacter === '∩') || ($opCharacter === '∪')) && (!$isOperandOrFunction)) {
|
||||
} elseif ((($opCharacter === '~') /*|| ($opCharacter === '∩') || ($opCharacter === '∪')*/) && (!$isOperandOrFunction)) {
|
||||
// We have to explicitly deny a tilde, union or intersect because they are legal
|
||||
return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression
|
||||
} elseif ((isset(self::CALCULATION_OPERATORS[$opCharacter]) || $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack?
|
||||
@@ -1233,6 +1237,15 @@ class Calculation extends CalculationLocale
|
||||
// MS Excel allows this if the content is cell references; but doesn't allow actual values,
|
||||
// but at this point, we can't differentiate (so allow both)
|
||||
return $this->raiseFormulaError('Formula Error: Unexpected ,');
|
||||
/* The following code may be a better choice, but, with
|
||||
the other changes for this PR, I can no longer come up
|
||||
with a test case that gets here
|
||||
$stack->push('Binary Operator', '∪');
|
||||
|
||||
++$index;
|
||||
$expectingOperator = false;
|
||||
|
||||
continue;*/
|
||||
}
|
||||
|
||||
/** @var array<string, int> $d */
|
||||
@@ -1699,7 +1712,7 @@ class Calculation extends CalculationLocale
|
||||
return $this->raiseFormulaError($e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
} elseif (!is_numeric($token) && !is_object($token) && isset(self::BINARY_OPERATORS[$token])) {
|
||||
} elseif (!is_numeric($token) && !is_object($token) && isset($token, self::BINARY_OPERATORS[$token])) { //* @phpstan-ignore-line
|
||||
// if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack
|
||||
// We must have two operands, error if we don't
|
||||
$operand2Data = $stack->pop();
|
||||
@@ -1927,6 +1940,14 @@ class Calculation extends CalculationLocale
|
||||
$stack->push('Value', $cellIntersect, $cellRef);
|
||||
}
|
||||
|
||||
break;
|
||||
case '∪': // union
|
||||
/** @var mixed[][] $operand1 */
|
||||
/** @var mixed[][] $operand2 */
|
||||
$cellUnion = array_merge($operand1, $operand2);
|
||||
$this->debugLog->writeDebugLog('Evaluation Result is %s', $this->showTypeDetails($cellUnion));
|
||||
$stack->push('Value', $cellUnion, 'A1');
|
||||
|
||||
break;
|
||||
}
|
||||
} elseif (($token === '~') || ($token === '%')) {
|
||||
@@ -2792,6 +2813,14 @@ class Calculation extends CalculationLocale
|
||||
|
||||
$definedNameValue = $namedRange->getValue();
|
||||
$definedNameType = $namedRange->isFormula() ? 'Formula' : 'Range';
|
||||
if ($definedNameType === 'Range') {
|
||||
if (preg_match('/^(.*!)?(.*)$/', $definedNameValue, $matches) === 1) {
|
||||
$matches2 = trim($matches[2]);
|
||||
$matches2 = preg_replace('/ +/', ' ∩ ', $matches2) ?? $matches2;
|
||||
$matches2 = preg_replace('/,/', ' ∪ ', $matches2) ?? $matches2;
|
||||
$definedNameValue = $matches[1] . $matches2;
|
||||
}
|
||||
}
|
||||
$definedNameWorksheet = $namedRange->getWorksheet();
|
||||
|
||||
if ($definedNameValue[0] !== '=') {
|
||||
@@ -2879,6 +2908,7 @@ class Calculation extends CalculationLocale
|
||||
if ($stack->count() > 0) {
|
||||
$o2 = $stack->last();
|
||||
if ($o2) {
|
||||
/** @var array{value: string} $o2 */
|
||||
if (isset(self::CALCULATION_OPERATORS[$o2['value']])) {
|
||||
$retVal = (self::OPERATOR_PRECEDENCE[$opCharacter] ?? 0) <= self::OPERATOR_PRECEDENCE[$o2['value']];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user