Move Style classes into Common folder (#432)
This commit is contained in:
1 parent
c4e25a168e
commit
238756ab6e
38 files changed
+463
-298
No files matched your search
@@ -10,6 +10,7 @@ use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Creator\InternalFactoryInterface;
|
||||
use Box\Spout\Writer\Common\Creator\WorkbookFactory;
|
||||
use Box\Spout\Writer\Common\Creator\WorksheetFactory;
|
||||
use Box\Spout\Writer\Common\Manager\StyleManager;
|
||||
use Box\Spout\Writer\XLSX\Helper\FileSystemHelper;
|
||||
use Box\Spout\Writer\XLSX\Helper\SharedStringsHelper;
|
||||
use Box\Spout\Writer\XLSX\Helper\StyleHelper;
|
||||
@@ -102,7 +103,17 @@ class InternalFactory implements InternalFactoryInterface
|
||||
private function createStyleHelper(OptionsManagerInterface $optionsManager)
|
||||
{
|
||||
$defaultRowStyle = $optionsManager->getOption(Options::DEFAULT_ROW_STYLE);
|
||||
return new StyleHelper($defaultRowStyle);
|
||||
$styleManager = $this->createStyleManager();
|
||||
|
||||
return new StyleHelper($defaultRowStyle, $styleManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return StyleManager
|
||||
*/
|
||||
private function createStyleManager()
|
||||
{
|
||||
return new StyleManager();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer\XLSX\Helper;
|
||||
|
||||
use Box\Spout\Writer\Style\Border;
|
||||
use Box\Spout\Writer\Style\BorderPart;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Border;
|
||||
use Box\Spout\Writer\Common\Entity\Style\BorderPart;
|
||||
|
||||
class BorderHelper
|
||||
{
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace Box\Spout\Writer\XLSX\Helper;
|
||||
|
||||
use Box\Spout\Writer\Common\Helper\StyleHelperAbstract;
|
||||
use Box\Spout\Writer\Style\Color;
|
||||
use Box\Spout\Writer\Style\Style;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Color;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Class StyleHelper
|
||||
@@ -45,8 +45,8 @@ class StyleHelper extends StyleHelperAbstract
|
||||
/**
|
||||
* XLSX specific operations on the registered styles
|
||||
*
|
||||
* @param \Box\Spout\Writer\Style\Style $style
|
||||
* @return \Box\Spout\Writer\Style\Style
|
||||
* @param \Box\Spout\Writer\Common\Entity\Style\Style $style
|
||||
* @return \Box\Spout\Writer\Common\Entity\Style\Style
|
||||
*/
|
||||
public function registerStyle($style)
|
||||
{
|
||||
@@ -59,7 +59,7 @@ class StyleHelper extends StyleHelperAbstract
|
||||
/**
|
||||
* Register a fill definition
|
||||
*
|
||||
* @param \Box\Spout\Writer\Style\Style $style
|
||||
* @param \Box\Spout\Writer\Common\Entity\Style\Style $style
|
||||
*/
|
||||
protected function registerFill($style)
|
||||
{
|
||||
@@ -92,7 +92,7 @@ class StyleHelper extends StyleHelperAbstract
|
||||
/**
|
||||
* Register a border definition
|
||||
*
|
||||
* @param \Box\Spout\Writer\Style\Style $style
|
||||
* @param \Box\Spout\Writer\Common\Entity\Style\Style $style
|
||||
*/
|
||||
protected function registerBorder($style)
|
||||
{
|
||||
@@ -174,7 +174,7 @@ EOD;
|
||||
{
|
||||
$content = '<fonts count="' . count($this->styleIdToStyleMappingTable) . '">';
|
||||
|
||||
/** @var \Box\Spout\Writer\Style\Style $style */
|
||||
/** @var \Box\Spout\Writer\Common\Entity\Style\Style $style */
|
||||
foreach ($this->getRegisteredStyles() as $style) {
|
||||
$content .= '<font>';
|
||||
|
||||
@@ -251,7 +251,7 @@ EOD;
|
||||
$content .= '<border><left/><right/><top/><bottom/></border>';
|
||||
|
||||
foreach ($this->registeredBorders as $styleId) {
|
||||
/** @var \Box\Spout\Writer\Style\Style $style */
|
||||
/** @var \Box\Spout\Writer\Common\Entity\Style\Style $style */
|
||||
$style = $this->styleIdToStyleMappingTable[$styleId];
|
||||
$border = $style->getBorder();
|
||||
$content .= '<border>';
|
||||
@@ -261,7 +261,7 @@ EOD;
|
||||
|
||||
foreach ($sortOrder as $partName) {
|
||||
if ($border->hasPart($partName)) {
|
||||
/** @var $part \Box\Spout\Writer\Style\BorderPart */
|
||||
/** @var $part \Box\Spout\Writer\Common\Entity\Style\BorderPart */
|
||||
$part = $border->getPart($partName);
|
||||
$content .= BorderHelper::serializeBorderPart($part);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Box\Spout\Writer\XLSX\Manager;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Options;
|
||||
use Box\Spout\Writer\Common\Manager\OptionsManagerAbstract;
|
||||
use Box\Spout\Writer\Style\StyleBuilder;
|
||||
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
|
||||
|
||||
/**
|
||||
* Class OptionsManager
|
||||
|
||||
@@ -11,7 +11,7 @@ use Box\Spout\Writer\Common\Entity\Options;
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
use Box\Spout\Writer\Common\Manager\WorksheetManagerInterface;
|
||||
use Box\Spout\Writer\Style\Style;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\XLSX\Helper\SharedStringsHelper;
|
||||
use Box\Spout\Writer\XLSX\Helper\StyleHelper;
|
||||
|
||||
@@ -155,7 +155,7 @@ EOD;
|
||||
* @param Worksheet $worksheet The worksheet to add the row to
|
||||
* @param array $dataRow Array containing data to be written. Cannot be empty.
|
||||
* Example $dataRow = ['data1', 1234, null, '', 'data5'];
|
||||
* @param \Box\Spout\Writer\Style\Style $style Style to be applied to the row. NULL means use default style.
|
||||
* @param \Box\Spout\Writer\Common\Entity\Style\Style $style Style to be applied to the row. NULL means use default style.
|
||||
* @return void
|
||||
* @throws \Box\Spout\Common\Exception\IOException If the data cannot be written
|
||||
* @throws \Box\Spout\Common\Exception\InvalidArgumentException If a cell value's type is not supported
|
||||
|
||||
Reference in new issue
Block a user