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