21#include <com/sun/star/io/XOutputStream.hpp>
22#include <com/sun/star/drawing/BitmapMode.hpp>
23#include <com/sun/star/graphic/XGraphic.hpp>
48 {
XML_LEFT, GraphicLocation_LEFT_MIDDLE },
49 {
XML_RIGHT, GraphicLocation_RIGHT_MIDDLE },
55 {
XML_TOP, GraphicLocation_MIDDLE_TOP },
61 GraphicLocation eHori )
63 DBG_ASSERT( GraphicLocation_LEFT_MIDDLE==eHori ||
64 GraphicLocation_MIDDLE_MIDDLE==eHori ||
65 GraphicLocation_RIGHT_MIDDLE==eHori,
66 "lcl_xmlbic_MergeHoriPos: vertical pos must be middle" );
70 case GraphicLocation_LEFT_TOP:
71 case GraphicLocation_MIDDLE_TOP:
72 case GraphicLocation_RIGHT_TOP:
73 ePos = GraphicLocation_LEFT_MIDDLE==eHori
74 ? GraphicLocation_LEFT_TOP
75 : (GraphicLocation_MIDDLE_MIDDLE==eHori
76 ? GraphicLocation_MIDDLE_TOP
77 : GraphicLocation_RIGHT_TOP);
80 case GraphicLocation_LEFT_MIDDLE:
81 case GraphicLocation_MIDDLE_MIDDLE:
82 case GraphicLocation_RIGHT_MIDDLE:
86 case GraphicLocation_LEFT_BOTTOM:
87 case GraphicLocation_MIDDLE_BOTTOM:
88 case GraphicLocation_RIGHT_BOTTOM:
89 ePos = GraphicLocation_LEFT_MIDDLE==eHori
90 ? GraphicLocation_LEFT_BOTTOM
91 : (GraphicLocation_MIDDLE_MIDDLE==eHori
92 ? GraphicLocation_MIDDLE_BOTTOM
93 : GraphicLocation_RIGHT_BOTTOM);
101 GraphicLocation eVert )
103 DBG_ASSERT( GraphicLocation_MIDDLE_TOP==eVert ||
104 GraphicLocation_MIDDLE_MIDDLE==eVert ||
105 GraphicLocation_MIDDLE_BOTTOM==eVert,
106 "lcl_xmlbic_MergeVertPos: horizontal pos must be middle" );
110 case GraphicLocation_LEFT_TOP:
111 case GraphicLocation_LEFT_MIDDLE:
112 case GraphicLocation_LEFT_BOTTOM:
113 ePos = GraphicLocation_MIDDLE_TOP==eVert
114 ? GraphicLocation_LEFT_TOP
115 : (GraphicLocation_MIDDLE_MIDDLE==eVert
116 ? GraphicLocation_LEFT_MIDDLE
117 : GraphicLocation_LEFT_BOTTOM);
120 case GraphicLocation_MIDDLE_TOP:
121 case GraphicLocation_MIDDLE_MIDDLE:
122 case GraphicLocation_MIDDLE_BOTTOM:
126 case GraphicLocation_RIGHT_TOP:
127 case GraphicLocation_RIGHT_MIDDLE:
128 case GraphicLocation_RIGHT_BOTTOM:
129 ePos = GraphicLocation_MIDDLE_TOP==eVert
130 ? GraphicLocation_RIGHT_TOP
131 : (GraphicLocation_MIDDLE_MIDDLE==eVert
132 ? GraphicLocation_RIGHT_MIDDLE
133 : GraphicLocation_RIGHT_BOTTOM);
142 const Reference< xml::sax::XFastAttributeList >& xAttrList )
144 ePos = GraphicLocation_NONE;
148 switch( aIter.getToken() )
151 m_sURL = aIter.toString();
152 if( GraphicLocation_NONE ==
ePos )
153 ePos = GraphicLocation_TILED;
161 GraphicLocation eNewPos = GraphicLocation_NONE, eTmp;
162 OUString sValue = aIter.toString();
164 std::u16string_view aToken;
165 bool bHori =
false, bVert =
false;
169 GraphicLocation nTmpGraphicLocation;
174 else if( std::u16string_view::npos != aToken.find(
'%' ) )
182 ? GraphicLocation_LEFT_TOP
183 : (nPrc < 75 ? GraphicLocation_MIDDLE_MIDDLE
184 : GraphicLocation_RIGHT_BOTTOM);
190 ? GraphicLocation_LEFT_TOP
191 : (nPrc < 75 ? GraphicLocation_LEFT_MIDDLE
192 : GraphicLocation_LEFT_BOTTOM);
207 GraphicLocation_MIDDLE_MIDDLE );
210 GraphicLocation_MIDDLE_MIDDLE );
212 eNewPos = GraphicLocation_MIDDLE_MIDDLE;
220 eNewPos = nTmpGraphicLocation;
231 eNewPos = nTmpGraphicLocation;
242 bOK &= GraphicLocation_NONE != eNewPos;
249 GraphicLocation
nPos = GraphicLocation_NONE;
260 if( GraphicLocation_MIDDLE_MIDDLE !=
nPos ||
261 GraphicLocation_NONE ==
ePos ||
262 GraphicLocation_AREA ==
ePos ||
263 GraphicLocation_TILED ==
ePos )
277 if( (nTmp >= 0) && (nTmp <= 100) )
290 SvXMLImport& rImport, sal_Int32 nElement,
291 const Reference< xml::sax::XFastAttributeList > & xAttrList,
294 sal_Int32 nFilterIdx,
295 sal_Int32 nTransparencyIdx,
296 sal_Int32 nBitmapModeIdx,
297 ::std::vector< XMLPropertyState > &rProps ) :
300 m_nBitmapModeIdx(nBitmapModeIdx),
301 aFilterProp( nFilterIdx ),
302 aTransparencyProp( nTransparencyIdx ),
314 const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
331 uno::Reference<graphic::XGraphic> xGraphic;
343 ePos = GraphicLocation_NONE;
344 else if (GraphicLocation_NONE ==
ePos)
345 ePos = GraphicLocation_TILED;
372 case GraphicLocation_TILED:
373 rProperty.maValue <<= drawing::BitmapMode_REPEAT;
375 case GraphicLocation_AREA:
376 rProperty.maValue <<= drawing::BitmapMode_STRETCH;
378 case GraphicLocation_MIDDLE_MIDDLE:
379 rProperty.maValue <<= drawing::BitmapMode_NO_REPEAT;
css::chart::ChartAxisLabelPosition ePos
static void lcl_xmlbic_MergeHoriPos(GraphicLocation &ePos, GraphicLocation eHori)
static void lcl_xmlbic_MergeVertPos(GraphicLocation &ePos, GraphicLocation eVert)
const SvXMLEnumMapEntry< GraphicLocation > psXML_BrushVertPos[]
const SvXMLEnumMapEntry< GraphicLocation > psXML_BrushHoriPos[]
SvXMLImport & GetImport()
bool getNextToken(std::u16string_view &rToken)
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
css::uno::Reference< css::io::XOutputStream > m_xBase64Stream
css::style::GraphicLocation ePos
XMLPropertyState aFilterProp
sal_Int32 m_nBitmapModeIdx
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
XMLBackgroundImageContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, const XMLPropertyState &rProp, sal_Int32 nPosIdx, sal_Int32 nFilterIdx, sal_Int32 nTransparencyIdx, sal_Int32 nBitmapModeIdx, ::std::vector< XMLPropertyState > &rProps)
void ProcessAttrs(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
virtual ~XMLBackgroundImageContext() override
XMLPropertyState aTransparencyProp
XMLPropertyState aPosProp
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
void SetInsert(bool bIns)
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
::std::vector< XMLPropertyState > & rProperties
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
#define DBG_ASSERT(sCon, aError)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Handling of tokens in XML:
@ XML_BACKGROUND_NO_REPEAT
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Smart struct to transport an Any with an index to the appropriate property-name.
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define XML_ELEMENT(prefix, name)
const struct SvXMLEnumMapEntry< SvxGraphicPosition > psXML_BrushRepeat[]