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