28#include <osl/diagnose.h>
31#include <com/sun/star/table/BorderLineStyle.hpp>
32#include <com/sun/star/text/HoriOrientation.hpp>
33#include <com/sun/star/text/VertOrientation.hpp>
35using ::editeng::SvxBorderLine;
39#define SVX_XML_BORDER_WIDTH_THIN 0
40#define SVX_XML_BORDER_WIDTH_MIDDLE 1
41#define SVX_XML_BORDER_WIDTH_THICK 2
47 {
XML_SOLID, table::BorderLineStyle::SOLID },
48 {
XML_DOUBLE, table::BorderLineStyle::DOUBLE },
50 {
XML_DOTTED, table::BorderLineStyle::DOTTED },
51 {
XML_DASHED, table::BorderLineStyle::DASHED },
55 {
XML_GROOVE, table::BorderLineStyle::ENGRAVED },
56 {
XML_RIDGE, table::BorderLineStyle::EMBOSSED },
57 {
XML_INSET, table::BorderLineStyle::INSET },
58 {
XML_OUTSET, table::BorderLineStyle::OUTSET },
79 bool& rHasStyle, sal_uInt16& rStyle,
80 bool& rHasWidth, sal_uInt16& rWidth,
81 sal_uInt16& rNamedWidth,
82 bool& rHasColor,
Color& rColor )
84 std::u16string_view aToken;
93 rNamedWidth = USHRT_MAX;
96 while( aTokens.
getNextToken( aToken ) && !aToken.empty() )
104 else if( !rHasStyle &&
114 else if( !rHasWidth &&
117 rWidth = o3tl::narrowing<sal_uInt16>(nTemp);
127 return rHasStyle || rHasWidth || rHasColor;
135 rLine.SetBorderLineStyle(eStyle);
139 bool bHasStyle, sal_uInt16 nStyle,
140 bool bHasWidth, sal_uInt16 nWidth,
141 sal_uInt16 nNamedWidth,
142 bool bHasColor,
const Color& rColor )
146 (bHasWidth && USHRT_MAX == nNamedWidth && 0 == nWidth) )
148 bool bRet =
nullptr != rpLine;
154 if( !rpLine && !(bHasStyle && bHasWidth) )
159 rpLine.reset(
new SvxBorderLine);
162 (USHRT_MAX != nNamedWidth || (nWidth != rpLine->GetWidth() ) ) ) ||
164 ((table::BorderLineStyle::SOLID == nStyle && rpLine->GetDistance()) ||
165 (table::BorderLineStyle::DOUBLE == nStyle && !rpLine->GetDistance())) ) )
167 bool bDouble = (bHasWidth && table::BorderLineStyle::DOUBLE == nStyle ) ||
168 rpLine->GetDistance();
172 if (!bDouble || !rpLine->GetWidth())
175 if (bHasWidth && USHRT_MAX != nNamedWidth)
179 rpLine->SetBorderLineStyle( SvxBorderLineStyle::DOUBLE );
186 nWidth = rpLine->GetScaledWidth();
188 rpLine->SetWidth( nWidth );
196 rpLine->SetColor( rColor );
202 sal_uInt16 nWidth, sal_uInt16 nOutWidth,
203 sal_uInt16 nInWidth, sal_uInt16 nDistance )
206 rpLine.reset(
new SvxBorderLine);
209 rpLine->SetWidth( nWidth );
211 rpLine->GuessLinesWidths(SvxBorderLineStyle::DOUBLE,
212 nOutWidth, nInWidth, nDistance);
241 "sw_frmitems_MergeXMLHoriPos: vertical pos must be middle" );
271 "sw_frmitems_MergeXMLVertPos: horizontal pos must be middle" );
309 {
XML_LEFT, text::HoriOrientation::LEFT },
310 {
XML_LEFT, text::HoriOrientation::LEFT_AND_WIDTH },
311 {
XML_CENTER, text::HoriOrientation::CENTER },
312 {
XML_RIGHT, text::HoriOrientation::RIGHT },
320 {
XML_TOP, text::VertOrientation::TOP },
321 {
XML_MIDDLE, text::VertOrientation::CENTER },
322 {
XML_BOTTOM, text::VertOrientation::BOTTOM },
css::chart::ChartAxisLabelPosition ePos
bool getNextToken(std::u16string_view &rToken)
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
bool convertMeasureToCore(sal_Int32 &rValue, std::u16string_view rString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32) const
static const sal_Int16 VeryThin
static const sal_Int16 Thin
static const sal_Int16 Hairline
static bool convertColor(sal_Int32 &rColor, std::u16string_view rValue)
const struct SvXMLEnumMapEntry< sal_Int16 > aXMLTableVAlignMap[]
#define SVX_XML_BORDER_WIDTH_MIDDLE
const struct SvXMLEnumMapEntry< sal_Int16 > aXMLTableAlignMap[]
const struct SvXMLEnumMapEntry< SvxGraphicPosition > psXML_BrushHoriPos[]
void sw_frmitems_MergeXMLVertPos(SvxGraphicPosition &ePos, SvxGraphicPosition eVert)
const struct SvXMLEnumMapEntry< SvxGraphicPosition > psXML_BrushVertPos[]
#define SVX_XML_BORDER_WIDTH_THIN
const sal_uInt16 aBorderWidths[]
const struct SvXMLEnumMapEntry< sal_uInt16 > psXML_BorderStyles[]
const struct SvXMLEnumMapEntry< sal_uInt16 > aXML_KeepTogetherType[]
static void sw_frmitems_setXMLBorderStyle(SvxBorderLine &rLine, sal_uInt16 nStyle)
bool sw_frmitems_parseXMLBorder(std::u16string_view rValue, const SvXMLUnitConverter &rUnitConverter, bool &rHasStyle, sal_uInt16 &rStyle, bool &rHasWidth, sal_uInt16 &rWidth, sal_uInt16 &rNamedWidth, bool &rHasColor, Color &rColor)
Define various helper variables and functions for xmlimpit.cxx and xmlexpit.cxx.
const struct SvXMLEnumMapEntry< sal_uInt16 > psXML_BreakType[]
bool sw_frmitems_setXMLBorder(std::unique_ptr< SvxBorderLine > &rpLine, bool bHasStyle, sal_uInt16 nStyle, bool bHasWidth, sal_uInt16 nWidth, sal_uInt16 nNamedWidth, bool bHasColor, const Color &rColor)
const struct SvXMLEnumMapEntry< SvxGraphicPosition > psXML_BrushRepeat[]
#define SVX_XML_BORDER_WIDTH_THICK
void sw_frmitems_MergeXMLHoriPos(SvxGraphicPosition &ePos, SvxGraphicPosition eHori)
const struct SvXMLEnumMapEntry< sal_uInt16 > psXML_NamedBorderWidths[]