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