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