41 #include <osl/diagnose.h>
44 #include <drawdoc.hxx>
74 const Size& rPixSpace,
83 pNewDrawObj->
SetLayer( m_xDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() );
89 sal_uInt16 nLeftSpace = 0, nRightSpace = 0, nUpperSpace = 0, nLowerSpace = 0;
96 nLeftSpace = nRightSpace = o3tl::narrowing<sal_uInt16>(aTwipSpc.Width());
97 nUpperSpace = nLowerSpace = o3tl::narrowing<sal_uInt16>(aTwipSpc.Height());
108 nLeftSpace =
static_cast< sal_uInt16
>(aLRItem.
GetLeft());
113 nRightSpace =
static_cast< sal_uInt16
>(aLRItem.
GetRight());
118 if( nLeftSpace || nRightSpace )
123 aFrameSet.Put( aLRItem );
132 nUpperSpace = pULItem->GetUpper();
137 nLowerSpace = pULItem->GetLower();
143 if( nUpperSpace || nLowerSpace )
148 aFrameSet.Put( aULItem );
161 aAnchor.
SetType( RndStdIds::FLY_AT_FLY );
167 aAnchor.
SetType( RndStdIds::FLY_AT_PAGE );
171 rCSS1PropInfo.
m_nTop + nUpperSpace) );
174 else if( SvxAdjust::Left == rCSS1PropInfo.
m_eFloat ||
175 text::HoriOrientation::LEFT == eHoriOri )
177 aAnchor.
SetType( RndStdIds::FLY_AT_PARA );
187 if (RndStdIds::FLY_AT_PAGE == aAnchor.
GetAnchorId())
191 else if( RndStdIds::FLY_AT_FLY != aAnchor.
GetAnchorId() )
195 aFrameSet.Put( aAnchor );
197 m_xDoc->getIDocumentContentOperations().InsertDrawObj( *m_pPam, *pNewDrawObj, aFrameSet );
204 sal_uInt16 nEEWhich = 0;
206 switch( rSwItem.
Which() )
243 OSL_ENSURE( !m_pMarquee,
"Marquee in Marquee???" );
246 OUString
aId, aStyle, aClass;
249 bool bPercentWidth =
false, bDirection =
false, bBGColor =
false;
251 sal_Int16 eVertOri = text::VertOrientation::TOP;
255 sal_uInt16
nCount = 0, nDelay = 60;
256 sal_Int16 nAmount = -6;
260 for (
const auto & rOption : rHTMLOptions)
262 switch( rOption.GetToken() )
264 case HtmlOptionId::ID:
265 aId = rOption.GetString();
267 case HtmlOptionId::STYLE:
268 aStyle = rOption.GetString();
270 case HtmlOptionId::CLASS:
271 aClass = rOption.GetString();
274 case HtmlOptionId::BEHAVIOR:
275 eAniKind = rOption.GetEnum( aHTMLMarqBehaviorTable, eAniKind );
278 case HtmlOptionId::BGCOLOR:
279 rOption.GetColor( aBGColor );
283 case HtmlOptionId::DIRECTION:
284 eAniDir = rOption.GetEnum( aHTMLMarqDirectionTable, eAniDir );
288 case HtmlOptionId::LOOP:
289 if (rOption.GetString().
296 const sal_Int32 nLoop = rOption.GetSNumber();
297 nCount = std::max<sal_Int32>(nLoop, 0);
301 case HtmlOptionId::SCROLLAMOUNT:
302 nAmount = -
static_cast<sal_Int16
>(rOption.GetNumber());
305 case HtmlOptionId::SCROLLDELAY:
306 nDelay = o3tl::narrowing<sal_uInt16>(rOption.GetNumber());
309 case HtmlOptionId::WIDTH:
311 nWidth = rOption.GetNumber();
312 bPercentWidth = rOption.GetString().indexOf(
'%') != -1;
313 if( bPercentWidth && nWidth>100 )
317 case HtmlOptionId::HEIGHT:
319 nHeight = rOption.GetNumber();
320 if( rOption.GetString().indexOf(
'%') != -1 )
324 case HtmlOptionId::HSPACE:
329 case HtmlOptionId::VSPACE:
331 aSpace.
setWidth( rOption.GetNumber() );
334 case HtmlOptionId::ALIGN:
337 text::VertOrientation::TOP );
347 SwDrawModel* pModel = m_xDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel();
351 SdrInventor::Default,
360 InsertBookmark( aId );
363 if( SdrTextAniKind::Alternate==eAniKind && !bDirection )
364 eAniDir = SdrTextAniDirection::Right;
379 if( SdrTextAniKind::Alternate==eAniKind )
384 if( SdrTextAniDirection::Left==eAniDir )
390 const Color& rDfltColor =
392 ->GetColor().GetValue();
396 sal_uInt16 nWhichIds[] =
414 for(
int i=0; nWhichIds[
i]; ++
i )
416 if( SfxItemState::SET == rItemSet.
GetItemState( nWhichIds[
i],
true, &pItem ) )
422 HTMLAttr** pHTMLAttributes =
reinterpret_cast<HTMLAttr**
>(m_xAttrTab.get());
438 SfxItemSet aStyleItemSet( m_xDoc->GetAttrPool(),
439 m_pCSS1Parser->GetWhichMap() );
441 if( HasStyleOptions( aStyle, aId, aClass ) &&
442 ParseStyleOptions( aStyle, aId, aClass, aStyleItemSet, aPropInfo ) )
453 Size aTwipSz( bPercentWidth ? 0 : nWidth, nHeight );
462 aTwipSz.
setWidth( aPropInfo.m_nWidth );
464 bPercentWidth =
false;
467 aTwipSz.
setHeight( aPropInfo.m_nHeight );
469 m_bFixMarqueeWidth =
false;
470 if( !nWidth || bPercentWidth )
479 m_bFixMarqueeWidth =
true;
487 bPercentWidth =
true;
493 tools::Long nBrowseWidth = GetCurrentBrowseWidth();
494 aTwipSz.
setWidth( !nWidth ? nBrowseWidth
495 : (nWidth*nBrowseWidth) / 100 );
504 m_pMarquee->SetMergedItemSetAndBroadcast(aItemSet);
511 InsertDrawObject( m_pMarquee, aSpace, eVertOri, eHoriOri, aStyleItemSet,
519 if( pCurTable && bPercentWidth)
520 RegisterDrawObjectToTable( pCurTable, m_pMarquee, static_cast<sal_uInt8>(nWidth) );
525 OSL_ENSURE( m_pMarquee && SdrObjKind::Text==m_pMarquee->GetObjIdentifier(),
526 "no marquee or wrong type" );
528 if( m_bFixMarqueeWidth )
534 Size( USHRT_MAX, 240 ) ) );
539 m_pMarquee->SetMergedItemSetAndBroadcast( m_pMarquee->GetMergedItemSet() );
541 if( m_bFixMarqueeWidth )
544 static_cast<SdrTextObj*
>(m_pMarquee)->FitFrameToTextSize();
548 m_pMarquee =
nullptr;
553 OSL_ENSURE( m_pMarquee && SdrObjKind::Text==m_pMarquee->GetObjIdentifier(),
554 "no marquee or wrong type" );
563 "no marquee or wrong type" );
#define OOO_STRING_SVTOOLS_HTML_LOOP_infinite
Starts a section of nodes in the document model.
constexpr TypedWhichId< SvxCrossedOutItem > RES_CHRATR_CROSSEDOUT(5)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
SvxCSS1LengthType m_eLeftType
SvxCSS1LengthType m_eTopType
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
#define OOO_STRING_SVTOOLS_HTML_BEHAV_alternate
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Marks a position in the document model.
constexpr TypedWhichId< SvxKerningItem > EE_CHAR_KERNING(EE_CHAR_START+12)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
void setWidth(tools::Long nWidth)
virtual void SetText(const OUString &rStr) override
tools::Long GetRight() const
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr sal_uInt16 RES_FRMATR_END(133)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
static SdrObject * MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
virtual SdrObjKind GetObjIdentifier() const
constexpr sal_uInt16 SDRATTR_MISC_LAST(SDRATTR_TEXT_CHAINNEXTNAME)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
HTMLOptionEnum< SdrTextAniDirection > const aHTMLMarqDirectionTable[]
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
Reference< css::datatransfer::XTransferable > m_aContents
static OutputDevice * GetDefaultDevice()
constexpr tools::Long Width() const
const SfxPoolItem * NextItem()
static void ResetFrameFormatAttrs(SfxItemSet &rFrameSet)
static void ResizeDrawObject(SdrObject *pObj, SwTwips nWidth)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
void InsertDrawObject(SdrObject *pNewDrawObj, const Size &rSpace, sal_Int16 eVertOri, sal_Int16 eHoriOri, SfxItemSet &rCSS1ItemSet, SvxCSS1PropertyInfo &rCSS1PropInfo)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
SwFormatColl & GetAnyFormatColl() const
const Color & GetColor() const
virtual void SetLayer(SdrLayerID nLayer)
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
void NewMarquee(HTMLTable *pCurTable=nullptr)
static void PutEEPoolItem(SfxItemSet &rEEItemSet, const SfxPoolItem &rSwItem)
tools::Long GetLeft() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
#define OOO_STRING_SVTOOLS_HTML_AL_left
constexpr sal_uInt16 EE_CHAR_START(EE_PARA_END+1)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
SvxCSS1Position m_ePosition
virtual void SetLogicRect(const tools::Rectangle &rRect)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CTL(EE_CHAR_START+24)
virtual void SetRelativePos(const Point &rPnt)
constexpr sal_uInt16 EE_CHAR_END(EE_CHAR_START+32)
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
HTMLOptionEnum< sal_Int16 > const aHTMLImgVAlignTable[]
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
SwTextNode is a paragraph in the document model.
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
#define OOO_STRING_SVTOOLS_HTML_AL_right
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
#define OOO_STRING_SVTOOLS_HTML_BEHAV_slide
constexpr tools::Long Height() const
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
SdrMetricItem makeSdrTextMinFrameHeightItem(tools::Long mnHeight)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
::std::vector< HTMLOption > HTMLOptions
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CTL(EE_CHAR_START+22)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
#define OOO_STRING_SVTOOLS_HTML_BEHAV_scroll
void setHeight(tools::Long nHeight)
const SwStartNode * FindFlyStartNode() const
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CJK(EE_CHAR_START+23)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
const SfxItemPool & GetItemPool() const
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
HTMLOptionEnum< sal_Int16 > const aHTMLImgHAlignTable[]
virtual const tools::Rectangle & GetLogicRect() const
constexpr sal_uInt16 SDRATTR_MISC_FIRST(SDRATTR_CAPTION_LAST+1)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
constexpr TypedWhichId< SvxKerningItem > RES_CHRATR_KERNING(9)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
HTMLOptionEnum< SdrTextAniKind > const aHTMLMarqBehaviorTable[]
const SfxPoolItem * GetCurItem() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.