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() )
434 OSL_FAIL(
"unknown member id!");
474 OSL_FAIL(
"unknown MemberId");
484 assert(pShadow &&
"Wrong Which-ID");
487 sal_Int32 nX = 1, nY = 1;
490 case SvxShadowLocation::TopLeft:
494 case SvxShadowLocation::TopRight:
497 case SvxShadowLocation::BottomLeft:
500 case SvxShadowLocation::BottomRight:
502 case SvxShadowLocation::NONE:
525 assert(pBox &&
"Wrong Which-ID");
550 const SvxBorderLine* pLeft = pBox->
GetLeft();
551 const SvxBorderLine* pRight = pBox->
GetRight();
552 const SvxBorderLine* pTop = pBox->
GetTop();
553 const SvxBorderLine* pBottom = pBox->
GetBottom();
554 const sal_uInt16 nTopDist = pBox->
GetDistance( SvxBoxItemLine::TOP );
555 const sal_uInt16 nBottomDist = pBox->
GetDistance( SvxBoxItemLine::BOTTOM );
556 const sal_uInt16 nLeftDist = pBox->
GetDistance( SvxBoxItemLine::LEFT );
557 const sal_uInt16 nRightDist = pBox->
GetDistance( SvxBoxItemLine::RIGHT );
568 bool bEqual = nLeftDist == nRightDist &&
569 nLeftDist == nTopDist &&
570 nLeftDist == nBottomDist;
584 bool bEqual = (
nullptr == pTop &&
nullptr == pBottom &&
585 nullptr == pLeft &&
nullptr == pRight ) ||
586 ( pTop && pBottom && pLeft && pRight &&
587 *pTop == *pBottom && *pTop == *pLeft &&
604 if( !pTop && !pBottom && !pLeft && !pRight )
607 bool bEqual =
nullptr != pTop &&
608 nullptr != pBottom &&
614 const sal_uInt16 nDistance = pTop->GetDistance();
615 const sal_uInt16 nInWidth = pTop->GetInWidth();
616 const sal_uInt16 nOutWidth = pTop->GetOutWidth();
619 bEqual = nDistance == pLeft->GetDistance() &&
620 nInWidth == pLeft->GetInWidth() &&
621 nOutWidth == pLeft->GetOutWidth() &&
622 nWidth == pLeft->GetWidth() &&
623 nDistance == pRight->GetDistance() &&
624 nInWidth == pRight->GetInWidth() &&
625 nOutWidth == pRight->GetOutWidth() &&
626 nWidth == pRight->GetWidth() &&
627 nDistance == pBottom->GetDistance() &&
628 nInWidth == pBottom->GetInWidth() &&
629 nOutWidth == pBottom->GetOutWidth() &&
630 nWidth == pBottom->GetWidth();
636 if( !bEqual || pTop->GetDistance() == 0 ||
641 if( bEqual ||
nullptr == pLeft ||
642 0 == pLeft->GetDistance() ||
647 if( bEqual ||
nullptr == pRight ||
648 0 == pRight->GetDistance() ||
653 if( bEqual ||
nullptr == pTop ||
654 0 == pTop->GetDistance() ||
659 if( bEqual ||
nullptr == pBottom ||
660 0 == pBottom->GetDistance() ||
694 const SvxBorderLine* pLine;
715 if(
nullptr != pLine )
717 sal_Int32 nWidth = pLine->GetWidth();
720 bool bNoBorder =
false;
721 switch (pLine->GetBorderLineStyle())
723 case SvxBorderLineStyle::SOLID:
726 case SvxBorderLineStyle::DOTTED:
729 case SvxBorderLineStyle::DASHED:
732 case SvxBorderLineStyle::FINE_DASHED:
735 case SvxBorderLineStyle::DASH_DOT:
738 case SvxBorderLineStyle::DASH_DOT_DOT:
741 case SvxBorderLineStyle::DOUBLE_THIN:
744 case SvxBorderLineStyle::DOUBLE:
745 case SvxBorderLineStyle::THINTHICK_SMALLGAP:
746 case SvxBorderLineStyle::THINTHICK_MEDIUMGAP:
747 case SvxBorderLineStyle::THINTHICK_LARGEGAP:
748 case SvxBorderLineStyle::THICKTHIN_SMALLGAP:
749 case SvxBorderLineStyle::THICKTHIN_MEDIUMGAP:
750 case SvxBorderLineStyle::THICKTHIN_LARGEGAP:
753 case SvxBorderLineStyle::EMBOSSED:
756 case SvxBorderLineStyle::ENGRAVED:
759 case SvxBorderLineStyle::INSET:
762 case SvxBorderLineStyle::OUTSET:
772 util::MeasureUnit::TWIP,
773 util::MeasureUnit::POINT);
794 const SvxBorderLine* pLine;
829 sal_uInt16 eEnum = 0;
836 case SvxBreak::ColumnBefore:
839 case SvxBreak::PageBefore:
852 case SvxBreak::ColumnAfter:
855 case SvxBreak::PageAfter:
874 assert(pFormatKeep &&
"Wrong Which-ID");
877 aOut.append( pFormatKeep->GetValue()
888 if (pHasTextChangesOnly && !pHasTextChangesOnly->GetValue())
890 aOut.append(
"false" );
1003 ::std::optional<sal_uInt16> oNumOffset = rPageDesc.
GetNumOffset();
1004 if (oNumOffset && *oNumOffset > 0)
1007 sal_Int32
const number(*oNumOffset);
1008 aOut.append(number);
1023 assert(pSplit &&
"Wrong Which-ID");
1035 assert(pHoriOrient &&
"Wrong Which-ID");
1048 assert(pVertOrient &&
"Wrong Which-ID");
1060 bool bOutHeight =
false;
1095 std::unique_ptr<XMLPropertyHandler> pWritingModeHandler =
1099 bOk = pWritingModeHandler->exportXML( sValue, aAny,
1102 aOut.append( sValue );
1110 assert(pBorders &&
"Wrong RES-ID");
1122 OSL_FAIL(
"GetXMLValue not implemented for this item.");
1127 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(120)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
constexpr TypedWhichId< SfxBoolItem > RES_COLLAPSING_BORDERS(125)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr TypedWhichId< SwFormatRowSplit > RES_ROW_SPLIT(122)
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(98)
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(110)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
constexpr TypedWhichId< SwFormatLayoutSplit > RES_LAYOUT_SPLIT(113)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
#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