30#include <oox/token/properties.hxx>
31#include <oox/token/tokens.hxx>
34#include <com/sun/star/table/BorderLineStyle.hpp>
35#include <com/sun/star/table/BorderLine2.hpp>
36#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
37#include <com/sun/star/text/XText.hpp>
38#include <com/sun/star/text/WritingMode.hpp>
46using ::com::sun::star::table::BorderLine2;
60, mnVertToken( XML_horz )
61, mnAnchorToken( XML_t )
63, mnHorzOverflowToken( XML_clip )
73 BorderLine2 aBorderLine;
78 aBorderLine.
Color = sal_Int32(aColor.
getColor(rFilterBase.getGraphicHelper()));
82 aBorderLine.LineDistance = 0;
91 aBorderLine.
Color = sal_Int32(aColor.
getColor(rFilterBase.getGraphicHelper()));
94 aBorderLine.Color = sal_Int32(
COL_AUTO);
100 aBorderLine.InnerLineWidth =
static_cast<sal_Int16
>(
GetCoordinate(rLineProperties.
moLineWidth.value_or(12700)) / 4);
102 aBorderLine.LineDistance = 0;
111 aBorderLine.LineStyle = ::table::BorderLineStyle::DOTTED;
116 aBorderLine.LineStyle = ::table::BorderLineStyle::DASHED;
121 aBorderLine.LineStyle = ::table::BorderLineStyle::DASH_DOT;
123 case XML_lgDashDotDot:
124 case XML_sysDashDotDot:
125 aBorderLine.LineStyle = ::table::BorderLineStyle::DASH_DOT_DOT;
128 aBorderLine.LineStyle = ::table::BorderLineStyle::SOLID;
131 aBorderLine.LineStyle = ::table::BorderLineStyle::DASHED;
137 aBorderLine.LineStyle = ::table::BorderLineStyle::DASHED;
141 aBorderLine.LineStyle = ::table::BorderLineStyle::NONE;
150 std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rPartLineBorders( rTableStylePart.
getLineBorders() );
152 std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >::const_iterator aIter( rPartLineBorders.find( nLineType ) );
153 if ( ( aIter != rPartLineBorders.end() ) && aIter->second )
157 if (
const Theme* pTheme = rFilterBase.getCurrentTheme())
178 bool bIsWholeTable =
false,
180 sal_Int32 nMaxCol = 0,
182 sal_Int32 nMaxRow = 0)
185 if ( rPartFillPropertiesPtr )
186 rFillProperties.
assignUsed( *rPartFillPropertiesPtr );
190 const Theme* pTheme = rFilterBase.getCurrentTheme();
204 applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder );
206 applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder );
208 applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder );
210 applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder );
212 applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder );
213 applyBorder( rFilterBase, rTableStylePart, XML_insideV, rInsideVBorder );
214 applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
215 applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
219 applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder );
220 applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder );
221 applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder );
222 applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder );
223 applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
224 applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
225 applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder );
226 applyBorder( rFilterBase, rTableStylePart, XML_insideV, rInsideVBorder );
247 xPropSet->setPropertyValue(
"TextUpperDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getTopMargin() / 360 ) ) );
248 xPropSet->setPropertyValue(
"TextRightDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getRightMargin() / 360 ) ) );
249 xPropSet->setPropertyValue(
"TextLeftDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getLeftMargin() / 360 ) ) );
250 xPropSet->setPropertyValue(
"TextLowerDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getBottomMargin() / 360 ) ) );
252 drawing::TextVerticalAdjust eVA;
255 case XML_ctr: eVA = drawing::TextVerticalAdjust_CENTER;
break;
256 case XML_b: eVA = drawing::TextVerticalAdjust_BOTTOM;
break;
260 case XML_t: eVA = drawing::TextVerticalAdjust_TOP;
break;
262 xPropSet->setPropertyValue(
"TextVerticalAdjust",
Any( eVA ) );
266 const css::uno::Reference < css::table::XCell >& rxCell,
const TableProperties& rTableProperties,
267 const TableStyle& rTableStyle, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow )
277 xAt->gotoStart(
true );
278 xAt->gotoEnd(
true );
293 aLinePropertiesRight,
295 aLinePropertiesBottom,
296 aLinePropertiesInsideH,
297 aLinePropertiesInsideV,
298 aLinePropertiesTopLeftToBottomRight,
299 aLinePropertiesBottomLeftToTopRight,
307 if ( rProperties.
isFirstRow() && ( nRow == 0 ) )
311 aLinePropertiesRight,
313 aLinePropertiesBottom,
314 aLinePropertiesInsideH,
315 aLinePropertiesInsideV,
316 aLinePropertiesTopLeftToBottomRight,
317 aLinePropertiesBottomLeftToTopRight,
320 if ( rProperties.
isLastRow() && ( nRow == nMaxRow ) )
324 aLinePropertiesRight,
326 aLinePropertiesBottom,
327 aLinePropertiesInsideH,
328 aLinePropertiesInsideV,
329 aLinePropertiesTopLeftToBottomRight,
330 aLinePropertiesBottomLeftToTopRight,
333 if ( rProperties.
isFirstCol() && ( nColumn == 0 ) )
337 aLinePropertiesRight,
339 aLinePropertiesBottom,
340 aLinePropertiesInsideH,
341 aLinePropertiesInsideV,
342 aLinePropertiesTopLeftToBottomRight,
343 aLinePropertiesBottomLeftToTopRight,
346 if ( rProperties.
isLastCol() && ( nColumn == nMaxColumn ) )
350 aLinePropertiesRight,
352 aLinePropertiesBottom,
353 aLinePropertiesInsideH,
354 aLinePropertiesInsideV,
355 aLinePropertiesTopLeftToBottomRight,
356 aLinePropertiesBottomLeftToTopRight,
361 if ( ( !rProperties.
isFirstRow() || ( nRow != 0 ) ) &&
362 ( !rProperties.
isLastRow() || ( nRow != nMaxRow ) ) &&
363 ( !rProperties.
isFirstCol() || ( nColumn != 0 ) ) &&
364 ( !rProperties.
isLastCol() || ( nColumn != nMaxColumn ) ) )
366 sal_Int32 nBand = nRow;
373 aLinePropertiesRight,
375 aLinePropertiesBottom,
376 aLinePropertiesInsideH,
377 aLinePropertiesInsideV,
378 aLinePropertiesTopLeftToBottomRight,
379 aLinePropertiesBottomLeftToTopRight,
386 aLinePropertiesRight,
388 aLinePropertiesBottom,
389 aLinePropertiesInsideH,
390 aLinePropertiesInsideV,
391 aLinePropertiesTopLeftToBottomRight,
392 aLinePropertiesBottomLeftToTopRight,
397 if ( ( nRow == 0 ) && ( nColumn == 0 ) )
401 aLinePropertiesRight,
403 aLinePropertiesBottom,
404 aLinePropertiesInsideH,
405 aLinePropertiesInsideV,
406 aLinePropertiesTopLeftToBottomRight,
407 aLinePropertiesBottomLeftToTopRight,
410 if ( ( nRow == nMaxRow ) && ( nColumn == 0 ) )
414 aLinePropertiesRight,
416 aLinePropertiesBottom,
417 aLinePropertiesInsideH,
418 aLinePropertiesInsideV,
419 aLinePropertiesTopLeftToBottomRight,
420 aLinePropertiesBottomLeftToTopRight,
423 if ( ( nRow == 0 ) && ( nColumn == nMaxColumn ) )
427 aLinePropertiesRight,
429 aLinePropertiesBottom,
430 aLinePropertiesInsideH,
431 aLinePropertiesInsideV,
432 aLinePropertiesTopLeftToBottomRight,
433 aLinePropertiesBottomLeftToTopRight,
436 if ( ( nRow == nMaxRow ) && ( nColumn == nMaxColumn ) )
440 aLinePropertiesRight,
442 aLinePropertiesBottom,
443 aLinePropertiesInsideH,
444 aLinePropertiesInsideV,
445 aLinePropertiesTopLeftToBottomRight,
446 aLinePropertiesBottomLeftToTopRight,
451 if ( ( !rProperties.
isFirstRow() || ( nRow != 0 ) ) &&
452 ( !rProperties.
isLastRow() || ( nRow != nMaxRow ) ) &&
453 ( !rProperties.
isFirstCol() || ( nColumn != 0 ) ) &&
454 ( !rProperties.
isLastCol() || ( nColumn != nMaxColumn ) ) )
456 sal_Int32 nBand = nColumn;
463 aLinePropertiesRight,
465 aLinePropertiesBottom,
466 aLinePropertiesInsideH,
467 aLinePropertiesInsideV,
468 aLinePropertiesTopLeftToBottomRight,
469 aLinePropertiesBottomLeftToTopRight,
476 aLinePropertiesRight,
478 aLinePropertiesBottom,
479 aLinePropertiesInsideH,
480 aLinePropertiesInsideV,
481 aLinePropertiesTopLeftToBottomRight,
482 aLinePropertiesBottomLeftToTopRight,
500 applyLineAttributes( rFilterBase, xPropSet, rTable, aLinePropertiesTopLeftToBottomRight, PROP_DiagonalTLBR );
501 applyLineAttributes( rFilterBase, xPropSet, rTable, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR );
506 aLinePropertiesInsideH.
assignUsed( aLinePropertiesTop );
511 aLinePropertiesInsideH.
assignUsed( aLinePropertiesBottom );
516 aLinePropertiesInsideV.
assignUsed( aLinePropertiesLeft );
519 if(nColumn != nMaxColumn)
521 aLinePropertiesInsideV.
assignUsed( aLinePropertiesRight );
539 if (rBackgroundFillPropertiesPtr)
540 aBgColor = rBackgroundFillPropertiesPtr->getBestSolidColor();
543 if (
const Theme* pTheme = rFilterBase.getCurrentTheme())
545 aBgColor = pTheme->getFillStyle(rBackgroundFillStyle.
mnThemedIdx)->getBestSolidColor();
546 nPhClr = rBackgroundFillStyle.
maPhClr.
getColor(rFilterBase.getGraphicHelper());
553 ::Color nBgColor( aBgColor.
getColor(rFilterBase.getGraphicHelper(), nPhClr) );
554 ::Color nCellColor( rCellColor.
getColor(rFilterBase.getGraphicHelper()) );
564 aFillProperties.
pushToPropMap( aPropMap, rFilterBase.getGraphicHelper() );
566 aPropSet.setProperties( aPropMap );
570 xPropSet->setPropertyValue(
"TextWritingMode",
Any(css::text::WritingMode_TB_RL));
573 getTextBody()->insertAt( rFilterBase, xText, xAt, aTextStyleProps, pMasterTextListStyle );
577 if (rParagraphs.size() == 1)
579 const auto pFirstParagraph = rParagraphs.at(0);
580 if (pFirstParagraph->getRuns().empty())
583 aTextStyleProps, *pMasterTextListStyle,
getTextBody()->getTextListStyle()) };
584 aTextCharacterProps.
assignUsed(pFirstParagraph->getEndProperties());
585 aTextCharacterProps.pushToPropSet(aPropSet, rFilterBase);
591 xPropSet->setPropertyValue(
"RotateAngle",
Any(
short(27000)));
595 xPropSet->setPropertyValue(
"RotateAngle",
Any(
short(9000)));
601 const OUString aTokenName{
reinterpret_cast<const char*
>(aTokenNameSeq.getConstArray()),
602 aTokenNameSeq.getLength(), RTL_TEXTENCODING_UTF8 };
605 xPropSet->getPropertyValue(
"CellInteropGrabBag") >>= aGrabBag;
607 if (aGrabBag.hasElements())
609 sal_Int32
nLength = aGrabBag.getLength();
611 aGrabBag.getArray()[
nLength] = aPropertyValue;
615 aGrabBag = { aPropertyValue };
617 xPropSet->setPropertyValue(
"CellInteropGrabBag",
Any(aGrabBag));
Color GetRGBColor() const
basegfx::BColor getBColor() const
A wrapper for a UNO property set.
bool setProperty(sal_Int32 nPropId, const Type &rValue)
Puts the passed value into the property set.
css::uno::Sequence< sal_Int8 > const & getUtf8TokenName(sal_Int32 nToken) const
Returns the UTF8 name of the passed token identifier as byte sequence.
sal_Int16 getTransparency() const
Returns the transparency of the color (0 = opaque, 100 = full transparent).
void clearTransformations()
Removes all color transformations.
bool isUsed() const
Returns true, if the color is initialized.
::Color getColor(const GraphicHelper &rGraphicHelper, ::Color nPhClr=API_RGB_TRANSPARENT) const
Returns the final RGB color value.
void setSrgbClr(sal_Int32 nRgb)
Sets an RGB value (hexadecimal RRGGBB) from the a:srgbClr element.
const FillProperties * getFillStyle(sal_Int32 nIndex) const
Returns the fill properties of the passed one-based themed style index.
oox::drawingml::FillProperties maFillProperties
const oox::drawingml::TextBodyPtr & getTextBody() const
sal_Int32 getTopMargin() const
oox::drawingml::LineProperties maLinePropertiesTopLeftToBottomRight
oox::drawingml::LineProperties maLinePropertiesBottomLeftToTopRight
sal_Int32 getBottomMargin() const
sal_Int32 getLeftMargin() const
sal_Int32 getVertToken() const
sal_Int32 getRightMargin() const
oox::drawingml::LineProperties maLinePropertiesInsideV
oox::drawingml::LineProperties maLinePropertiesLeft
void pushToXCell(const ::oox::core::XmlFilterBase &rFilterBase, const ::oox::drawingml::TextListStylePtr &pMasterTextListStyle, const css::uno::Reference< css::table::XCell > &rxCell, const TableProperties &rTableProperties, const TableStyle &rTable, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow)
oox::drawingml::LineProperties maLinePropertiesTop
oox::drawingml::LineProperties maLinePropertiesRight
oox::drawingml::LineProperties maLinePropertiesBottom
sal_Int32 getAnchorToken() const
oox::drawingml::LineProperties maLinePropertiesInsideH
::oox::drawingml::TextFont & getSymbolFont()
::oox::drawingml::ShapeStyleRefMap & getStyleRefs()
::oox::drawingml::TextFont & getComplexFont()
::std::optional< bool > & getTextBoldStyle()
::oox::drawingml::TextFont & getLatinFont()
::std::optional< bool > & getTextItalicStyle()
::oox::drawingml::Color & getTextColor()
::oox::drawingml::FillPropertiesPtr & getFillProperties()
::oox::drawingml::TextFont & getAsianFont()
std::map< sal_Int32, ::oox::drawingml::LinePropertiesPtr > & getLineBorders()
TableStylePart & getBand2V()
::oox::drawingml::ShapeStyleRef & getBackgroundFillStyleRef()
TableStylePart & getLastCol()
TableStylePart & getSeCell()
TableStylePart & getBand2H()
TableStylePart & getBand1H()
TableStylePart & getWholeTbl()
TableStylePart & getNeCell()
::oox::drawingml::FillPropertiesPtr & getBackgroundFillProperties()
TableStylePart & getNwCell()
TableStylePart & getFirstCol()
TableStylePart & getBand1V()
TableStylePart & getLastRow()
TableStylePart & getSwCell()
TableStylePart & getFirstRow()
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
B2DTuple interpolate(const B2DTuple &rOld1, const B2DTuple &rOld2, double t)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
std::shared_ptr< T > make_shared(Args &&... args)
static void applyBorder(const ::oox::core::XmlFilterBase &rFilterBase, TableStylePart &rTableStylePart, sal_Int32 nLineType, oox::drawingml::LineProperties &rLineProperties)
static void applyTableCellProperties(const Reference< css::table::XCell > &rxCell, const TableCell &rTableCell)
static void applyLineAttributes(const ::oox::core::XmlFilterBase &rFilterBase, Reference< XPropertySet > const &rxPropSet, oox::drawingml::table::TableStyle const &rTableStyle, oox::drawingml::LineProperties const &rLineProperties, sal_Int32 nPropId)
static void applyTableStylePart(const ::oox::core::XmlFilterBase &rFilterBase, oox::drawingml::FillProperties &rFillProperties, TextCharacterProperties &aTextCharProps, oox::drawingml::LineProperties &rLeftBorder, oox::drawingml::LineProperties &rRightBorder, oox::drawingml::LineProperties &rTopBorder, oox::drawingml::LineProperties &rBottomBorder, oox::drawingml::LineProperties &rInsideHBorder, oox::drawingml::LineProperties &rInsideVBorder, oox::drawingml::LineProperties &rTopLeftToBottomRightBorder, oox::drawingml::LineProperties &rBottomLeftToTopRightBorder, TableStylePart &rTableStylePart, bool bIsWholeTable=false, sal_Int32 nCol=0, sal_Int32 nMaxCol=0, sal_Int32 nRow=0, sal_Int32 nMaxRow=0)
sal_Int32 GetCoordinate(sal_Int32 nValue)
converts EMUs into 1/100th mmm
std::shared_ptr< FillProperties > FillPropertiesPtr
std::shared_ptr< TextListStyle > TextListStylePtr
TokenMap & StaticTokenMap()
const ::Color API_RGB_TRANSPARENT(ColorTransparency, 0xffffffff)
Transparent color for API calls.
void pushToPropMap(ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper, sal_Int32 nShapeRotation=0, ::Color nPhClr=API_RGB_TRANSPARENT, const css::awt::Size &rSize={}, sal_Int16 nPhClrTheme=-1, bool bFlipH=false, bool bFlipV=false, bool bIsCustomShape=false) const
Writes the properties to the passed property map.
void assignUsed(const FillProperties &rSourceProps)
Properties for bitmap fills.
Color getBestSolidColor() const
Tries to resolve current settings to a solid color, e.g.
Color maFillColor
Fill type (OOXML token).
std::optional< sal_Int32 > moFillType
void assignUsed(const LineProperties &rSourceProps)
Line joint type (OOXML token).
FillProperties maLineFill
End line arrow style.
std::optional< sal_Int32 > moLineWidth
User-defined line dash style.
std::optional< sal_Int32 > moPresetDash
Line width (EMUs).
DashStopVector maCustomDash
Line fill (solid, gradient, ...).
std::optional< bool > moItalic
void assignUsed(const TextCharacterProperties &rSourceProps)
Overwrites all members that are explicitly set in rSourceProps.
FillProperties maFillProperties
std::optional< bool > moBold
constexpr OUStringLiteral PROP_RightBorder
constexpr OUStringLiteral PROP_LeftBorder
constexpr OUStringLiteral PROP_TopBorder
constexpr OUStringLiteral PROP_BottomBorder