28#include <oox/token/properties.hxx>
29#include <oox/token/tokens.hxx>
31#include <com/sun/star/table/BorderLineStyle.hpp>
32#include <com/sun/star/table/BorderLine2.hpp>
33#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
34#include <com/sun/star/text/XText.hpp>
35#include <com/sun/star/text/WritingMode.hpp>
41using ::com::sun::star::table::BorderLine2;
55, mnVertToken( XML_horz )
56, mnAnchorToken( XML_t )
58, mnHorzOverflowToken( XML_clip )
66 BorderLine2 aBorderLine;
70 aBorderLine.
Color = sal_Int32(aColor.
getColor( rFilterBase.getGraphicHelper() ));
71 aBorderLine.OuterLineWidth =
static_cast< sal_Int16
>(
GetCoordinate( rLineProperties.
moLineWidth.value_or( 0 ) ) / 4 );
72 aBorderLine.InnerLineWidth =
static_cast< sal_Int16
>(
GetCoordinate( rLineProperties.
moLineWidth.value_or( 0 ) ) / 4 );
74 aBorderLine.LineDistance = 0;
78 aBorderLine.Color = sal_Int32(
COL_AUTO );
79 aBorderLine.OuterLineWidth =
static_cast< sal_Int16
>(
GetCoordinate( rLineProperties.
moLineWidth.value_or( 0 ) ) / 4 );
80 aBorderLine.InnerLineWidth =
static_cast< sal_Int16
>(
GetCoordinate( rLineProperties.
moLineWidth.value_or( 0 ) ) / 4 );
82 aBorderLine.LineDistance = 0;
91 aBorderLine.LineStyle = ::table::BorderLineStyle::DOTTED;
96 aBorderLine.LineStyle = ::table::BorderLineStyle::DASHED;
101 aBorderLine.LineStyle = ::table::BorderLineStyle::DASH_DOT;
103 case XML_lgDashDotDot:
104 case XML_sysDashDotDot:
105 aBorderLine.LineStyle = ::table::BorderLineStyle::DASH_DOT_DOT;
108 aBorderLine.LineStyle = ::table::BorderLineStyle::SOLID;
111 aBorderLine.LineStyle = ::table::BorderLineStyle::DASHED;
117 aBorderLine.LineStyle = ::table::BorderLineStyle::DASHED;
121 aBorderLine.LineStyle = ::table::BorderLineStyle::NONE;
130 std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rPartLineBorders( rTableStylePart.
getLineBorders() );
132 std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >::const_iterator aIter( rPartLineBorders.find( nLineType ) );
133 if ( ( aIter != rPartLineBorders.end() ) && aIter->second )
137 if (
const Theme* pTheme = rFilterBase.getCurrentTheme())
158 bool bIsWholeTable =
false,
160 sal_Int32 nMaxCol = 0,
162 sal_Int32 nMaxRow = 0)
165 if ( rPartFillPropertiesPtr )
166 rFillProperties.
assignUsed( *rPartFillPropertiesPtr );
170 const Theme* pTheme = rFilterBase.getCurrentTheme();
184 applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder );
186 applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder );
188 applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder );
190 applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder );
192 applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder );
193 applyBorder( rFilterBase, rTableStylePart, XML_insideV, rInsideVBorder );
194 applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
195 applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
199 applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder );
200 applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder );
201 applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder );
202 applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder );
203 applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
204 applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
205 applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder );
206 applyBorder( rFilterBase, rTableStylePart, XML_insideV, rInsideVBorder );
227 xPropSet->setPropertyValue(
"TextUpperDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getTopMargin() / 360 ) ) );
228 xPropSet->setPropertyValue(
"TextRightDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getRightMargin() / 360 ) ) );
229 xPropSet->setPropertyValue(
"TextLeftDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getLeftMargin() / 360 ) ) );
230 xPropSet->setPropertyValue(
"TextLowerDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getBottomMargin() / 360 ) ) );
232 drawing::TextVerticalAdjust eVA;
235 case XML_ctr: eVA = drawing::TextVerticalAdjust_CENTER;
break;
236 case XML_b: eVA = drawing::TextVerticalAdjust_BOTTOM;
break;
240 case XML_t: eVA = drawing::TextVerticalAdjust_TOP;
break;
242 xPropSet->setPropertyValue(
"TextVerticalAdjust",
Any( eVA ) );
246 const css::uno::Reference < css::table::XCell >& rxCell,
const TableProperties& rTableProperties,
247 const TableStyle& rTableStyle, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow )
257 xAt->gotoStart(
true );
258 xAt->gotoEnd(
true );
273 aLinePropertiesRight,
275 aLinePropertiesBottom,
276 aLinePropertiesInsideH,
277 aLinePropertiesInsideV,
278 aLinePropertiesTopLeftToBottomRight,
279 aLinePropertiesBottomLeftToTopRight,
287 if ( rProperties.
isFirstRow() && ( nRow == 0 ) )
291 aLinePropertiesRight,
293 aLinePropertiesBottom,
294 aLinePropertiesInsideH,
295 aLinePropertiesInsideV,
296 aLinePropertiesTopLeftToBottomRight,
297 aLinePropertiesBottomLeftToTopRight,
300 if ( rProperties.
isLastRow() && ( nRow == nMaxRow ) )
304 aLinePropertiesRight,
306 aLinePropertiesBottom,
307 aLinePropertiesInsideH,
308 aLinePropertiesInsideV,
309 aLinePropertiesTopLeftToBottomRight,
310 aLinePropertiesBottomLeftToTopRight,
313 if ( rProperties.
isFirstCol() && ( nColumn == 0 ) )
317 aLinePropertiesRight,
319 aLinePropertiesBottom,
320 aLinePropertiesInsideH,
321 aLinePropertiesInsideV,
322 aLinePropertiesTopLeftToBottomRight,
323 aLinePropertiesBottomLeftToTopRight,
326 if ( rProperties.
isLastCol() && ( nColumn == nMaxColumn ) )
330 aLinePropertiesRight,
332 aLinePropertiesBottom,
333 aLinePropertiesInsideH,
334 aLinePropertiesInsideV,
335 aLinePropertiesTopLeftToBottomRight,
336 aLinePropertiesBottomLeftToTopRight,
341 if ( ( !rProperties.
isFirstRow() || ( nRow != 0 ) ) &&
342 ( !rProperties.
isLastRow() || ( nRow != nMaxRow ) ) &&
343 ( !rProperties.
isFirstCol() || ( nColumn != 0 ) ) &&
344 ( !rProperties.
isLastCol() || ( nColumn != nMaxColumn ) ) )
346 sal_Int32 nBand = nRow;
353 aLinePropertiesRight,
355 aLinePropertiesBottom,
356 aLinePropertiesInsideH,
357 aLinePropertiesInsideV,
358 aLinePropertiesTopLeftToBottomRight,
359 aLinePropertiesBottomLeftToTopRight,
366 aLinePropertiesRight,
368 aLinePropertiesBottom,
369 aLinePropertiesInsideH,
370 aLinePropertiesInsideV,
371 aLinePropertiesTopLeftToBottomRight,
372 aLinePropertiesBottomLeftToTopRight,
377 if ( ( nRow == 0 ) && ( nColumn == 0 ) )
381 aLinePropertiesRight,
383 aLinePropertiesBottom,
384 aLinePropertiesInsideH,
385 aLinePropertiesInsideV,
386 aLinePropertiesTopLeftToBottomRight,
387 aLinePropertiesBottomLeftToTopRight,
390 if ( ( nRow == nMaxRow ) && ( nColumn == 0 ) )
394 aLinePropertiesRight,
396 aLinePropertiesBottom,
397 aLinePropertiesInsideH,
398 aLinePropertiesInsideV,
399 aLinePropertiesTopLeftToBottomRight,
400 aLinePropertiesBottomLeftToTopRight,
403 if ( ( nRow == 0 ) && ( nColumn == nMaxColumn ) )
407 aLinePropertiesRight,
409 aLinePropertiesBottom,
410 aLinePropertiesInsideH,
411 aLinePropertiesInsideV,
412 aLinePropertiesTopLeftToBottomRight,
413 aLinePropertiesBottomLeftToTopRight,
416 if ( ( nRow == nMaxRow ) && ( nColumn == nMaxColumn ) )
420 aLinePropertiesRight,
422 aLinePropertiesBottom,
423 aLinePropertiesInsideH,
424 aLinePropertiesInsideV,
425 aLinePropertiesTopLeftToBottomRight,
426 aLinePropertiesBottomLeftToTopRight,
431 if ( ( !rProperties.
isFirstRow() || ( nRow != 0 ) ) &&
432 ( !rProperties.
isLastRow() || ( nRow != nMaxRow ) ) &&
433 ( !rProperties.
isFirstCol() || ( nColumn != 0 ) ) &&
434 ( !rProperties.
isLastCol() || ( nColumn != nMaxColumn ) ) )
436 sal_Int32 nBand = nColumn;
443 aLinePropertiesRight,
445 aLinePropertiesBottom,
446 aLinePropertiesInsideH,
447 aLinePropertiesInsideV,
448 aLinePropertiesTopLeftToBottomRight,
449 aLinePropertiesBottomLeftToTopRight,
456 aLinePropertiesRight,
458 aLinePropertiesBottom,
459 aLinePropertiesInsideH,
460 aLinePropertiesInsideV,
461 aLinePropertiesTopLeftToBottomRight,
462 aLinePropertiesBottomLeftToTopRight,
480 applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTopLeftToBottomRight, PROP_DiagonalTLBR );
481 applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR );
486 aLinePropertiesInsideH.
assignUsed( aLinePropertiesTop );
491 aLinePropertiesInsideH.
assignUsed( aLinePropertiesBottom );
496 aLinePropertiesInsideV.
assignUsed( aLinePropertiesLeft );
499 if(nColumn != nMaxColumn)
501 aLinePropertiesInsideV.
assignUsed( aLinePropertiesRight );
518 if (rBackgroundFillPropertiesPtr)
519 aBgColor = rBackgroundFillPropertiesPtr->getBestSolidColor();
522 if (
const Theme* pTheme = rFilterBase.getCurrentTheme())
524 aBgColor = pTheme->getFillStyle(rBackgroundFillStyle.
mnThemedIdx)->getBestSolidColor();
525 nPhClr = rBackgroundFillStyle.
maPhClr.
getColor(rFilterBase.getGraphicHelper());
532 ::Color nBgColor( aBgColor.
getColor(rFilterBase.getGraphicHelper(), nPhClr) );
533 ::Color nCellColor( rCellColor.
getColor(rFilterBase.getGraphicHelper()) );
543 aFillProperties.
pushToPropMap( aPropMap, rFilterBase.getGraphicHelper() );
548 xPropSet->setPropertyValue(
"TextWritingMode",
Any(css::text::WritingMode_TB_RL));
551 getTextBody()->insertAt( rFilterBase, xText, xAt, aTextStyleProps, pMasterTextListStyle );
554 xPropSet->setPropertyValue(
"RotateAngle",
Any(
short(27000)));
556 xPropSet->setPropertyValue(
"RotateAngle",
Any(
short(9000)));
Color GetRGBColor() const
basegfx::BColor getBColor() const
A wrapper for a UNO property set.
void setProperties(const css::uno::Sequence< OUString > &rPropNames, const css::uno::Sequence< css::uno::Any > &rValues)
Puts the passed properties into the property set.
bool setProperty(sal_Int32 nPropId, const Type &rValue)
Puts the passed value into the property set.
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)
B2DTuple interpolate(const B2DTuple &rOld1, const B2DTuple &rOld2, double t)
std::shared_ptr< T > make_shared(Args &&... args)
static void applyLineAttributes(const ::oox::core::XmlFilterBase &rFilterBase, Reference< XPropertySet > const &rxPropSet, oox::drawingml::LineProperties const &rLineProperties, sal_Int32 nPropId)
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 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
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, 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
FillProperties maFillProperties
std::optional< bool > moBold