30#include <oox/token/properties.hxx>
31#include <oox/token/tokens.hxx>
33#include <com/sun/star/table/BorderLineStyle.hpp>
34#include <com/sun/star/table/BorderLine2.hpp>
35#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
36#include <com/sun/star/text/XText.hpp>
37#include <com/sun/star/text/WritingMode.hpp>
43using ::com::sun::star::table::BorderLine2;
57, mnVertToken( XML_horz )
58, mnAnchorToken( XML_t )
60, mnHorzOverflowToken( XML_clip )
70 BorderLine2 aBorderLine;
75 aBorderLine.
Color = sal_Int32(aColor.
getColor(rFilterBase.getGraphicHelper()));
79 aBorderLine.LineDistance = 0;
88 aBorderLine.
Color = sal_Int32(aColor.
getColor(rFilterBase.getGraphicHelper()));
91 aBorderLine.Color = sal_Int32(
COL_AUTO);
99 aBorderLine.LineDistance = 0;
108 aBorderLine.LineStyle = ::table::BorderLineStyle::DOTTED;
113 aBorderLine.LineStyle = ::table::BorderLineStyle::DASHED;
118 aBorderLine.LineStyle = ::table::BorderLineStyle::DASH_DOT;
120 case XML_lgDashDotDot:
121 case XML_sysDashDotDot:
122 aBorderLine.LineStyle = ::table::BorderLineStyle::DASH_DOT_DOT;
125 aBorderLine.LineStyle = ::table::BorderLineStyle::SOLID;
128 aBorderLine.LineStyle = ::table::BorderLineStyle::DASHED;
134 aBorderLine.LineStyle = ::table::BorderLineStyle::DASHED;
138 aBorderLine.LineStyle = ::table::BorderLineStyle::NONE;
147 std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rPartLineBorders( rTableStylePart.
getLineBorders() );
149 std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >::const_iterator aIter( rPartLineBorders.find( nLineType ) );
150 if ( ( aIter != rPartLineBorders.end() ) && aIter->second )
154 if (
const Theme* pTheme = rFilterBase.getCurrentTheme())
175 bool bIsWholeTable =
false,
177 sal_Int32 nMaxCol = 0,
179 sal_Int32 nMaxRow = 0)
182 if ( rPartFillPropertiesPtr )
183 rFillProperties.
assignUsed( *rPartFillPropertiesPtr );
187 const Theme* pTheme = rFilterBase.getCurrentTheme();
201 applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder );
203 applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder );
205 applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder );
207 applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder );
209 applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder );
210 applyBorder( rFilterBase, rTableStylePart, XML_insideV, rInsideVBorder );
211 applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
212 applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
216 applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder );
217 applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder );
218 applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder );
219 applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder );
220 applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
221 applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
222 applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder );
223 applyBorder( rFilterBase, rTableStylePart, XML_insideV, rInsideVBorder );
244 xPropSet->setPropertyValue(
"TextUpperDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getTopMargin() / 360 ) ) );
245 xPropSet->setPropertyValue(
"TextRightDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getRightMargin() / 360 ) ) );
246 xPropSet->setPropertyValue(
"TextLeftDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getLeftMargin() / 360 ) ) );
247 xPropSet->setPropertyValue(
"TextLowerDistance",
Any(
static_cast< sal_Int32
>( rTableCell.
getBottomMargin() / 360 ) ) );
249 drawing::TextVerticalAdjust eVA;
252 case XML_ctr: eVA = drawing::TextVerticalAdjust_CENTER;
break;
253 case XML_b: eVA = drawing::TextVerticalAdjust_BOTTOM;
break;
257 case XML_t: eVA = drawing::TextVerticalAdjust_TOP;
break;
259 xPropSet->setPropertyValue(
"TextVerticalAdjust",
Any( eVA ) );
263 const css::uno::Reference < css::table::XCell >& rxCell,
const TableProperties& rTableProperties,
264 const TableStyle& rTableStyle, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow )
274 xAt->gotoStart(
true );
275 xAt->gotoEnd(
true );
290 aLinePropertiesRight,
292 aLinePropertiesBottom,
293 aLinePropertiesInsideH,
294 aLinePropertiesInsideV,
295 aLinePropertiesTopLeftToBottomRight,
296 aLinePropertiesBottomLeftToTopRight,
304 if ( rProperties.
isFirstRow() && ( nRow == 0 ) )
308 aLinePropertiesRight,
310 aLinePropertiesBottom,
311 aLinePropertiesInsideH,
312 aLinePropertiesInsideV,
313 aLinePropertiesTopLeftToBottomRight,
314 aLinePropertiesBottomLeftToTopRight,
317 if ( rProperties.
isLastRow() && ( nRow == nMaxRow ) )
321 aLinePropertiesRight,
323 aLinePropertiesBottom,
324 aLinePropertiesInsideH,
325 aLinePropertiesInsideV,
326 aLinePropertiesTopLeftToBottomRight,
327 aLinePropertiesBottomLeftToTopRight,
330 if ( rProperties.
isFirstCol() && ( nColumn == 0 ) )
334 aLinePropertiesRight,
336 aLinePropertiesBottom,
337 aLinePropertiesInsideH,
338 aLinePropertiesInsideV,
339 aLinePropertiesTopLeftToBottomRight,
340 aLinePropertiesBottomLeftToTopRight,
343 if ( rProperties.
isLastCol() && ( nColumn == nMaxColumn ) )
347 aLinePropertiesRight,
349 aLinePropertiesBottom,
350 aLinePropertiesInsideH,
351 aLinePropertiesInsideV,
352 aLinePropertiesTopLeftToBottomRight,
353 aLinePropertiesBottomLeftToTopRight,
358 if ( ( !rProperties.
isFirstRow() || ( nRow != 0 ) ) &&
359 ( !rProperties.
isLastRow() || ( nRow != nMaxRow ) ) &&
360 ( !rProperties.
isFirstCol() || ( nColumn != 0 ) ) &&
361 ( !rProperties.
isLastCol() || ( nColumn != nMaxColumn ) ) )
363 sal_Int32 nBand = nRow;
370 aLinePropertiesRight,
372 aLinePropertiesBottom,
373 aLinePropertiesInsideH,
374 aLinePropertiesInsideV,
375 aLinePropertiesTopLeftToBottomRight,
376 aLinePropertiesBottomLeftToTopRight,
383 aLinePropertiesRight,
385 aLinePropertiesBottom,
386 aLinePropertiesInsideH,
387 aLinePropertiesInsideV,
388 aLinePropertiesTopLeftToBottomRight,
389 aLinePropertiesBottomLeftToTopRight,
394 if ( ( nRow == 0 ) && ( nColumn == 0 ) )
398 aLinePropertiesRight,
400 aLinePropertiesBottom,
401 aLinePropertiesInsideH,
402 aLinePropertiesInsideV,
403 aLinePropertiesTopLeftToBottomRight,
404 aLinePropertiesBottomLeftToTopRight,
407 if ( ( nRow == nMaxRow ) && ( nColumn == 0 ) )
411 aLinePropertiesRight,
413 aLinePropertiesBottom,
414 aLinePropertiesInsideH,
415 aLinePropertiesInsideV,
416 aLinePropertiesTopLeftToBottomRight,
417 aLinePropertiesBottomLeftToTopRight,
420 if ( ( nRow == 0 ) && ( nColumn == nMaxColumn ) )
424 aLinePropertiesRight,
426 aLinePropertiesBottom,
427 aLinePropertiesInsideH,
428 aLinePropertiesInsideV,
429 aLinePropertiesTopLeftToBottomRight,
430 aLinePropertiesBottomLeftToTopRight,
433 if ( ( nRow == nMaxRow ) && ( nColumn == nMaxColumn ) )
437 aLinePropertiesRight,
439 aLinePropertiesBottom,
440 aLinePropertiesInsideH,
441 aLinePropertiesInsideV,
442 aLinePropertiesTopLeftToBottomRight,
443 aLinePropertiesBottomLeftToTopRight,
448 if ( ( !rProperties.
isFirstRow() || ( nRow != 0 ) ) &&
449 ( !rProperties.
isLastRow() || ( nRow != nMaxRow ) ) &&
450 ( !rProperties.
isFirstCol() || ( nColumn != 0 ) ) &&
451 ( !rProperties.
isLastCol() || ( nColumn != nMaxColumn ) ) )
453 sal_Int32 nBand = nColumn;
460 aLinePropertiesRight,
462 aLinePropertiesBottom,
463 aLinePropertiesInsideH,
464 aLinePropertiesInsideV,
465 aLinePropertiesTopLeftToBottomRight,
466 aLinePropertiesBottomLeftToTopRight,
473 aLinePropertiesRight,
475 aLinePropertiesBottom,
476 aLinePropertiesInsideH,
477 aLinePropertiesInsideV,
478 aLinePropertiesTopLeftToBottomRight,
479 aLinePropertiesBottomLeftToTopRight,
497 applyLineAttributes( rFilterBase, xPropSet, rTable, aLinePropertiesTopLeftToBottomRight, PROP_DiagonalTLBR );
498 applyLineAttributes( rFilterBase, xPropSet, rTable, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR );
503 aLinePropertiesInsideH.
assignUsed( aLinePropertiesTop );
508 aLinePropertiesInsideH.
assignUsed( aLinePropertiesBottom );
513 aLinePropertiesInsideV.
assignUsed( aLinePropertiesLeft );
516 if(nColumn != nMaxColumn)
518 aLinePropertiesInsideV.
assignUsed( aLinePropertiesRight );
536 if (rBackgroundFillPropertiesPtr)
537 aBgColor = rBackgroundFillPropertiesPtr->getBestSolidColor();
540 if (
const Theme* pTheme = rFilterBase.getCurrentTheme())
542 aBgColor = pTheme->getFillStyle(rBackgroundFillStyle.
mnThemedIdx)->getBestSolidColor();
543 nPhClr = rBackgroundFillStyle.
maPhClr.
getColor(rFilterBase.getGraphicHelper());
550 ::Color nBgColor( aBgColor.
getColor(rFilterBase.getGraphicHelper(), nPhClr) );
551 ::Color nCellColor( rCellColor.
getColor(rFilterBase.getGraphicHelper()) );
561 aFillProperties.
pushToPropMap( aPropMap, rFilterBase.getGraphicHelper() );
563 aPropSet.setProperties( aPropMap );
567 xPropSet->setPropertyValue(
"TextWritingMode",
Any(css::text::WritingMode_TB_RL));
570 getTextBody()->insertAt( rFilterBase, xText, xAt, aTextStyleProps, pMasterTextListStyle );
574 if (rParagraphs.size() == 1)
576 const auto pFirstParagraph = rParagraphs.at(0);
577 if (pFirstParagraph->getRuns().empty())
580 aTextStyleProps, *pMasterTextListStyle,
getTextBody()->getTextListStyle()) };
581 aTextCharacterProps.
assignUsed(pFirstParagraph->getEndProperties());
582 aTextCharacterProps.pushToPropSet(aPropSet, rFilterBase);
587 xPropSet->setPropertyValue(
"RotateAngle",
Any(
short(27000)));
589 xPropSet->setPropertyValue(
"RotateAngle",
Any(
short(9000)));
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.
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)
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
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
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