LibreOffice Module sw (master)  1
unoframe.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <com/sun/star/awt/XBitmap.hpp>
21 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
22 #include <com/sun/star/container/XChild.hpp>
23 #include <com/sun/star/drawing/BitmapMode.hpp>
24 #include <com/sun/star/drawing/FillStyle.hpp>
25 #include <com/sun/star/embed/EmbedStates.hpp>
26 #include <com/sun/star/embed/Aspects.hpp>
27 #include <com/sun/star/frame/XTitle.hpp>
28 #include <com/sun/star/frame/XModel.hpp>
29 #include <o3tl/any.hxx>
30 #include <svx/xfillit0.hxx>
31 #include <svx/xflgrit.hxx>
32 #include <svx/sdtaitm.hxx>
33 #include <svx/xflclit.hxx>
34 #include <tools/globname.hxx>
35 #include <tools/UnitConversion.hxx>
36 #include <editeng/memberids.h>
37 #include <swtypes.hxx>
38 #include <cmdid.h>
39 #include <unomid.h>
40 #include <memory>
41 #include <utility>
42 #include <cntfrm.hxx>
43 #include <doc.hxx>
44 #include <drawdoc.hxx>
45 #include <IDocumentUndoRedo.hxx>
49 #include <docsh.hxx>
50 #include <editsh.hxx>
51 #include <ndindex.hxx>
52 #include <pam.hxx>
53 #include <ndnotxt.hxx>
54 #include <svx/unomid.hxx>
55 #include <unocrsr.hxx>
56 #include <unocrsrhelper.hxx>
57 #include <docstyle.hxx>
58 #include <dcontact.hxx>
59 #include <fmtcnct.hxx>
60 #include <ndole.hxx>
61 #include <frmfmt.hxx>
62 #include <frame.hxx>
63 #include <textboxhelper.hxx>
64 #include <unotextrange.hxx>
65 #include <unotextcursor.hxx>
66 #include <unoparagraph.hxx>
67 #include <unomap.hxx>
68 #include <unoprnms.hxx>
69 #include <unoevent.hxx>
70 #include <com/sun/star/util/XModifyBroadcaster.hpp>
71 #include <com/sun/star/text/TextContentAnchorType.hpp>
72 #include <com/sun/star/text/WrapTextMode.hpp>
73 #include <com/sun/star/beans/PropertyAttribute.hpp>
74 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
75 #include <com/sun/star/drawing/PointSequence.hpp>
76 #include <tools/poly.hxx>
77 #include <swundo.hxx>
78 #include <svx/svdpage.hxx>
79 #include <editeng/brushitem.hxx>
80 #include <editeng/protitem.hxx>
81 #include <fmtornt.hxx>
82 #include <fmteiro.hxx>
83 #include <fmturl.hxx>
84 #include <editeng/lrspitem.hxx>
85 #include <editeng/ulspitem.hxx>
86 #include <editeng/boxitem.hxx>
87 #include <editeng/opaqitem.hxx>
88 #include <editeng/prntitem.hxx>
89 #include <editeng/shaditem.hxx>
90 #include <fmtsrnd.hxx>
91 #include <fmtfsize.hxx>
92 #include <grfatr.hxx>
93 #include <unoframe.hxx>
94 #include <fmtanchr.hxx>
95 #include <fmtclds.hxx>
96 #include <fmtcntnt.hxx>
97 #include <frmatr.hxx>
98 #include <ndtxt.hxx>
99 #include <ndgrf.hxx>
100 #include <mutex>
101 #include <vcl/svapp.hxx>
102 #include <vcl/GraphicLoader.hxx>
103 #include <SwStyleNameMapper.hxx>
104 #include <editeng/xmlcnitm.hxx>
105 #include <poolfmt.hxx>
106 #include <pagedesc.hxx>
107 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
108 #include <editeng/frmdiritem.hxx>
109 #include <fmtfollowtextflow.hxx>
115 #include <sal/log.hxx>
116 #include <vcl/errinf.hxx>
117 
119 #include <svx/xbtmpit.hxx>
120 #include <svx/xgrscit.hxx>
121 #include <svx/xflbmtit.hxx>
122 #include <svx/xflbmpit.hxx>
123 #include <svx/xflbmsxy.hxx>
124 #include <svx/xflftrit.hxx>
125 #include <svx/xsflclit.hxx>
126 #include <svx/xflbmsli.hxx>
127 #include <svx/xflbtoxy.hxx>
128 #include <svx/xflbstit.hxx>
129 #include <svx/xflboxy.hxx>
130 #include <svx/xflbckit.hxx>
131 #include <svx/unoshape.hxx>
132 #include <svx/xflhtit.hxx>
133 #include <svx/xfltrit.hxx>
134 #include <swunohelper.hxx>
135 #include <fefly.hxx>
136 
137 using namespace ::com::sun::star;
138 
139 using ::com::sun::star::frame::XModel;
140 using ::com::sun::star::container::XNameAccess;
141 using ::com::sun::star::style::XStyleFamiliesSupplier;
142 
144 {
146 
147 public:
148  virtual ~BaseFrameProperties_Impl();
149 
150  void SetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any& rVal);
151  bool GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any*& pAny );
152  bool FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet &rFromSet, bool& rSizeFound);
153 
154  virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) = 0;
155 };
156 
158 {
159 }
160 
161 void BaseFrameProperties_Impl::SetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any& rVal)
162 {
163  m_aAnyMap.SetValue( nWID, nMemberId, rVal );
164 }
165 
166 bool BaseFrameProperties_Impl::GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any*& rpAny)
167 {
168  return m_aAnyMap.FillValue( nWID, nMemberId, rpAny );
169 }
170 
171 bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet& rFromSet, bool& rSizeFound)
172 {
173  // assert when the target SfxItemSet has no parent. It *should* have the pDfltFrameFormat
174  // from SwDoc set as parent (or similar) to have the necessary XFILL_NONE in the ItemSet
175  if(!rToSet.GetParent())
176  {
177  OSL_ENSURE(false, "OOps, target SfxItemSet *should* have a parent which contains XFILL_NONE as XFillStyleItem (!)");
178  }
179 
180  bool bRet = true;
181  // always add an anchor to the set
182  SwFormatAnchor aAnchor ( rFromSet.Get ( RES_ANCHOR ) );
183  {
184  const ::uno::Any* pAnchorPgNo;
185  if(GetProperty(RES_ANCHOR, MID_ANCHOR_PAGENUM, pAnchorPgNo))
186  bRet &= static_cast<SfxPoolItem&>(aAnchor).PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM);
187  const ::uno::Any* pAnchorType;
188  if(GetProperty(RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, pAnchorType))
189  bRet &= static_cast<SfxPoolItem&>(aAnchor).PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE);
190  }
191 
192  rToSet.Put(aAnchor);
193 
194  // check for SvxBrushItem (RES_BACKGROUND) properties
195  const ::uno::Any* pCol = nullptr; GetProperty(RES_BACKGROUND, MID_BACK_COLOR, pCol );
196  const ::uno::Any* pRGBCol = nullptr; GetProperty(RES_BACKGROUND, MID_BACK_COLOR_R_G_B, pRGBCol );
197  const ::uno::Any* pColTrans = nullptr; GetProperty(RES_BACKGROUND, MID_BACK_COLOR_TRANSPARENCY, pColTrans);
198  const ::uno::Any* pTrans = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pTrans );
199  const ::uno::Any* pGrLoc = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION, pGrLoc );
200  const ::uno::Any* pGraphic = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC, pGraphic );
201  const ::uno::Any* pGrFilter = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER, pGrFilter );
202  const ::uno::Any* pGraphicURL = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL, pGraphicURL );
203  const ::uno::Any* pGrTransparency = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENCY, pGrTransparency );
204  const bool bSvxBrushItemPropertiesUsed(
205  pCol ||
206  pTrans ||
207  pGraphic ||
208  pGraphicURL ||
209  pGrFilter ||
210  pGrLoc ||
211  pGrTransparency ||
212  pColTrans ||
213  pRGBCol);
214 
215  // check for FillStyle properties in the range XATTR_FILL_FIRST, XATTR_FILL_LAST
216  const uno::Any* pXFillStyleItem = nullptr; GetProperty(XATTR_FILLSTYLE, 0, pXFillStyleItem);
217  const uno::Any* pXFillColorItem = nullptr; GetProperty(XATTR_FILLCOLOR, 0, pXFillColorItem);
218 
219  // XFillGradientItem: two possible slots supported in UNO API
220  const uno::Any* pXFillGradientItem = nullptr; GetProperty(XATTR_FILLGRADIENT, MID_FILLGRADIENT, pXFillGradientItem);
221  const uno::Any* pXFillGradientNameItem = nullptr; GetProperty(XATTR_FILLGRADIENT, MID_NAME, pXFillGradientNameItem);
222 
223  // XFillHatchItem: two possible slots supported in UNO API
224  const uno::Any* pXFillHatchItem = nullptr; GetProperty(XATTR_FILLHATCH, MID_FILLHATCH, pXFillHatchItem);
225  const uno::Any* pXFillHatchNameItem = nullptr; GetProperty(XATTR_FILLHATCH, MID_NAME, pXFillHatchNameItem);
226 
227  // XFillBitmapItem: three possible slots supported in UNO API
228  const uno::Any* pXFillBitmapItem = nullptr; GetProperty(XATTR_FILLBITMAP, MID_BITMAP, pXFillBitmapItem);
229  const uno::Any* pXFillBitmapNameItem = nullptr; GetProperty(XATTR_FILLBITMAP, MID_NAME, pXFillBitmapNameItem);
230 
231  const uno::Any* pXFillTransparenceItem = nullptr; GetProperty(XATTR_FILLTRANSPARENCE, 0, pXFillTransparenceItem);
232  const uno::Any* pXGradientStepCountItem = nullptr; GetProperty(XATTR_GRADIENTSTEPCOUNT, 0, pXGradientStepCountItem);
233  const uno::Any* pXFillBmpPosItem = nullptr; GetProperty(XATTR_FILLBMP_POS, 0, pXFillBmpPosItem);
234  const uno::Any* pXFillBmpSizeXItem = nullptr; GetProperty(XATTR_FILLBMP_SIZEX, 0, pXFillBmpSizeXItem);
235  const uno::Any* pXFillBmpSizeYItem = nullptr; GetProperty(XATTR_FILLBMP_SIZEY, 0, pXFillBmpSizeYItem);
236 
237  // XFillFloatTransparenceItem: two possible slots supported in UNO API
238  const uno::Any* pXFillFloatTransparenceItem = nullptr; GetProperty(XATTR_FILLFLOATTRANSPARENCE, MID_FILLGRADIENT, pXFillFloatTransparenceItem);
239  const uno::Any* pXFillFloatTransparenceNameItem = nullptr; GetProperty(XATTR_FILLFLOATTRANSPARENCE, MID_NAME, pXFillFloatTransparenceNameItem);
240 
241  const uno::Any* pXSecondaryFillColorItem = nullptr; GetProperty(XATTR_SECONDARYFILLCOLOR, 0, pXSecondaryFillColorItem);
242  const uno::Any* pXFillBmpSizeLogItem = nullptr; GetProperty(XATTR_FILLBMP_SIZELOG, 0, pXFillBmpSizeLogItem);
243  const uno::Any* pXFillBmpTileOffsetXItem = nullptr; GetProperty(XATTR_FILLBMP_TILEOFFSETX, 0, pXFillBmpTileOffsetXItem);
244  const uno::Any* pXFillBmpTileOffsetYItem = nullptr; GetProperty(XATTR_FILLBMP_TILEOFFSETY, 0, pXFillBmpTileOffsetYItem);
245  const uno::Any* pXFillBmpPosOffsetXItem = nullptr; GetProperty(XATTR_FILLBMP_POSOFFSETX, 0, pXFillBmpPosOffsetXItem);
246  const uno::Any* pXFillBmpPosOffsetYItem = nullptr; GetProperty(XATTR_FILLBMP_POSOFFSETY, 0, pXFillBmpPosOffsetYItem);
247  const uno::Any* pXFillBackgroundItem = nullptr; GetProperty(XATTR_FILLBACKGROUND, 0, pXFillBackgroundItem);
248  const uno::Any* pOwnAttrFillBmpItem = nullptr; GetProperty(OWN_ATTR_FILLBMP_MODE, 0, pOwnAttrFillBmpItem);
249 
250  // tdf#91140: ignore SOLID fill style for determining if fill style is used
251  // but there is a Graphic
252  const bool bFillStyleUsed(pXFillStyleItem && pXFillStyleItem->hasValue() &&
253  (pXFillStyleItem->get<drawing::FillStyle>() != drawing::FillStyle_SOLID || (!pGraphic || !pGraphicURL) ));
254  SAL_INFO_IF(pXFillStyleItem && pXFillStyleItem->hasValue() && !bFillStyleUsed,
255  "sw.uno", "FillBaseProperties: ignoring invalid FillStyle");
256  const bool bXFillStyleItemUsed(
257  bFillStyleUsed ||
258  pXFillColorItem ||
259  pXFillGradientItem || pXFillGradientNameItem ||
260  pXFillHatchItem || pXFillHatchNameItem ||
261  pXFillBitmapItem || pXFillBitmapNameItem ||
262  pXFillTransparenceItem ||
263  pXGradientStepCountItem ||
264  pXFillBmpPosItem ||
265  pXFillBmpSizeXItem ||
266  pXFillBmpSizeYItem ||
267  pXFillFloatTransparenceItem || pXFillFloatTransparenceNameItem ||
268  pXSecondaryFillColorItem ||
269  pXFillBmpSizeLogItem ||
270  pXFillBmpTileOffsetXItem ||
271  pXFillBmpTileOffsetYItem ||
272  pXFillBmpPosOffsetXItem ||
273  pXFillBmpPosOffsetYItem ||
274  pXFillBackgroundItem ||
275  pOwnAttrFillBmpItem);
276 
277  // use brush items, but *only* if no FillStyle properties are used; if both are used and when applying both
278  // in the obvious order some attributes may be wrong since they are set by the 1st set, but not
279  // redefined as needed by the 2nd set when they are default (and thus no tset) in the 2nd set. If
280  // it is necessary for any reason to set both (it should not) an in-between step will be needed
281  // that resets the items for FillAttributes in rToSet to default.
282  // Note: There are other mechanisms in XMLOFF to pre-sort this relationship already, but this version
283  // was used initially, is tested and works. Keep it to be able to react when another feed adds attributes
284  // from both sets.
285  if(bSvxBrushItemPropertiesUsed && !bXFillStyleItemUsed)
286  {
287  // create a temporary SvxBrushItem, fill the attributes to it and use it to set
288  // the corresponding FillAttributes
290 
291  if(pCol)
292  {
293  bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pCol,MID_BACK_COLOR );
294  }
295 
296  if(pColTrans)
297  {
298  bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY);
299  }
300 
301  if(pRGBCol)
302  {
303  bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B);
304  }
305 
306  if(pTrans)
307  {
308  // don't overwrite transparency with a non-transparence flag
309  if(!pColTrans || Any2Bool( *pTrans ))
310  bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pTrans, MID_GRAPHIC_TRANSPARENT);
311  }
312 
313  if (pGraphic)
314  {
315  bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pGraphic, MID_GRAPHIC);
316  }
317 
318  if (pGraphicURL)
319  {
320  bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pGraphicURL, MID_GRAPHIC_URL);
321  }
322 
323  if(pGrFilter)
324  {
325  bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pGrFilter, MID_GRAPHIC_FILTER);
326  }
327 
328  if(pGrLoc)
329  {
330  bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pGrLoc, MID_GRAPHIC_POSITION);
331  }
332 
333  if(pGrTransparency)
334  {
335  bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pGrTransparency, MID_GRAPHIC_TRANSPARENCY);
336  }
337 
339  }
340 
341  if(bXFillStyleItemUsed)
342  {
343  XFillStyleItem aXFillStyleItem;
344  std::unique_ptr<SvxBrushItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
345 
346  if(pXFillStyleItem)
347  {
348  aXFillStyleItem.PutValue(*pXFillStyleItem, 0);
349  rToSet.Put(aXFillStyleItem);
350  }
351 
352  if(pXFillColorItem)
353  {
354  const Color aNullCol(COL_DEFAULT_SHAPE_FILLING);
355  XFillColorItem aXFillColorItem(OUString(), aNullCol);
356 
357  aXFillColorItem.PutValue(*pXFillColorItem, 0);
358  rToSet.Put(aXFillColorItem);
359  //set old-school brush color if we later encounter the
360  //MID_BACK_COLOR_TRANSPARENCY case below
361  aBrush = getSvxBrushItemFromSourceSet(rToSet, RES_BACKGROUND, false);
362  }
363  else if (aXFillStyleItem.GetValue() == drawing::FillStyle_SOLID && (pCol || pRGBCol))
364  {
365  // Fill style is set to solid, but no fill color is given.
366  // On the other hand, we have a BackColor, so use that.
367  if (pCol)
368  aBrush->PutValue(*pCol, MID_BACK_COLOR);
369  else
370  aBrush->PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B);
372  }
373 
374  if(pXFillGradientItem || pXFillGradientNameItem)
375  {
376  if(pXFillGradientItem)
377  {
378  const XGradient aNullGrad(COL_BLACK, COL_WHITE);
379  XFillGradientItem aXFillGradientItem(aNullGrad);
380 
381  aXFillGradientItem.PutValue(*pXFillGradientItem, MID_FILLGRADIENT);
382  rToSet.Put(aXFillGradientItem);
383  }
384 
385  if(pXFillGradientNameItem)
386  {
387  OUString aTempName;
388 
389  if(!(*pXFillGradientNameItem >>= aTempName ))
390  {
391  throw lang::IllegalArgumentException();
392  }
393 
394  bool const bSuccess = SvxShape::SetFillAttribute(
395  XATTR_FILLGRADIENT, aTempName, rToSet);
396  if (aXFillStyleItem.GetValue() == drawing::FillStyle_GRADIENT)
397  { // tdf#90946 ignore invalid gradient-name if SOLID
398  bRet &= bSuccess;
399  }
400  else
401  {
402  SAL_INFO_IF(!bSuccess, "sw.uno",
403  "FillBaseProperties: ignoring invalid FillGradientName");
404  }
405  }
406  }
407 
408  if(pXFillHatchItem || pXFillHatchNameItem)
409  {
410  if(pXFillHatchItem)
411  {
412  const Color aNullCol(COL_DEFAULT_SHAPE_STROKE);
413  const XHatch aNullHatch(aNullCol);
414  XFillHatchItem aXFillHatchItem(aNullHatch);
415 
416  aXFillHatchItem.PutValue(*pXFillHatchItem, MID_FILLHATCH);
417  rToSet.Put(aXFillHatchItem);
418  }
419 
420  if(pXFillHatchNameItem)
421  {
422  OUString aTempName;
423 
424  if(!(*pXFillHatchNameItem >>= aTempName ))
425  {
426  throw lang::IllegalArgumentException();
427  }
428 
429  bRet &= SvxShape::SetFillAttribute(XATTR_FILLHATCH, aTempName, rToSet);
430  }
431  }
432 
433  if (pXFillBitmapItem || pXFillBitmapNameItem)
434  {
435  if(pXFillBitmapItem)
436  {
437  const Graphic aNullGraphic;
438  XFillBitmapItem aXFillBitmapItem(aNullGraphic);
439 
440  aXFillBitmapItem.PutValue(*pXFillBitmapItem, MID_BITMAP);
441  rToSet.Put(aXFillBitmapItem);
442  }
443 
444  if(pXFillBitmapNameItem)
445  {
446  OUString aTempName;
447 
448  if(!(*pXFillBitmapNameItem >>= aTempName ))
449  {
450  throw lang::IllegalArgumentException();
451  }
452 
453  bRet &= SvxShape::SetFillAttribute(XATTR_FILLBITMAP, aTempName, rToSet);
454  }
455  }
456 
457  if (pXFillTransparenceItem)
458  {
459  XFillTransparenceItem aXFillTransparenceItem;
460  aXFillTransparenceItem.PutValue(*pXFillTransparenceItem, 0);
461  rToSet.Put(aXFillTransparenceItem);
462  }
463  else if (pColTrans &&
464  !pXFillFloatTransparenceItem && !pXFillFloatTransparenceNameItem)
465  {
466  // No fill transparency is given. On the other hand, we have a
467  // BackColorTransparency, so use that.
468  // tdf#90640 tdf#90130: this is necessary for LO 4.4.0 - 4.4.2
469  // that forgot to write draw:opacity into documents
470  // but: the value was *always* wrong for bitmaps! => ignore it
471  sal_Int8 nGraphicTransparency(0);
472  *pColTrans >>= nGraphicTransparency;
473  if (aXFillStyleItem.GetValue() != drawing::FillStyle_BITMAP)
474  {
475  rToSet.Put(XFillTransparenceItem(nGraphicTransparency));
476  }
477  if (aXFillStyleItem.GetValue() == drawing::FillStyle_SOLID)
478  {
479  aBrush->PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY);
481  }
482  }
483 
484  if(pXGradientStepCountItem)
485  {
486  XGradientStepCountItem aXGradientStepCountItem;
487 
488  aXGradientStepCountItem.PutValue(*pXGradientStepCountItem, 0);
489  rToSet.Put(aXGradientStepCountItem);
490  }
491 
492  if(pXFillBmpPosItem)
493  {
494  XFillBmpPosItem aXFillBmpPosItem;
495 
496  aXFillBmpPosItem.PutValue(*pXFillBmpPosItem, 0);
497  rToSet.Put(aXFillBmpPosItem);
498  }
499 
500  if(pXFillBmpSizeXItem)
501  {
502  XFillBmpSizeXItem aXFillBmpSizeXItem;
503 
504  aXFillBmpSizeXItem.PutValue(*pXFillBmpSizeXItem, 0);
505  rToSet.Put(aXFillBmpSizeXItem);
506  }
507 
508  if(pXFillBmpSizeYItem)
509  {
510  XFillBmpSizeYItem aXFillBmpSizeYItem;
511 
512  aXFillBmpSizeYItem.PutValue(*pXFillBmpSizeYItem, 0);
513  rToSet.Put(aXFillBmpSizeYItem);
514  }
515 
516  if(pXFillFloatTransparenceItem || pXFillFloatTransparenceNameItem)
517  {
518  if(pXFillFloatTransparenceItem)
519  {
520  const XGradient aNullGrad(COL_BLACK, COL_WHITE);
521  XFillFloatTransparenceItem aXFillFloatTransparenceItem(aNullGrad, false);
522 
523  aXFillFloatTransparenceItem.PutValue(*pXFillFloatTransparenceItem, MID_FILLGRADIENT);
524  rToSet.Put(aXFillFloatTransparenceItem);
525  }
526 
527  if(pXFillFloatTransparenceNameItem)
528  {
529  OUString aTempName;
530 
531  if(!(*pXFillFloatTransparenceNameItem >>= aTempName ))
532  {
533  throw lang::IllegalArgumentException();
534  }
535 
536  bRet &= SvxShape::SetFillAttribute(XATTR_FILLFLOATTRANSPARENCE, aTempName, rToSet);
537  }
538  }
539 
540  if(pXSecondaryFillColorItem)
541  {
542  const Color aNullCol(COL_DEFAULT_SHAPE_FILLING);
543  XSecondaryFillColorItem aXSecondaryFillColorItem(OUString(), aNullCol);
544 
545  aXSecondaryFillColorItem.PutValue(*pXSecondaryFillColorItem, 0);
546  rToSet.Put(aXSecondaryFillColorItem);
547  }
548 
549  if(pXFillBmpSizeLogItem)
550  {
551  XFillBmpSizeLogItem aXFillBmpSizeLogItem;
552 
553  aXFillBmpSizeLogItem.PutValue(*pXFillBmpSizeLogItem, 0);
554  rToSet.Put(aXFillBmpSizeLogItem);
555  }
556 
557  if(pXFillBmpTileOffsetXItem)
558  {
559  XFillBmpTileOffsetXItem aXFillBmpTileOffsetXItem;
560 
561  aXFillBmpTileOffsetXItem.PutValue(*pXFillBmpTileOffsetXItem, 0);
562  rToSet.Put(aXFillBmpTileOffsetXItem);
563  }
564 
565  if(pXFillBmpTileOffsetYItem)
566  {
567  XFillBmpTileOffsetYItem aXFillBmpTileOffsetYItem;
568 
569  aXFillBmpTileOffsetYItem.PutValue(*pXFillBmpTileOffsetYItem, 0);
570  rToSet.Put(aXFillBmpTileOffsetYItem);
571  }
572 
573  if(pXFillBmpPosOffsetXItem)
574  {
575  XFillBmpPosOffsetXItem aXFillBmpPosOffsetXItem;
576 
577  aXFillBmpPosOffsetXItem.PutValue(*pXFillBmpPosOffsetXItem, 0);
578  rToSet.Put(aXFillBmpPosOffsetXItem);
579  }
580 
581  if(pXFillBmpPosOffsetYItem)
582  {
583  XFillBmpPosOffsetYItem aXFillBmpPosOffsetYItem;
584 
585  aXFillBmpPosOffsetYItem.PutValue(*pXFillBmpPosOffsetYItem, 0);
586  rToSet.Put(aXFillBmpPosOffsetYItem);
587  }
588 
589  if(pXFillBackgroundItem)
590  {
591  XFillBackgroundItem aXFillBackgroundItem;
592 
593  aXFillBackgroundItem.PutValue(*pXFillBackgroundItem, 0);
594  rToSet.Put(aXFillBackgroundItem);
595  }
596 
597  if(pOwnAttrFillBmpItem)
598  {
599  drawing::BitmapMode eMode;
600 
601  if(!(*pOwnAttrFillBmpItem >>= eMode))
602  {
603  sal_Int32 nMode = 0;
604 
605  if(!(*pOwnAttrFillBmpItem >>= nMode))
606  {
607  throw lang::IllegalArgumentException();
608  }
609 
610  eMode = static_cast<drawing::BitmapMode>(nMode);
611  }
612 
613  rToSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
614  rToSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
615  }
616  }
617  {
618  const ::uno::Any* pCont = nullptr;
620  const ::uno::Any* pPos = nullptr;
622  const ::uno::Any* pName = nullptr;
624  if(pCont||pPos||pName)
625  {
626  SvxProtectItem aProt ( rFromSet.Get ( RES_PROTECT ) );
627  if(pCont)
628  bRet &= static_cast<SfxPoolItem&>(aProt).PutValue(*pCont, MID_PROTECT_CONTENT);
629  if(pPos )
630  bRet &= static_cast<SfxPoolItem&>(aProt).PutValue(*pPos, MID_PROTECT_POSITION);
631  if(pName)
632  bRet &= static_cast<SfxPoolItem&>(aProt).PutValue(*pName, MID_PROTECT_SIZE);
633  rToSet.Put(aProt);
634  }
635  }
636  {
637  const ::uno::Any* pHori = nullptr;
639  const ::uno::Any* pHoriP = nullptr;
641  const ::uno::Any* pHoriR = nullptr;
643  const ::uno::Any* pPageT = nullptr;
645  if(pHori||pHoriP||pHoriR||pPageT)
646  {
647  SwFormatHoriOrient aOrient ( rFromSet.Get ( RES_HORI_ORIENT ) );
648  if(pHori )
649  bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pHori, MID_HORIORIENT_ORIENT);
650  if(pHoriP)
651  bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pHoriP, MID_HORIORIENT_POSITION|CONVERT_TWIPS);
652  if(pHoriR)
653  bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pHoriR, MID_HORIORIENT_RELATION);
654  if(pPageT)
655  bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pPageT, MID_HORIORIENT_PAGETOGGLE);
656  rToSet.Put(aOrient);
657  }
658  }
659 
660  {
661  const ::uno::Any* pVert = nullptr;
663  const ::uno::Any* pVertP = nullptr;
665  const ::uno::Any* pVertR = nullptr;
667  if(pVert||pVertP||pVertR)
668  {
669  SwFormatVertOrient aOrient ( rFromSet.Get ( RES_VERT_ORIENT ) );
670  if(pVert )
671  bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pVert, MID_VERTORIENT_ORIENT);
672  if(pVertP)
673  bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pVertP, MID_VERTORIENT_POSITION|CONVERT_TWIPS);
674  if(pVertR)
675  bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pVertR, MID_VERTORIENT_RELATION);
676  rToSet.Put(aOrient);
677  }
678  }
679  {
680  const ::uno::Any* pURL = nullptr;
682  const ::uno::Any* pTarget = nullptr;
683  GetProperty(RES_URL, MID_URL_TARGET, pTarget );
684  const ::uno::Any* pHyLNm = nullptr;
686  const ::uno::Any* pHySMp = nullptr;
688  if(pURL||pTarget||pHyLNm||pHySMp)
689  {
690  SwFormatURL aURL ( rFromSet.Get ( RES_URL ) );
691  if(pURL)
692  bRet &= static_cast<SfxPoolItem&>(aURL).PutValue(*pURL, MID_URL_URL);
693  if(pTarget)
694  bRet &= static_cast<SfxPoolItem&>(aURL).PutValue(*pTarget, MID_URL_TARGET);
695  if(pHyLNm)
696  bRet &= static_cast<SfxPoolItem&>(aURL).PutValue(*pHyLNm, MID_URL_HYPERLINKNAME );
697  if(pHySMp)
698  bRet &= static_cast<SfxPoolItem&>(aURL).PutValue(*pHySMp, MID_URL_SERVERMAP);
699  rToSet.Put(aURL);
700  }
701  }
702  const ::uno::Any* pL = nullptr;
704  const ::uno::Any* pR = nullptr;
706  if(pL||pR)
707  {
708  SvxLRSpaceItem aLR ( rFromSet.Get ( RES_LR_SPACE ) );
709  if(pL)
710  bRet &= static_cast<SfxPoolItem&>(aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS);
711  if(pR)
712  bRet &= static_cast<SfxPoolItem&>(aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS);
713  rToSet.Put(aLR);
714  }
715  const ::uno::Any* pT = nullptr;
717  const ::uno::Any* pB = nullptr;
719  if(pT||pB)
720  {
721  SvxULSpaceItem aTB ( rFromSet.Get ( RES_UL_SPACE ) );
722  if(pT)
723  bRet &= static_cast<SfxPoolItem&>(aTB).PutValue(*pT, MID_UP_MARGIN|CONVERT_TWIPS);
724  if(pB)
725  bRet &= static_cast<SfxPoolItem&>(aTB).PutValue(*pB, MID_LO_MARGIN|CONVERT_TWIPS);
726  rToSet.Put(aTB);
727  }
728  const ::uno::Any* pOp;
729  if(GetProperty(RES_OPAQUE, 0, pOp))
730  {
731  SvxOpaqueItem aOp ( rFromSet.Get ( RES_OPAQUE ) );
732  bRet &= static_cast<SfxPoolItem&>(aOp).PutValue(*pOp, 0);
733  rToSet.Put(aOp);
734  }
735  const ::uno::Any* pPrt;
736  if(GetProperty(RES_PRINT, 0, pPrt))
737  {
738  SvxPrintItem aPrt ( rFromSet.Get ( RES_PRINT ) );
739  bRet &= static_cast<SfxPoolItem&>(aPrt).PutValue(*pPrt, 0);
740  rToSet.Put(aPrt);
741  }
742  const ::uno::Any* pSh;
744  {
745  SvxShadowItem aSh ( rFromSet.Get ( RES_SHADOW ) );
746  bRet &= static_cast<SfxPoolItem&>(aSh).PutValue(*pSh, CONVERT_TWIPS);
747  rToSet.Put(aSh);
748  }
749  const ::uno::Any* pShTr;
751  {
752  SvxShadowItem aSh(rToSet.Get(RES_SHADOW));
753  bRet &= aSh.PutValue(*pShTr, MID_SHADOW_TRANSPARENCE);
754  rToSet.Put(aSh);
755  }
756  const ::uno::Any* pSur = nullptr;
758  const ::uno::Any* pSurCont = nullptr;
760  const ::uno::Any* pSurAnch = nullptr;
762  if(pSur || pSurAnch)
763  {
764  SwFormatSurround aSrnd ( rFromSet.Get ( RES_SURROUND ) );
765  if(pSur)
766  bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE);
767  if(pSurCont)
768  bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSurCont, MID_SURROUND_CONTOUR);
769  if(pSurAnch)
770  bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY);
771  rToSet.Put(aSrnd);
772  }
773  const ::uno::Any* pLeft = nullptr;
775  const ::uno::Any* pRight = nullptr;
777  const ::uno::Any* pTop = nullptr;
779  const ::uno::Any* pBottom = nullptr;
781  const ::uno::Any* pDistance = nullptr;
783  const ::uno::Any* pLeftDistance = nullptr;
785  const ::uno::Any* pRightDistance = nullptr;
787  const ::uno::Any* pTopDistance = nullptr;
789  const ::uno::Any* pBottomDistance = nullptr;
791  const ::uno::Any* pLineStyle = nullptr;
792  GetProperty(RES_BOX, LINE_STYLE, pLineStyle);
793  const ::uno::Any* pLineWidth = nullptr;
794  GetProperty(RES_BOX, LINE_WIDTH, pLineWidth);
795  if( pLeft || pRight || pTop || pBottom || pDistance ||
796  pLeftDistance || pRightDistance || pTopDistance || pBottomDistance ||
797  pLineStyle || pLineWidth )
798  {
799  SvxBoxItem aBox ( rFromSet.Get ( RES_BOX ) );
800  if( pLeft )
801  bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pLeft, CONVERT_TWIPS|LEFT_BORDER );
802  if( pRight )
803  bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pRight, CONVERT_TWIPS|RIGHT_BORDER );
804  if( pTop )
805  bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pTop, CONVERT_TWIPS|TOP_BORDER);
806  if( pBottom )
807  bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pBottom, CONVERT_TWIPS|BOTTOM_BORDER);
808  if( pDistance )
809  bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pDistance, CONVERT_TWIPS|BORDER_DISTANCE);
810  if( pLeftDistance )
811  bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pLeftDistance, CONVERT_TWIPS|LEFT_BORDER_DISTANCE);
812  if( pRightDistance )
813  bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pRightDistance, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE);
814  if( pTopDistance )
815  bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pTopDistance, CONVERT_TWIPS|TOP_BORDER_DISTANCE);
816  if( pBottomDistance )
817  bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pBottomDistance, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE);
818  if( pLineStyle )
819  bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pLineStyle, LINE_STYLE);
820  if( pLineWidth )
821  bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pLineWidth, LINE_WIDTH|CONVERT_TWIPS);
822  rToSet.Put(aBox);
823  }
824  {
825  const ::uno::Any* pRelH = nullptr;
827  const ::uno::Any* pRelHRelation = nullptr;
829  const ::uno::Any* pRelW = nullptr;
831  const ::uno::Any* pRelWRelation = nullptr;
833  const ::uno::Any* pSyncWidth = nullptr;
835  const ::uno::Any* pSyncHeight = nullptr;
837  const ::uno::Any* pWidth = nullptr;
839  const ::uno::Any* pHeight = nullptr;
841  const ::uno::Any* pSize = nullptr;
843  const ::uno::Any* pSizeType = nullptr;
845  const ::uno::Any* pWidthType = nullptr;
847  if( pWidth || pHeight ||pRelH || pRelHRelation || pRelW || pRelWRelation || pSize ||pSizeType ||
848  pWidthType ||pSyncWidth || pSyncHeight )
849  {
850  rSizeFound = true;
851  SwFormatFrameSize aFrameSz ( rFromSet.Get ( RES_FRM_SIZE ) );
852  if(pWidth)
853  bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH|CONVERT_TWIPS);
854  if(pHeight)
855  bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pHeight, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS);
856  if(pRelH )
857  bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pRelH, MID_FRMSIZE_REL_HEIGHT);
858  if (pRelHRelation)
859  bRet &= aFrameSz.PutValue(*pRelHRelation, MID_FRMSIZE_REL_HEIGHT_RELATION);
860  if(pRelW )
861  bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pRelW, MID_FRMSIZE_REL_WIDTH);
862  if (pRelWRelation)
863  bRet &= aFrameSz.PutValue(*pRelWRelation, MID_FRMSIZE_REL_WIDTH_RELATION);
864  if(pSyncWidth)
865  bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pSyncWidth, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT);
866  if(pSyncHeight)
867  bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pSyncHeight, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH);
868  if(pSize)
869  bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pSize, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
870  if(pSizeType)
871  bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pSizeType, MID_FRMSIZE_SIZE_TYPE);
872  if(pWidthType)
873  bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pWidthType, MID_FRMSIZE_WIDTH_TYPE);
874  if(!aFrameSz.GetWidth())
875  aFrameSz.SetWidth(MINFLY);
876  if(!aFrameSz.GetHeight())
877  aFrameSz.SetHeight(MINFLY);
878  rToSet.Put(aFrameSz);
879  }
880  else
881  {
882  rSizeFound = false;
883  SwFormatFrameSize aFrameSz;
884  constexpr sal_Int32 constTwips_1cm = o3tl::toTwips(1, o3tl::Length::cm);
885  awt::Size aSize;
886  aSize.Width = constTwips_1cm;
887  aSize.Height = constTwips_1cm;
888  ::uno::Any aSizeVal;
889  aSizeVal <<= aSize;
890  static_cast<SfxPoolItem&>(aFrameSz).PutValue(aSizeVal, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
891  rToSet.Put(aFrameSz);
892  }
893  }
894  const ::uno::Any* pFrameDirection = nullptr;
895  GetProperty(RES_FRAMEDIR, 0, pFrameDirection);
896  if(pFrameDirection)
897  {
898  SvxFrameDirectionItem aAttr(SvxFrameDirection::Horizontal_LR_TB, RES_FRAMEDIR);
899  aAttr.PutValue(*pFrameDirection, 0);
900  rToSet.Put(aAttr);
901  }
902  const ::uno::Any* pUnknown = nullptr;
904  if(pUnknown)
905  {
907  aAttr.PutValue(*pUnknown, 0);
908  rToSet.Put(aAttr);
909  }
910 
911  // #i18732#
912  const ::uno::Any* pFollowTextFlow = nullptr;
914 
915  if (pFollowTextFlow)
916  {
917  SwFormatFollowTextFlow aFormatFollowTextFlow;
918  if( pFollowTextFlow )
919  {
920  aFormatFollowTextFlow.PutValue(*pFollowTextFlow, MID_FOLLOW_TEXT_FLOW);
921  }
922 
923  rToSet.Put(aFormatFollowTextFlow);
924  }
925 
926  // #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS
927  const ::uno::Any* pWrapInfluenceOnObjPos = nullptr;
929  const ::uno::Any* pAllowOverlap = nullptr;
931  if ( pWrapInfluenceOnObjPos || pAllowOverlap )
932  {
933  SwFormatWrapInfluenceOnObjPos aFormatWrapInfluenceOnObjPos;
934  if (pWrapInfluenceOnObjPos)
935  aFormatWrapInfluenceOnObjPos.PutValue( *pWrapInfluenceOnObjPos, MID_WRAP_INFLUENCE );
936  if (pAllowOverlap)
937  aFormatWrapInfluenceOnObjPos.PutValue( *pAllowOverlap, MID_ALLOW_OVERLAP );
938  rToSet.Put(aFormatWrapInfluenceOnObjPos);
939  }
940 
941  {
942  const ::uno::Any* pTextVertAdjust = nullptr;
943  GetProperty(RES_TEXT_VERT_ADJUST, 0, pTextVertAdjust);
944  if ( pTextVertAdjust )
945  {
946  SdrTextVertAdjustItem aTextVertAdjust( rFromSet.Get ( RES_TEXT_VERT_ADJUST ) );
947  bRet &= static_cast<SfxPoolItem&>(aTextVertAdjust).PutValue(*pTextVertAdjust, 0);
948  rToSet.Put(aTextVertAdjust);
949  }
950  }
951 
952  return bRet;
953 }
954 
955 namespace {
956 
957 class SwFrameProperties_Impl : public BaseFrameProperties_Impl
958 {
959 public:
960  SwFrameProperties_Impl();
961 
962  bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override;
963 };
964 
965 }
966 
967 SwFrameProperties_Impl::SwFrameProperties_Impl():
968  BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)*/ )
969 {
970 }
971 
972 static void lcl_FillCol ( SfxItemSet &rToSet, const ::SfxItemSet &rFromSet, const ::uno::Any *pAny)
973 {
974  if ( pAny )
975  {
976  SwFormatCol aCol ( rFromSet.Get ( RES_COL ) );
977  static_cast<SfxPoolItem&>(aCol).PutValue( *pAny, MID_COLUMNS);
978  rToSet.Put(aCol);
979  }
980 }
981 
982 bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItemSet&, bool& rSizeFound)
983 {
984  // Properties for all frames
985  const ::uno::Any *pStyleName;
986  SwDocStyleSheet* pStyle = nullptr;
987  bool bRet;
988 
989  if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
990  {
991  OUString sStyle;
992  *pStyleName >>= sStyle;
994  pStyle = static_cast<SwDocStyleSheet*>(pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
995  SfxStyleFamily::Frame));
996  }
997 
998  const ::uno::Any* pColumns = nullptr;
999  GetProperty (RES_COL, MID_COLUMNS, pColumns);
1000  if ( pStyle )
1001  {
1002  rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *pStyle ) );
1003  const ::SfxItemSet *pItemSet = &xStyle->GetItemSet();
1004  bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
1005  lcl_FillCol ( rSet, *pItemSet, pColumns );
1006  }
1007  else
1008  {
1009  const ::SfxItemSet *pItemSet = &pDoc->getIDocumentStylePoolAccess().GetFrameFormatFromPool( RES_POOLFRM_FRAME )->GetAttrSet();
1010  bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
1011  lcl_FillCol ( rSet, *pItemSet, pColumns );
1012  }
1013  const ::uno::Any* pEdit;
1014  if(GetProperty(RES_EDIT_IN_READONLY, 0, pEdit))
1015  {
1017  item.PutValue(*pEdit, 0);
1018  rSet.Put(item);
1019  }
1020  return bRet;
1021 }
1022 
1023 namespace {
1024 
1025 class SwGraphicProperties_Impl : public BaseFrameProperties_Impl
1026 {
1027 public:
1028  SwGraphicProperties_Impl();
1029 
1030  virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override;
1031 };
1032 
1033 }
1034 
1035 SwGraphicProperties_Impl::SwGraphicProperties_Impl( ) :
1036  BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC)*/ )
1037 {
1038 }
1039 
1040 static void lcl_FillMirror ( SfxItemSet &rToSet, const ::SfxItemSet &rFromSet, const ::uno::Any *pHEvenMirror, const ::uno::Any *pHOddMirror, const ::uno::Any *pVMirror, bool &rRet )
1041 {
1042  if(pHEvenMirror || pHOddMirror || pVMirror )
1043  {
1044  SwMirrorGrf aMirror ( rFromSet.Get ( RES_GRFATR_MIRRORGRF ) );
1045  if(pHEvenMirror)
1046  rRet &= static_cast<SfxPoolItem&>(aMirror).PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES);
1047  if(pHOddMirror)
1048  rRet &= static_cast<SfxPoolItem&>(aMirror).PutValue(*pHOddMirror, MID_MIRROR_HORZ_ODD_PAGES);
1049  if(pVMirror)
1050  rRet &= static_cast<SfxPoolItem&>(aMirror).PutValue(*pVMirror, MID_MIRROR_VERT);
1051  rToSet.Put(aMirror);
1052  }
1053 }
1054 
1055 bool SwGraphicProperties_Impl::AnyToItemSet(
1056  SwDoc* pDoc,
1057  SfxItemSet& rFrameSet,
1058  SfxItemSet& rGrSet,
1059  bool& rSizeFound)
1060 {
1061  // Properties for all frames
1062  bool bRet;
1063  const ::uno::Any *pStyleName;
1064  SwDocStyleSheet* pStyle = nullptr;
1065 
1066  if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
1067  {
1068  OUString sStyle;
1069  *pStyleName >>= sStyle;
1071  pStyle = static_cast<SwDocStyleSheet*>(pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
1072  SfxStyleFamily::Frame));
1073  }
1074 
1075  const ::uno::Any* pHEvenMirror = nullptr;
1076  const ::uno::Any* pHOddMirror = nullptr;
1077  const ::uno::Any* pVMirror = nullptr;
1081 
1082  if ( pStyle )
1083  {
1084  rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet(*pStyle) );
1085  const ::SfxItemSet *pItemSet = &xStyle->GetItemSet();
1086  bRet = FillBaseProperties(rFrameSet, *pItemSet, rSizeFound);
1087  lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
1088  }
1089  else
1090  {
1091  const ::SfxItemSet *pItemSet = &pDoc->getIDocumentStylePoolAccess().GetFrameFormatFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet();
1092  bRet = FillBaseProperties(rFrameSet, *pItemSet, rSizeFound);
1093  lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
1094  }
1095 
1096  static const ::sal_uInt16 nIDs[] =
1097  {
1109  0
1110  };
1111  const ::uno::Any* pAny;
1112  for(sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++)
1113  {
1114  sal_uInt8 nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0;
1115  if(GetProperty(nIDs[nIndex], nMId, pAny ))
1116  {
1117  std::unique_ptr<SfxPoolItem> pItem(::GetDfltAttr( nIDs[nIndex] )->Clone());
1118  bRet &= pItem->PutValue(*pAny, nMId );
1119  rGrSet.Put(std::move(pItem));
1120  }
1121  }
1122 
1123  return bRet;
1124 }
1125 
1126 namespace {
1127 
1128 class SwOLEProperties_Impl : public SwFrameProperties_Impl
1129 {
1130 public:
1131  SwOLEProperties_Impl() {}
1132 
1133  virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override;
1134 };
1135 
1136 }
1137 
1138 bool SwOLEProperties_Impl::AnyToItemSet(
1139  SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound)
1140 {
1141  const ::uno::Any* pTemp;
1142  if(!GetProperty(FN_UNO_CLSID, 0, pTemp) && !GetProperty(FN_UNO_STREAM_NAME, 0, pTemp)
1143  && !GetProperty(FN_EMBEDDED_OBJECT, 0, pTemp)
1144  && !GetProperty(FN_UNO_VISIBLE_AREA_WIDTH, 0, pTemp)
1145  && !GetProperty(FN_UNO_VISIBLE_AREA_HEIGHT, 0, pTemp) )
1146  return false;
1147  SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrameSet, rSet, rSizeFound);
1148 
1149  return true;
1150 }
1151 
1153 {
1154 public:
1155  uno::WeakReference<uno::XInterface> m_wThis;
1156  std::mutex m_Mutex; // just for OInterfaceContainerHelper4
1158 };
1159 
1160 const ::uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId()
1161 {
1162  static const comphelper::UnoIdInit theSwXFrameUnoTunnelId;
1163  return theSwXFrameUnoTunnelId.getSeq();
1164 }
1165 
1166 sal_Int64 SAL_CALL SwXFrame::getSomething( const ::uno::Sequence< sal_Int8 >& rId )
1167 {
1168  return comphelper::getSomethingImpl(rId, this);
1169 }
1170 
1171 
1173 {
1174  return "SwXFrame";
1175 }
1176 
1177 sal_Bool SwXFrame::supportsService(const OUString& rServiceName)
1178 {
1179  return cppu::supportsService(this, rServiceName);
1180 }
1181 
1182 uno::Sequence< OUString > SwXFrame::getSupportedServiceNames()
1183 {
1184  return { "com.sun.star.text.BaseFrame", "com.sun.star.text.TextContent", "com.sun.star.document.LinkTarget" };
1185 }
1186 
1187 SwXFrame::SwXFrame(FlyCntType eSet, const ::SfxItemPropertySet* pSet, SwDoc *pDoc)
1188  : m_pImpl(new Impl)
1189  , m_pFrameFormat(nullptr)
1190  , m_pPropSet(pSet)
1191  , m_pDoc(pDoc)
1192  , m_eType(eSet)
1193  , m_bIsDescriptor(true)
1194  , m_nDrawAspect(embed::Aspects::MSOLE_CONTENT)
1195  , m_nVisibleAreaWidth(0)
1196  , m_nVisibleAreaHeight(0)
1197 {
1198  // Register ourselves as a listener to the document (via the page descriptor)
1200  // get the property set for the default style data
1201  // First get the model
1202  uno::Reference < XModel > xModel = pDoc->GetDocShell()->GetBaseModel();
1203  // Ask the model for its family supplier interface
1204  uno::Reference < XStyleFamiliesSupplier > xFamilySupplier ( xModel, uno::UNO_QUERY );
1205  // Get the style families
1206  uno::Reference < XNameAccess > xFamilies = xFamilySupplier->getStyleFamilies();
1207  // Get the Frame family (and keep it for later)
1208  const ::uno::Any aAny = xFamilies->getByName ("FrameStyles");
1209  aAny >>= mxStyleFamily;
1210  // In the derived class, we'll ask mxStyleFamily for the relevant default style
1211  // mxStyleFamily is initialised in the SwXFrame constructor
1212  switch(m_eType)
1213  {
1214  case FLYCNTTYPE_FRM:
1215  {
1216  uno::Any aAny2 = mxStyleFamily->getByName ("Frame");
1217  aAny2 >>= mxStyleData;
1218  m_pProps.reset(new SwFrameProperties_Impl);
1219  }
1220  break;
1221  case FLYCNTTYPE_GRF:
1222  {
1223  uno::Any aAny2 = mxStyleFamily->getByName ("Graphics");
1224  aAny2 >>= mxStyleData;
1225  m_pProps.reset(new SwGraphicProperties_Impl);
1226  }
1227  break;
1228  case FLYCNTTYPE_OLE:
1229  {
1230  uno::Any aAny2 = mxStyleFamily->getByName ("OLE");
1231  aAny2 >>= mxStyleData;
1232  m_pProps.reset(new SwOLEProperties_Impl);
1233  }
1234  break;
1235 
1236  default:
1237  m_pProps.reset();
1238  break;
1239  }
1240 }
1241 
1242 SwXFrame::SwXFrame(SwFrameFormat& rFrameFormat, FlyCntType eSet, const ::SfxItemPropertySet* pSet)
1243  : m_pImpl(new Impl)
1244  , m_pFrameFormat(&rFrameFormat)
1245  , m_pPropSet(pSet)
1246  , m_pDoc(nullptr)
1247  , m_eType(eSet)
1248  , m_bIsDescriptor(false)
1249  , m_nDrawAspect(embed::Aspects::MSOLE_CONTENT)
1250  , m_nVisibleAreaWidth(0)
1251  , m_nVisibleAreaHeight(0)
1252 {
1253  StartListening(rFrameFormat.GetNotifier());
1254 }
1255 
1257 {
1258  SolarMutexGuard aGuard;
1259  m_pProps.reset();
1260  EndListeningAll();
1261 }
1262 
1263 template<class Interface, class NameLookupIsHard>
1264 uno::Reference<Interface>
1265 SwXFrame::CreateXFrame(SwDoc & rDoc, SwFrameFormat *const pFrameFormat)
1266 {
1267  assert(!pFrameFormat || &rDoc == pFrameFormat->GetDoc());
1268  uno::Reference<Interface> xFrame;
1269  if (pFrameFormat)
1270  {
1271  xFrame.set(pFrameFormat->GetXObject(), uno::UNO_QUERY); // cached?
1272  }
1273  if (!xFrame.is())
1274  {
1275  NameLookupIsHard *const pNew(pFrameFormat
1276  ? new NameLookupIsHard(*pFrameFormat)
1277  : new NameLookupIsHard(&rDoc));
1278  xFrame.set(pNew);
1279  if (pFrameFormat)
1280  {
1281  pFrameFormat->SetXObject(xFrame);
1282  }
1283  // need a permanent Reference to initialize m_wThis
1284  pNew->SwXFrame::m_pImpl->m_wThis = xFrame;
1285  }
1286  return xFrame;
1287 }
1288 
1290 {
1291  SolarMutexGuard aGuard;
1292  SwFrameFormat* pFormat = GetFrameFormat();
1293  if(pFormat)
1294  return pFormat->GetName();
1295  if(!m_bIsDescriptor)
1296  throw uno::RuntimeException();
1297  return m_sName;
1298 }
1299 
1300 void SwXFrame::setName(const OUString& rName)
1301 {
1302  SolarMutexGuard aGuard;
1303  SwFrameFormat* pFormat = GetFrameFormat();
1304  if(pFormat)
1305  {
1306  pFormat->GetDoc()->SetFlyName(static_cast<SwFlyFrameFormat&>(*pFormat), rName);
1307  if(pFormat->GetName() != rName)
1308  {
1309  throw uno::RuntimeException("SwXFrame::setName(): Illegal object name. Duplicate name?");
1310  }
1311  }
1312  else if(m_bIsDescriptor)
1313  m_sName = rName;
1314  else
1315  throw uno::RuntimeException();
1316 }
1317 
1318 uno::Reference< beans::XPropertySetInfo > SwXFrame::getPropertySetInfo()
1319 {
1320  uno::Reference< beans::XPropertySetInfo > xRef;
1321  static uno::Reference< beans::XPropertySetInfo > xFrameRef;
1322  static uno::Reference< beans::XPropertySetInfo > xGrfRef;
1323  static uno::Reference< beans::XPropertySetInfo > xOLERef;
1324  switch(m_eType)
1325  {
1326  case FLYCNTTYPE_FRM:
1327  if( !xFrameRef.is() )
1328  xFrameRef = m_pPropSet->getPropertySetInfo();
1329  xRef = xFrameRef;
1330  break;
1331  case FLYCNTTYPE_GRF:
1332  if( !xGrfRef.is() )
1333  xGrfRef = m_pPropSet->getPropertySetInfo();
1334  xRef = xGrfRef;
1335  break;
1336  case FLYCNTTYPE_OLE:
1337  if( !xOLERef.is() )
1338  xOLERef = m_pPropSet->getPropertySetInfo();
1339  xRef = xOLERef;
1340  break;
1341  default:
1342  ;
1343  }
1344  return xRef;
1345 }
1346 
1348 {
1349  SdrObject* pObject = rFormat.FindSdrObject();
1350  if( !pObject )
1351  {
1352  SwDoc *pDoc = rFormat.GetDoc();
1353  // #i52858# - method name changed
1354  SwFlyDrawContact* pContactObject(rFormat.GetOrCreateContact());
1355  pObject = pContactObject->GetMaster();
1356 
1357  const ::SwFormatSurround& rSurround = rFormat.GetSurround();
1358  pObject->SetLayer(
1359  ( css::text::WrapTextMode_THROUGH == rSurround.GetSurround() &&
1360  !rFormat.GetOpaque().GetValue() ) ? pDoc->getIDocumentDrawModelAccess().GetHellId()
1363  pDrawModel->GetPage(0)->InsertObject( pObject );
1364  }
1365 
1366  return pObject;
1367 }
1368 
1369 static SwFrameFormat *lcl_GetFrameFormat( const ::uno::Any& rValue, SwDoc *pDoc )
1370 {
1371  SwFrameFormat *pRet = nullptr;
1372  SwDocShell* pDocSh = pDoc->GetDocShell();
1373  if(pDocSh)
1374  {
1375  OUString uTemp;
1376  rValue >>= uTemp;
1377  OUString sStyle;
1378  SwStyleNameMapper::FillUIName(uTemp, sStyle,
1380  SwDocStyleSheet* pStyle =
1381  static_cast<SwDocStyleSheet*>(pDocSh->GetStyleSheetPool()->Find(sStyle,
1382  SfxStyleFamily::Frame));
1383  if(pStyle)
1384  pRet = pStyle->GetFrameFormat();
1385  }
1386 
1387  return pRet;
1388 }
1389 
1390 void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& _rValue)
1391 {
1392  SolarMutexGuard aGuard;
1393  SwFrameFormat* pFormat = GetFrameFormat();
1394 
1395  // Hack to support hidden property to transfer textDirection
1396  if(rPropertyName == "FRMDirection")
1397  {
1398  if (pFormat)
1399  {
1400  SvxFrameDirectionItem aItem(SvxFrameDirection::Environment, RES_FRAMEDIR);
1401  aItem.PutValue(_rValue, 0);
1402  GetFrameFormat()->SetFormatAttr(aItem);
1403  }
1404  else if(IsDescriptor())
1405  {
1406  m_pProps->SetProperty(o3tl::narrowing<sal_uInt16>(RES_FRAMEDIR), 0, _rValue);
1407  }
1408  return;
1409  }
1410 
1411  const ::SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
1412 
1413  if (!pEntry)
1414  {
1415  // Hack to skip the dummy CursorNotIgnoreTables property
1416  if (rPropertyName != "CursorNotIgnoreTables")
1417  throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast <cppu::OWeakObject*> (this));
1418  return;
1419  }
1420 
1421  const sal_uInt8 nMemberId(pEntry->nMemberId);
1422  uno::Any aValue(_rValue);
1423 
1424  // check for needed metric translation
1425  if(pEntry->nMoreFlags & PropertyMoreFlags::METRIC_ITEM)
1426  {
1427  bool bDoIt(true);
1428 
1429  if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
1430  {
1431  // exception: If these ItemTypes are used, do not convert when these are negative
1432  // since this means they are intended as percent values
1433  sal_Int32 nValue = 0;
1434 
1435  if(aValue >>= nValue)
1436  {
1437  bDoIt = nValue > 0;
1438  }
1439  }
1440 
1441  if(bDoIt)
1442  {
1443  const SwDoc* pDoc = (IsDescriptor() ? m_pDoc : GetFrameFormat()->GetDoc());
1444  const SfxItemPool& rPool = pDoc->GetAttrPool();
1445  const MapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));
1446 
1447  if(eMapUnit != MapUnit::Map100thMM)
1448  {
1449  SvxUnoConvertFromMM(eMapUnit, aValue);
1450  }
1451  }
1452  }
1453 
1454  if(pFormat)
1455  {
1456  bool bNextFrame = false;
1457  if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
1458  throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1459 
1460  SwDoc* pDoc = pFormat->GetDoc();
1461  if ( ((m_eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID)) ||
1462  (FN_PARAM_CONTOUR_PP == pEntry->nWID) ||
1463  (FN_UNO_IS_AUTOMATIC_CONTOUR == pEntry->nWID) ||
1464  (FN_UNO_IS_PIXEL_CONTOUR == pEntry->nWID) )
1465  {
1466  const ::SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
1467  if(pIdx)
1468  {
1469  SwNodeIndex aIdx(*pIdx, 1);
1470  SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
1471  if(pEntry->nWID == FN_PARAM_CONTOUR_PP)
1472  {
1473  drawing::PointSequenceSequence aParam;
1474  if(!aValue.hasValue())
1475  pNoText->SetContour(nullptr);
1476  else if(aValue >>= aParam)
1477  {
1478  tools::PolyPolygon aPoly(o3tl::narrowing<sal_uInt16>(aParam.getLength()));
1479  for(const ::drawing::PointSequence& rPointSeq : std::as_const(aParam))
1480  {
1481  sal_Int32 nPoints = rPointSeq.getLength();
1482  const ::awt::Point* pPoints = rPointSeq.getConstArray();
1483  tools::Polygon aSet( o3tl::narrowing<sal_uInt16>(nPoints) );
1484  for(sal_Int32 j = 0; j < nPoints; j++)
1485  {
1486  Point aPoint(pPoints[j].X, pPoints[j].Y);
1487  aSet.SetPoint(aPoint, o3tl::narrowing<sal_uInt16>(j));
1488  }
1489  // Close polygon if it isn't closed already.
1490  aSet.Optimize( PolyOptimizeFlags::CLOSE );
1491  aPoly.Insert( aSet );
1492  }
1493  pNoText->SetContourAPI( &aPoly );
1494  }
1495  else
1496  throw lang::IllegalArgumentException();
1497  }
1498  else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
1499  {
1500  pNoText->SetAutomaticContour( *o3tl::doAccess<bool>(aValue) );
1501  }
1502  else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
1503  {
1504  // The IsPixelContour property can only be set if there
1505  // is no contour, or if the contour has been set by the
1506  // API itself (or in other words, if the contour isn't
1507  // used already).
1508  if( pNoText->HasContour_() && pNoText->IsContourMapModeValid() )
1509  throw lang::IllegalArgumentException();
1510 
1511  pNoText->SetPixelContour( *o3tl::doAccess<bool>(aValue) );
1512 
1513  }
1514  else
1515  {
1516  SfxItemSet aSet(pNoText->GetSwAttrSet());
1517  m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
1518  pNoText->SetAttr(aSet);
1519  }
1520  }
1521  }
1522  // New attribute Title
1523  else if( FN_UNO_TITLE == pEntry->nWID )
1524  {
1525  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
1526  OUString sTitle;
1527  aValue >>= sTitle;
1528  // assure that <SdrObject> instance exists.
1529  GetOrCreateSdrObject(rFlyFormat);
1530  rFlyFormat.GetDoc()->SetFlyFrameTitle(rFlyFormat, sTitle);
1531  }
1532  else if (pEntry->nWID == FN_UNO_TOOLTIP)
1533  {
1534  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
1535  OUString sTooltip;
1536  aValue >>= sTooltip;
1537  rFlyFormat.SetObjTooltip(sTooltip);
1538  }
1539  // New attribute Description
1540  else if( FN_UNO_DESCRIPTION == pEntry->nWID )
1541  {
1542  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
1543  OUString sDescription;
1544  aValue >>= sDescription;
1545  // assure that <SdrObject> instance exists.
1546  GetOrCreateSdrObject(rFlyFormat);
1547  rFlyFormat.GetDoc()->SetFlyFrameDescription(rFlyFormat, sDescription);
1548  }
1549  else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
1550  {
1551  SwFrameFormat *pFrameFormat = lcl_GetFrameFormat( aValue, pFormat->GetDoc() );
1552  if( !pFrameFormat )
1553  throw lang::IllegalArgumentException();
1554 
1555  UnoActionContext aAction(pFormat->GetDoc());
1556 
1557  std::optional<SfxItemSet> pSet;
1558  // #i31771#, #i25798# - No adjustment of
1559  // anchor ( no call of method <sw_ChkAndSetNewAnchor(..)> ),
1560  // if document is currently in reading mode.
1561  if ( !pFormat->GetDoc()->IsInReading() )
1562  {
1563  // see SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Point* pDocPos )
1564  SwFlyFrame *pFly = nullptr;
1565  if (auto pFlyFrameFormat = dynamic_cast<const SwFlyFrameFormat*>(pFormat) )
1566  pFly = pFlyFrameFormat->GetFrame();
1567  if ( pFly )
1568  {
1569  if( const SwFormatAnchor* pItem = pFrameFormat->GetItemIfSet( RES_ANCHOR, false ))
1570  {
1571  pSet.emplace( pDoc->GetAttrPool(), aFrameFormatSetRange );
1572  pSet->Put( *pItem );
1573  if ( pFormat->GetDoc()->GetEditShell() != nullptr
1574  && !sw_ChkAndSetNewAnchor( *pFly, *pSet ) )
1575  {
1576  pSet.reset();
1577  }
1578  }
1579  }
1580  }
1581 
1582  pFormat->GetDoc()->SetFrameFormatToFly( *pFormat, *pFrameFormat, pSet ? &*pSet : nullptr );
1583  }
1584  else if (FN_UNO_GRAPHIC_FILTER == pEntry->nWID)
1585  {
1586  OUString sGrfName;
1587  OUString sFltName;
1588  SwDoc::GetGrfNms( *static_cast<SwFlyFrameFormat*>(pFormat), &sGrfName, &sFltName );
1589  aValue >>= sFltName;
1590  UnoActionContext aAction(pFormat->GetDoc());
1591  const ::SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
1592  if (pIdx)
1593  {
1594  SwNodeIndex aIdx(*pIdx, 1);
1595  SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
1596  if(!pGrfNode)
1597  {
1598  throw uno::RuntimeException();
1599  }
1600  SwPaM aGrfPaM(*pGrfNode);
1601  pFormat->GetDoc()->getIDocumentContentOperations().ReRead(aGrfPaM, sGrfName, sFltName, nullptr);
1602  }
1603  }
1604  else if (FN_UNO_GRAPHIC == pEntry->nWID || FN_UNO_GRAPHIC_URL == pEntry->nWID)
1605  {
1606  Graphic aGraphic;
1607  if (aValue.has<OUString>())
1608  {
1609  OUString aURL = aValue.get<OUString>();
1610  if (!aURL.isEmpty())
1611  {
1612  aGraphic = vcl::graphic::loadFromURL(aURL);
1613  }
1614  }
1615  else if (aValue.has<uno::Reference<graphic::XGraphic>>())
1616  {
1617  uno::Reference<graphic::XGraphic> xGraphic = aValue.get<uno::Reference<graphic::XGraphic>>();
1618  if (xGraphic.is())
1619  {
1620  aGraphic = Graphic(xGraphic);
1621  }
1622  }
1623 
1624  if (!aGraphic.IsNone())
1625  {
1626  const ::SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
1627  if (pIdx)
1628  {
1629  SwNodeIndex aIdx(*pIdx, 1);
1630  SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
1631  if (!pGrfNode)
1632  {
1633  throw uno::RuntimeException();
1634  }
1635  SwPaM aGrfPaM(*pGrfNode);
1636  pFormat->GetDoc()->getIDocumentContentOperations().ReRead(aGrfPaM, OUString(), OUString(), &aGraphic);
1637  }
1638  }
1639  }
1640  else if (FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID || FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID)
1641  {
1642  Graphic aGraphic;
1643  if (aValue.has<OUString>())
1644  {
1645  OUString aURL = aValue.get<OUString>();
1646  if (!aURL.isEmpty())
1647  {
1648  aGraphic = vcl::graphic::loadFromURL(aURL);
1649  }
1650  }
1651  else if (aValue.has<uno::Reference<graphic::XGraphic>>())
1652  {
1653  uno::Reference<graphic::XGraphic> xGraphic = aValue.get<uno::Reference<graphic::XGraphic>>();
1654  if (xGraphic.is())
1655  {
1656  aGraphic = Graphic(xGraphic);
1657  }
1658  }
1659 
1660  if (!aGraphic.IsNone())
1661  {
1662  const ::SwFormatContent* pCnt = &pFormat->GetContent();
1663  if ( pCnt->GetContentIdx() && pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ] )
1664  {
1665  SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ]->GetOLENode();
1666 
1667  if ( pOleNode )
1668  {
1669  svt::EmbeddedObjectRef &rEmbeddedObject = pOleNode->GetOLEObj().GetObject();
1670  rEmbeddedObject.SetGraphic(aGraphic, OUString() );
1671  }
1672  }
1673  }
1674  }
1675  else if((bNextFrame = (rPropertyName == UNO_NAME_CHAIN_NEXT_NAME))
1676  || rPropertyName == UNO_NAME_CHAIN_PREV_NAME)
1677  {
1678  OUString sChainName;
1679  aValue >>= sChainName;
1680  if (sChainName.isEmpty())
1681  {
1682  if(bNextFrame)
1683  pDoc->Unchain(*pFormat);
1684  else
1685  {
1686  const SwFormatChain& aChain( pFormat->GetChain() );
1687  SwFrameFormat *pPrev = aChain.GetPrev();
1688  if(pPrev)
1689  pDoc->Unchain(*pPrev);
1690  }
1691  }
1692  else
1693  {
1694  const size_t nCount = pDoc->GetFlyCount(FLYCNTTYPE_FRM);
1695 
1696  SwFrameFormat* pChain = nullptr;
1697  for( size_t i = 0; i < nCount; ++i )
1698  {
1699  SwFrameFormat* pFormat2 = pDoc->GetFlyNum(i, FLYCNTTYPE_FRM);
1700  if(sChainName == pFormat2->GetName() )
1701  {
1702  pChain = pFormat2;
1703  break;
1704  }
1705  }
1706  if(pChain)
1707  {
1708  SwFrameFormat* pSource = bNextFrame ? pFormat : pChain;
1709  SwFrameFormat* pDest = bNextFrame ? pChain: pFormat;
1710  pDoc->Chain(*pSource, *pDest);
1711  }
1712  }
1713  }
1714  else if(FN_UNO_Z_ORDER == pEntry->nWID)
1715  {
1716  sal_Int32 nZOrder = - 1;
1717  aValue >>= nZOrder;
1718 
1719  // Don't set an explicit ZOrder on TextBoxes.
1720  if( nZOrder >= 0 && !SwTextBoxHelper::isTextBox(pFormat, RES_FLYFRMFMT) )
1721  {
1722  SdrObject* pObject =
1723  GetOrCreateSdrObject( static_cast<SwFlyFrameFormat&>(*pFormat) );
1724  SwDrawModel *pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel();
1725  pDrawModel->GetPage(0)->
1726  SetObjectOrdNum(pObject->GetOrdNum(), nZOrder);
1727  }
1728  }
1729  else if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == nMemberId)
1730  {
1731  bool bDone = false;
1732  uno::Reference<text::XTextFrame> xFrame;
1733  if(aValue >>= xFrame)
1734  {
1735  SwXFrame* pFrame = comphelper::getFromUnoTunnel<SwXFrame>(xFrame);
1736  if(pFrame && this != pFrame && pFrame->GetFrameFormat() && pFrame->GetFrameFormat()->GetDoc() == pDoc)
1737  {
1739  aSet.SetParent(&pFormat->GetAttrSet());
1740  SwFormatAnchor aAnchor = static_cast<const SwFormatAnchor&>(aSet.Get(pEntry->nWID));
1741 
1742  SwPosition aPos(*pFrame->GetFrameFormat()->GetContent().GetContentIdx());
1743  aAnchor.SetAnchor(&aPos);
1744  aAnchor.SetType(RndStdIds::FLY_AT_FLY);
1745  aSet.Put(aAnchor);
1746  pDoc->SetFlyFrameAttr( *pFormat, aSet );
1747  bDone = true;
1748  }
1749  }
1750  if(!bDone)
1751  throw lang::IllegalArgumentException();
1752  }
1753  else
1754  {
1755  // standard UNO API write attributes
1756  // adapt former attr from SvxBrushItem::PutValue to new items XATTR_FILL_FIRST, XATTR_FILL_LAST
1760 
1761  // FillAttribute support
1763  aSet( pDoc->GetAttrPool());
1764  bool bDone(false);
1765 
1766  aSet.SetParent(&pFormat->GetAttrSet());
1767 
1768  if(RES_BACKGROUND == pEntry->nWID)
1769  {
1770  const SwAttrSet& rSet = pFormat->GetAttrSet();
1771  const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
1772  std::unique_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
1773 
1774  aChangedBrushItem->PutValue(aValue, nMemberId);
1775 
1776  if(*aChangedBrushItem != *aOriginalBrushItem)
1777  {
1778  setSvxBrushItemAsFillAttributesToTargetSet(*aChangedBrushItem, aSet);
1779  pFormat->GetDoc()->SetFlyFrameAttr( *pFormat, aSet );
1780  }
1781 
1782  bDone = true;
1783  }
1784  else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
1785  {
1786  drawing::BitmapMode eMode;
1787 
1788  if(!(aValue >>= eMode))
1789  {
1790  sal_Int32 nMode = 0;
1791 
1792  if(!(aValue >>= nMode))
1793  {
1794  throw lang::IllegalArgumentException();
1795  }
1796 
1797  eMode = static_cast<drawing::BitmapMode>(nMode);
1798  }
1799 
1800  aSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
1801  aSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
1802  pFormat->GetDoc()->SetFlyFrameAttr( *pFormat, aSet );
1803  bDone = true;
1804  }
1805 
1806  switch(nMemberId)
1807  {
1808  case MID_NAME:
1809  {
1810  // when named items get set, replace these with the NameOrIndex items
1811  // which exist already in the pool
1812  switch(pEntry->nWID)
1813  {
1814  case XATTR_FILLGRADIENT:
1815  case XATTR_FILLHATCH:
1816  case XATTR_FILLBITMAP:
1818  {
1819  OUString aTempName;
1820 
1821  if(!(aValue >>= aTempName ))
1822  {
1823  throw lang::IllegalArgumentException();
1824  }
1825 
1826  bDone = SvxShape::SetFillAttribute(pEntry->nWID, aTempName, aSet);
1827  break;
1828  }
1829  default:
1830  {
1831  break;
1832  }
1833  }
1834  break;
1835  }
1836  case MID_BITMAP:
1837  {
1838  switch(pEntry->nWID)
1839  {
1840  case XATTR_FILLBITMAP:
1841  {
1842  const Graphic aNullGraphic;
1843  XFillBitmapItem aXFillBitmapItem(aNullGraphic);
1844 
1845  aXFillBitmapItem.PutValue(aValue, nMemberId);
1846  aSet.Put(aXFillBitmapItem);
1847  bDone = true;
1848  break;
1849  }
1850  default:
1851  {
1852  break;
1853  }
1854  }
1855  break;
1856  }
1857  default:
1858  {
1859  break;
1860  }
1861  }
1862 
1863  if(!bDone)
1864  {
1865  m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
1866  }
1867 
1868  if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == nMemberId)
1869  {
1870  SwFormatAnchor aAnchor = static_cast<const SwFormatAnchor&>(aSet.Get(pEntry->nWID));
1871  if(aAnchor.GetAnchorId() == RndStdIds::FLY_AT_FLY)
1872  {
1873  const ::SwPosition* pPosition = aAnchor.GetContentAnchor();
1874  SwFrameFormat* pFlyFormat = pPosition ? pPosition->nNode.GetNode().GetFlyFormat() : nullptr;
1875  if(!pFlyFormat || pFlyFormat->Which() == RES_DRAWFRMFMT)
1876  {
1877  lang::IllegalArgumentException aExcept;
1878  aExcept.Message = "Anchor to frame: no frame found";
1879  throw aExcept;
1880  }
1881  else
1882  {
1883  SwPosition aPos = *pPosition;
1884  aPos.nNode = *pFlyFormat->GetContent().GetContentIdx();
1885  aAnchor.SetAnchor(&aPos);
1886  aSet.Put(aAnchor);
1887  }
1888  }
1889  else if ((aAnchor.GetAnchorId() != RndStdIds::FLY_AT_PAGE) &&
1890  !aAnchor.GetContentAnchor())
1891  {
1892  SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
1893  SwPaM aPam(rNode);
1894  aPam.Move( fnMoveBackward, GoInDoc );
1895  aAnchor.SetAnchor( aPam.Start() );
1896  aSet.Put(aAnchor);
1897  }
1898 
1899  // #i31771#, #i25798# - No adjustment of
1900  // anchor ( no call of method <sw_ChkAndSetNewAnchor(..)> ),
1901  // if document is currently in reading mode.
1902  if ( !pFormat->GetDoc()->IsInReading() )
1903  {
1904  // see SwFEShell::SetFlyFrameAttr( SfxItemSet& rSet )
1905  SwFlyFrame *pFly = nullptr;
1906  if (auto pFrameFormat = dynamic_cast<SwFlyFrameFormat*>( pFormat) )
1907  pFly = pFrameFormat->GetFrame();
1908  if (pFly)
1909  {
1910  if( const SwFormatAnchor* pItem = aSet.GetItemIfSet( RES_ANCHOR, false ))
1911  {
1912  aSet.Put( *pItem );
1913  if ( pFormat->GetDoc()->GetEditShell() != nullptr )
1914  {
1915  sw_ChkAndSetNewAnchor( *pFly, aSet );
1916  }
1917  }
1918  }
1919  }
1920 
1921  pFormat->GetDoc()->SetFlyFrameAttr( *pFormat, aSet );
1922  }
1923  else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_STREAM_NAME == pEntry->nWID || FN_EMBEDDED_OBJECT == pEntry->nWID)
1924  {
1925  throw lang::IllegalArgumentException();
1926  }
1927  else
1928  {
1929  pFormat->SetFormatAttr(aSet);
1930  }
1931  }
1932  }
1933  else if(IsDescriptor())
1934  {
1935  m_pProps->SetProperty(pEntry->nWID, nMemberId, aValue);
1936  if( FN_UNO_FRAME_STYLE_NAME == pEntry->nWID )
1937  {
1938  OUString sStyleName;
1939  aValue >>= sStyleName;
1940  try
1941  {
1942  uno::Any aAny = mxStyleFamily->getByName ( sStyleName );
1943  aAny >>= mxStyleData;
1944  }
1945  catch ( container::NoSuchElementException const & )
1946  {
1947  }
1948  catch ( lang::WrappedTargetException const & )
1949  {
1950  }
1951  catch ( uno::RuntimeException const & )
1952  {
1953  }
1954  }
1955  else if (FN_UNO_DRAW_ASPECT == pEntry->nWID)
1956  {
1957  OUString sAspect = "";
1958  aValue >>= sAspect;
1959 
1960  if (sAspect == "Icon")
1961  m_nDrawAspect = embed::Aspects::MSOLE_ICON;
1962  else if (sAspect == "Content")
1963  m_nDrawAspect = embed::Aspects::MSOLE_CONTENT;
1964  }
1965  else if (FN_UNO_VISIBLE_AREA_WIDTH == pEntry->nWID)
1966  {
1967  OUString sAspect = "";
1968  aValue >>= sAspect;
1969  m_nVisibleAreaWidth = sAspect.toInt64();
1970  }
1971  else if (FN_UNO_VISIBLE_AREA_HEIGHT == pEntry->nWID)
1972  {
1973  OUString sAspect = "";
1974  aValue >>= sAspect;
1975  m_nVisibleAreaHeight = sAspect.toInt64();
1976  }
1977  }
1978  else
1979  throw uno::RuntimeException();
1980 }
1981 
1982 namespace
1983 {
1985 class DisplayLockGuard
1986 {
1987  bool m_bLock;
1988 
1989 public:
1990  DisplayLockGuard()
1991  {
1992  m_bLock = ErrorRegistry::GetLock();
1993  ErrorRegistry::SetLock(true);
1994  }
1995 
1996  ~DisplayLockGuard() { ErrorRegistry::SetLock(m_bLock); }
1997 };
1998 }
1999 
2000 uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
2001 {
2002  SolarMutexGuard aGuard;
2003  DisplayLockGuard aDisplayGuard;
2004  uno::Any aAny;
2005  SwFrameFormat* pFormat = GetFrameFormat();
2006  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
2007  if (!pEntry)
2008  throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2009 
2010  const sal_uInt8 nMemberId(pEntry->nMemberId);
2011 
2012  if(FN_UNO_ANCHOR_TYPES == pEntry->nWID)
2013  {
2014  uno::Sequence<text::TextContentAnchorType> aTypes
2015  {
2016  text::TextContentAnchorType_AT_PARAGRAPH,
2017  text::TextContentAnchorType_AS_CHARACTER,
2018  text::TextContentAnchorType_AT_PAGE,
2019  text::TextContentAnchorType_AT_FRAME,
2020  text::TextContentAnchorType_AT_CHARACTER
2021  };
2022  aAny <<= aTypes;
2023  }
2024  else if(pFormat)
2025  {
2026  if( ((m_eType == FLYCNTTYPE_GRF) || (m_eType == FLYCNTTYPE_OLE)) &&
2027  (isGRFATR(pEntry->nWID) ||
2028  pEntry->nWID == FN_PARAM_CONTOUR_PP ||
2029  pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ||
2030  pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR ))
2031  {
2032  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2033  if(pIdx)
2034  {
2035  SwNodeIndex aIdx(*pIdx, 1);
2036  SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
2037  if(pEntry->nWID == FN_PARAM_CONTOUR_PP)
2038  {
2039  tools::PolyPolygon aContour;
2040  if( pNoText->GetContourAPI( aContour ) )
2041  {
2042  drawing::PointSequenceSequence aPtSeq(aContour.Count());
2043  drawing::PointSequence* pPSeq = aPtSeq.getArray();
2044  for(sal_uInt16 i = 0; i < aContour.Count(); i++)
2045  {
2046  const tools::Polygon& rPoly = aContour.GetObject(i);
2047  pPSeq[i].realloc(rPoly.GetSize());
2048  awt::Point* pPoints = pPSeq[i].getArray();
2049  for(sal_uInt16 j = 0; j < rPoly.GetSize(); j++)
2050  {
2051  const Point& rPoint = rPoly.GetPoint(j);
2052  pPoints[j].X = rPoint.X();
2053  pPoints[j].Y = rPoint.Y();
2054  }
2055  }
2056  aAny <<= aPtSeq;
2057  }
2058  }
2059  else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
2060  {
2061  aAny <<= pNoText->HasAutomaticContour();
2062  }
2063  else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
2064  {
2065  aAny <<= pNoText->IsPixelContour();
2066  }
2067  else
2068  {
2069  const SfxItemSet& aSet(pNoText->GetSwAttrSet());
2070  m_pPropSet->getPropertyValue(*pEntry, aSet, aAny);
2071  }
2072  }
2073  }
2074  else if (FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID)
2075  {
2076  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2077  uno::Reference<graphic::XGraphic> xGraphic;
2078 
2079  if (pIdx)
2080  {
2081  SwNodeIndex aIdx(*pIdx, 1);
2082  SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
2083  if (!pGrfNode)
2084  throw uno::RuntimeException();
2085 
2086  const GraphicObject* pGraphicObject = pGrfNode->GetReplacementGrfObj();
2087 
2088  if (pGraphicObject)
2089  {
2090  xGraphic = pGraphicObject->GetGraphic().GetXGraphic();
2091  }
2092  }
2093  aAny <<= xGraphic;
2094  }
2095  else if( FN_UNO_GRAPHIC_FILTER == pEntry->nWID )
2096  {
2097  OUString sFltName;
2098  SwDoc::GetGrfNms( *static_cast<SwFlyFrameFormat*>(pFormat), nullptr, &sFltName );
2099  aAny <<= sFltName;
2100  }
2101  else if( FN_UNO_GRAPHIC_URL == pEntry->nWID )
2102  {
2103  throw uno::RuntimeException("Getting from this property is not supported");
2104  }
2105  else if( FN_UNO_GRAPHIC == pEntry->nWID )
2106  {
2107  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2108  if(pIdx)
2109  {
2110  SwNodeIndex aIdx(*pIdx, 1);
2111  SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
2112  if(!pGrfNode)
2113  throw uno::RuntimeException();
2114  aAny <<= pGrfNode->GetGrf().GetXGraphic();
2115  }
2116  }
2117  else if( FN_UNO_TRANSFORMED_GRAPHIC == pEntry->nWID
2118  || FN_UNO_GRAPHIC_PREVIEW == pEntry->nWID )
2119  {
2120  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2121  if(pIdx)
2122  {
2123  SwNodeIndex aIdx(*pIdx, 1);
2124  SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
2125  if(!pGrfNode)
2126  throw uno::RuntimeException();
2127 
2128  SwDoc* pDoc = pFormat->GetDoc();
2129  if (pDoc)
2130  {
2131  const SwEditShell* pEditShell = pDoc->GetEditShell();
2132  if (pEditShell)
2133  {
2134  SwFrame* pCurrFrame = pEditShell->GetCurrFrame(false);
2135  GraphicAttr aGraphicAttr;
2136  pGrfNode->GetGraphicAttr( aGraphicAttr, pCurrFrame );
2137  const GraphicObject aGraphicObj = pGrfNode->GetGrfObj();
2138 
2139  awt::Size aFrameSize = getSize();
2140  Size aSize100thmm(aFrameSize.Width, aFrameSize.Height);
2141  Size aSize = OutputDevice::LogicToLogic(aSize100thmm, MapMode(MapUnit::Map100thMM), aGraphicObj.GetPrefMapMode());
2142 
2143  if (FN_UNO_GRAPHIC_PREVIEW == pEntry->nWID)
2144  {
2145  double fX = static_cast<double>(aSize.getWidth()) / 1280;
2146  double fY = static_cast<double>(aSize.getHeight()) / 720;
2147  double fFactor = fX > fY ? fX : fY;
2148  if (fFactor > 1.0)
2149  {
2150  aSize.setWidth(aSize.getWidth() / fFactor);
2151  aSize.setHeight(aSize.getHeight() / fFactor);
2152  }
2153  }
2154 
2155  Graphic aGraphic = aGraphicObj.GetTransformedGraphic(aSize, aGraphicObj.GetPrefMapMode(), aGraphicAttr);
2156  aAny <<= aGraphic.GetXGraphic();
2157  }
2158  }
2159  }
2160  }
2161  else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
2162  {
2164  }
2165  // #i73249#
2166  else if( FN_UNO_TITLE == pEntry->nWID )
2167  {
2168  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
2169  // assure that <SdrObject> instance exists.
2170  GetOrCreateSdrObject(rFlyFormat);
2171  aAny <<= rFlyFormat.GetObjTitle();
2172  }
2173  else if (pEntry->nWID == FN_UNO_TOOLTIP)
2174  {
2175  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
2176  aAny <<= rFlyFormat.GetObjTooltip();
2177  }
2178  // New attribute Description
2179  else if( FN_UNO_DESCRIPTION == pEntry->nWID )
2180  {
2181  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
2182  // assure that <SdrObject> instance exists.
2183  GetOrCreateSdrObject(rFlyFormat);
2184  aAny <<= rFlyFormat.GetObjDescription();
2185  }
2186  else if(m_eType == FLYCNTTYPE_GRF &&
2187  (rPropertyName == UNO_NAME_ACTUAL_SIZE))
2188  {
2189  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2190  if(pIdx)
2191  {
2192  SwNodeIndex aIdx(*pIdx, 1);
2193  Size aActSize = aIdx.GetNode().GetNoTextNode()->GetTwipSize();
2194  awt::Size aTmp;
2195  aTmp.Width = convertTwipToMm100(aActSize.Width());
2196  aTmp.Height = convertTwipToMm100(aActSize.Height());
2197  aAny <<= aTmp;
2198  }
2199  }
2200  else if(FN_PARAM_LINK_DISPLAY_NAME == pEntry->nWID)
2201  {
2202  aAny <<= pFormat->GetName();
2203  }
2204  else if(FN_UNO_Z_ORDER == pEntry->nWID)
2205  {
2206  const SdrObject* pObj = pFormat->FindRealSdrObject();
2207  if( pObj == nullptr )
2208  pObj = pFormat->FindSdrObject();
2209  if( pObj )
2210  {
2211  aAny <<= static_cast<sal_Int32>(pObj->GetOrdNum());
2212  }
2213  }
2214  else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_MODEL == pEntry->nWID||
2215  FN_UNO_COMPONENT == pEntry->nWID ||FN_UNO_STREAM_NAME == pEntry->nWID||
2216  FN_EMBEDDED_OBJECT == pEntry->nWID)
2217  {
2218  SwDoc* pDoc = pFormat->GetDoc();
2219  const SwFormatContent* pCnt = &pFormat->GetContent();
2220  OSL_ENSURE( pCnt->GetContentIdx() &&
2221  pDoc->GetNodes()[ pCnt->GetContentIdx()->
2222  GetIndex() + 1 ]->GetOLENode(), "no OLE-Node?");
2223 
2224  SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetContentIdx()
2225  ->GetIndex() + 1 ]->GetOLENode();
2226  uno::Reference < embed::XEmbeddedObject > xIP = pOleNode->GetOLEObj().GetOleRef();
2227  OUString aHexCLSID;
2228  {
2229  SvGlobalName aClassName( xIP->getClassID() );
2230  aHexCLSID = aClassName.GetHexName();
2231  if(FN_UNO_CLSID != pEntry->nWID)
2232  {
2234  {
2235  uno::Reference < lang::XComponent > xComp( xIP->getComponent(), uno::UNO_QUERY );
2236  uno::Reference < frame::XModel > xModel( xComp, uno::UNO_QUERY );
2237  if ( FN_EMBEDDED_OBJECT == pEntry->nWID )
2238  {
2239  // when exposing the EmbeddedObject, ensure it has a client site
2240  OSL_ENSURE( pDoc->GetDocShell(), "no doc shell => no client site" );
2241  if ( pDoc->GetDocShell() )
2242  pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP, embed::Aspects::MSOLE_CONTENT ) );
2243  aAny <<= xIP;
2244  }
2245  else if ( xModel.is() )
2246  aAny <<= xModel;
2247  else if ( FN_UNO_COMPONENT == pEntry->nWID )
2248  aAny <<= xComp;
2249  }
2250  }
2251  }
2252 
2253  if(FN_UNO_CLSID == pEntry->nWID)
2254  aAny <<= aHexCLSID;
2255  else if(FN_UNO_STREAM_NAME == pEntry->nWID)
2256  {
2257  aAny <<= pOleNode->GetOLEObj().GetCurrentPersistName();
2258  }
2259  else if(FN_EMBEDDED_OBJECT == pEntry->nWID)
2260  {
2261  aAny <<= pOleNode->GetOLEObj().GetOleRef();
2262  }
2263  }
2264  else if(WID_LAYOUT_SIZE == pEntry->nWID)
2265  {
2266  // format document completely in order to get correct value
2267  pFormat->GetDoc()->GetEditShell()->CalcLayout();
2268 
2269  SwFrame* pTmpFrame = SwIterator<SwFrame,SwFormat>( *pFormat ).First();
2270  if ( pTmpFrame )
2271  {
2272  OSL_ENSURE( pTmpFrame->isFrameAreaDefinitionValid(), "frame not valid" );
2273  const SwRect &rRect = pTmpFrame->getFrameArea();
2274  Size aMM100Size = o3tl::convert(
2275  Size( rRect.Width(), rRect.Height() ),
2277  aAny <<= awt::Size( aMM100Size.Width(), aMM100Size.Height() );
2278  }
2279  }
2280  else if(pEntry->nWID == FN_UNO_PARENT_TEXT)
2281  {
2282  if (!m_xParentText.is())
2283  {
2284  const SwPosition* pContentAnchor = pFormat->GetAnchor().GetContentAnchor();
2285  if (pContentAnchor)
2286  {
2287  m_xParentText = sw::CreateParentXText(*pFormat->GetDoc(), *pContentAnchor);
2288  }
2289  }
2290  aAny <<= m_xParentText;
2291  }
2292  else
2293  {
2294  // standard UNO API read attributes
2295  // adapt former attr from SvxBrushItem::PutValue to new items XATTR_FILL_FIRST, XATTR_FILL_LAST
2296  const SwAttrSet& rSet = pFormat->GetAttrSet();
2297  bool bDone(false);
2298 
2299  if(RES_BACKGROUND == pEntry->nWID)
2300  {
2301  const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
2302 
2303  if(!aOriginalBrushItem->QueryValue(aAny, nMemberId))
2304  {
2305  OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
2306  }
2307 
2308  bDone = true;
2309  }
2310  else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
2311  {
2312  if (rSet.Get(XATTR_FILLBMP_TILE).GetValue())
2313  {
2314  aAny <<= drawing::BitmapMode_REPEAT;
2315  }
2316  else if (rSet.Get(XATTR_FILLBMP_STRETCH).GetValue())
2317  {
2318  aAny <<= drawing::BitmapMode_STRETCH;
2319  }
2320  else
2321  {
2322  aAny <<= drawing::BitmapMode_NO_REPEAT;
2323  }
2324 
2325  bDone = true;
2326  }
2327 
2328  if(!bDone)
2329  {
2330  m_pPropSet->getPropertyValue(*pEntry, rSet, aAny);
2331  }
2332  }
2333  }
2334  else if(IsDescriptor())
2335  {
2336  if ( ! m_pDoc )
2337  throw uno::RuntimeException();
2338  if(WID_LAYOUT_SIZE != pEntry->nWID) // there is no LayoutSize in a descriptor
2339  {
2340  const uno::Any* pAny = nullptr;
2341  if (!m_pProps->GetProperty(pEntry->nWID, nMemberId, pAny))
2342  aAny = mxStyleData->getPropertyValue( rPropertyName );
2343  else if ( pAny )
2344  aAny = *pAny;
2345  }
2346  }
2347  else
2348  throw uno::RuntimeException();
2349 
2350  if (pEntry->aType == ::cppu::UnoType<sal_Int16>::get() && pEntry->aType != aAny.getValueType())
2351  {
2352  // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
2353  sal_Int32 nValue = 0;
2354  aAny >>= nValue;
2355  aAny <<= static_cast<sal_Int16>(nValue);
2356  }
2357 
2358  // check for needed metric translation
2359  if(pEntry->nMoreFlags & PropertyMoreFlags::METRIC_ITEM)
2360  {
2361  bool bDoIt(true);
2362 
2363  if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
2364  {
2365  // exception: If these ItemTypes are used, do not convert when these are negative
2366  // since this means they are intended as percent values
2367  sal_Int32 nValue = 0;
2368 
2369  if(aAny >>= nValue)
2370  {
2371  bDoIt = nValue > 0;
2372  }
2373  }
2374 
2375  if(bDoIt)
2376  {
2377  const SwDoc* pDoc = (IsDescriptor() ? m_pDoc : GetFrameFormat()->GetDoc());
2378  const SfxItemPool& rPool = pDoc->GetAttrPool();
2379  const MapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));
2380 
2381  if(eMapUnit != MapUnit::Map100thMM)
2382  {
2383  SvxUnoConvertToMM(eMapUnit, aAny);
2384  }
2385  }
2386  }
2387 
2388  return aAny;
2389 }
2390 
2391 void SwXFrame::addPropertyChangeListener(const OUString& /*PropertyName*/,
2392  const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
2393 {
2394  OSL_FAIL("not implemented");
2395 }
2396 
2397 void SwXFrame::removePropertyChangeListener(const OUString& /*PropertyName*/,
2398  const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
2399 {
2400  OSL_FAIL("not implemented");
2401 }
2402 
2403 void SwXFrame::addVetoableChangeListener(const OUString& /*PropertyName*/,
2404  const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
2405 {
2406  OSL_FAIL("not implemented");
2407 }
2408 
2410  const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
2411 {
2412  OSL_FAIL("not implemented");
2413 }
2414 
2415 beans::PropertyState SwXFrame::getPropertyState( const OUString& rPropertyName )
2416 {
2417  SolarMutexGuard aGuard;
2418  uno::Sequence< OUString > aPropertyNames { rPropertyName };
2419  uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aPropertyNames);
2420  return aStates.getConstArray()[0];
2421 }
2422 
2423 uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
2424  const uno::Sequence< OUString >& aPropertyNames )
2425 {
2426  SolarMutexGuard aGuard;
2427  uno::Sequence< beans::PropertyState > aStates(aPropertyNames.getLength());
2428  auto [pStates, end] = asNonConstRange(aStates);
2429  SwFrameFormat* pFormat = GetFrameFormat();
2430  if(pFormat)
2431  {
2432  const OUString* pNames = aPropertyNames.getConstArray();
2433  const SwAttrSet& rFormatSet = pFormat->GetAttrSet();
2434  for(int i = 0; i < aPropertyNames.getLength(); i++)
2435  {
2436  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName(pNames[i]);
2437  if (!pEntry)
2438  throw beans::UnknownPropertyException("Unknown property: " + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
2439 
2440  if(pEntry->nWID == FN_UNO_ANCHOR_TYPES||
2441  pEntry->nWID == FN_PARAM_LINK_DISPLAY_NAME||
2442  FN_UNO_FRAME_STYLE_NAME == pEntry->nWID||
2443  FN_UNO_GRAPHIC == pEntry->nWID||
2444  FN_UNO_GRAPHIC_URL == pEntry->nWID||
2445  FN_UNO_GRAPHIC_FILTER == pEntry->nWID||
2446  FN_UNO_ACTUAL_SIZE == pEntry->nWID||
2447  FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
2448  {
2449  pStates[i] = beans::PropertyState_DIRECT_VALUE;
2450  }
2451  else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
2452  {
2453  if(SfxItemState::SET == rFormatSet.GetItemState(XATTR_FILLBMP_STRETCH, false)
2454  || SfxItemState::SET == rFormatSet.GetItemState(XATTR_FILLBMP_TILE, false))
2455  {
2456  pStates[i] = beans::PropertyState_DIRECT_VALUE;
2457  }
2458  else
2459  {
2460  pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
2461  }
2462  }
2463  // for FlyFrames we need to mark the used properties from type RES_BACKGROUND
2464  // as beans::PropertyState_DIRECT_VALUE to let users of this property call
2465  // getPropertyValue where the member properties will be mapped from the
2466  // fill attributes to the according SvxBrushItem entries
2467  else if (RES_BACKGROUND == pEntry->nWID)
2468  {
2470  pStates[i] = beans::PropertyState_DIRECT_VALUE;
2471  else
2472  pStates[i] = beans::PropertyState_DEFAULT_VALUE;
2473  }
2474  else
2475  {
2476  if ((m_eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID))
2477  {
2478  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2479  if(pIdx)
2480  {
2481  SwNodeIndex aIdx(*pIdx, 1);
2482  SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
2483  const SfxItemSet& aSet(pNoText->GetSwAttrSet());
2484  aSet.GetItemState(pEntry->nWID);
2485  if(SfxItemState::SET == aSet.GetItemState( pEntry->nWID, false ))
2486  pStates[i] = beans::PropertyState_DIRECT_VALUE;
2487  }
2488  }
2489  else
2490  {
2491  if(SfxItemState::SET == rFormatSet.GetItemState( pEntry->nWID, false ))
2492  pStates[i] = beans::PropertyState_DIRECT_VALUE;
2493  else
2494  pStates[i] = beans::PropertyState_DEFAULT_VALUE;
2495  }
2496  }
2497  }
2498  }
2499  else if(IsDescriptor())
2500  {
2501  std::fill(pStates, end, beans::PropertyState_DIRECT_VALUE);
2502  }
2503  else
2504  throw uno::RuntimeException();
2505  return aStates;
2506 }
2507 
2508 void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
2509 {
2510  SolarMutexGuard aGuard;
2511  SwFrameFormat* pFormat = GetFrameFormat();
2512  if(pFormat)
2513  {
2514  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
2515  if (!pEntry)
2516  throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2517  if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
2518  throw uno::RuntimeException("setPropertyToDefault: property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2519 
2520  if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
2521  {
2522  SwDoc* pDoc = pFormat->GetDoc();
2524  aSet.SetParent(&pFormat->GetAttrSet());
2525 
2526  aSet.ClearItem(XATTR_FILLBMP_STRETCH);
2527  aSet.ClearItem(XATTR_FILLBMP_TILE);
2528 
2529  pFormat->SetFormatAttr(aSet);
2530  }
2531  else if( pEntry->nWID &&
2532  pEntry->nWID != FN_UNO_ANCHOR_TYPES &&
2533  pEntry->nWID != FN_PARAM_LINK_DISPLAY_NAME)
2534  {
2535  if ( (m_eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID) )
2536  {
2537  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2538  if(pIdx)
2539  {
2540  SwNodeIndex aIdx(*pIdx, 1);
2541  SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
2542  {
2543  SfxItemSet aSet(pNoText->GetSwAttrSet());
2544  aSet.ClearItem(pEntry->nWID);
2545  pNoText->SetAttr(aSet);
2546  }
2547  }
2548  }
2549  // #i73249#
2550  else if( FN_UNO_TITLE == pEntry->nWID )
2551  {
2552  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
2553  // assure that <SdrObject> instance exists.
2554  GetOrCreateSdrObject(rFlyFormat);
2555  rFlyFormat.GetDoc()->SetFlyFrameTitle(rFlyFormat, OUString());
2556  }
2557  // New attribute Description
2558  else if( FN_UNO_DESCRIPTION == pEntry->nWID )
2559  {
2560  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
2561  // assure that <SdrObject> instance exists.
2562  GetOrCreateSdrObject(rFlyFormat);
2563  rFlyFormat.GetDoc()->SetFlyFrameDescription(rFlyFormat, OUString());
2564  }
2565  else
2566  {
2567  SwDoc* pDoc = pFormat->GetDoc();
2569  aSet.SetParent(&pFormat->GetAttrSet());
2570  aSet.ClearItem(pEntry->nWID);
2571  if(rPropertyName != UNO_NAME_ANCHOR_TYPE)
2572  pFormat->SetFormatAttr(aSet);
2573  }
2574  }
2575  else
2576  {
2577  bool bNextFrame = rPropertyName == UNO_NAME_CHAIN_NEXT_NAME;
2578  if( bNextFrame || rPropertyName == UNO_NAME_CHAIN_PREV_NAME )
2579  {
2580  SwDoc* pDoc = pFormat->GetDoc();
2581  if(bNextFrame)
2582  pDoc->Unchain(*pFormat);
2583  else
2584  {
2585  const SwFormatChain& aChain( pFormat->GetChain() );
2586  SwFrameFormat *pPrev = aChain.GetPrev();
2587  if(pPrev)
2588  pDoc->Unchain(*pPrev);
2589  }
2590  }
2591  }
2592  }
2593  else if(!IsDescriptor())
2594  throw uno::RuntimeException();
2595 
2596 }
2597 
2598 uno::Any SwXFrame::getPropertyDefault( const OUString& rPropertyName )
2599 {
2600  SolarMutexGuard aGuard;
2601  uno::Any aRet;
2602  SwFrameFormat* pFormat = GetFrameFormat();
2603  if(pFormat)
2604  {
2605  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
2606  if(!pEntry)
2607  throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2608 
2609  if ( pEntry->nWID < RES_FRMATR_END )
2610  {
2611  const SfxPoolItem& rDefItem =
2612  pFormat->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
2613  rDefItem.QueryValue(aRet, pEntry->nMemberId);
2614  }
2615 
2616  }
2617  else if(!IsDescriptor())
2618  throw uno::RuntimeException();
2619  return aRet;
2620 }
2621 
2623  const uno::Reference<lang::XEventListener> & xListener)
2624 {
2625  std::unique_lock aGuard(m_pImpl->m_Mutex);
2626  m_pImpl->m_EventListeners.addInterface(aGuard, xListener);
2627 }
2628 
2630  const uno::Reference<lang::XEventListener> & xListener)
2631 {
2632  std::unique_lock aGuard(m_pImpl->m_Mutex);
2633  m_pImpl->m_EventListeners.removeInterface(aGuard, xListener);
2634 }
2635 
2637 {
2638  mxStyleData.clear();
2639  mxStyleFamily.clear();
2640  m_pDoc = nullptr;
2641  uno::Reference<uno::XInterface> const xThis(m_pImpl->m_wThis);
2642  if (!xThis.is())
2643  { // fdo#72695: if UNO object is already dead, don't revive it with event
2644  return;
2645  }
2646  {
2647  lang::EventObject const ev(xThis);
2648  std::unique_lock aGuard(m_pImpl->m_Mutex);
2649  m_pImpl->m_EventListeners.disposeAndClear(aGuard, ev);
2650  }
2651  m_pFrameFormat = nullptr;
2652  EndListeningAll();
2653 }
2654 void SwXFrame::Notify(const SfxHint& rHint)
2655 {
2656  if(rHint.GetId() == SfxHintId::Dying)
2657  DisposeInternal();
2658 }
2659 
2661 {
2662  SolarMutexGuard aGuard;
2663  SwFrameFormat* pFormat = GetFrameFormat();
2664  if (!pFormat)
2665  return;
2666 
2667  DisposeInternal();
2668  SdrObject* pObj = pFormat->FindSdrObject();
2669  // OD 11.09.2003 #112039# - add condition to perform delete of
2670  // format/anchor sign, not only if the object is inserted, but also
2671  // if a contact object is registered, which isn't in the destruction.
2672  if ( pObj &&
2673  ( pObj->IsInserted() ||
2674  ( pObj->GetUserCall() &&
2675  !static_cast<SwContact*>(pObj->GetUserCall())->IsInDTOR() ) ) )
2676  {
2677  if (pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR)
2678  {
2679  const SwPosition &rPos = *(pFormat->GetAnchor().GetContentAnchor());
2680  SwTextNode *pTextNode = rPos.nNode.GetNode().GetTextNode();
2681  const sal_Int32 nIdx = rPos.nContent.GetIndex();
2682  pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
2683  }
2684  else
2685  pFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat(pFormat);
2686  }
2687 
2688 }
2689 
2690 uno::Reference< text::XTextRange > SwXFrame::getAnchor()
2691 {
2692  SolarMutexGuard aGuard;
2693  uno::Reference< text::XTextRange > aRef;
2694  SwFrameFormat* pFormat = GetFrameFormat();
2695  if(!pFormat)
2696  throw uno::RuntimeException();
2697 
2698  const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
2699  // return an anchor for non-page bound frames
2700  // and for page bound frames that have a page no == NULL and a content position
2701  if ((rAnchor.GetAnchorId() != RndStdIds::FLY_AT_PAGE) ||
2702  (rAnchor.GetContentAnchor() && !rAnchor.GetPageNum()))
2703  {
2704  const SwPosition &rPos = *(rAnchor.GetContentAnchor());
2705  if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA)
2706  { // ensure that SwXTextRange has SwIndex
2707  aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), SwPosition(rPos.nNode), nullptr);
2708  }
2709  else
2710  {
2711  aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), rPos, nullptr);
2712  }
2713  }
2714 
2715  return aRef;
2716 }
2717 
2719 {
2720  m_bIsDescriptor = false;
2721  mxStyleData.clear();
2722  mxStyleFamily.clear();
2723  m_pProps.reset();
2724 }
2725 
2726 void SwXFrame::attachToRange(uno::Reference<text::XTextRange> const& xTextRange,
2727  SwPaM const*const pCopySource)
2728 {
2729  SolarMutexGuard aGuard;
2730  if(!IsDescriptor())
2731  throw uno::RuntimeException();
2732  uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
2733  SwXTextRange* pRange = comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel);
2734  OTextCursorHelper* pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel);
2735 
2736  SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor ? pCursor->GetDoc() : nullptr;
2737  if(!pDoc)
2738  throw lang::IllegalArgumentException();
2739 
2740  SwUnoInternalPaM aIntPam(*pDoc);
2741  // this now needs to return TRUE
2742  ::sw::XTextRangeToSwPaM(aIntPam, xTextRange);
2743 
2744  SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
2745  SwPaM aPam(rNode);
2746  aPam.Move( fnMoveBackward, GoInDoc );
2747 
2748  SfxItemSetFixed<RES_GRFATR_BEGIN, RES_GRFATR_END-1> aGrSet(pDoc->GetAttrPool());
2749 
2753 
2754  // FillAttribute support
2756 
2757  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>
2758  aFrameSet(pDoc->GetAttrPool() );
2759 
2760  // set correct parent to get the XFILL_NONE FillStyle as needed
2761  aFrameSet.SetParent(&pDoc->GetDfltFrameFormat()->GetAttrSet());
2762 
2763  // no the related items need to be added to the set
2764  bool bSizeFound;
2765  if (!m_pProps->AnyToItemSet(pDoc, aFrameSet, aGrSet, bSizeFound))
2766  throw lang::IllegalArgumentException();
2767  // a TextRange is handled separately
2768  *aPam.GetPoint() = *aIntPam.GetPoint();
2769  if(aIntPam.HasMark())
2770  {
2771  aPam.SetMark();
2772  *aPam.GetMark() = *aIntPam.GetMark();
2773  }
2774 
2775  RndStdIds eAnchorId = RndStdIds::FLY_AT_PARA;
2776  if(const SwFormatAnchor* pItem = aFrameSet.GetItemIfSet(RES_ANCHOR, false) )
2777  {
2778  eAnchorId = pItem->GetAnchorId();
2779  if( RndStdIds::FLY_AT_FLY == eAnchorId &&
2780  !aPam.GetNode().FindFlyStartNode())
2781  {
2782  // framebound only where a frame exists
2783  SwFormatAnchor aAnchor(RndStdIds::FLY_AT_PARA);
2784  aFrameSet.Put(aAnchor);
2785  }
2786  else if ((RndStdIds::FLY_AT_PAGE == eAnchorId) &&
2787  0 == pItem->GetPageNum() )
2788  {
2789  SwFormatAnchor aAnchor( *pItem );
2790  aAnchor.SetType(RndStdIds::FLY_AT_CHAR); // convert invalid at-page
2791  aAnchor.SetAnchor( aPam.GetPoint() );
2792  aFrameSet.Put(aAnchor);
2793  }
2794 
2795  if (eAnchorId == RndStdIds::FLY_AT_PAGE)
2796  {
2797  sal_Int16 nRelOrient(aFrameSet.Get(RES_HORI_ORIENT).GetRelationOrient());
2798  if (sw::GetAtPageRelOrientation(nRelOrient, true))
2799  {
2800  SAL_WARN("sw.core", "SwXFrame: fixing invalid horizontal RelOrientation for at-page anchor");
2801 
2802  SwFormatHoriOrient item(aFrameSet.Get(RES_HORI_ORIENT));
2803  item.SetRelationOrient(nRelOrient);
2804  aFrameSet.Put(item);
2805  }
2806  }
2807  }
2808 
2809  const ::uno::Any* pStyle;
2810  SwFrameFormat *pParentFrameFormat = nullptr;
2811  if (m_pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0, pStyle))
2812  pParentFrameFormat = lcl_GetFrameFormat( *pStyle, pDoc );
2813 
2814  SwFlyFrameFormat* pFormat = nullptr;
2815  if( m_eType == FLYCNTTYPE_FRM)
2816  {
2817  UnoActionContext aCont(pDoc);
2818  if (pCopySource)
2819  {
2820  std::unique_ptr<SwFormatAnchor> pAnchorItem;
2821  // the frame is inserted bound to page
2822  // to prevent conflicts if the to-be-anchored position is part of the to-be-copied text
2823  if (eAnchorId != RndStdIds::FLY_AT_PAGE)
2824  {
2825  pAnchorItem.reset(aFrameSet.Get(RES_ANCHOR).Clone());
2826  aFrameSet.Put( SwFormatAnchor( RndStdIds::FLY_AT_PAGE, 1 ));
2827  }
2828 
2829  aPam.DeleteMark(); // mark position node will be deleted!
2830  aIntPam.DeleteMark(); // mark position node will be deleted!
2831  pFormat = pDoc->MakeFlyAndMove( *pCopySource, aFrameSet,
2832  nullptr,
2833  pParentFrameFormat );
2834  if(pAnchorItem && pFormat)
2835  {
2836  pFormat->DelFrames();
2837  pAnchorItem->SetAnchor( pCopySource->Start() );
2838  SfxItemSetFixed<RES_ANCHOR, RES_ANCHOR> aAnchorSet( pDoc->GetAttrPool() );
2839  aAnchorSet.Put( *pAnchorItem );
2840  pDoc->SetFlyFrameAttr( *pFormat, aAnchorSet );
2841  }
2842  }
2843  else
2844  {
2845  pFormat = pDoc->MakeFlySection( RndStdIds::FLY_AT_PARA, aPam.GetPoint(),
2846  &aFrameSet, pParentFrameFormat );
2847  }
2848  if(pFormat)
2849  {
2850  EndListeningAll();
2851  m_pFrameFormat = pFormat;
2852  StartListening(pFormat->GetNotifier());
2853  if(!m_sName.isEmpty())
2854  pDoc->SetFlyName(*pFormat, m_sName);
2855  }
2856  // wake up the SwXTextFrame
2857  static_cast<SwXTextFrame*>(this)->SetDoc( m_bIsDescriptor ? m_pDoc : GetFrameFormat()->GetDoc() );
2858  }
2859  else if( m_eType == FLYCNTTYPE_GRF)
2860  {
2861  UnoActionContext aActionContext(pDoc);
2862  Graphic aGraphic;
2863 
2864  // Read graphic URL from the descriptor, if it has any.
2865  const ::uno::Any* pGraphicURL;
2866  if (m_pProps->GetProperty(FN_UNO_GRAPHIC_URL, 0, pGraphicURL))
2867  {
2868  OUString sGraphicURL;
2869  uno::Reference<awt::XBitmap> xBitmap;
2870  if (((*pGraphicURL) >>= sGraphicURL) && !sGraphicURL.isEmpty())
2871  aGraphic = vcl::graphic::loadFromURL(sGraphicURL);
2872  else if ((*pGraphicURL) >>= xBitmap)
2873  {
2874  uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
2875  if (xGraphic.is())
2876  aGraphic = xGraphic;
2877  }
2878  }
2879 
2880  const ::uno::Any* pGraphicAny;
2881  const bool bHasGraphic = m_pProps->GetProperty(FN_UNO_GRAPHIC, 0, pGraphicAny);
2882  if (bHasGraphic)
2883  {
2884  uno::Reference<graphic::XGraphic> xGraphic;
2885  (*pGraphicAny) >>= xGraphic;
2886  aGraphic = Graphic(xGraphic);
2887  }
2888 
2889  OUString sFilterName;
2890  const uno::Any* pFilterAny;
2891  if (m_pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilterAny))
2892  {
2893  (*pFilterAny) >>= sFilterName;
2894  }
2895 
2896  pFormat = pDoc->getIDocumentContentOperations().InsertGraphic(
2897  aPam, OUString(), sFilterName, &aGraphic, &aFrameSet, &aGrSet, pParentFrameFormat);
2898  if (pFormat)
2899  {
2900  SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFormat->GetContent().GetContentIdx()
2901  ->GetIndex()+1 ]->GetGrfNode();
2902  if (pGrfNd)
2903  pGrfNd->SetChgTwipSize( !bSizeFound );
2904  m_pFrameFormat = pFormat;
2905  EndListeningAll();
2907  if(!m_sName.isEmpty())
2908  pDoc->SetFlyName(*pFormat, m_sName);
2909 
2910  }
2911  const ::uno::Any* pSurroundContour;
2912  if (m_pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurroundContour))
2913  setPropertyValue(UNO_NAME_SURROUND_CONTOUR, *pSurroundContour);
2914  const ::uno::Any* pContourOutside;
2915  if (m_pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE, pContourOutside))
2916  setPropertyValue(UNO_NAME_CONTOUR_OUTSIDE, *pContourOutside);
2917  const ::uno::Any* pContourPoly;
2918  if (m_pProps->GetProperty(FN_PARAM_CONTOUR_PP, 0, pContourPoly))
2920  const ::uno::Any* pPixelContour;
2921  if (m_pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0, pPixelContour))
2923  const ::uno::Any* pAutoContour;
2924  if (m_pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour))
2926  }
2927  else
2928  {
2929  const ::uno::Any* pCLSID = nullptr;
2930  const ::uno::Any* pStreamName = nullptr;
2931  const ::uno::Any* pEmbeddedObject = nullptr;
2932  if (!m_pProps->GetProperty(FN_UNO_CLSID, 0, pCLSID)
2933  && !m_pProps->GetProperty(FN_UNO_STREAM_NAME, 0, pStreamName)
2934  && !m_pProps->GetProperty(FN_EMBEDDED_OBJECT, 0, pEmbeddedObject))
2935  {
2936  throw uno::RuntimeException();
2937  }
2938  if(pCLSID)
2939  {
2940  OUString aCLSID;
2941  SvGlobalName aClassName;
2942  uno::Reference < embed::XEmbeddedObject > xIPObj;
2943  std::unique_ptr < comphelper::EmbeddedObjectContainer > pCnt;
2944  if( (*pCLSID) >>= aCLSID )
2945  {
2946  if( !aClassName.MakeId( aCLSID ) )
2947  {
2948  lang::IllegalArgumentException aExcept;
2949  aExcept.Message = "CLSID invalid";
2950  throw aExcept;
2951  }
2952 
2953  pCnt.reset( new comphelper::EmbeddedObjectContainer );
2954  OUString aName;
2955 
2956  OUString sDocumentBaseURL = pDoc->GetPersist()->getDocumentBaseURL();
2957  xIPObj = pCnt->CreateEmbeddedObject(aClassName.GetByteSequence(), aName,
2958  &sDocumentBaseURL);
2959  }
2960  if ( xIPObj.is() )
2961  {
2962  UnoActionContext aAction(pDoc);
2963  pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr);
2964 
2965  // tdf#99631 set imported VisibleArea settings of embedded XLSX OLE objects
2966  if ( m_nDrawAspect == embed::Aspects::MSOLE_CONTENT
2968  {
2969  sal_Int64 nAspect = m_nDrawAspect;
2970  MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xIPObj->getMapUnit( nAspect ) );
2972  MapMode(MapUnit::MapTwip), MapMode(aUnit)));
2973  awt::Size aSz;
2974  aSz.Width = aSize.Width();
2975  aSz.Height = aSize.Height();
2976  xIPObj->setVisualAreaSize(m_nDrawAspect, aSz);
2977  }
2978 
2979  if(!bSizeFound)
2980  {
2981  //TODO/LATER: how do I transport it to the OLENode?
2982  sal_Int64 nAspect = m_nDrawAspect;
2983 
2984  // TODO/LEAN: VisualArea still needs running state
2986 
2987  // set parent to get correct VisArea(in case of object needing parent printer)
2988  uno::Reference < container::XChild > xChild( xIPObj, uno::UNO_QUERY );
2989  if ( xChild.is() )
2990  xChild->setParent( pDoc->GetDocShell()->GetModel() );
2991 
2992  //The Size should be suggested by the OLE server if not manually set
2993  MapUnit aRefMap = VCLUnoHelper::UnoEmbed2VCLMapUnit( xIPObj->getMapUnit( nAspect ) );
2994  awt::Size aSize;
2995  try
2996  {
2997  aSize = xIPObj->getVisualAreaSize( nAspect );
2998  }
2999  catch ( embed::NoVisualAreaSizeException& )
3000  {
3001  // the default size will be set later
3002  }
3003 
3004  Size aSz( aSize.Width, aSize.Height );
3005  if ( !aSz.Width() || !aSz.Height() )
3006  {
3007  aSz.setWidth(5000);
3008  aSz.setHeight(5000);
3009  aSz = OutputDevice::LogicToLogic(aSz,
3010  MapMode(MapUnit::Map100thMM), MapMode(aRefMap));
3011  }
3012  MapMode aMyMap( MapUnit::MapTwip );
3013  aSz = OutputDevice::LogicToLogic(aSz, MapMode(aRefMap), aMyMap);
3014  SwFormatFrameSize aFrameSz;
3015  aFrameSz.SetSize(aSz);
3016  aFrameSet.Put(aFrameSz);
3017  }
3018  SwFlyFrameFormat* pFormat2 = nullptr;
3019 
3020  ::svt::EmbeddedObjectRef xObjRef( xIPObj, m_nDrawAspect);
3021  pFormat2 = pDoc->getIDocumentContentOperations().InsertEmbObject(
3022  aPam, xObjRef, &aFrameSet );
3023 
3024  // store main document name to show in the title bar
3025  uno::Reference< frame::XTitle > xModelTitle( pDoc->GetDocShell()->GetModel(), css::uno::UNO_QUERY );
3026  if( xModelTitle.is() )
3027  xIPObj->setContainerName( xModelTitle->getTitle() );
3028 
3029  assert(pFormat2 && "Doc->Insert(notxt) failed.");
3030 
3031  pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
3032  m_pFrameFormat = pFormat2;
3033  EndListeningAll();
3035  if(!m_sName.isEmpty())
3036  pDoc->SetFlyName(*pFormat2, m_sName);
3037  }
3038  }
3039  else if( pStreamName )
3040  {
3041  OUString sStreamName;
3042  (*pStreamName) >>= sStreamName;
3043  pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr);
3044 
3045  SwFlyFrameFormat* pFrameFormat = pDoc->getIDocumentContentOperations().InsertOLE(
3046  aPam, sStreamName, m_nDrawAspect, &aFrameSet, nullptr);
3047 
3048  // store main document name to show in the title bar
3049  SwOLENode* pNd = nullptr;
3050  const SwNodeIndex* pIdx = pFrameFormat->GetContent().GetContentIdx();
3051  if( pIdx )
3052  {
3053  SwNodeIndex aIdx( *pIdx, 1 );
3054  SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
3055  pNd = pNoText->GetOLENode();
3056  }
3057  if( pNd )
3058  {
3059  uno::Reference < embed::XEmbeddedObject > xObj = pNd->GetOLEObj().GetOleRef();
3060  if( xObj.is() )
3061  {
3062  uno::Reference< frame::XTitle > xModelTitle( pDoc->GetDocShell()->GetModel(), css::uno::UNO_QUERY );
3063  if( xModelTitle.is() )
3064  xObj->setContainerName( xModelTitle->getTitle() );
3065  }
3066  }
3067 
3068  pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
3069  m_pFrameFormat = pFrameFormat;
3070  EndListeningAll();
3072  if(!m_sName.isEmpty())
3073  pDoc->SetFlyName(*pFrameFormat, m_sName);
3074  }
3075  else if (pEmbeddedObject)
3076  {
3077  uno::Reference< embed::XEmbeddedObject > obj;
3078  (*pEmbeddedObject) >>= obj;
3080  xObj.Assign( obj, embed::Aspects::MSOLE_CONTENT );
3081 
3082  pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr);
3083 
3084  // Do not call here container::XChild(obj)->setParent() and
3085  // pDoc->GetPersist()->GetEmbeddedObjectContainer().InsertEmbeddedObject:
3086  // they are called indirectly by pDoc->getIDocumentContentOperations().InsertEmbObject
3087  // below. Calling them twice will add the same object twice to EmbeddedObjectContainer's
3088  // pImpl->maNameToObjectMap, and then it will misbehave in
3089  // EmbeddedObjectContainer::StoreAsChildren and SfxObjectShell::SaveCompletedChildren.
3090 
3091  SwFlyFrameFormat* pFrameFormat
3092  = pDoc->getIDocumentContentOperations().InsertEmbObject(aPam, xObj, &aFrameSet);
3093  pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
3094  m_pFrameFormat = pFrameFormat;
3095  EndListeningAll();
3097  if(!m_sName.isEmpty())
3098  pDoc->SetFlyName(*pFrameFormat, m_sName);
3099  }
3100  }
3101  if( pFormat && pDoc->getIDocumentDrawModelAccess().GetDrawModel() )
3102  GetOrCreateSdrObject(*pFormat);
3103  const ::uno::Any* pOrder;
3104  if (m_pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder))
3106  const ::uno::Any* pReplacement;
3107  if (m_pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0, pReplacement))
3108  setPropertyValue(UNO_NAME_GRAPHIC, *pReplacement);
3109  // new attribute Title
3110  const ::uno::Any* pTitle;
3111  if (m_pProps->GetProperty(FN_UNO_TITLE, 0, pTitle))
3112  {
3113  setPropertyValue(UNO_NAME_TITLE, *pTitle);
3114  }
3115  // new attribute Description
3116  const ::uno::Any* pDescription;
3117  if (m_pProps->GetProperty(FN_UNO_DESCRIPTION, 0, pDescription))
3118  {
3119  setPropertyValue(UNO_NAME_DESCRIPTION, *pDescription);
3120  }
3121 
3122  // For grabbag
3123  const uno::Any* pFrameIntropgrabbagItem;
3124  if (m_pProps->GetProperty(RES_FRMATR_GRABBAG, 0, pFrameIntropgrabbagItem))
3125  {
3126  setPropertyValue(UNO_NAME_FRAME_INTEROP_GRAB_BAG, *pFrameIntropgrabbagItem);
3127  }
3128 
3129  // reset the flag and delete Descriptor pointer
3130  ResetDescriptor();
3131 }
3132 
3133 void SwXFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
3134 {
3135  SolarMutexGuard g;
3136 
3137  if(IsDescriptor())
3138  {
3139  attachToRange(xTextRange);
3140  return;
3141  }
3142 
3143  SwFrameFormat* pFormat = GetFrameFormat();
3144  if( !pFormat )
3145  return;
3146 
3147  SwDoc* pDoc = pFormat->GetDoc();
3148  SwUnoInternalPaM aIntPam(*pDoc);
3149  if (!::sw::XTextRangeToSwPaM(aIntPam, xTextRange))
3150  throw lang::IllegalArgumentException();
3151 
3153  aSet.SetParent(&pFormat->GetAttrSet());
3154  SwFormatAnchor aAnchor = aSet.Get(RES_ANCHOR);
3155 
3156  if (aAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR)
3157  {
3158  throw lang::IllegalArgumentException(
3159  "SwXFrame::attach(): re-anchoring AS_CHAR not supported",
3160  *this, 0);
3161  }
3162 
3163  aAnchor.SetAnchor( aIntPam.Start() );
3164  aSet.Put(aAnchor);
3165  pDoc->SetFlyFrameAttr( *pFormat, aSet );
3166 }
3167 
3169 {
3170  uno::RuntimeException aRuntime;
3171  aRuntime.Message = "position cannot be determined with this method";
3172  throw aRuntime;
3173 }
3174 
3175 void SwXFrame::setPosition(const awt::Point& /*aPosition*/)
3176 {
3177  uno::RuntimeException aRuntime;
3178  aRuntime.Message = "position cannot be changed with this method";
3179  throw aRuntime;
3180 }
3181 
3183 {
3184  const ::uno::Any aVal = getPropertyValue("Size");
3185  awt::Size const * pRet = o3tl::doAccess<awt::Size>(aVal);
3186  return *pRet;
3187 }
3188 
3189 void SwXFrame::setSize(const awt::Size& aSize)
3190 {
3191  const ::uno::Any aVal(&aSize, ::cppu::UnoType<awt::Size>::get());
3192  setPropertyValue("Size", aVal);
3193 }
3194 
3196 {
3197  return "FrameShape";
3198 }
3199 
3202  SwXText(nullptr, CursorType::Frame)
3203 {
3204 }
3205 
3208  SwXText(rFormat.GetDoc(), CursorType::Frame)
3209 {
3210 
3211 }
3212 
3214 {
3215 }
3216 
3217 uno::Reference<text::XTextFrame>
3219 {
3220  return CreateXFrame<text::XTextFrame, SwXTextFrame>(rDoc, pFrameFormat);
3221 }
3222 
3223 void SAL_CALL SwXTextFrame::acquire( )noexcept
3224 {
3225  SwXFrame::acquire();
3226 }
3227 
3228 void SAL_CALL SwXTextFrame::release( )noexcept
3229 {
3230  SwXFrame::release();
3231 }
3232 
3234 {
3235  ::uno::Any aRet = SwXFrame::queryInterface(aType);
3236  if(aRet.getValueType() == cppu::UnoType<void>::get())
3237  aRet = SwXText::queryInterface(aType);
3238  if(aRet.getValueType() == cppu::UnoType<void>::get())
3239  aRet = SwXTextFrameBaseClass::queryInterface(aType);
3240  return aRet;
3241 }
3242 
3243 uno::Sequence< uno::Type > SAL_CALL SwXTextFrame::getTypes( )
3244 {
3246  SwXTextFrameBaseClass::getTypes(),
3247  SwXFrame::getTypes(),
3249  );
3250 }
3251 
3252 uno::Sequence< sal_Int8 > SAL_CALL SwXTextFrame::getImplementationId( )
3253 {
3254  return css::uno::Sequence<sal_Int8>();
3255 }
3256 
3257 uno::Reference< text::XText > SwXTextFrame::getText()
3258 {
3259  return this;
3260 }
3261 
3263 {
3264  const SwStartNode *pSttNd = nullptr;
3265 
3266  const SwFrameFormat* pFormat = GetFrameFormat();
3267  if(pFormat)
3268  {
3269  const SwFormatContent& rFlyContent = pFormat->GetContent();
3270  if( rFlyContent.GetContentIdx() )
3271  pSttNd = rFlyContent.GetContentIdx()->GetNode().GetStartNode();
3272  }
3273 
3274  return pSttNd;
3275 }
3276 
3277 uno::Reference< text::XTextCursor >
3279 {
3280  return createTextCursor();
3281 }
3282 
3283 uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursor()
3284 {
3285  SolarMutexGuard aGuard;
3286  SwFrameFormat* pFormat = GetFrameFormat();
3287  if(!pFormat)
3288  throw uno::RuntimeException();
3289 
3290  //save current start node to be able to check if there is content after the table -
3291  //otherwise the cursor would be in the body text!
3292  const SwNode& rNode = pFormat->GetContent().GetContentIdx()->GetNode();
3293  const SwStartNode* pOwnStartNode = rNode.FindSttNodeByType(SwFlyStartNode);
3294 
3295  SwPaM aPam(rNode);
3296  aPam.Move(fnMoveForward, GoInNode);
3297  SwTableNode* pTableNode = aPam.GetNode().FindTableNode();
3298  SwContentNode* pCont = nullptr;
3299  while( pTableNode )
3300  {
3301  aPam.GetPoint()->nNode = *pTableNode->EndOfSectionNode();
3302  pCont = GetDoc()->GetNodes().GoNext(&aPam.GetPoint()->nNode);
3303  pTableNode = pCont->FindTableNode();
3304  }
3305  if(pCont)
3306  aPam.GetPoint()->nContent.Assign(pCont, 0);
3307 
3308  const SwStartNode* pNewStartNode =
3310  if(!pNewStartNode || pNewStartNode != pOwnStartNode)
3311  {
3312  uno::RuntimeException aExcept;
3313  aExcept.Message = "no text available";
3314  throw aExcept;
3315  }
3316 
3317  return static_cast<text::XWordCursor*>(new SwXTextCursor(
3318  *pFormat->GetDoc(), this, CursorType::Frame, *aPam.GetPoint()));
3319 }
3320 
3321 uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursorByRange(const uno::Reference< text::XTextRange > & aTextPosition)
3322 {
3323  SolarMutexGuard aGuard;
3324  SwFrameFormat* pFormat = GetFrameFormat();
3325  if (!pFormat)
3326  throw uno::RuntimeException();
3327  SwUnoInternalPaM aPam(*GetDoc());
3328  if (!::sw::XTextRangeToSwPaM(aPam, aTextPosition))
3329  throw uno::RuntimeException();
3330 
3331  uno::Reference<text::XTextCursor> aRef;
3332  SwNode& rNode = pFormat->GetContent().GetContentIdx()->GetNode();
3333  if(aPam.GetNode().FindFlyStartNode() == rNode.FindFlyStartNode())
3334  {
3335  aRef = static_cast<text::XWordCursor*>(
3336  new SwXTextCursor(*pFormat->GetDoc(), this, CursorType::Frame,
3337  *aPam.GetPoint(), aPam.GetMark()));
3338  }
3339 
3340  return aRef;
3341 }
3342 
3343 uno::Reference< container::XEnumeration > SwXTextFrame::createEnumeration()
3344 {
3345  SolarMutexGuard aGuard;
3346  SwFrameFormat* pFormat = GetFrameFormat();
3347  if(!pFormat)
3348  return nullptr;
3349  SwPosition aPos(pFormat->GetContent().GetContentIdx()->GetNode());
3350  auto pUnoCursor(GetDoc()->CreateUnoCursor(aPos));
3351  pUnoCursor->Move(fnMoveForward, GoInNode);
3352  return SwXParagraphEnumeration::Create(this, pUnoCursor, CursorType::Frame);
3353 }
3354 
3356 {
3358 }
3359 
3361 {
3362  return true;
3363 }
3364 
3365 void SwXTextFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
3366 {
3367  SwXFrame::attach(xTextRange);
3368 }
3369 
3370 uno::Reference< text::XTextRange > SwXTextFrame::getAnchor()
3371 {
3372  SolarMutexGuard aGuard;
3373  return SwXFrame::getAnchor();
3374 }
3375 
3377 {
3378  SolarMutexGuard aGuard;
3380 }
3381 
3382 void SwXTextFrame::addEventListener(const uno::Reference< lang::XEventListener > & aListener)
3383 {
3384  SwXFrame::addEventListener(aListener);
3385 }
3386 
3387 void SwXTextFrame::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
3388 {
3389  SwXFrame::removeEventListener(aListener);
3390 }
3391 
3393 {
3394  return "SwXTextFrame";
3395 }
3396 
3397 sal_Bool SwXTextFrame::supportsService(const OUString& rServiceName)
3398 {
3399  return cppu::supportsService(this, rServiceName);
3400 }
3401 
3402 uno::Sequence< OUString > SwXTextFrame::getSupportedServiceNames()
3403 {
3404  uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
3405  aRet.realloc(aRet.getLength() + 2);
3406  OUString* pArray = aRet.getArray();
3407  pArray[aRet.getLength() - 2] = "com.sun.star.text.TextFrame";
3408  pArray[aRet.getLength() - 1] = "com.sun.star.text.Text";
3409  return aRet;
3410 }
3411 
3412 uno::Reference<container::XNameReplace > SAL_CALL SwXTextFrame::getEvents()
3413 {
3414  return new SwFrameEventDescriptor( *this );
3415 }
3416 
3417 sal_Int64 SAL_CALL SwXTextFrame::getSomething( const uno::Sequence< sal_Int8 >& rId )
3418 {
3419  sal_Int64 nRet = SwXFrame::getSomething( rId );
3420  if( !nRet )
3421  nRet = SwXText::getSomething( rId );
3422 
3423  return nRet;
3424 }
3425 
3426 ::uno::Any SwXTextFrame::getPropertyValue(const OUString& rPropertyName)
3427 {
3428  SolarMutexGuard aGuard;
3429  ::uno::Any aRet;
3430  if(rPropertyName == UNO_NAME_START_REDLINE||
3431  rPropertyName == UNO_NAME_END_REDLINE)
3432  {
3433  //redline can only be returned if it's a living object
3434  if(!IsDescriptor())
3435  aRet = SwXText::getPropertyValue(rPropertyName);
3436  }
3437  else
3438  aRet = SwXFrame::getPropertyValue(rPropertyName);
3439  return aRet;
3440 }
3441 
3444  aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC), pDoc)
3445 {
3446 }
3447 
3450  aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC))
3451 {
3452 }
3453 
3455 {
3456 }
3457 
3458 uno::Reference<text::XTextContent>
3460 {
3461  return CreateXFrame<text::XTextContent, SwXTextGraphicObject>(rDoc, pFrameFormat);
3462 }
3463 
3465 {
3466  return "SwXTextGraphicObject";
3467 }
3468 
3470 {
3471  return cppu::supportsService(this, rServiceName);
3472 }
3473 
3475 {
3476  uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
3477  aRet.realloc(aRet.getLength() + 1);
3478  OUString* pArray = aRet.getArray();
3479  pArray[aRet.getLength() - 1] = "com.sun.star.text.TextGraphicObject";
3480  return aRet;
3481 }
3482 
3483 uno::Reference<container::XNameReplace> SAL_CALL
3485 {
3486  return new SwFrameEventDescriptor( *this );
3487 }
3488 
3491  aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT), pDoc)
3492 {
3493 }
3494 
3498 {
3499 }
3500 
3502 {
3503 }
3504 
3505 uno::Reference<text::XTextContent>
3507 {
3508  return CreateXFrame<text::XTextContent, SwXTextEmbeddedObject>(rDoc, pFrameFormat);
3509 }
3510 
3511 uno::Reference< lang::XComponent > SwXTextEmbeddedObject::getEmbeddedObject()
3512 {
3513  uno::Reference<embed::XEmbeddedObject> xObj(getExtendedControlOverEmbeddedObject());
3514  return xObj.is() ? uno::Reference<lang::XComponent>(xObj->getComponent(), uno::UNO_QUERY) : nullptr;
3515 }
3516 
3517 uno::Reference< embed::XEmbeddedObject > SAL_CALL SwXTextEmbeddedObject::getExtendedControlOverEmbeddedObject()
3518 {
3519  uno::Reference< embed::XEmbeddedObject > xResult;
3520  SwFrameFormat* pFormat = GetFrameFormat();
3521  if(pFormat)
3522  {
3523  SwDoc* pDoc = pFormat->GetDoc();
3524  const SwFormatContent* pCnt = &pFormat->GetContent();
3525  OSL_ENSURE( pCnt->GetContentIdx() &&
3526  pDoc->GetNodes()[ pCnt->GetContentIdx()->
3527  GetIndex() + 1 ]->GetOLENode(), "no OLE-Node?");
3528 
3529  SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetContentIdx()
3530  ->GetIndex() + 1 ]->GetOLENode();
3531  xResult = pOleNode->GetOLEObj().GetOleRef();
3532  if ( svt::EmbeddedObjectRef::TryRunningState( xResult ) )
3533  {
3534  // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
3535  if ( pDoc->GetDocShell() )
3536  pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xResult, embed::Aspects::MSOLE_CONTENT ) );
3537 
3538  uno::Reference < lang::XComponent > xComp( xResult->getComponent(), uno::UNO_QUERY );
3539  uno::Reference< util::XModifyBroadcaster > xBrdcst( xComp, uno::UNO_QUERY);
3540  uno::Reference< frame::XModel > xModel( xComp, uno::UNO_QUERY);
3541  if(xBrdcst.is() && xModel.is() && !m_xOLEListener.is())
3542  {
3543  m_xOLEListener = new SwXOLEListener(*pFormat, xModel);
3544  xBrdcst->addModifyListener( m_xOLEListener );
3545  }
3546  }
3547  }
3548  return xResult;
3549 }
3550 
3552 {
3553  SwFrameFormat* pFormat = GetFrameFormat();
3554  if(pFormat)
3555  {
3556  SwDoc* pDoc = pFormat->GetDoc();
3557  const SwFormatContent* pCnt = &pFormat->GetContent();
3558  OSL_ENSURE( pCnt->GetContentIdx() &&
3559  pDoc->GetNodes()[ pCnt->GetContentIdx()->
3560  GetIndex() + 1 ]->GetOLENode(), "no OLE-Node?");
3561 
3562  return pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ]->GetOLENode()->GetAspect();
3563  }
3564 
3565  return embed::Aspects::MSOLE_CONTENT; // return the default value
3566 }
3567 
3568 void SAL_CALL SwXTextEmbeddedObject::setAspect( sal_Int64 nAspect )
3569 {
3570  SwFrameFormat* pFormat = GetFrameFormat();
3571  if(pFormat)
3572  {
3573  SwDoc* pDoc = pFormat->GetDoc();
3574  const SwFormatContent* pCnt = &pFormat->GetContent();
3575  OSL_ENSURE( pCnt->GetContentIdx() &&
3576  pDoc->GetNodes()[ pCnt->GetContentIdx()->
3577  GetIndex() + 1 ]->GetOLENode(), "no OLE-Node?");
3578 
3579  pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ]->GetOLENode()->SetAspect( nAspect );
3580  }
3581 }
3582 
3583 uno::Reference< graphic::XGraphic > SAL_CALL SwXTextEmbeddedObject::getReplacementGraphic()
3584 {
3585  SwFrameFormat* pFormat = GetFrameFormat();
3586  if(pFormat)
3587  {
3588  SwDoc* pDoc = pFormat->GetDoc();
3589  const SwFormatContent* pCnt = &pFormat->GetContent();
3590  OSL_ENSURE( pCnt->GetContentIdx() &&
3591  pDoc->GetNodes()[ pCnt->GetContentIdx()->
3592  GetIndex() + 1 ]->GetOLENode(), "no OLE-Node?");
3593 
3594  const Graphic* pGraphic = pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ]->GetOLENode()->GetGraphic();
3595  if ( pGraphic )
3596  return pGraphic->GetXGraphic();
3597  }
3598 
3599  return uno::Reference< graphic::XGraphic >();
3600 }
3601 
3603 {
3604  return "SwXTextEmbeddedObject";
3605 }
3606 
3608 {
3609  return cppu::supportsService(this, rServiceName);
3610 }
3611 
3613 {
3614  uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
3615  aRet.realloc(aRet.getLength() + 1);
3616  OUString* pArray = aRet.getArray();
3617  pArray[aRet.getLength() - 1] = "com.sun.star.text.TextEmbeddedObject";
3618  return aRet;
3619 }
3620 
3621 uno::Reference<container::XNameReplace> SAL_CALL
3623 {
3624  return new SwFrameEventDescriptor( *this );
3625 }
3626 
3627 namespace
3628 {
3629  SwOLENode* lcl_GetOLENode(const SwFormat* pFormat)
3630  {
3631  if(!pFormat)
3632  return nullptr;
3633  const SwNodeIndex* pIdx(pFormat->GetContent().GetContentIdx());
3634  if(!pIdx)
3635  return nullptr;
3636  const SwNodeIndex aIdx(*pIdx, 1);
3637  return aIdx.GetNode().GetNoTextNode()->GetOLENode();
3638  }
3639 }
3640 
3641 SwXOLEListener::SwXOLEListener( SwFormat& rOLEFormat, uno::Reference< XModel > const & xOLE)
3642  : m_pOLEFormat(&rOLEFormat)
3643  , m_xOLEModel(xOLE)
3644 {
3646 }
3647 
3649 {}
3650 
3651 void SwXOLEListener::modified( const lang::EventObject& /*rEvent*/ )
3652 {
3653  SolarMutexGuard aGuard;
3654  const auto pNd = lcl_GetOLENode(m_pOLEFormat);
3655  if(!pNd)
3656  throw uno::RuntimeException();
3657  const auto xIP = pNd->GetOLEObj().GetOleRef();
3658  if(xIP.is())
3659  {
3660  sal_Int32 nState = xIP->getCurrentState();
3661  if(nState == embed::EmbedStates::INPLACE_ACTIVE || nState == embed::EmbedStates::UI_ACTIVE)
3662  // if the OLE-Node is UI-Active do nothing
3663  return;
3664  }
3665  pNd->SetOLESizeInvalid(true);
3666  pNd->GetDoc().SetOLEObjModified();
3667 }
3668 
3669 void SwXOLEListener::disposing( const lang::EventObject& rEvent )
3670 {
3671  SolarMutexGuard aGuard;
3672  uno::Reference<util::XModifyListener> xListener( this );
3673  uno::Reference<frame::XModel> xModel(rEvent.Source, uno::UNO_QUERY);
3674  uno::Reference<util::XModifyBroadcaster> xBrdcst(xModel, uno::UNO_QUERY);
3675  if(!xBrdcst.is())
3676  return;
3677  try
3678  {
3679  xBrdcst->removeModifyListener(xListener);
3680  }
3681  catch(uno::Exception const &)
3682  {
3683  OSL_FAIL("OLE Listener couldn't be removed");
3684  }
3685 }
3686 
3687 void SwXOLEListener::Notify( const SfxHint& rHint )
3688 {
3689  if(rHint.GetId() == SfxHintId::Dying)
3690  {
3691  m_xOLEModel = nullptr;
3692  m_pOLEFormat = nullptr;
3693  }
3694 }
3695 
3696 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwStartNode * FindSttNodeByType(SwStartNodeType eTyp)
Definition: node.cxx:764
#define UNO_NAME_CONTOUR_OUTSIDE
Definition: unoprnms.hxx:242
#define MID_FILLGRADIENT
sal_uInt16 Count() const
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:692
Starts a section of nodes in the document model.
Definition: node.hxx:313
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(100)
virtual OUString SAL_CALL getImplementationName() override
Definition: unoframe.cxx:1172
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Base class for the following contact objects (frame + draw objects).
Definition: dcontact.hxx:66
Base class of the Writer layout elements.
Definition: frame.hxx:314
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
static SwFrameFormat * lcl_GetFrameFormat(const ::uno::Any &rValue, SwDoc *pDoc)
Definition: unoframe.cxx:1369
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN)
virtual ~SwXOLEListener() override
Definition: unoframe.cxx:3648
void DeleteMark()
Definition: pam.hxx:178
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
URL aURL
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:224
UNOTOOLS_DLLPUBLIC css::uno::Any GetProperty(OUString const &url, OUString const &property)
SwFlyDrawContact * GetOrCreateContact()
Definition: atrfrm.cxx:2914
bool hasValue()
sal_Int32 nIndex
const tools::Polygon & GetObject(sal_uInt16 nPos) const
#define MID_SURROUND_SURROUNDTYPE
Definition: unomid.h:29
virtual void SAL_CALL setName(const OUString &Name_) override
Definition: unoframe.cxx:1300
const FlyCntType m_eType
Definition: unoframe.hxx:67
virtual void SAL_CALL setSize(const css::awt::Size &aSize) override
Definition: unoframe.cxx:3189
Marks a position in the document model.
Definition: pam.hxx:36
void setPropertyValue(const SfxItemPropertyMapEntry &rEntry, const css::uno::Any &aVal, SfxItemSet &rSet) const
#define FN_UNO_VISIBLE_AREA_WIDTH
Definition: cmdid.h:644
constexpr TypedWhichId< XFillBmpTileOffsetYItem > XATTR_FILLBMP_TILEOFFSETY(XATTR_FILL_FIRST+15)
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(98)
OUString GetObjDescription() const
Definition: atrfrm.cxx:3222
SfxInPlaceClient * GetIPClient(const ::svt::EmbeddedObjectRef &xObjRef)
Definition: docsh2.cxx:1672
constexpr auto toTwips(N number, Length from)
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:164
#define UNO_NAME_SURROUND_CONTOUR
Definition: unoprnms.hxx:317
bool HasAutomaticContour() const
Definition: ndnotxt.hxx:77
void setWidth(tools::Long nWidth)
constexpr OUStringLiteral sDocumentBaseURL
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:115
CursorType
#define FN_EMBEDDED_OBJECT
Definition: cmdid.h:634
virtual bool AnyToItemSet(SwDoc *pDoc, SfxItemSet &rFrameSet, SfxItemSet &rSet, bool &rSizeFound)=0
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
Definition: unoframe.cxx:2415
#define MID_PROTECT_POSITION
std::mutex m_Mutex
Definition: unoframe.cxx:1156
SwDocShell * GetDocShell()
Definition: doc.hxx:1351
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoframe.cxx:3612
constexpr TypedWhichId< SwFormatEditInReadonly > RES_EDIT_IN_READONLY(112)
#define WID_LAYOUT_SIZE
Definition: unomap.hxx:292
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
#define MID_FRMSIZE_SIZE_TYPE
Definition: unomid.h:76
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
bool IsNone() const
#define MID_NAME
std::unique_ptr< SvxBrushItem > getSvxBrushItemFromSourceSet(const SfxItemSet &rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack)
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
#define COL_DEFAULT_SHAPE_FILLING
signed char sal_Int8
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unoframe.cxx:2397
SwNodeIndex nNode
Definition: pam.hxx:38
#define UNO_NAME_END_REDLINE
Definition: unoprnms.hxx:557
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
SAL_DLLPRIVATE css::uno::WeakReference< css::uno::XInterface > const & GetXObject() const
Definition: frmfmt.hxx:170
constexpr TypedWhichId< SfxMetricItem > XATTR_FILLBMP_SIZEX(XATTR_FILL_FIRST+9)
virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override
Definition: unoframe.cxx:3484
constexpr TypedWhichId< SdrTextVertAdjustItem > RES_TEXT_VERT_ADJUST(130)
constexpr TypedWhichId< SwTransparencyGrf > RES_GRFATR_TRANSPARENCY(143)
#define MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT
Definition: unomid.h:84
#define MID_FRMSIZE_REL_WIDTH
Definition: unomid.h:72
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:66
virtual Size GetTwipSize() const =0
#define MINFLY
Definition: swtypes.hxx:61
#define SAL_INFO_IF(condition, area, stream)
std::unique_ptr< BaseFrameProperties_Impl > m_pProps
Definition: unoframe.hxx:70
const SwFrameFormat * GetFrameFormat() const
Definition: unoframe.hxx:152
virtual css::uno::Reference< css::embed::XEmbeddedObject > SAL_CALL getExtendedControlOverEmbeddedObject() override
Definition: unoframe.cxx:3517
Reference< XFrame > xFrame
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unoframe.cxx:3133
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
const SwPosition * GetMark() const
Definition: pam.hxx:210
virtual SdrLayerID GetHeavenId() const =0
#define PROPERTY_MAP_TEXT_GRAPHIC
Definition: unomap.hxx:39
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:939
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
#define FN_UNO_CLSID
Definition: cmdid.h:602
#define MID_VERTORIENT_RELATION
Definition: unomid.h:35
#define MID_URL_HYPERLINKNAME
Definition: unomid.h:47
#define LINE_STYLE
exports com.sun.star. embed
void attachToRange(css::uno::Reference< css::text::XTextRange > const &xTextRange, SwPaM const *pCopySource=nullptr)
Definition: unoframe.cxx:2726
bool IsInserted() const
Definition: doc.hxx:187
constexpr sal_uInt16 RES_FRMATR_END(133)
#define FN_UNO_MODEL
Definition: cmdid.h:603
#define FN_UNO_VISIBLE_AREA_HEIGHT
Definition: cmdid.h:645
uno::WeakReference< uno::XInterface > m_wThis
Definition: unoframe.cxx:1155
SwFormat * m_pOLEFormat
Definition: unoframe.hxx:310
#define MID_GRAPHIC_TRANSPARENT
constexpr TypedWhichId< SwChannelRGrf > RES_GRFATR_CHANNELR(138)
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unoframe.cxx:3387
#define RIGHT_BORDER_DISTANCE
virtual void SAL_CALL acquire() noexcept override
Definition: unoframe.cxx:3223
css::uno::Sequence< sal_Int8 > GetByteSequence() const
#define FN_UNO_STREAM_NAME
Definition: cmdid.h:616
virtual void SAL_CALL release() noexcept override
Definition: unoframe.cxx:3228
SwNode & GetNode() const
Definition: ndindex.hxx:128
bool IsPixelContour() const
Definition: ndnotxt.cxx:213
SwDoc * m_pDoc
Definition: unoframe.hxx:65
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
#define MID_BACK_COLOR
const GraphicObject * GetReplacementGrfObj() const
Definition: ndgrf.cxx:385
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
#define FN_UNO_ALTERNATIVE_TEXT
Definition: cmdid.h:591
#define MID_SURROUND_ANCHORONLY
Definition: unomid.h:30
constexpr TypedWhichId< SwContrastGrf > RES_GRFATR_CONTRAST(137)
#define UNO_NAME_GRAPHIC
Definition: unoprnms.hxx:162
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
virtual SwFrameFormat * GetFrameFormatFromPool(sal_uInt16 nId)=0
Return required automatic format.
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
virtual const SwStartNode * GetStartNode() const override
Definition: unoframe.cxx:3262
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
void SetPoint(const Point &rPt, sal_uInt16 nPos)
EmbeddedObjectRef * pObject
Graphic loadFromURL(OUString const &rURL, weld::Window *pParentWin)
WhichRangesContainer const aFrameFormatSetRange(svl::Items< RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST >)
#define MID_GRAPHIC_TRANSPARENCY
#define MID_ANCHOR_PAGENUM
Definition: unomid.h:44
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
constexpr TypedWhichId< XFillBackgroundItem > XATTR_FILLBACKGROUND(XATTR_FILL_FIRST+19)
bool HasContour_() const
Definition: ndnotxt.hxx:72
#define UNO_NAME_ACTUAL_SIZE
Definition: unoprnms.hxx:307
SfxHintId GetId() const
#define LEFT_BORDER
bool isFrameAreaDefinitionValid() const
Definition: frame.hxx:171
Graphic GetTransformedGraphic(const Size &rDestSize, const MapMode &rDestMap, const GraphicAttr &rAttr) const
constexpr TypedWhichId< SwLuminanceGrf > RES_GRFATR_LUMINANCE(136)
virtual void SAL_CALL dispose() override
Definition: unoframe.cxx:3376
static void lcl_FillMirror(SfxItemSet &rToSet, const ::SfxItemSet &rFromSet, const ::uno::Any *pHEvenMirror, const ::uno::Any *pHOddMirror, const ::uno::Any *pVMirror, bool &rRet)
Definition: unoframe.cxx:1040
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
Definition: unoframe.cxx:2508
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unotext.cxx:264
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
#define UNO_NAME_IS_PIXEL_CONTOUR
Definition: unoprnms.hxx:496
virtual ~SwXTextEmbeddedObject() override
Definition: unoframe.cxx:3501
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
static css::uno::Reference< Interface > CreateXFrame(SwDoc &rDoc, SwFrameFormat *const pFrameFormat)
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
Definition: unoframe.cxx:3283
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoframe.cxx:3402
SwChainRet Chain(SwFrameFormat &rSource, const SwFrameFormat &rDest)
Definition: docfly.cxx:1103
constexpr auto convertTwipToMm100(N n)
SwFrameFormat * m_pFrameFormat
Definition: unoframe.hxx:62
constexpr tools::Long Width() const
void ResetDescriptor()
Definition: unoframe.cxx:2718
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
virtual css::awt::Size SAL_CALL getSize() override
Definition: unoframe.cxx:3182
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Templatized version of GetItemState() to directly return the correct type.
Definition: format.hxx:111
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
void SetChgTwipSize(bool b)
Definition: ndgrf.hxx:98
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
#define MID_FRMSIZE_HEIGHT
Definition: unomid.h:75
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:767
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
Definition: unoframe.cxx:3651
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
css::uno::Reference< css::container::XNameAccess > mxStyleFamily
Definition: unoframe.hxx:82
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoframe.cxx:1182
#define UNO_NAME_CHAIN_NEXT_NAME
Definition: unoprnms.hxx:234
bool isGRFATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:511
#define MID_FRMSIZE_SIZE
Definition: unomid.h:70
constexpr sal_uInt16 RES_GRFATR_END(150)
bool IsContourMapModeValid() const
Definition: ndnotxt.hxx:88
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unoframe.cxx:3426
SwIndex nContent
Definition: pam.hxx:39
virtual ~SwXFrame() override
Definition: unoframe.cxx:1256
const SwRect & getFrameArea() const
Definition: frame.hxx:179
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
GraphicAttr & GetGraphicAttr(GraphicAttr &, const SwFrame *pFrame) const
Returns the with our graphic attributes filled Graphic-Attr-Structure.
Definition: ndgrf.cxx:733
#define MID_FOLLOW_TEXT_FLOW
Definition: unomid.h:152
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoframe.cxx:1177
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:990
#define FN_PARAM_CONTOUR_PP
Definition: cmdid.h:824
const OUString & GetName() const
Definition: format.hxx:131
int nCount
css::uno::Reference< css::beans::XPropertySet > mxStyleData
Definition: unoframe.hxx:81
void getPropertyValue(const SfxItemPropertyMapEntry &rEntry, const SfxItemSet &rSet, css::uno::Any &rAny) const
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
#define FN_UNO_PARENT_TEXT
Definition: cmdid.h:561
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
SwFrameFormat * GetFrameFormat()
Definition: docstyle.cxx:2239
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: unoframe.cxx:3257
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unoframe.cxx:2690
void SetValue(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any &rAny)
Mode eMode
bool GetContourAPI(tools::PolyPolygon &rPoly) const
Definition: ndnotxt.cxx:179
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoframe.cxx:3397
void Insert(const tools::Polygon &rPoly, sal_uInt16 nPos=POLYPOLY_APPEND)
#define MID_FILLHATCH
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
Is the frame format a text box?
#define MID_MIRROR_HORZ_ODD_PAGES
Definition: unomid.h:24
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:156
void SetFlyName(SwFlyFrameFormat &rFormat, const OUString &rName)
Definition: doclay.cxx:1418
OUString GetObjTitle() const
Definition: atrfrm.cxx:3179
SAL_DLLPRIVATE void SetXObject(css::uno::Reference< css::uno::XInterface > const &xObject)
Definition: frmfmt.hxx:172
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:161
SwFrameFormat * GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes=false)
Definition: docfly.cxx:115
constexpr tools::Long getHeight() const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
void Unchain(SwFrameFormat &rFormat)
Definition: docfly.cxx:1146
#define MID_COLUMNS
Definition: unomid.h:90
void SetObjTooltip(const OUString &rTooltip)
Definition: atrfrm.cxx:3193
#define FN_UNO_GRAPHIC_FILTER
Definition: cmdid.h:594
virtual void SAL_CALL setAspect(::sal_Int64 _aspect) override
Definition: unoframe.cxx:3568
constexpr TypedWhichId< SwFormatWrapInfluenceOnObjPos > RES_WRAP_INFLUENCE_ON_OBJPOS(125)
static void lcl_FillCol(SfxItemSet &rToSet, const ::SfxItemSet &rFromSet, const ::uno::Any *pAny)
Definition: unoframe.cxx:972
#define FN_UNO_TRANSFORMED_GRAPHIC
Definition: cmdid.h:647
#define PROPERTY_MAP_TEXT_FRAME
Definition: unomap.hxx:38
virtual void Notify(const SfxHint &) override
Definition: unoframe.cxx:2654
const OUString & GetObjTooltip() const
Definition: atrfrm.cxx:3198
#define FN_UNO_Z_ORDER
Definition: cmdid.h:581
MapMode GetPrefMapMode() const
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
#define LEFT_BORDER_DISTANCE
virtual OUString SAL_CALL getImplementationName() override
Definition: unoframe.cxx:3602
#define MID_SURROUND_CONTOUR
Definition: unomid.h:31
constexpr TypedWhichId< SwChannelBGrf > RES_GRFATR_CHANNELB(140)
Base class for various Writer styles.
Definition: format.hxx:46
const css::uno::Sequence< sal_Int8 > & getSeq() const
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:162
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: unoframe.cxx:3252
bool GetAtPageRelOrientation(sal_Int16 &rOrientation, bool const isIgnorePrintArea)
Definition: atrfrm.cxx:108
ContactObject for connection between frames (or their formats respectively) in SwClient and the drawo...
Definition: dcontact.hxx:175
virtual ~BaseFrameProperties_Impl()
Definition: unoframe.cxx:157
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
Definition: unoframe.cxx:3233
css::uno::Reference< css::text::XText > m_xParentText
Definition: unoframe.hxx:77
#define MID_FRMSIZE_WIDTH
Definition: unomid.h:74
void EndListeningAll()
css::uno::Type aType
#define FN_UNO_DESCRIPTION
Definition: cmdid.h:870
constexpr TypedWhichId< SwRotationGrf > RES_GRFATR_ROTATION(135)
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:502
SwUnoCursorHelper::SwAnyMapHelper m_aAnyMap
Definition: unoframe.cxx:145
#define MID_L_MARGIN
sal_uInt16 char * pName
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
#define MID_ANCHOR_ANCHORTYPE
Definition: unomid.h:43
Style of a layout element.
Definition: frmfmt.hxx:59
virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getReplacementGraphic() override
Definition: unoframe.cxx:3583
const SfxItemSet * GetParent() const
#define MID_HORIORIENT_POSITION
Definition: unomid.h:40
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unoframe.cxx:3355
constexpr TypedWhichId< XFillTransparenceItem > XATTR_FILLTRANSPARENCE(XATTR_FILL_FIRST+5)
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:959
virtual css::uno::Reference< css::text::XTextCursor > CreateCursor() override
Definition: unoframe.cxx:3278
#define MID_URL_URL
Definition: unomid.h:50
virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override
Definition: unoframe.cxx:3622
virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override
Definition: unoframe.cxx:3412
constexpr TypedWhichId< XSecondaryFillColorItem > XATTR_SECONDARYFILLCOLOR(XATTR_FILL_FIRST+12)
const SwPosition * GetPoint() const
Definition: pam.hxx:208
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rIdentifier) override
Definition: unotext.cxx:1210
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
#define MID_FRMSIZE_WIDTH_TYPE
Definition: unomid.h:86
static bool SetFillAttribute(sal_uInt16 nWID, const OUString &rName, SfxItemSet &rSet, SdrModel const *pModel)
#define UNO_NAME_FRAME_INTEROP_GRAB_BAG
Definition: unoprnms.hxx:855
void SetContourAPI(const tools::PolyPolygon *pPoly)
Definition: ndnotxt.cxx:170
virtual OUString SAL_CALL getImplementationName() override
Definition: unoframe.cxx:3392
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
OUString GetHexName() const
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:328
FlyCntType
Definition: flyenum.hxx:23
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(58)
bool GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any *&pAny)
Definition: unoframe.cxx:166
#define LINE_WIDTH
virtual css::awt::Point SAL_CALL getPosition() override
Definition: unoframe.cxx:3168
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unoframe.cxx:2409
constexpr TypedWhichId< SwFormatURL > RES_URL(111)
constexpr TypedWhichId< SwCropGrf > RES_GRFATR_CROPGRF(134)
#define MID_VERTORIENT_POSITION
Definition: unomid.h:36
void SetFlyFrameDescription(SwFlyFrameFormat &rFlyFrameFormat, const OUString &sNewDescription)
Definition: docfly.cxx:605
#define TOP_BORDER
TElementType * First()
Definition: calbck.hxx:356
void Assign(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
bool SetFrameFormatToFly(SwFrameFormat &rFlyFormat, SwFrameFormat &rNewFormat, SfxItemSet *pSet=nullptr, bool bKeepOrient=false)
Definition: docfly.cxx:628
#define FN_UNO_TOOLTIP
Definition: cmdid.h:871
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unoframe.cxx:3243
cppu::ImplInheritanceHelper< SwXFrame, css::text::XTextFrame, css::container::XEnumerationAccess, css::document::XEventsSupplier > SwXTextFrameBaseClass
Definition: unoframe.hxx:172
bool MakeId(std::u16string_view rId)
FlyAnchors.
Definition: fmtanchr.hxx:34
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:206
bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet &rSet, sal_uInt16 const nMID)
helper to check if fill style is set to color or bitmap and thus formerly used SvxBrushItem parts nee...
SwNoTextNode * GetNoTextNode()
Definition: ndnotxt.hxx:95
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: unoframe.cxx:2598
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
const SdrPage * GetPage(sal_uInt16 nPgNum) const
#define FN_UNO_COMPONENT
Definition: cmdid.h:604
static SdrObject * GetOrCreateSdrObject(SwFlyFrameFormat &rFormat)
Definition: unoframe.cxx:1347
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
constexpr TypedWhichId< XFillBmpPosItem > XATTR_FILLBMP_POS(XATTR_FILL_FIRST+8)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1154
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: unotext.cxx:193
void SetRelationOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:90
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2694
unsigned char sal_Bool
#define BOTTOM_BORDER_DISTANCE
void SetAutomaticContour(bool bSet)
Definition: ndnotxt.hxx:76
const SfxItemPropertyMap & getPropertyMap() const
#define MID_BACK_COLOR_R_G_B
css::uno::Reference< css::util::XModifyListener > m_xOLEListener
Definition: unoframe.hxx:278
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
sal_uInt32 GetOrdNum() const
PropertyMoreFlags nMoreFlags
virtual void ReRead(SwPaM &, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic)=0
Transpose graphic (with undo)
void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem &rBrush, SfxItemSet &rToSet)
#define MID_BACK_COLOR_TRANSPARENCY
virtual ~SwXTextFrame() override
Definition: unoframe.cxx:3213
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:1697
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Definition: ndnotxt.hxx:29
#define FN_UNO_TITLE
Definition: cmdid.h:869
sal_uInt16 GetSize() const
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:31
Marks a node in the document model.
Definition: ndindex.hxx:30
css::uno::Type const & get()
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:703
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > &aTextPosition) override
Definition: unoframe.cxx:3321
#define MID_SURROUND_CONTOUROUTSIDE
Definition: unomid.h:32
bool GoInDoc(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:947
virtual OUString SAL_CALL getImplementationName() override
Definition: unoframe.cxx:3464
static SwOLENode * lcl_GetOLENode(const SwFrameFormat *pFrameFormat)
Definition: xmltexti.cxx:185
#define MID_R_MARGIN
#define MID_GRAPHIC_POSITION
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
cppu::ImplInheritanceHelper< SwXFrame, css::document::XEmbeddedObjectSupplier2, css::document::XEventsSupplier > SwXTextEmbeddedObjectBaseClass
Definition: unoframe.hxx:274
bool StartListening(SvtBroadcaster &rBroadcaster)
virtual ::sal_Int64 SAL_CALL getAspect() override
Definition: unoframe.cxx:3551
SwStartNode * GetStartNode()
Definition: node.hxx:601
virtual void SAL_CALL setPosition(const css::awt::Point &aPosition) override
Definition: unoframe.cxx:3175
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getEmbeddedObject() override
Definition: unoframe.cxx:3511
const SfxItemPropertySet * m_pPropSet
Definition: unoframe.hxx:64
#define UNO_NAME_CHAIN_PREV_NAME
Definition: unoprnms.hxx:235
bool FillValue(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any *&pAny)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
const SvXMLTokenMapEntry aTypes[]
bool SetFlyFrameAttr(SwFrameFormat &rFlyFormat, SfxItemSet &rSet)
Definition: docfly.cxx:554
const GraphicObject & GetGrfObj(bool bWait=false) const
Definition: ndgrf.cxx:379
css::uno::Reference< css::frame::XModel > m_xOLEModel
Definition: unoframe.hxx:311
static void GetGrfNms(const SwFlyFrameFormat &rFormat, OUString *pGrfName, OUString *pFltName)
Definition: docfly.cxx:715
bool IsInReading() const
Definition: doc.hxx:953
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_EventListeners
Definition: unoframe.cxx:1157
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
enumrange< T >::Iterator end(enumrange< T >)
#define Y
const SwPosition * Start() const
Definition: pam.hxx:213
#define UNO_NAME_IS_AUTOMATIC_CONTOUR
Definition: unoprnms.hxx:497
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange,::sw::TextRangeMode const eMode)
Definition: unoobj2.cxx:1107
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoframe.cxx:3474
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unoframe.cxx:3343
#define MID_PROTECT_CONTENT
virtual SdrLayerID GetHellId() const =0
SwXTextEmbeddedObject(SwDoc *pDoc)
Definition: unoframe.cxx:3489
#define FN_UNO_GRAPHIC
Definition: cmdid.h:610
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unoframe.cxx:2391
virtual OUString SAL_CALL getShapeType() override
Definition: unoframe.cxx:3195
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unoframe.cxx:3365
#define MID_MIRROR_HORZ_EVEN_PAGES
Definition: unomid.h:23
bool FillBaseProperties(SfxItemSet &rToSet, const SfxItemSet &rFromSet, bool &rSizeFound)
Definition: unoframe.cxx:171
void SvxUnoConvertFromMM(const MapUnit eDestinationMapUnit, uno::Any &rMetric) noexcept
void SetParent(const SfxItemSet *pNew)
bool Any2Bool(const css::uno::Any &rValue)
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
SvtBroadcaster & GetNotifier()
Definition: calbck.hxx:101
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unoframe.cxx:1166
virtual ~SwXTextGraphicObject() override
Definition: unoframe.cxx:3454
const Point & GetPoint(sal_uInt16 nPos) const
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
constexpr TypedWhichId< SfxGrabBagItem > RES_FRMATR_GRABBAG(129)
SwFormat * DerivedFrom() const
Definition: format.hxx:128
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
#define MID_GRAPHIC_URL
sal_Int64 m_nVisibleAreaWidth
Definition: unoframe.hxx:75
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr TypedWhichId< SwMirrorGrf > RES_GRFATR_MIRRORGRF(RES_GRFATR_BEGIN)
constexpr TypedWhichId< XGradientStepCountItem > XATTR_GRADIENTSTEPCOUNT(XATTR_FILL_FIRST+6)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
#define MID_HORIORIENT_ORIENT
Definition: unomid.h:38
void DeleteAttributes(const sal_uInt16 nWhich, const sal_Int32 nStart, const sal_Int32 nEnd=0)
delete all attributes of type nWhich at nStart (opt. end nEnd)
Definition: thints.cxx:1772
#define COL_DEFAULT_SHAPE_STROKE
static bool GetLock()
#define MID_FRMSIZE_REL_HEIGHT_RELATION
Definition: unomid.h:88
const SwDoc * GetDoc() const
Definition: unotext.cxx:133
bool IsDescriptor() const
Definition: unoframe.hxx:159
SwXOLEListener(SwFormat &rOLEFormat, css::uno::Reference< css::frame::XModel > const &xOLE)
Definition: unoframe.cxx:3641
#define OWN_ATTR_FILLBMP_MODE
Definition: unomap.hxx:314
constexpr TypedWhichId< XFillFloatTransparenceItem > XATTR_FILLFLOATTRANSPARENCE(XATTR_FILL_FIRST+11)
#define MID_ANCHOR_ANCHORFRAME
Definition: unomid.h:45
#define BOTTOM_BORDER
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unoframe.cxx:3417
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1572
SwXFrame(FlyCntType eSet, const SfxItemPropertySet *pPropSet, SwDoc *pDoc)
void SetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any &rVal)
Definition: unoframe.cxx:161
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
const SwFormatChain & GetChain(bool=true) const
Definition: fmtcnct.hxx:70
const SvxOpaqueItem & GetOpaque(bool=true) const
Definition: frmatr.hxx:80
sal_Int64 m_nVisibleAreaHeight
Definition: unoframe.hxx:76
general base class for all free-flowing frames
Definition: flyfrm.hxx:78
static MapUnit UnoEmbed2VCLMapUnit(sal_Int32 nUnoEmbedMapUnit)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const Graphic & GetGraphic() const
#define MID_WRAP_INFLUENCE
Definition: unomid.h:148
SwContentFrame * GetCurrFrame(const bool bCalcFrame=true) const
Get current frame in which the cursor is positioned.
Definition: crsrsh.cxx:2457
constexpr TypedWhichId< XFillBmpPosOffsetYItem > XATTR_FILLBMP_POSOFFSETY(XATTR_FILL_FIRST+18)
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unoframe.cxx:2403
constexpr tools::Long Height() const
#define MID_VERTORIENT_ORIENT
Definition: unomid.h:34
unsigned char sal_uInt8
#define UNO_NAME_ANCHOR_TYPE
Definition: unoprnms.hxx:228
constexpr TypedWhichId< SwChannelGGrf > RES_GRFATR_CHANNELG(139)
constexpr TypedWhichId< SwInvertGrf > RES_GRFATR_INVERT(142)
#define FN_UNO_ACTUAL_SIZE
Definition: cmdid.h:592
constexpr sal_uInt16 RES_GRFATR_BEGIN(RES_FRMATR_END)
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
constexpr TypedWhichId< XFillBmpStretchItem > XATTR_FILLBMP_STRETCH(XATTR_FILL_FIRST+16)
#define FN_PARAM_LINK_DISPLAY_NAME
Definition: cmdid.h:822
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
void SvxUnoConvertToMM(const MapUnit eSourceMapUnit, uno::Any &rMetric) noexcept
#define MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH
Definition: unomid.h:85
#define MID_FRMSIZE_REL_WIDTH_RELATION
Definition: unomid.h:87
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
OUString aName
sal_Int32 GetIndex() const
Definition: index.hxx:91
constexpr TypedWhichId< SwDrawModeGrf > RES_GRFATR_DRAWMODE(144)
virtual SwDrawModel * GetOrCreateDrawModel()=0
SwNodes & GetNodes()
Definition: doc.hxx:408
#define FN_UNO_REPLACEMENT_GRAPHIC_URL
Definition: cmdid.h:612
#define MID_SHADOW_TRANSPARENCE
size_t GetFlyCount(FlyCntType eType, bool bIgnoreTextBoxes=false) const
Access to frames.
Definition: docfly.cxx:68
#define BORDER_DISTANCE
constexpr TypedWhichId< XFillBmpPosOffsetXItem > XATTR_FILLBMP_POSOFFSETX(XATTR_FILL_FIRST+17)
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3218
#define TOP_BORDER_DISTANCE
static void SetLock(bool bLock)
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
constexpr TypedWhichId< XFillBmpTileItem > XATTR_FILLBMP_TILE(XATTR_FILL_FIRST+7)
void SetSize(const Size &rSize)
void SetGraphic(const Graphic &rGraphic, const OUString &rMediaType)
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:87
#define MID_LO_MARGIN
#define MID_GRAPHIC_FILTER
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
constexpr TypedWhichId< XFillBmpSizeLogItem > XATTR_FILLBMP_SIZELOG(XATTR_FILL_FIRST+13)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
#define FN_UNO_GRAPHIC_URL
Definition: cmdid.h:593
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
void SetFlyFrameTitle(SwFlyFrameFormat &rFlyFrameFormat, const OUString &sNewTitle)
Definition: docfly.cxx:582
void Optimize(PolyOptimizeFlags nOptimizeFlags)
#define FN_UNO_ANCHOR_TYPES
Definition: cmdid.h:571
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:108
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:724
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:358
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unoframe.hxx:60
#define MID_HORIORIENT_PAGETOGGLE
Definition: unomid.h:41
#define MID_HORIORIENT_RELATION
Definition: unomid.h:39
#define FN_UNO_REPLACEMENT_GRAPHIC
Definition: cmdid.h:618
void setHeight(tools::Long nHeight)
void SetType(RndStdIds nRndId)
Definition: fmtanchr.hxx:71
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unoframe.cxx:1318
#define MID_FRMSIZE_REL_HEIGHT
Definition: unomid.h:71
#define UNO_NAME_Z_ORDER
Definition: unoprnms.hxx:531
const SwStartNode * FindFlyStartNode() const
Definition: node.hxx:200
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unoframe.cxx:3382
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoframe.cxx:3469
#define FN_UNO_GRAPHIC_PREVIEW
Definition: cmdid.h:648
#define FN_UNO_IS_AUTOMATIC_CONTOUR
Definition: cmdid.h:589
#define UNO_NAME_START_REDLINE
Definition: unoprnms.hxx:556
cppu::ImplInheritanceHelper< SwXFrame, css::document::XEventsSupplier > SwXTextGraphicObjectBaseClass
Definition: unoframe.hxx:246
MapUnit
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unoframe.cxx:1160
#define SAL_WARN(area, stream)
#define RIGHT_BORDER
Reference< XModel > xModel
virtual void SAL_CALL dispose() override
Definition: unoframe.cxx:2660
#define UNO_NAME_DESCRIPTION
Definition: unoprnms.hxx:814
RndStdIds
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
#define MID_URL_TARGET
Definition: unomid.h:51
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
constexpr tools::Long getWidth() const
static css::uno::Reference< css::text::XTextContent > CreateXTextEmbeddedObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3506
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unoframe.cxx:2000
static css::uno::Reference< css::text::XTextContent > CreateXTextGraphicObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3459
const EnumerationType m_eType
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:476
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
Definition: unoframe.cxx:3669
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unoframe.cxx:2622
SwGrfNode * GetGrfNode()
Definition: ndgrf.hxx:154
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
#define MID_URL_SERVERMAP
Definition: unomid.h:49
static css::uno::Reference< css::text::XTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1214
constexpr TypedWhichId< XFillBmpTileOffsetXItem > XATTR_FILLBMP_TILEOFFSETX(XATTR_FILL_FIRST+14)
static rtl::Reference< SwXParagraphEnumeration > Create(css::uno::Reference< css::text::XText > const &xParent, const std::shared_ptr< SwUnoCursor > &pCursor, const CursorType eType, SwTableBox const *const pTableBox=nullptr)
Definition: unoobj2.cxx:449
#define UNO_NAME_CONTOUR_POLY_POLYGON
Definition: unoprnms.hxx:494
#define FN_UNO_IS_PIXEL_CONTOUR
Definition: cmdid.h:590
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
#define PROPERTY_MAP_EMBEDDED_OBJECT
Definition: unomap.hxx:62
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unoframe.cxx:3370
constexpr TypedWhichId< SwFormatFollowTextFlow > RES_FOLLOW_TEXT_FLOW(123)
#define MID_MIRROR_VERT
Definition: unomid.h:22
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoframe.cxx:3607
#define FN_UNO_FRAME_STYLE_NAME
Definition: cmdid.h:532
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
#define MID_GRAPHIC
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unotext.cxx:1115
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
constexpr TypedWhichId< XFillBmpSizeYItem > XATTR_FILLBMP_SIZEY(XATTR_FILL_FIRST+10)
OUString m_sName
Definition: unoframe.hxx:72
Standard page.
Definition: poolfmt.hxx:170
SwXTextGraphicObject(SwDoc *pDoc)
Definition: unoframe.cxx:3442
SdrObjUserCall * GetUserCall() const
sal_Int32 nState
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
#define UNO_NAME_TITLE
Definition: unoprnms.hxx:322
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1300
SwXTextFrame(SwDoc *pDoc)
Definition: unoframe.cxx:3200
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:140
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
sal_Int64 m_nDrawAspect
Definition: unoframe.hxx:74
uno::Reference< text::XText > CreateParentXText(SwDoc &rDoc, const SwPosition &rPos)
Definition: unoobj2.cxx:1235
void DisposeInternal()
Definition: unoframe.cxx:2636
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2763
#define MID_BITMAP
const Graphic & GetGrf(bool bWait=false) const
Definition: ndgrf.cxx:373
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unoframe.cxx:2629
bool m_bIsDescriptor
Definition: unoframe.hxx:71
virtual sal_Bool SAL_CALL hasElements() override
Definition: unoframe.cxx:3360
virtual OUString SAL_CALL getName() override
Definition: unoframe.cxx:1289
#define FN_UNO_DRAW_ASPECT
Definition: cmdid.h:635
bool sw_ChkAndSetNewAnchor(const SwFlyFrame &rFly, SfxItemSet &rSet)
also used in unoframe.cxx
Definition: fefly1.cxx:213
bool IsInXMLImport() const
Definition: doc.hxx:969
void SetContour(const tools::PolyPolygon *pPoly, bool bAutomatic=false)
Definition: ndnotxt.cxx:85
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1318
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
Definition: unoframe.cxx:2423
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
sal_Int16 nValue
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unoframe.cxx:1390
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:713
#define MID_ALLOW_OVERLAP
Definition: unomid.h:149
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1585
bool m_bDetectedRangeSegmentation false
#define CONVERT_TWIPS
void SetPixelContour(bool bSet)
Definition: ndnotxt.hxx:85
virtual void Notify(const SfxHint &) override
Definition: unoframe.cxx:3687
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
static const OUString & GetProgName(const OUString &rName, SwGetPoolIdFromName)
Base class of the Writer document model elements.
Definition: node.hxx:81
constexpr TypedWhichId< SwGammaGrf > RES_GRFATR_GAMMA(141)
#define MID_UP_MARGIN
#define MID_PROTECT_SIZE