22#include <osl/diagnose.h>
23#include <rtl/ustrbuf.hxx>
57using ::editeng::SvxBorderLine;
68 std::vector<sal_uInt16> *pIndexArray )
const
89 pIndexArray->push_back(
nIndex );
94 exportXML( rExport, rAttrList, *pItem, rEntry, rUnitConverter,
95 rNamespaceMap, &
rSet );
101 OSL_FAIL(
"no item not handled in xml export" );
120 bool bAddAttribute =
true;
123 bAddAttribute =
false;
129 assert(pSplit &&
"Wrong Which-ID");
130 const sal_uInt16 eEnum = (pSplit && pSplit->
GetValue()) ? 1 : 0;
132 aValue = aOut.makeStringAndClear();
144 std::unique_ptr<SvXMLNamespaceMap> pNewNamespaceMap;
147 const sal_uInt16
nCount = pUnknown->GetAttrCount();
150 const OUString
sPrefix( pUnknown->GetAttrPrefix(
i ) );
153 const OUString sNamespace( pUnknown->GetAttrNamespace(
i ) );
158 if( USHRT_MAX == nIdx ||
161 if( !pNewNamespaceMap )
163 pNewNamespaceMap.reset(
165 pNamespaceMap = pNewNamespaceMap.get();
174 pUnknown->GetAttrValue(
i) );
179 pUnknown->GetAttrValue(
i) );
186 rNamespaceMap, pSet );
192 switch (rItem.
Which())
200 && pDirection->GetValue() == SvxFrameDirection::Vertical_LR_BT)
207 || pDirection->GetValue() == SvxFrameDirection::Vertical_LR_BT)
211 && pDirection->GetValue() == SvxFrameDirection::Vertical_RL_TB90)
218 || pDirection->GetValue() == SvxFrameDirection::Vertical_RL_TB90)
228 static_cast< sal_uInt16
>(
232 const OUString
sName(
244 const std::vector<sal_uInt16> &rIndexArray )
const
246 const size_t nCount = rIndexArray.size();
248 bool bItemsExported =
false;
251 const sal_uInt16 nElement = rIndexArray[
nIndex ];
262 bItemsExported =
true;
280 if( SfxItemState::SET == eState )
291 : mrMapEntries(
std::move(rMapEntries))
304 std::vector<sal_uInt16> aIndexArray;
328 OSL_FAIL(
"special item not handled in xml export" );
337 OSL_FAIL(
"element item not handled in xml export" );
342 bool bIsOdfDouble =
false;
343 switch (pLine->GetBorderLineStyle())
345 case SvxBorderLineStyle::DOUBLE:
346 case SvxBorderLineStyle::THINTHICK_SMALLGAP:
347 case SvxBorderLineStyle::THINTHICK_MEDIUMGAP:
348 case SvxBorderLineStyle::THINTHICK_LARGEGAP:
349 case SvxBorderLineStyle::THICKTHIN_SMALLGAP:
350 case SvxBorderLineStyle::THICKTHIN_MEDIUMGAP:
351 case SvxBorderLineStyle::THICKTHIN_LARGEGAP:
363 sal_uInt16 nMemberId,
369 switch ( rItem.
Which() )
439 OSL_FAIL(
"unknown member id!");
479 OSL_FAIL(
"unknown MemberId");
489 assert(pShadow &&
"Wrong Which-ID");
492 sal_Int32 nX = 1, nY = 1;
495 case SvxShadowLocation::TopLeft:
499 case SvxShadowLocation::TopRight:
502 case SvxShadowLocation::BottomLeft:
505 case SvxShadowLocation::BottomRight:
507 case SvxShadowLocation::NONE:
530 assert(pBox &&
"Wrong Which-ID");
555 const SvxBorderLine* pLeft = pBox->
GetLeft();
556 const SvxBorderLine* pRight = pBox->
GetRight();
557 const SvxBorderLine* pTop = pBox->
GetTop();
558 const SvxBorderLine* pBottom = pBox->
GetBottom();
559 const sal_uInt16 nTopDist = pBox->
GetDistance( SvxBoxItemLine::TOP );
560 const sal_uInt16 nBottomDist = pBox->
GetDistance( SvxBoxItemLine::BOTTOM );
561 const sal_uInt16 nLeftDist = pBox->
GetDistance( SvxBoxItemLine::LEFT );
562 const sal_uInt16 nRightDist = pBox->
GetDistance( SvxBoxItemLine::RIGHT );
573 bool bEqual = nLeftDist == nRightDist &&
574 nLeftDist == nTopDist &&
575 nLeftDist == nBottomDist;
589 bool bEqual = (
nullptr == pTop &&
nullptr == pBottom &&
590 nullptr == pLeft &&
nullptr == pRight ) ||
591 ( pTop && pBottom && pLeft && pRight &&
592 *pTop == *pBottom && *pTop == *pLeft &&
609 if( !pTop && !pBottom && !pLeft && !pRight )
612 bool bEqual =
nullptr != pTop &&
613 nullptr != pBottom &&
619 const sal_uInt16 nDistance = pTop->GetDistance();
620 const sal_uInt16 nInWidth = pTop->GetInWidth();
621 const sal_uInt16 nOutWidth = pTop->GetOutWidth();
624 bEqual = nDistance == pLeft->GetDistance() &&
625 nInWidth == pLeft->GetInWidth() &&
626 nOutWidth == pLeft->GetOutWidth() &&
627 nWidth == pLeft->GetWidth() &&
628 nDistance == pRight->GetDistance() &&
629 nInWidth == pRight->GetInWidth() &&
630 nOutWidth == pRight->GetOutWidth() &&
631 nWidth == pRight->GetWidth() &&
632 nDistance == pBottom->GetDistance() &&
633 nInWidth == pBottom->GetInWidth() &&
634 nOutWidth == pBottom->GetOutWidth() &&
635 nWidth == pBottom->GetWidth();
641 if( !bEqual || pTop->GetDistance() == 0 ||
646 if( bEqual ||
nullptr == pLeft ||
647 0 == pLeft->GetDistance() ||
652 if( bEqual ||
nullptr == pRight ||
653 0 == pRight->GetDistance() ||
658 if( bEqual ||
nullptr == pTop ||
659 0 == pTop->GetDistance() ||
664 if( bEqual ||
nullptr == pBottom ||
665 0 == pBottom->GetDistance() ||
699 const SvxBorderLine* pLine;
720 if(
nullptr != pLine )
722 sal_Int32 nWidth = pLine->GetWidth();
725 bool bNoBorder =
false;
726 switch (pLine->GetBorderLineStyle())
728 case SvxBorderLineStyle::SOLID:
731 case SvxBorderLineStyle::DOTTED:
734 case SvxBorderLineStyle::DASHED:
737 case SvxBorderLineStyle::FINE_DASHED:
740 case SvxBorderLineStyle::DASH_DOT:
743 case SvxBorderLineStyle::DASH_DOT_DOT:
746 case SvxBorderLineStyle::DOUBLE_THIN:
749 case SvxBorderLineStyle::DOUBLE:
750 case SvxBorderLineStyle::THINTHICK_SMALLGAP:
751 case SvxBorderLineStyle::THINTHICK_MEDIUMGAP:
752 case SvxBorderLineStyle::THINTHICK_LARGEGAP:
753 case SvxBorderLineStyle::THICKTHIN_SMALLGAP:
754 case SvxBorderLineStyle::THICKTHIN_MEDIUMGAP:
755 case SvxBorderLineStyle::THICKTHIN_LARGEGAP:
758 case SvxBorderLineStyle::EMBOSSED:
761 case SvxBorderLineStyle::ENGRAVED:
764 case SvxBorderLineStyle::INSET:
767 case SvxBorderLineStyle::OUTSET:
777 util::MeasureUnit::TWIP,
778 util::MeasureUnit::POINT);
799 const SvxBorderLine* pLine;
834 sal_uInt16 eEnum = 0;
841 case SvxBreak::ColumnBefore:
844 case SvxBreak::PageBefore:
857 case SvxBreak::ColumnAfter:
860 case SvxBreak::PageAfter:
879 assert(pFormatKeep &&
"Wrong Which-ID");
882 aOut.append( pFormatKeep->GetValue()
893 if (pHasTextChangesOnly && !pHasTextChangesOnly->GetValue())
895 aOut.append(
"false" );
1008 ::std::optional<sal_uInt16> oNumOffset = rPageDesc.
GetNumOffset();
1009 if (oNumOffset && *oNumOffset > 0)
1012 sal_Int32
const number(*oNumOffset);
1013 aOut.append(number);
1028 assert(pSplit &&
"Wrong Which-ID");
1040 assert(pHoriOrient &&
"Wrong Which-ID");
1053 assert(pVertOrient &&
"Wrong Which-ID");
1065 bool bOutHeight =
false;
1100 std::unique_ptr<XMLPropertyHandler> pWritingModeHandler =
1104 bOk = pWritingModeHandler->exportXML( sValue, aAny,
1107 aOut.append( sValue );
1115 assert(pBorders &&
"Wrong RES-ID");
1127 OSL_FAIL(
"GetXMLValue not implemented for this item.");
1132 rValue = aOut.makeStringAndClear();
bool IsTransparent() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
static bool QueryXMLValue(const SfxPoolItem &rItem, OUString &rValue, sal_uInt16 nMemberId, const SvXMLUnitConverter &rUnitConverter)
void exportXML(const SvXMLExport &rExport, comphelper::AttributeList &rAttrList, const SfxItemSet &rSet, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap, std::vector< sal_uInt16 > *pIndexArray) const
fills the given attribute list with the items in the given set
virtual ~SvXMLExportItemMapper()
virtual void handleElementItem(const SvXMLItemMapEntry &rEntry, const SfxPoolItem &rItem) const
this method is called for every item that has the MID_SW_FLAG_ELEMENT_EXPORT flag set
static const SfxPoolItem * GetItem(const SfxItemSet &rSet, sal_uInt16 nWhichId)
returns the item with the given WhichId from the given ItemSet if it's set
SvXMLExportItemMapper(SvXMLItemMapEntriesRef rMapEntries)
void exportElementItems(SvXMLExport &rExport, const SfxItemSet &rSet, const std::vector< sal_uInt16 > &rIndexArray) const
virtual void handleSpecialItem(comphelper::AttributeList &rAttrList, const SvXMLItemMapEntry &rEntry, const SfxPoolItem &rItem, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap, const SfxItemSet *pSet) const
this method is called for every item that has the MID_SW_FLAG_SPECIAL_ITEM_EXPORT flag set
SvXMLItemMapEntriesRef mrMapEntries
const SvXMLNamespaceMap & GetNamespaceMap() const
void IgnorableWhitespace()
comphelper::AttributeList & GetAttrList()
OUString GetQNameByKey(sal_uInt16 nKey, const OUString &rLocalName, bool bCache=true) const
sal_uInt16 GetIndexByPrefix(const OUString &rPrefix) const
sal_uInt16 Add(const OUString &rPrefix, const OUString &rName, sal_uInt16 nKey=XML_NAMESPACE_UNKNOWN)
const OUString & GetNameByIndex(sal_uInt16 nIdx) const
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
const editeng::SvxBorderLine * GetTop() const
const editeng::SvxBorderLine * GetRight() const
const editeng::SvxBorderLine * GetLeft() const
sal_Int16 GetDistance(SvxBoxItemLine nLine, bool bAllowNegative=false) const
const editeng::SvxBorderLine * GetBottom() const
const Color & GetColor() const
const OUString & GetGraphicFilter() const
SvxGraphicPosition GetGraphicPos() const
sal_uInt16 GetPropLeft() const
sal_uInt16 GetPropRight() const
short GetTextFirstLineOffset() const
tools::Long GetRight() const
tools::Long GetLeft() const
sal_uInt16 GetPropTextFirstLineOffset() const
sal_uInt16 GetWidth() const
const Color & GetColor() const
SvxShadowLocation GetLocation() const
tools::Long GetHeight() const
sal_uInt16 GetPropLower() const
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
sal_uInt16 GetPropUpper() const
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
const ::std::optional< sal_uInt16 > & GetNumOffset() const
static std::unique_ptr< XMLPropertyHandler > CreatePropertyHandler(sal_Int32 nType)
void AddAttribute(const OUString &sName, const OUString &sValue)
virtual sal_Int16 SAL_CALL getLength() override
static bool convertMeasure(sal_Int32 &rValue, std::u16string_view rString, sal_Int16 nTargetUnit=css::util::MeasureUnit::MM_100TH, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32)
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
static bool convertColor(sal_Int32 &rColor, std::u16string_view rValue)
static bool convertBool(bool &rBool, std::u16string_view rString)
@ Fixed
Frame cannot be moved in Var-direction.
@ Minimum
Value in Var-direction gives minimum (can be exceeded but not be less).
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(116)
constexpr TypedWhichId< SwFormatRowSplit > RES_ROW_SPLIT(128)
constexpr TypedWhichId< SvxFirstLineIndentItem > RES_MARGIN_FIRSTLINE(91)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(109)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(113)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SwFormatLayoutSplit > RES_LAYOUT_SPLIT(119)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SfxBoolItem > RES_COLLAPSING_BORDERS(131)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SvxRightMarginItem > RES_MARGIN_RIGHT(93)
constexpr TypedWhichId< SvxTextLeftMarginItem > RES_MARGIN_TEXTLEFT(92)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(104)
#define MID_GRAPHIC_REPEAT
#define MID_GRAPHIC_POSITION
#define MID_FIRST_LINE_INDENT
#define MID_GRAPHIC_FILTER
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
enum::xmloff::token::XMLTokenEnum const eLocalName
#define MID_FRMSIZE_MIN_HEIGHT
#define MID_FRMSIZE_FIX_HEIGHT
#define MID_FRMSIZE_REL_WIDTH
#define MID_PAGEDESC_PAGENUMOFFSET
#define ALL_BORDER_PADDING
#define TOP_BORDER_LINE_WIDTH
#define BOTTOM_BORDER_PADDING
#define BOTTOM_BORDER_LINE_WIDTH
#define ALL_BORDER_LINE_WIDTH
#define LEFT_BORDER_PADDING
#define LEFT_BORDER_LINE_WIDTH
#define RIGHT_BORDER_PADDING
#define RIGHT_BORDER_LINE_WIDTH
#define TOP_BORDER_PADDING
static bool lcl_isOdfDoubleLine(const SvxBorderLine *pLine)
const struct SvXMLEnumMapEntry< sal_Int16 > aXMLTableVAlignMap[]
const struct SvXMLEnumMapEntry< sal_Int16 > aXMLTableAlignMap[]
const struct SvXMLEnumMapEntry< sal_uInt16 > aXML_KeepTogetherType[]
const struct SvXMLEnumMapEntry< sal_uInt16 > psXML_BreakType[]
#define MID_SW_FLAG_SPECIAL_ITEM_EXPORT
#define MID_SW_FLAG_ELEMENT_ITEM_EXPORT
#define MID_SW_FLAG_NO_ITEM_EXPORT
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
constexpr sal_uInt16 XML_NAMESPACE_STYLE
#define XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT