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;
923  const ::uno::Any* pLayOutinCell = nullptr;
926 
927  if ( pFollowTextFlow || pLayOutinCell)
928  {
929  SwFormatFollowTextFlow aFormatFollowTextFlow;
930  if( pFollowTextFlow )
931  {
932  aFormatFollowTextFlow.PutValue(*pFollowTextFlow, MID_FOLLOW_TEXT_FLOW);
933  }
934 
935  if ( pLayOutinCell )
936  {
937  aFormatFollowTextFlow.PutValue(*pLayOutinCell, MID_FTF_LAYOUT_IN_CELL);
938  }
939  rToSet.Put(aFormatFollowTextFlow);
940  }
941 
942  // #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS
943  const ::uno::Any* pWrapInfluenceOnObjPos = nullptr;
945  if ( pWrapInfluenceOnObjPos )
946  {
947  SwFormatWrapInfluenceOnObjPos aFormatWrapInfluenceOnObjPos;
948  aFormatWrapInfluenceOnObjPos.PutValue( *pWrapInfluenceOnObjPos, MID_WRAP_INFLUENCE );
949  rToSet.Put(aFormatWrapInfluenceOnObjPos);
950  }
951 
952  {
953  const ::uno::Any* pTextVertAdjust = nullptr;
954  GetProperty(RES_TEXT_VERT_ADJUST, 0, pTextVertAdjust);
955  if ( pTextVertAdjust )
956  {
957  SdrTextVertAdjustItem aTextVertAdjust( rFromSet.Get ( RES_TEXT_VERT_ADJUST ) );
958  bRet &= static_cast<SfxPoolItem&>(aTextVertAdjust).PutValue(*pTextVertAdjust, 0);
959  rToSet.Put(aTextVertAdjust);
960  }
961  }
962 
963  return bRet;
964 }
965 
967 {
968 public:
970 
971  bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override;
972 };
973 
975  BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)*/ )
976 {
977 }
978 
979 static void lcl_FillCol ( SfxItemSet &rToSet, const ::SfxItemSet &rFromSet, const ::uno::Any *pAny)
980 {
981  if ( pAny )
982  {
983  SwFormatCol aCol ( rFromSet.Get ( RES_COL ) );
984  static_cast<SfxPoolItem&>(aCol).PutValue( *pAny, MID_COLUMNS);
985  rToSet.Put(aCol);
986  }
987 }
988 
989 bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItemSet&, bool& rSizeFound)
990 {
991  // Properties for all frames
992  const ::uno::Any *pStyleName;
993  SwDocStyleSheet* pStyle = nullptr;
994  bool bRet;
995 
996  if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
997  {
998  OUString sStyle;
999  *pStyleName >>= sStyle;
1001  pStyle = static_cast<SwDocStyleSheet*>(pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
1002  SfxStyleFamily::Frame));
1003  }
1004 
1005  const ::uno::Any* pColumns = nullptr;
1006  GetProperty (RES_COL, MID_COLUMNS, pColumns);
1007  if ( pStyle )
1008  {
1009  rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *pStyle ) );
1010  const ::SfxItemSet *pItemSet = &xStyle->GetItemSet();
1011  bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
1012  lcl_FillCol ( rSet, *pItemSet, pColumns );
1013  }
1014  else
1015  {
1016  const ::SfxItemSet *pItemSet = &pDoc->getIDocumentStylePoolAccess().GetFrameFormatFromPool( RES_POOLFRM_FRAME )->GetAttrSet();
1017  bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
1018  lcl_FillCol ( rSet, *pItemSet, pColumns );
1019  }
1020  const ::uno::Any* pEdit;
1021  if(GetProperty(RES_EDIT_IN_READONLY, 0, pEdit))
1022  {
1024  item.PutValue(*pEdit, 0);
1025  rSet.Put(item);
1026  }
1027  return bRet;
1028 }
1029 
1031 {
1032 public:
1034 
1035  virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override;
1036 };
1037 
1039  BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC)*/ )
1040 {
1041 }
1042 
1043 static void lcl_FillMirror ( SfxItemSet &rToSet, const ::SfxItemSet &rFromSet, const ::uno::Any *pHEvenMirror, const ::uno::Any *pHOddMirror, const ::uno::Any *pVMirror, bool &rRet )
1044 {
1045  if(pHEvenMirror || pHOddMirror || pVMirror )
1046  {
1047  SwMirrorGrf aMirror ( rFromSet.Get ( RES_GRFATR_MIRRORGRF ) );
1048  if(pHEvenMirror)
1049  rRet &= static_cast<SfxPoolItem&>(aMirror).PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES);
1050  if(pHOddMirror)
1051  rRet &= static_cast<SfxPoolItem&>(aMirror).PutValue(*pHOddMirror, MID_MIRROR_HORZ_ODD_PAGES);
1052  if(pVMirror)
1053  rRet &= static_cast<SfxPoolItem&>(aMirror).PutValue(*pVMirror, MID_MIRROR_VERT);
1054  rToSet.Put(aMirror);
1055  }
1056 }
1057 
1059  SwDoc* pDoc,
1060  SfxItemSet& rFrameSet,
1061  SfxItemSet& rGrSet,
1062  bool& rSizeFound)
1063 {
1064  // Properties for all frames
1065  bool bRet;
1066  const ::uno::Any *pStyleName;
1067  SwDocStyleSheet* pStyle = nullptr;
1068 
1069  if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
1070  {
1071  OUString sStyle;
1072  *pStyleName >>= sStyle;
1074  pStyle = static_cast<SwDocStyleSheet*>(pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
1075  SfxStyleFamily::Frame));
1076  }
1077 
1078  const ::uno::Any* pHEvenMirror = nullptr;
1079  const ::uno::Any* pHOddMirror = nullptr;
1080  const ::uno::Any* pVMirror = nullptr;
1084 
1085  if ( pStyle )
1086  {
1087  rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet(*pStyle) );
1088  const ::SfxItemSet *pItemSet = &xStyle->GetItemSet();
1089  bRet = FillBaseProperties(rFrameSet, *pItemSet, rSizeFound);
1090  lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
1091  }
1092  else
1093  {
1094  const ::SfxItemSet *pItemSet = &pDoc->getIDocumentStylePoolAccess().GetFrameFormatFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet();
1095  bRet = FillBaseProperties(rFrameSet, *pItemSet, rSizeFound);
1096  lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
1097  }
1098 
1099  static const ::sal_uInt16 nIDs[] =
1100  {
1112  0
1113  };
1114  const ::uno::Any* pAny;
1115  for(sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++)
1116  {
1117  sal_uInt8 nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0;
1118  if(GetProperty(nIDs[nIndex], nMId, pAny ))
1119  {
1120  std::unique_ptr<SfxPoolItem> pItem(::GetDfltAttr( nIDs[nIndex] )->Clone());
1121  bRet &= pItem->PutValue(*pAny, nMId );
1122  rGrSet.Put(std::move(pItem));
1123  }
1124  }
1125 
1126  return bRet;
1127 }
1128 
1130 {
1131 public:
1133  SwFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT)*/ ){}
1134 
1135  virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override;
1136 };
1137 
1139  SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound)
1140 {
1141  const ::uno::Any* pTemp;
1142  if(!GetProperty(FN_UNO_CLSID, 0, pTemp) && !GetProperty(FN_UNO_STREAM_NAME, 0, pTemp)
1143  && !GetProperty(FN_EMBEDDED_OBJECT, 0, pTemp)
1144  && !GetProperty(FN_UNO_VISIBLE_AREA_WIDTH, 0, pTemp)
1145  && !GetProperty(FN_UNO_VISIBLE_AREA_HEIGHT, 0, pTemp) )
1146  return false;
1147  SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrameSet, rSet, rSizeFound);
1148 
1149  return true;
1150 }
1151 
1153 {
1154 private:
1155  ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
1156 
1157 public:
1158  uno::WeakReference<uno::XInterface> m_wThis;
1160 
1161  Impl() : m_EventListeners(m_Mutex) { }
1162 };
1163 
1164 namespace
1165 {
1166  class theSwXFrameUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXFrameUnoTunnelId > {};
1167 }
1168 
1169 const ::uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId()
1170 {
1171  return theSwXFrameUnoTunnelId::get().getSeq();
1172 }
1173 
1174 sal_Int64 SAL_CALL SwXFrame::getSomething( const ::uno::Sequence< sal_Int8 >& rId )
1175 {
1176  if( isUnoTunnelId<SwXFrame>(rId) )
1177  {
1178  return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
1179  }
1180  return 0;
1181 }
1182 
1183 
1185 {
1186  return "SwXFrame";
1187 }
1188 
1189 sal_Bool SwXFrame::supportsService(const OUString& rServiceName)
1190 {
1191  return cppu::supportsService(this, rServiceName);
1192 }
1193 
1194 uno::Sequence< OUString > SwXFrame::getSupportedServiceNames()
1195 {
1196  return { "com.sun.star.text.BaseFrame", "com.sun.star.text.TextContent", "com.sun.star.document.LinkTarget" };
1197 }
1198 
1199 SwXFrame::SwXFrame(FlyCntType eSet, const ::SfxItemPropertySet* pSet, SwDoc *pDoc)
1200  : m_pImpl(new Impl)
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  : SwClient(&rFrameFormat)
1255  , m_pImpl(new Impl)
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 }
1265 
1267 {
1268  SolarMutexGuard aGuard;
1269  m_pCopySource.reset();
1270  m_pProps.reset();
1271  EndListeningAll();
1272 }
1273 
1274 template<class Interface, class NameLookupIsHard>
1275 uno::Reference<Interface>
1276 SwXFrame::CreateXFrame(SwDoc & rDoc, SwFrameFormat *const pFrameFormat)
1277 {
1278  assert(!pFrameFormat || &rDoc == pFrameFormat->GetDoc());
1279  uno::Reference<Interface> xFrame;
1280  if (pFrameFormat)
1281  {
1282  xFrame.set(pFrameFormat->GetXObject(), uno::UNO_QUERY); // cached?
1283  }
1284  if (!xFrame.is())
1285  {
1286  NameLookupIsHard *const pNew(pFrameFormat
1287  ? new NameLookupIsHard(*pFrameFormat)
1288  : new NameLookupIsHard(&rDoc));
1289  xFrame.set(pNew);
1290  if (pFrameFormat)
1291  {
1292  pFrameFormat->SetXObject(xFrame);
1293  }
1294  // need a permanent Reference to initialize m_wThis
1295  pNew->SwXFrame::m_pImpl->m_wThis = xFrame;
1296  }
1297  return xFrame;
1298 }
1299 
1301 {
1302  SolarMutexGuard aGuard;
1303  SwFrameFormat* pFormat = GetFrameFormat();
1304  if(pFormat)
1305  return pFormat->GetName();
1306  if(!bIsDescriptor)
1307  throw uno::RuntimeException();
1308  return m_sName;
1309 }
1310 
1311 void SwXFrame::setName(const OUString& rName)
1312 {
1313  SolarMutexGuard aGuard;
1314  SwFrameFormat* pFormat = GetFrameFormat();
1315  if(pFormat)
1316  {
1317  pFormat->GetDoc()->SetFlyName(static_cast<SwFlyFrameFormat&>(*pFormat), rName);
1318  if(pFormat->GetName() != rName)
1319  {
1320  throw uno::RuntimeException();
1321  }
1322  }
1323  else if(bIsDescriptor)
1324  m_sName = rName;
1325  else
1326  throw uno::RuntimeException();
1327 }
1328 
1329 uno::Reference< beans::XPropertySetInfo > SwXFrame::getPropertySetInfo()
1330 {
1331  uno::Reference< beans::XPropertySetInfo > xRef;
1332  static uno::Reference< beans::XPropertySetInfo > xFrameRef;
1333  static uno::Reference< beans::XPropertySetInfo > xGrfRef;
1334  static uno::Reference< beans::XPropertySetInfo > xOLERef;
1335  switch(eType)
1336  {
1337  case FLYCNTTYPE_FRM:
1338  if( !xFrameRef.is() )
1339  xFrameRef = m_pPropSet->getPropertySetInfo();
1340  xRef = xFrameRef;
1341  break;
1342  case FLYCNTTYPE_GRF:
1343  if( !xGrfRef.is() )
1344  xGrfRef = m_pPropSet->getPropertySetInfo();
1345  xRef = xGrfRef;
1346  break;
1347  case FLYCNTTYPE_OLE:
1348  if( !xOLERef.is() )
1349  xOLERef = m_pPropSet->getPropertySetInfo();
1350  xRef = xOLERef;
1351  break;
1352  default:
1353  ;
1354  }
1355  return xRef;
1356 }
1357 
1358 void SwXFrame::SetSelection(SwPaM& rCopySource)
1359 {
1360  m_pCopySource.reset(new SwPaM(*rCopySource.Start()));
1361  m_pCopySource->SetMark();
1362  *m_pCopySource->GetMark() = *rCopySource.End();
1363 }
1364 
1366 {
1367  SdrObject* pObject = rFormat.FindSdrObject();
1368  if( !pObject )
1369  {
1370  SwDoc *pDoc = rFormat.GetDoc();
1371  // #i52858# - method name changed
1372  SwFlyDrawContact* pContactObject(rFormat.GetOrCreateContact());
1373  pObject = pContactObject->GetMaster();
1374 
1375  const ::SwFormatSurround& rSurround = rFormat.GetSurround();
1376  pObject->SetLayer(
1377  ( css::text::WrapTextMode_THROUGH == rSurround.GetSurround() &&
1378  !rFormat.GetOpaque().GetValue() ) ? pDoc->getIDocumentDrawModelAccess().GetHellId()
1381  pDrawModel->GetPage(0)->InsertObject( pObject );
1382  }
1383 
1384  return pObject;
1385 }
1386 
1387 static SwFrameFormat *lcl_GetFrameFormat( const ::uno::Any& rValue, SwDoc *pDoc )
1388 {
1389  SwFrameFormat *pRet = nullptr;
1390  SwDocShell* pDocSh = pDoc->GetDocShell();
1391  if(pDocSh)
1392  {
1393  OUString uTemp;
1394  rValue >>= uTemp;
1395  OUString sStyle;
1396  SwStyleNameMapper::FillUIName(uTemp, sStyle,
1398  SwDocStyleSheet* pStyle =
1399  static_cast<SwDocStyleSheet*>(pDocSh->GetStyleSheetPool()->Find(sStyle,
1400  SfxStyleFamily::Frame));
1401  if(pStyle)
1402  pRet = pStyle->GetFrameFormat();
1403  }
1404 
1405  return pRet;
1406 }
1407 
1408 void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& _rValue)
1409 {
1410  SolarMutexGuard aGuard;
1411  SwFrameFormat* pFormat = GetFrameFormat();
1412  const ::SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
1413 
1414  if (!pEntry)
1415  throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1416 
1417  const sal_uInt8 nMemberId(pEntry->nMemberId);
1418  uno::Any aValue(_rValue);
1419 
1420  // check for needed metric translation
1421  if(pEntry->nMoreFlags & PropertyMoreFlags::METRIC_ITEM)
1422  {
1423  bool bDoIt(true);
1424 
1425  if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
1426  {
1427  // exception: If these ItemTypes are used, do not convert when these are negative
1428  // since this means they are intended as percent values
1429  sal_Int32 nValue = 0;
1430 
1431  if(aValue >>= nValue)
1432  {
1433  bDoIt = nValue > 0;
1434  }
1435  }
1436 
1437  if(bDoIt)
1438  {
1439  const SwDoc* pDoc = (IsDescriptor() ? m_pDoc : GetFrameFormat()->GetDoc());
1440  const SfxItemPool& rPool = pDoc->GetAttrPool();
1441  const MapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));
1442 
1443  if(eMapUnit != MapUnit::Map100thMM)
1444  {
1445  SvxUnoConvertFromMM(eMapUnit, aValue);
1446  }
1447  }
1448  }
1449 
1450  if(pFormat)
1451  {
1452  bool bNextFrame = false;
1453  if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
1454  throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1455 
1456  SwDoc* pDoc = pFormat->GetDoc();
1457  if ( ((eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID)) ||
1458  (FN_PARAM_CONTOUR_PP == pEntry->nWID) ||
1459  (FN_UNO_IS_AUTOMATIC_CONTOUR == pEntry->nWID) ||
1460  (FN_UNO_IS_PIXEL_CONTOUR == pEntry->nWID) )
1461  {
1462  const ::SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
1463  if(pIdx)
1464  {
1465  SwNodeIndex aIdx(*pIdx, 1);
1466  SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
1467  if(pEntry->nWID == FN_PARAM_CONTOUR_PP)
1468  {
1469  drawing::PointSequenceSequence aParam;
1470  if(!aValue.hasValue())
1471  pNoText->SetContour(nullptr);
1472  else if(aValue >>= aParam)
1473  {
1474  tools::PolyPolygon aPoly(static_cast<sal_uInt16>(aParam.getLength()));
1475  for(const ::drawing::PointSequence& rPointSeq : std::as_const(aParam))
1476  {
1477  sal_Int32 nPoints = rPointSeq.getLength();
1478  const ::awt::Point* pPoints = rPointSeq.getConstArray();
1479  tools::Polygon aSet( static_cast<sal_uInt16>(nPoints) );
1480  for(sal_Int32 j = 0; j < nPoints; j++)
1481  {
1482  Point aPoint(pPoints[j].X, pPoints[j].Y);
1483  aSet.SetPoint(aPoint, static_cast<sal_uInt16>(j));
1484  }
1485  // Close polygon if it isn't closed already.
1486  aSet.Optimize( PolyOptimizeFlags::CLOSE );
1487  aPoly.Insert( aSet );
1488  }
1489  pNoText->SetContourAPI( &aPoly );
1490  }
1491  else
1492  throw lang::IllegalArgumentException();
1493  }
1494  else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
1495  {
1496  pNoText->SetAutomaticContour( *o3tl::doAccess<bool>(aValue) );
1497  }
1498  else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
1499  {
1500  // The IsPixelContour property can only be set if there
1501  // is no contour, or if the contour has been set by the
1502  // API itself (or in other words, if the contour isn't
1503  // used already).
1504  if( pNoText->HasContour_() && pNoText->IsContourMapModeValid() )
1505  throw lang::IllegalArgumentException();
1506 
1507  pNoText->SetPixelContour( *o3tl::doAccess<bool>(aValue) );
1508 
1509  }
1510  else
1511  {
1512  SfxItemSet aSet(pNoText->GetSwAttrSet());
1513  m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
1514  pNoText->SetAttr(aSet);
1515  }
1516  }
1517  }
1518  // New attribute Title
1519  else if( FN_UNO_TITLE == pEntry->nWID )
1520  {
1521  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
1522  OUString sTitle;
1523  aValue >>= sTitle;
1524  // assure that <SdrObject> instance exists.
1525  GetOrCreateSdrObject(rFlyFormat);
1526  rFlyFormat.GetDoc()->SetFlyFrameTitle(rFlyFormat, sTitle);
1527  }
1528  // New attribute Description
1529  else if( FN_UNO_DESCRIPTION == pEntry->nWID )
1530  {
1531  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
1532  OUString sDescription;
1533  aValue >>= sDescription;
1534  // assure that <SdrObject> instance exists.
1535  GetOrCreateSdrObject(rFlyFormat);
1536  rFlyFormat.GetDoc()->SetFlyFrameDescription(rFlyFormat, sDescription);
1537  }
1538  else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
1539  {
1540  SwFrameFormat *pFrameFormat = lcl_GetFrameFormat( aValue, pFormat->GetDoc() );
1541  if( !pFrameFormat )
1542  throw lang::IllegalArgumentException();
1543 
1544  UnoActionContext aAction(pFormat->GetDoc());
1545 
1546  std::unique_ptr<SfxItemSet> pSet;
1547  // #i31771#, #i25798# - No adjustment of
1548  // anchor ( no call of method <sw_ChkAndSetNewAnchor(..)> ),
1549  // if document is currently in reading mode.
1550  if ( !pFormat->GetDoc()->IsInReading() )
1551  {
1552  // see SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Point* pDocPos )
1553  SwFlyFrame *pFly = nullptr;
1554  if (auto pFlyFrameFormat = dynamic_cast<const SwFlyFrameFormat*>(pFormat) )
1555  pFly = pFlyFrameFormat->GetFrame();
1556  if ( pFly )
1557  {
1558  const ::SfxPoolItem* pItem;
1559  if( SfxItemState::SET == pFrameFormat->GetItemState( RES_ANCHOR, false, &pItem ))
1560  {
1561  pSet.reset(new SfxItemSet( pDoc->GetAttrPool(), aFrameFormatSetRange ));
1562  pSet->Put( *pItem );
1563  if ( pFormat->GetDoc()->GetEditShell() != nullptr
1564  && !sw_ChkAndSetNewAnchor( *pFly, *pSet ) )
1565  {
1566  pSet.reset();
1567  }
1568  }
1569  }
1570  }
1571 
1572  pFormat->GetDoc()->SetFrameFormatToFly( *pFormat, *pFrameFormat, pSet.get() );
1573  }
1574  else if (FN_UNO_GRAPHIC_FILTER == pEntry->nWID)
1575  {
1576  OUString sGrfName;
1577  OUString sFltName;
1578  SwDoc::GetGrfNms( *static_cast<SwFlyFrameFormat*>(pFormat), &sGrfName, &sFltName );
1579  aValue >>= sFltName;
1580  UnoActionContext aAction(pFormat->GetDoc());
1581  const ::SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
1582  if (pIdx)
1583  {
1584  SwNodeIndex aIdx(*pIdx, 1);
1585  SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
1586  if(!pGrfNode)
1587  {
1588  throw uno::RuntimeException();
1589  }
1590  SwPaM aGrfPaM(*pGrfNode);
1591  pFormat->GetDoc()->getIDocumentContentOperations().ReRead(aGrfPaM, sGrfName, sFltName, nullptr);
1592  }
1593  }
1594  else if (FN_UNO_GRAPHIC == pEntry->nWID || FN_UNO_GRAPHIC_URL == pEntry->nWID)
1595  {
1596  Graphic aGraphic;
1597  if (aValue.has<OUString>())
1598  {
1599  OUString aURL = aValue.get<OUString>();
1600  if (!aURL.isEmpty())
1601  {
1602  aGraphic = vcl::graphic::loadFromURL(aURL);
1603  }
1604  }
1605  else if (aValue.has<uno::Reference<graphic::XGraphic>>())
1606  {
1607  uno::Reference<graphic::XGraphic> xGraphic = aValue.get<uno::Reference<graphic::XGraphic>>();
1608  if (xGraphic.is())
1609  {
1610  aGraphic = Graphic(xGraphic);
1611  }
1612  }
1613 
1614  if (!aGraphic.IsNone())
1615  {
1616  const ::SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
1617  if (pIdx)
1618  {
1619  SwNodeIndex aIdx(*pIdx, 1);
1620  SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
1621  if (!pGrfNode)
1622  {
1623  throw uno::RuntimeException();
1624  }
1625  SwPaM aGrfPaM(*pGrfNode);
1626  pFormat->GetDoc()->getIDocumentContentOperations().ReRead(aGrfPaM, OUString(), OUString(), &aGraphic);
1627  }
1628  }
1629  }
1630  else if (FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID || FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID)
1631  {
1632  Graphic aGraphic;
1633  if (aValue.has<OUString>())
1634  {
1635  OUString aURL = aValue.get<OUString>();
1636  if (!aURL.isEmpty())
1637  {
1638  aGraphic = vcl::graphic::loadFromURL(aURL);
1639  }
1640  }
1641  else if (aValue.has<uno::Reference<graphic::XGraphic>>())
1642  {
1643  uno::Reference<graphic::XGraphic> xGraphic = aValue.get<uno::Reference<graphic::XGraphic>>();
1644  if (xGraphic.is())
1645  {
1646  aGraphic = Graphic(xGraphic);
1647  }
1648  }
1649 
1650  if (!aGraphic.IsNone())
1651  {
1652  const ::SwFormatContent* pCnt = &pFormat->GetContent();
1653  if ( pCnt->GetContentIdx() && pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ] )
1654  {
1655  SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ]->GetOLENode();
1656 
1657  if ( pOleNode )
1658  {
1659  svt::EmbeddedObjectRef &rEmbeddedObject = pOleNode->GetOLEObj().GetObject();
1660  rEmbeddedObject.SetGraphic(aGraphic, OUString() );
1661  }
1662  }
1663  }
1664  }
1665  else if((bNextFrame = (rPropertyName == UNO_NAME_CHAIN_NEXT_NAME))
1666  || rPropertyName == UNO_NAME_CHAIN_PREV_NAME)
1667  {
1668  OUString sChainName;
1669  aValue >>= sChainName;
1670  if (sChainName.isEmpty())
1671  {
1672  if(bNextFrame)
1673  pDoc->Unchain(*pFormat);
1674  else
1675  {
1676  const SwFormatChain& aChain( pFormat->GetChain() );
1677  SwFrameFormat *pPrev = aChain.GetPrev();
1678  if(pPrev)
1679  pDoc->Unchain(*pPrev);
1680  }
1681  }
1682  else
1683  {
1684  const size_t nCount = pDoc->GetFlyCount(FLYCNTTYPE_FRM);
1685 
1686  SwFrameFormat* pChain = nullptr;
1687  for( size_t i = 0; i < nCount; ++i )
1688  {
1689  SwFrameFormat* pFormat2 = pDoc->GetFlyNum(i, FLYCNTTYPE_FRM);
1690  if(sChainName == pFormat2->GetName() )
1691  {
1692  pChain = pFormat2;
1693  break;
1694  }
1695  }
1696  if(pChain)
1697  {
1698  SwFrameFormat* pSource = bNextFrame ? pFormat : pChain;
1699  SwFrameFormat* pDest = bNextFrame ? pChain: pFormat;
1700  pDoc->Chain(*pSource, *pDest);
1701  }
1702  }
1703  }
1704  else if(FN_UNO_Z_ORDER == pEntry->nWID)
1705  {
1706  sal_Int32 nZOrder = - 1;
1707  aValue >>= nZOrder;
1708 
1709  // Don't set an explicit ZOrder on TextBoxes.
1710  if( nZOrder >= 0 && !SwTextBoxHelper::isTextBox(pFormat, RES_FLYFRMFMT) )
1711  {
1712  SdrObject* pObject =
1713  GetOrCreateSdrObject( static_cast<SwFlyFrameFormat&>(*pFormat) );
1714  SwDrawModel *pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel();
1715  pDrawModel->GetPage(0)->
1716  SetObjectOrdNum(pObject->GetOrdNum(), nZOrder);
1717  }
1718  }
1719  else if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == nMemberId)
1720  {
1721  bool bDone = false;
1722  uno::Reference<text::XTextFrame> xFrame;
1723  if(aValue >>= xFrame)
1724  {
1725  uno::Reference<lang::XUnoTunnel> xTunnel(xFrame, uno::UNO_QUERY);
1726  SwXFrame* pFrame = xTunnel.is() ?
1727  reinterpret_cast< SwXFrame * >( sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXFrame::getUnoTunnelId()) ))
1728  : nullptr;
1729  if(pFrame && this != pFrame && pFrame->GetFrameFormat() && pFrame->GetFrameFormat()->GetDoc() == pDoc)
1730  {
1731  SfxItemSet aSet( pDoc->GetAttrPool(),
1733  aSet.SetParent(&pFormat->GetAttrSet());
1734  SwFormatAnchor aAnchor = static_cast<const SwFormatAnchor&>(aSet.Get(pEntry->nWID));
1735 
1736  SwPosition aPos(*pFrame->GetFrameFormat()->GetContent().GetContentIdx());
1737  aAnchor.SetAnchor(&aPos);
1738  aAnchor.SetType(RndStdIds::FLY_AT_FLY);
1739  aSet.Put(aAnchor);
1740  pDoc->SetFlyFrameAttr( *pFormat, aSet );
1741  bDone = true;
1742  }
1743  }
1744  if(!bDone)
1745  throw lang::IllegalArgumentException();
1746  }
1747  else
1748  {
1749  // standard UNO API write attributes
1750  // adapt former attr from SvxBrushItem::PutValue to new items XATTR_FILL_FIRST, XATTR_FILL_LAST
1751  SfxItemSet aSet( pDoc->GetAttrPool(),
1754 
1755  // FillAttribute support
1757  bool bDone(false);
1758 
1759  aSet.SetParent(&pFormat->GetAttrSet());
1760 
1761  if(RES_BACKGROUND == pEntry->nWID)
1762  {
1763  const SwAttrSet& rSet = pFormat->GetAttrSet();
1764  const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
1765  std::shared_ptr<SvxBrushItem> aChangedBrushItem(static_cast<SvxBrushItem*>(aOriginalBrushItem->Clone()));
1766 
1767  aChangedBrushItem->PutValue(aValue, nMemberId);
1768 
1769  if(*aChangedBrushItem != *aOriginalBrushItem)
1770  {
1771  setSvxBrushItemAsFillAttributesToTargetSet(*aChangedBrushItem, aSet);
1772  pFormat->GetDoc()->SetFlyFrameAttr( *pFormat, aSet );
1773  }
1774 
1775  bDone = true;
1776  }
1777  else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
1778  {
1779  drawing::BitmapMode eMode;
1780 
1781  if(!(aValue >>= eMode))
1782  {
1783  sal_Int32 nMode = 0;
1784 
1785  if(!(aValue >>= nMode))
1786  {
1787  throw lang::IllegalArgumentException();
1788  }
1789 
1790  eMode = static_cast<drawing::BitmapMode>(nMode);
1791  }
1792 
1793  aSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
1794  aSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
1795  pFormat->GetDoc()->SetFlyFrameAttr( *pFormat, aSet );
1796  bDone = true;
1797  }
1798 
1799  switch(nMemberId)
1800  {
1801  case MID_NAME:
1802  {
1803  // when named items get set, replace these with the NameOrIndex items
1804  // which exist already in the pool
1805  switch(pEntry->nWID)
1806  {
1807  case XATTR_FILLGRADIENT:
1808  case XATTR_FILLHATCH:
1809  case XATTR_FILLBITMAP:
1811  {
1812  OUString aTempName;
1813 
1814  if(!(aValue >>= aTempName ))
1815  {
1816  throw lang::IllegalArgumentException();
1817  }
1818 
1819  bDone = SvxShape::SetFillAttribute(pEntry->nWID, aTempName, aSet);
1820  break;
1821  }
1822  default:
1823  {
1824  break;
1825  }
1826  }
1827  break;
1828  }
1829  case MID_BITMAP:
1830  {
1831  switch(pEntry->nWID)
1832  {
1833  case XATTR_FILLBITMAP:
1834  {
1835  const Graphic aNullGraphic;
1836  XFillBitmapItem aXFillBitmapItem(aNullGraphic);
1837 
1838  aXFillBitmapItem.PutValue(aValue, nMemberId);
1839  aSet.Put(aXFillBitmapItem);
1840  bDone = true;
1841  break;
1842  }
1843  default:
1844  {
1845  break;
1846  }
1847  }
1848  break;
1849  }
1850  default:
1851  {
1852  break;
1853  }
1854  }
1855 
1856  if(!bDone)
1857  {
1858  m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
1859  }
1860 
1861  if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == nMemberId)
1862  {
1863  SwFormatAnchor aAnchor = static_cast<const SwFormatAnchor&>(aSet.Get(pEntry->nWID));
1864  if(aAnchor.GetAnchorId() == RndStdIds::FLY_AT_FLY)
1865  {
1866  const ::SwPosition* pPosition = aAnchor.GetContentAnchor();
1867  SwFrameFormat* pFlyFormat = pPosition ? pPosition->nNode.GetNode().GetFlyFormat() : nullptr;
1868  if(!pFlyFormat || pFlyFormat->Which() == RES_DRAWFRMFMT)
1869  {
1870  lang::IllegalArgumentException aExcept;
1871  aExcept.Message = "Anchor to frame: no frame found";
1872  throw aExcept;
1873  }
1874  else
1875  {
1876  SwPosition aPos = *pPosition;
1877  aPos.nNode = *pFlyFormat->GetContent().GetContentIdx();
1878  aAnchor.SetAnchor(&aPos);
1879  aSet.Put(aAnchor);
1880  }
1881  }
1882  else if ((aAnchor.GetAnchorId() != RndStdIds::FLY_AT_PAGE) &&
1883  !aAnchor.GetContentAnchor())
1884  {
1885  SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
1886  SwPaM aPam(rNode);
1887  aPam.Move( fnMoveBackward, GoInDoc );
1888  aAnchor.SetAnchor( aPam.Start() );
1889  aSet.Put(aAnchor);
1890  }
1891 
1892  // #i31771#, #i25798# - No adjustment of
1893  // anchor ( no call of method <sw_ChkAndSetNewAnchor(..)> ),
1894  // if document is currently in reading mode.
1895  if ( !pFormat->GetDoc()->IsInReading() )
1896  {
1897  // see SwFEShell::SetFlyFrameAttr( SfxItemSet& rSet )
1898  SwFlyFrame *pFly = nullptr;
1899  if (auto pFrameFormat = dynamic_cast<SwFlyFrameFormat*>( pFormat) )
1900  pFly = pFrameFormat->GetFrame();
1901  if (pFly)
1902  {
1903  const ::SfxPoolItem* pItem;
1904  if( SfxItemState::SET == aSet.GetItemState( RES_ANCHOR, false, &pItem ))
1905  {
1906  aSet.Put( *pItem );
1907  if ( pFormat->GetDoc()->GetEditShell() != nullptr )
1908  {
1909  sw_ChkAndSetNewAnchor( *pFly, aSet );
1910  }
1911  }
1912  }
1913  }
1914 
1915  pFormat->GetDoc()->SetFlyFrameAttr( *pFormat, aSet );
1916  }
1917  else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_STREAM_NAME == pEntry->nWID || FN_EMBEDDED_OBJECT == pEntry->nWID)
1918  {
1919  throw lang::IllegalArgumentException();
1920  }
1921  else
1922  {
1923  pFormat->SetFormatAttr(aSet);
1924  }
1925  }
1926  }
1927  else if(IsDescriptor())
1928  {
1929  m_pProps->SetProperty(pEntry->nWID, nMemberId, aValue);
1930  if( FN_UNO_FRAME_STYLE_NAME == pEntry->nWID )
1931  {
1932  OUString sStyleName;
1933  aValue >>= sStyleName;
1934  try
1935  {
1936  uno::Any aAny = mxStyleFamily->getByName ( sStyleName );
1937  aAny >>= mxStyleData;
1938  }
1939  catch ( container::NoSuchElementException const & )
1940  {
1941  }
1942  catch ( lang::WrappedTargetException const & )
1943  {
1944  }
1945  catch ( uno::RuntimeException const & )
1946  {
1947  }
1948  }
1949  else if (FN_UNO_DRAW_ASPECT == pEntry->nWID)
1950  {
1951  OUString sAspect = "";
1952  aValue >>= sAspect;
1953 
1954  if (sAspect == "Icon")
1955  m_nDrawAspect = embed::Aspects::MSOLE_ICON;
1956  else if (sAspect == "Content")
1957  m_nDrawAspect = embed::Aspects::MSOLE_CONTENT;
1958  }
1959  else if (FN_UNO_VISIBLE_AREA_WIDTH == pEntry->nWID)
1960  {
1961  OUString sAspect = "";
1962  aValue >>= sAspect;
1963  m_nVisibleAreaWidth = sAspect.toInt64();
1964  }
1965  else if (FN_UNO_VISIBLE_AREA_HEIGHT == pEntry->nWID)
1966  {
1967  OUString sAspect = "";
1968  aValue >>= sAspect;
1969  m_nVisibleAreaHeight = sAspect.toInt64();
1970  }
1971  }
1972  else
1973  throw uno::RuntimeException();
1974 }
1975 
1976 uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
1977 {
1978  SolarMutexGuard aGuard;
1979  uno::Any aAny;
1980  SwFrameFormat* pFormat = GetFrameFormat();
1981  const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
1982  if (!pEntry)
1983  throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1984 
1985  const sal_uInt8 nMemberId(pEntry->nMemberId);
1986 
1987  if(FN_UNO_ANCHOR_TYPES == pEntry->nWID)
1988  {
1989  uno::Sequence<text::TextContentAnchorType> aTypes(5);
1990  text::TextContentAnchorType* pArray = aTypes.getArray();
1991  pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
1992  pArray[1] = text::TextContentAnchorType_AS_CHARACTER;
1993  pArray[2] = text::TextContentAnchorType_AT_PAGE;
1994  pArray[3] = text::TextContentAnchorType_AT_FRAME;
1995  pArray[4] = text::TextContentAnchorType_AT_CHARACTER;
1996  aAny <<= aTypes;
1997  }
1998  else if(pFormat)
1999  {
2000  if( ((eType == FLYCNTTYPE_GRF) || (eType == FLYCNTTYPE_OLE)) &&
2001  (isGRFATR(pEntry->nWID) ||
2002  pEntry->nWID == FN_PARAM_CONTOUR_PP ||
2003  pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ||
2004  pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR ))
2005  {
2006  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2007  if(pIdx)
2008  {
2009  SwNodeIndex aIdx(*pIdx, 1);
2010  SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
2011  if(pEntry->nWID == FN_PARAM_CONTOUR_PP)
2012  {
2013  tools::PolyPolygon aContour;
2014  if( pNoText->GetContourAPI( aContour ) )
2015  {
2016  drawing::PointSequenceSequence aPtSeq(aContour.Count());
2017  drawing::PointSequence* pPSeq = aPtSeq.getArray();
2018  for(sal_uInt16 i = 0; i < aContour.Count(); i++)
2019  {
2020  const tools::Polygon& rPoly = aContour.GetObject(i);
2021  pPSeq[i].realloc(rPoly.GetSize());
2022  awt::Point* pPoints = pPSeq[i].getArray();
2023  for(sal_uInt16 j = 0; j < rPoly.GetSize(); j++)
2024  {
2025  const Point& rPoint = rPoly.GetPoint(j);
2026  pPoints[j].X = rPoint.X();
2027  pPoints[j].Y = rPoint.Y();
2028  }
2029  }
2030  aAny <<= aPtSeq;
2031  }
2032  }
2033  else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
2034  {
2035  aAny <<= pNoText->HasAutomaticContour();
2036  }
2037  else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
2038  {
2039  aAny <<= pNoText->IsPixelContour();
2040  }
2041  else
2042  {
2043  const SfxItemSet& aSet(pNoText->GetSwAttrSet());
2044  m_pPropSet->getPropertyValue(*pEntry, aSet, aAny);
2045  }
2046  }
2047  }
2048  else if (FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID)
2049  {
2050  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2051  uno::Reference<graphic::XGraphic> xGraphic;
2052 
2053  if (pIdx)
2054  {
2055  SwNodeIndex aIdx(*pIdx, 1);
2056  SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
2057  if (!pGrfNode)
2058  throw uno::RuntimeException();
2059 
2060  const GraphicObject* pGraphicObject = pGrfNode->GetReplacementGrfObj();
2061 
2062  if (pGraphicObject)
2063  {
2064  xGraphic = pGraphicObject->GetGraphic().GetXGraphic();
2065  }
2066  }
2067  aAny <<= xGraphic;
2068  }
2069  else if( FN_UNO_GRAPHIC_FILTER == pEntry->nWID )
2070  {
2071  OUString sFltName;
2072  SwDoc::GetGrfNms( *static_cast<SwFlyFrameFormat*>(pFormat), nullptr, &sFltName );
2073  aAny <<= sFltName;
2074  }
2075  else if( FN_UNO_GRAPHIC_URL == pEntry->nWID )
2076  {
2077  throw uno::RuntimeException("Getting from this property is not supported");
2078  }
2079  else if( FN_UNO_GRAPHIC == pEntry->nWID )
2080  {
2081  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2082  if(pIdx)
2083  {
2084  SwNodeIndex aIdx(*pIdx, 1);
2085  SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
2086  if(!pGrfNode)
2087  throw uno::RuntimeException();
2088  aAny <<= pGrfNode->GetGrf().GetXGraphic();
2089  }
2090  }
2091  else if( FN_UNO_TRANSFORMED_GRAPHIC == pEntry->nWID )
2092  {
2093  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2094  if(pIdx)
2095  {
2096  SwNodeIndex aIdx(*pIdx, 1);
2097  SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
2098  if(!pGrfNode)
2099  throw uno::RuntimeException();
2100 
2101  SwDoc* pDoc = pFormat->GetDoc();
2102  if (pDoc)
2103  {
2104  const SwEditShell* pEditShell = pDoc->GetEditShell();
2105  if (pEditShell)
2106  {
2107  SwFrame* pCurrFrame = pEditShell->GetCurrFrame(false);
2108  GraphicAttr aGraphicAttr;
2109  pGrfNode->GetGraphicAttr( aGraphicAttr, pCurrFrame );
2110  const GraphicObject aGraphicObj = pGrfNode->GetGrfObj();
2111 
2112  awt::Size aFrameSize = getSize();
2113  Size aSize100thmm(aFrameSize.Width, aFrameSize.Height);
2114  Size aSize = OutputDevice::LogicToLogic(aSize100thmm, MapMode(MapUnit::Map100thMM), aGraphicObj.GetPrefMapMode());
2115  Graphic aGraphic = aGraphicObj.GetTransformedGraphic(aSize, aGraphicObj.GetPrefMapMode(), aGraphicAttr);
2116  aAny <<= aGraphic.GetXGraphic();
2117  }
2118  }
2119  }
2120  }
2121  else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
2122  {
2124  }
2125  // #i73249#
2126  else if( FN_UNO_TITLE == pEntry->nWID )
2127  {
2128  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
2129  // assure that <SdrObject> instance exists.
2130  GetOrCreateSdrObject(rFlyFormat);
2131  aAny <<= rFlyFormat.GetObjTitle();
2132  }
2133  // New attribute Description
2134  else if( FN_UNO_DESCRIPTION == pEntry->nWID )
2135  {
2136  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
2137  // assure that <SdrObject> instance exists.
2138  GetOrCreateSdrObject(rFlyFormat);
2139  aAny <<= rFlyFormat.GetObjDescription();
2140  }
2141  else if(eType == FLYCNTTYPE_GRF &&
2142  (rPropertyName == UNO_NAME_ACTUAL_SIZE))
2143  {
2144  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2145  if(pIdx)
2146  {
2147  SwNodeIndex aIdx(*pIdx, 1);
2148  Size aActSize = aIdx.GetNode().GetNoTextNode()->GetTwipSize();
2149  awt::Size aTmp;
2150  aTmp.Width = convertTwipToMm100(aActSize.Width());
2151  aTmp.Height = convertTwipToMm100(aActSize.Height());
2152  aAny <<= aTmp;
2153  }
2154  }
2155  else if(FN_PARAM_LINK_DISPLAY_NAME == pEntry->nWID)
2156  {
2157  aAny <<= pFormat->GetName();
2158  }
2159  else if(FN_UNO_Z_ORDER == pEntry->nWID)
2160  {
2161  const SdrObject* pObj = pFormat->FindRealSdrObject();
2162  if( pObj == nullptr )
2163  pObj = pFormat->FindSdrObject();
2164  if( pObj )
2165  {
2166  aAny <<= static_cast<sal_Int32>(pObj->GetOrdNum());
2167  }
2168  }
2169  else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_MODEL == pEntry->nWID||
2170  FN_UNO_COMPONENT == pEntry->nWID ||FN_UNO_STREAM_NAME == pEntry->nWID||
2171  FN_EMBEDDED_OBJECT == pEntry->nWID)
2172  {
2173  SwDoc* pDoc = pFormat->GetDoc();
2174  const SwFormatContent* pCnt = &pFormat->GetContent();
2175  OSL_ENSURE( pCnt->GetContentIdx() &&
2176  pDoc->GetNodes()[ pCnt->GetContentIdx()->
2177  GetIndex() + 1 ]->GetOLENode(), "no OLE-Node?");
2178 
2179  SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetContentIdx()
2180  ->GetIndex() + 1 ]->GetOLENode();
2181  uno::Reference < embed::XEmbeddedObject > xIP = pOleNode->GetOLEObj().GetOleRef();
2182  OUString aHexCLSID;
2183  {
2184  SvGlobalName aClassName( xIP->getClassID() );
2185  aHexCLSID = aClassName.GetHexName();
2186  if(FN_UNO_CLSID != pEntry->nWID)
2187  {
2189  {
2190  uno::Reference < lang::XComponent > xComp( xIP->getComponent(), uno::UNO_QUERY );
2191  uno::Reference < frame::XModel > xModel( xComp, uno::UNO_QUERY );
2192  if ( FN_EMBEDDED_OBJECT == pEntry->nWID )
2193  {
2194  // when exposing the EmbeddedObject, ensure it has a client site
2195  OSL_ENSURE( pDoc->GetDocShell(), "no doc shell => no client site" );
2196  if ( pDoc->GetDocShell() )
2197  pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP, embed::Aspects::MSOLE_CONTENT ) );
2198  aAny <<= xIP;
2199  }
2200  else if ( xModel.is() )
2201  aAny <<= xModel;
2202  else if ( FN_UNO_COMPONENT == pEntry->nWID )
2203  aAny <<= xComp;
2204  }
2205  }
2206  }
2207 
2208  if(FN_UNO_CLSID == pEntry->nWID)
2209  aAny <<= aHexCLSID;
2210  else if(FN_UNO_STREAM_NAME == pEntry->nWID)
2211  {
2212  aAny <<= pOleNode->GetOLEObj().GetCurrentPersistName();
2213  }
2214  else if(FN_EMBEDDED_OBJECT == pEntry->nWID)
2215  {
2216  aAny <<= pOleNode->GetOLEObj().GetOleRef();
2217  }
2218  }
2219  else if(WID_LAYOUT_SIZE == pEntry->nWID)
2220  {
2221  // format document completely in order to get correct value
2222  pFormat->GetDoc()->GetEditShell()->CalcLayout();
2223 
2224  SwFrame* pTmpFrame = SwIterator<SwFrame,SwFormat>( *pFormat ).First();
2225  if ( pTmpFrame )
2226  {
2227  OSL_ENSURE( pTmpFrame->isFrameAreaDefinitionValid(), "frame not valid" );
2228  const SwRect &rRect = pTmpFrame->getFrameArea();
2229  Size aMM100Size = OutputDevice::LogicToLogic(
2230  Size( rRect.Width(), rRect.Height() ),
2231  MapMode( MapUnit::MapTwip ), MapMode( MapUnit::Map100thMM ));
2232  aAny <<= awt::Size( aMM100Size.Width(), aMM100Size.Height() );
2233  }
2234  }
2235  else if(pEntry->nWID == FN_UNO_PARENT_TEXT)
2236  {
2237  if (!m_xParentText.is())
2238  {
2239  const SwPosition* pContentAnchor = pFormat->GetAnchor().GetContentAnchor();
2240  if (pContentAnchor)
2241  {
2242  m_xParentText = sw::CreateParentXText(*pFormat->GetDoc(), *pContentAnchor);
2243  }
2244  }
2245  aAny <<= m_xParentText;
2246  }
2247  else
2248  {
2249  // standard UNO API read attributes
2250  // adapt former attr from SvxBrushItem::PutValue to new items XATTR_FILL_FIRST, XATTR_FILL_LAST
2251  const SwAttrSet& rSet = pFormat->GetAttrSet();
2252  bool bDone(false);
2253 
2254  if(RES_BACKGROUND == pEntry->nWID)
2255  {
2256  const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
2257 
2258  if(!aOriginalBrushItem->QueryValue(aAny, nMemberId))
2259  {
2260  OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
2261  }
2262 
2263  bDone = true;
2264  }
2265  else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
2266  {
2267  if (rSet.Get(XATTR_FILLBMP_TILE).GetValue())
2268  {
2269  aAny <<= drawing::BitmapMode_REPEAT;
2270  }
2271  else if (rSet.Get(XATTR_FILLBMP_STRETCH).GetValue())
2272  {
2273  aAny <<= drawing::BitmapMode_STRETCH;
2274  }
2275  else
2276  {
2277  aAny <<= drawing::BitmapMode_NO_REPEAT;
2278  }
2279 
2280  bDone = true;
2281  }
2282 
2283  if(!bDone)
2284  {
2285  m_pPropSet->getPropertyValue(*pEntry, rSet, aAny);
2286  }
2287  }
2288  }
2289  else if(IsDescriptor())
2290  {
2291  if ( ! m_pDoc )
2292  throw uno::RuntimeException();
2293  if(WID_LAYOUT_SIZE != pEntry->nWID) // there is no LayoutSize in a descriptor
2294  {
2295  const uno::Any* pAny = nullptr;
2296  if (!m_pProps->GetProperty(pEntry->nWID, nMemberId, pAny))
2297  aAny = mxStyleData->getPropertyValue( rPropertyName );
2298  else if ( pAny )
2299  aAny = *pAny;
2300  }
2301  }
2302  else
2303  throw uno::RuntimeException();
2304 
2305  if (pEntry->aType == ::cppu::UnoType<sal_Int16>::get() && pEntry->aType != aAny.getValueType())
2306  {
2307  // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
2308  sal_Int32 nValue = 0;
2309  aAny >>= nValue;
2310  aAny <<= static_cast<sal_Int16>(nValue);
2311  }
2312 
2313  // check for needed metric translation
2314  if(pEntry->nMoreFlags & PropertyMoreFlags::METRIC_ITEM)
2315  {
2316  bool bDoIt(true);
2317 
2318  if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
2319  {
2320  // exception: If these ItemTypes are used, do not convert when these are negative
2321  // since this means they are intended as percent values
2322  sal_Int32 nValue = 0;
2323 
2324  if(aAny >>= nValue)
2325  {
2326  bDoIt = nValue > 0;
2327  }
2328  }
2329 
2330  if(bDoIt)
2331  {
2332  const SwDoc* pDoc = (IsDescriptor() ? m_pDoc : GetFrameFormat()->GetDoc());
2333  const SfxItemPool& rPool = pDoc->GetAttrPool();
2334  const MapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));
2335 
2336  if(eMapUnit != MapUnit::Map100thMM)
2337  {
2338  SvxUnoConvertToMM(eMapUnit, aAny);
2339  }
2340  }
2341  }
2342 
2343  return aAny;
2344 }
2345 
2346 void SwXFrame::addPropertyChangeListener(const OUString& /*PropertyName*/,
2347  const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
2348 {
2349  OSL_FAIL("not implemented");
2350 }
2351 
2352 void SwXFrame::removePropertyChangeListener(const OUString& /*PropertyName*/,
2353  const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
2354 {
2355  OSL_FAIL("not implemented");
2356 }
2357 
2358 void SwXFrame::addVetoableChangeListener(const OUString& /*PropertyName*/,
2359  const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
2360 {
2361  OSL_FAIL("not implemented");
2362 }
2363 
2365  const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
2366 {
2367  OSL_FAIL("not implemented");
2368 }
2369 
2370 beans::PropertyState SwXFrame::getPropertyState( const OUString& rPropertyName )
2371 {
2372  SolarMutexGuard aGuard;
2373  uno::Sequence< OUString > aPropertyNames { rPropertyName };
2374  uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aPropertyNames);
2375  return aStates.getConstArray()[0];
2376 }
2377 
2378 uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
2379  const uno::Sequence< OUString >& aPropertyNames )
2380 {
2381  SolarMutexGuard aGuard;
2382  uno::Sequence< beans::PropertyState > aStates(aPropertyNames.getLength());
2383  beans::PropertyState* pStates = aStates.getArray();
2384  SwFrameFormat* pFormat = GetFrameFormat();
2385  if(pFormat)
2386  {
2387  const OUString* pNames = aPropertyNames.getConstArray();
2388  const SwAttrSet& rFormatSet = pFormat->GetAttrSet();
2389  for(int i = 0; i < aPropertyNames.getLength(); i++)
2390  {
2391  const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(pNames[i]);
2392  if (!pEntry)
2393  throw beans::UnknownPropertyException("Unknown property: " + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
2394 
2395  if(pEntry->nWID == FN_UNO_ANCHOR_TYPES||
2396  pEntry->nWID == FN_PARAM_LINK_DISPLAY_NAME||
2397  FN_UNO_FRAME_STYLE_NAME == pEntry->nWID||
2398  FN_UNO_GRAPHIC == pEntry->nWID||
2399  FN_UNO_GRAPHIC_URL == pEntry->nWID||
2400  FN_UNO_GRAPHIC_FILTER == pEntry->nWID||
2401  FN_UNO_ACTUAL_SIZE == pEntry->nWID||
2402  FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
2403  {
2404  pStates[i] = beans::PropertyState_DIRECT_VALUE;
2405  }
2406  else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
2407  {
2408  if(SfxItemState::SET == rFormatSet.GetItemState(XATTR_FILLBMP_STRETCH, false)
2409  || SfxItemState::SET == rFormatSet.GetItemState(XATTR_FILLBMP_TILE, false))
2410  {
2411  pStates[i] = beans::PropertyState_DIRECT_VALUE;
2412  }
2413  else
2414  {
2415  pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
2416  }
2417  }
2418  // for FlyFrames we need to mark the used properties from type RES_BACKGROUND
2419  // as beans::PropertyState_DIRECT_VALUE to let users of this property call
2420  // getPropertyValue where the member properties will be mapped from the
2421  // fill attributes to the according SvxBrushItem entries
2422  else if (RES_BACKGROUND == pEntry->nWID)
2423  {
2425  pStates[i] = beans::PropertyState_DIRECT_VALUE;
2426  else
2427  pStates[i] = beans::PropertyState_DEFAULT_VALUE;
2428  }
2429  else
2430  {
2431  if ((eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID))
2432  {
2433  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2434  if(pIdx)
2435  {
2436  SwNodeIndex aIdx(*pIdx, 1);
2437  SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
2438  const SfxItemSet& aSet(pNoText->GetSwAttrSet());
2439  aSet.GetItemState(pEntry->nWID);
2440  if(SfxItemState::SET == aSet.GetItemState( pEntry->nWID, false ))
2441  pStates[i] = beans::PropertyState_DIRECT_VALUE;
2442  }
2443  }
2444  else
2445  {
2446  if(SfxItemState::SET == rFormatSet.GetItemState( pEntry->nWID, false ))
2447  pStates[i] = beans::PropertyState_DIRECT_VALUE;
2448  else
2449  pStates[i] = beans::PropertyState_DEFAULT_VALUE;
2450  }
2451  }
2452  }
2453  }
2454  else if(IsDescriptor())
2455  {
2456  std::fill(aStates.begin(), aStates.end(), beans::PropertyState_DIRECT_VALUE);
2457  }
2458  else
2459  throw uno::RuntimeException();
2460  return aStates;
2461 }
2462 
2463 void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
2464 {
2465  SolarMutexGuard aGuard;
2466  SwFrameFormat* pFormat = GetFrameFormat();
2467  if(pFormat)
2468  {
2469  const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
2470  if (!pEntry)
2471  throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2472  if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
2473  throw uno::RuntimeException("setPropertyToDefault: property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2474 
2475  bool bNextFrame;
2476  if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
2477  {
2478  SwDoc* pDoc = pFormat->GetDoc();
2480  aSet.SetParent(&pFormat->GetAttrSet());
2481 
2482  aSet.ClearItem(XATTR_FILLBMP_STRETCH);
2483  aSet.ClearItem(XATTR_FILLBMP_TILE);
2484 
2485  pFormat->SetFormatAttr(aSet);
2486  }
2487  else if( pEntry->nWID &&
2488  pEntry->nWID != FN_UNO_ANCHOR_TYPES &&
2489  pEntry->nWID != FN_PARAM_LINK_DISPLAY_NAME)
2490  {
2491  if ( (eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID) )
2492  {
2493  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
2494  if(pIdx)
2495  {
2496  SwNodeIndex aIdx(*pIdx, 1);
2497  SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
2498  {
2499  SfxItemSet aSet(pNoText->GetSwAttrSet());
2500  aSet.ClearItem(pEntry->nWID);
2501  pNoText->SetAttr(aSet);
2502  }
2503  }
2504  }
2505  // #i73249#
2506  else if( FN_UNO_TITLE == pEntry->nWID )
2507  {
2508  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
2509  // assure that <SdrObject> instance exists.
2510  GetOrCreateSdrObject(rFlyFormat);
2511  rFlyFormat.GetDoc()->SetFlyFrameTitle(rFlyFormat, OUString());
2512  }
2513  // New attribute Description
2514  else if( FN_UNO_DESCRIPTION == pEntry->nWID )
2515  {
2516  SwFlyFrameFormat& rFlyFormat = dynamic_cast<SwFlyFrameFormat&>(*pFormat);
2517  // assure that <SdrObject> instance exists.
2518  GetOrCreateSdrObject(rFlyFormat);
2519  rFlyFormat.GetDoc()->SetFlyFrameDescription(rFlyFormat, OUString());
2520  }
2521  else
2522  {
2523  SwDoc* pDoc = pFormat->GetDoc();
2524  SfxItemSet aSet( pDoc->GetAttrPool(),
2526  aSet.SetParent(&pFormat->GetAttrSet());
2527  aSet.ClearItem(pEntry->nWID);
2528  if(rPropertyName != UNO_NAME_ANCHOR_TYPE)
2529  pFormat->SetFormatAttr(aSet);
2530  }
2531  }
2532  else
2533  {
2534  bNextFrame = rPropertyName == UNO_NAME_CHAIN_NEXT_NAME;
2535  if( bNextFrame || rPropertyName == UNO_NAME_CHAIN_PREV_NAME )
2536  {
2537  SwDoc* pDoc = pFormat->GetDoc();
2538  if(bNextFrame)
2539  pDoc->Unchain(*pFormat);
2540  else
2541  {
2542  const SwFormatChain& aChain( pFormat->GetChain() );
2543  SwFrameFormat *pPrev = aChain.GetPrev();
2544  if(pPrev)
2545  pDoc->Unchain(*pPrev);
2546  }
2547  }
2548  }
2549  }
2550  else if(!IsDescriptor())
2551  throw uno::RuntimeException();
2552 
2553 }
2554 
2555 uno::Any SwXFrame::getPropertyDefault( const OUString& rPropertyName )
2556 {
2557  SolarMutexGuard aGuard;
2558  uno::Any aRet;
2559  SwFrameFormat* pFormat = GetFrameFormat();
2560  if(pFormat)
2561  {
2562  const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
2563  if(!pEntry)
2564  throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2565 
2566  if ( pEntry->nWID < RES_FRMATR_END )
2567  {
2568  const SfxPoolItem& rDefItem =
2569  pFormat->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
2570  rDefItem.QueryValue(aRet, pEntry->nMemberId);
2571  }
2572 
2573  }
2574  else if(!IsDescriptor())
2575  throw uno::RuntimeException();
2576  return aRet;
2577 }
2578 
2580  const uno::Reference<lang::XEventListener> & xListener)
2581 {
2582  // no need to lock here as m_pImpl is const and container threadsafe
2583  m_pImpl->m_EventListeners.addInterface(xListener);
2584 }
2585 
2587  const uno::Reference<lang::XEventListener> & xListener)
2588 {
2589  // no need to lock here as m_pImpl is const and container threadsafe
2590  m_pImpl->m_EventListeners.removeInterface(xListener);
2591 }
2592 
2593 void SwXFrame::Modify(const SfxPoolItem* pOld, const SfxPoolItem *pNew)
2594 {
2595  ClientModify(this, pOld, pNew);
2596  if (GetRegisteredIn())
2597  {
2598  return; // core object still alive
2599  }
2600  mxStyleData.clear();
2601  mxStyleFamily.clear();
2602  m_pDoc = nullptr;
2603  uno::Reference<uno::XInterface> const xThis(m_pImpl->m_wThis);
2604  if (!xThis.is())
2605  { // fdo#72695: if UNO object is already dead, don't revive it with event
2606  return;
2607  }
2608  lang::EventObject const ev(xThis);
2609  m_pImpl->m_EventListeners.disposeAndClear(ev);
2610 }
2611 
2613 {
2614  SolarMutexGuard aGuard;
2615  SwFrameFormat* pFormat = GetFrameFormat();
2616  if ( pFormat )
2617  {
2618  SdrObject* pObj = pFormat->FindSdrObject();
2619  // OD 11.09.2003 #112039# - add condition to perform delete of
2620  // format/anchor sign, not only if the object is inserted, but also
2621  // if a contact object is registered, which isn't in the destruction.
2622  if ( pObj &&
2623  ( pObj->IsInserted() ||
2624  ( pObj->GetUserCall() &&
2625  !static_cast<SwContact*>(pObj->GetUserCall())->IsInDTOR() ) ) )
2626  {
2627  if (pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR)
2628  {
2629  const SwPosition &rPos = *(pFormat->GetAnchor().GetContentAnchor());
2630  SwTextNode *pTextNode = rPos.nNode.GetNode().GetTextNode();
2631  const sal_Int32 nIdx = rPos.nContent.GetIndex();
2632  pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
2633  }
2634  else
2635  pFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat(pFormat);
2636  }
2637  }
2638 
2639 }
2640 
2641 uno::Reference< text::XTextRange > SwXFrame::getAnchor()
2642 {
2643  SolarMutexGuard aGuard;
2644  uno::Reference< text::XTextRange > aRef;
2645  SwFrameFormat* pFormat = GetFrameFormat();
2646  if(!pFormat)
2647  throw uno::RuntimeException();
2648 
2649  const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
2650  // return an anchor for non-page bound frames
2651  // and for page bound frames that have a page no == NULL and a content position
2652  if ((rAnchor.GetAnchorId() != RndStdIds::FLY_AT_PAGE) ||
2653  (rAnchor.GetContentAnchor() && !rAnchor.GetPageNum()))
2654  {
2655  const SwPosition &rPos = *(rAnchor.GetContentAnchor());
2656  aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), rPos, nullptr);
2657  }
2658 
2659  return aRef;
2660 }
2661 
2663 {
2664  bIsDescriptor = false;
2665  mxStyleData.clear();
2666  mxStyleFamily.clear();
2667  m_pProps.reset();
2668 }
2669 
2670 void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
2671 {
2672  SolarMutexGuard aGuard;
2673  if(!IsDescriptor())
2674  throw uno::RuntimeException();
2675  uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
2676  SwXTextRange* pRange = nullptr;
2677  OTextCursorHelper* pCursor = nullptr;
2678  if(xRangeTunnel.is())
2679  {
2680  pRange = reinterpret_cast< SwXTextRange * >(
2681  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
2682  pCursor = reinterpret_cast< OTextCursorHelper * >(
2683  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
2684  }
2685 
2686  SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor ? pCursor->GetDoc() : nullptr;
2687  if(!pDoc)
2688  throw lang::IllegalArgumentException();
2689 
2690  SwUnoInternalPaM aIntPam(*pDoc);
2691  // this now needs to return TRUE
2692  ::sw::XTextRangeToSwPaM(aIntPam, xTextRange);
2693 
2694  SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
2695  SwPaM aPam(rNode);
2696  aPam.Move( fnMoveBackward, GoInDoc );
2697  static sal_uInt16 const aFrameAttrRange[] =
2698  {
2701 
2702  // FillAttribute support
2704 
2705  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
2706  0
2707  };
2708  static sal_uInt16 const aGrAttrRange[] =
2709  {
2711  0
2712  };
2713  SfxItemSet aGrSet(pDoc->GetAttrPool(), aGrAttrRange );
2714 
2715  SfxItemSet aFrameSet(pDoc->GetAttrPool(), aFrameAttrRange );
2716 
2717  // set correct parent to get the XFILL_NONE FillStyle as needed
2718  aFrameSet.SetParent(&pDoc->GetDfltFrameFormat()->GetAttrSet());
2719 
2720  // no the related items need to be added to the set
2721  bool bSizeFound;
2722  if (!m_pProps->AnyToItemSet(pDoc, aFrameSet, aGrSet, bSizeFound))
2723  throw lang::IllegalArgumentException();
2724  // a TextRange is handled separately
2725  *aPam.GetPoint() = *aIntPam.GetPoint();
2726  if(aIntPam.HasMark())
2727  {
2728  aPam.SetMark();
2729  *aPam.GetMark() = *aIntPam.GetMark();
2730  }
2731 
2732  const SfxPoolItem* pItem;
2733  RndStdIds eAnchorId = RndStdIds::FLY_AT_PARA;
2734  if(SfxItemState::SET == aFrameSet.GetItemState(RES_ANCHOR, false, &pItem) )
2735  {
2736  eAnchorId = static_cast<const SwFormatAnchor*>(pItem)->GetAnchorId();
2737  if( RndStdIds::FLY_AT_FLY == eAnchorId &&
2738  !aPam.GetNode().FindFlyStartNode())
2739  {
2740  // framebound only where a frame exists
2741  SwFormatAnchor aAnchor(RndStdIds::FLY_AT_PARA);
2742  aFrameSet.Put(aAnchor);
2743  }
2744  else if ((RndStdIds::FLY_AT_PAGE == eAnchorId) &&
2745  0 == static_cast<const SwFormatAnchor*>(pItem)->GetPageNum() )
2746  {
2747  SwFormatAnchor aAnchor( *static_cast<const SwFormatAnchor*>(pItem) );
2748  aAnchor.SetAnchor( aPam.GetPoint() );
2749  aFrameSet.Put(aAnchor);
2750  }
2751  }
2752 
2753  const ::uno::Any* pStyle;
2754  SwFrameFormat *pParentFrameFormat = nullptr;
2755  if (m_pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0, pStyle))
2756  pParentFrameFormat = lcl_GetFrameFormat( *pStyle, pDoc );
2757 
2758  SwFlyFrameFormat* pFormat = nullptr;
2759  if( eType == FLYCNTTYPE_FRM)
2760  {
2761  UnoActionContext aCont(pDoc);
2762  if(m_pCopySource)
2763  {
2764  std::unique_ptr<SwFormatAnchor> pAnchorItem;
2765  // the frame is inserted bound to page
2766  // to prevent conflicts if the to-be-anchored position is part of the to-be-copied text
2767  if (eAnchorId != RndStdIds::FLY_AT_PAGE)
2768  {
2769  pAnchorItem.reset(static_cast<SwFormatAnchor*>(aFrameSet.Get(RES_ANCHOR).Clone()));
2770  aFrameSet.Put( SwFormatAnchor( RndStdIds::FLY_AT_PAGE, 1 ));
2771  }
2772 
2773  aPam.DeleteMark(); // mark position node will be deleted!
2774  aIntPam.DeleteMark(); // mark position node will be deleted!
2775  pFormat = pDoc->MakeFlyAndMove( *m_pCopySource, aFrameSet,
2776  nullptr,
2777  pParentFrameFormat );
2778  if(pAnchorItem && pFormat)
2779  {
2780  pFormat->DelFrames();
2781  pAnchorItem->SetAnchor( m_pCopySource->Start() );
2783  aAnchorSet.Put( *pAnchorItem );
2784  pDoc->SetFlyFrameAttr( *pFormat, aAnchorSet );
2785  }
2786  m_pCopySource.reset();
2787  }
2788  else
2789  {
2790  pFormat = pDoc->MakeFlySection( RndStdIds::FLY_AT_PARA, aPam.GetPoint(),
2791  &aFrameSet, pParentFrameFormat );
2792  }
2793  if(pFormat)
2794  {
2795  pFormat->Add(this);
2796  if(!m_sName.isEmpty())
2797  pDoc->SetFlyName(*pFormat, m_sName);
2798  }
2799  // wake up the SwXTextFrame
2800  static_cast<SwXTextFrame*>(this)->SetDoc( bIsDescriptor ? m_pDoc : GetFrameFormat()->GetDoc() );
2801  }
2802  else if( eType == FLYCNTTYPE_GRF)
2803  {
2804  UnoActionContext aActionContext(pDoc);
2805  Graphic aGraphic;
2806 
2807  // Read graphic URL from the descriptor, if it has any.
2808  const ::uno::Any* pGraphicURL;
2809  if (m_pProps->GetProperty(FN_UNO_GRAPHIC_URL, 0, pGraphicURL))
2810  {
2811  OUString sGraphicURL;
2812  uno::Reference<awt::XBitmap> xBitmap;
2813  if (((*pGraphicURL) >>= sGraphicURL) && !sGraphicURL.isEmpty())
2814  aGraphic = vcl::graphic::loadFromURL(sGraphicURL);
2815  else if ((*pGraphicURL) >>= xBitmap)
2816  {
2817  uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
2818  if (xGraphic.is())
2819  aGraphic = xGraphic;
2820  }
2821  }
2822 
2823  const ::uno::Any* pGraphicAny;
2824  const bool bHasGraphic = m_pProps->GetProperty(FN_UNO_GRAPHIC, 0, pGraphicAny);
2825  if (bHasGraphic)
2826  {
2827  uno::Reference<graphic::XGraphic> xGraphic;
2828  (*pGraphicAny) >>= xGraphic;
2829  aGraphic = Graphic(xGraphic);
2830  }
2831 
2832  OUString sFilterName;
2833  const uno::Any* pFilterAny;
2834  if (m_pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilterAny))
2835  {
2836  (*pFilterAny) >>= sFilterName;
2837  }
2838 
2839  pFormat = pDoc->getIDocumentContentOperations().InsertGraphic(
2840  aPam, OUString(), sFilterName, &aGraphic, &aFrameSet, &aGrSet, pParentFrameFormat);
2841  if (pFormat)
2842  {
2843  SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFormat->GetContent().GetContentIdx()
2844  ->GetIndex()+1 ]->GetGrfNode();
2845  if (pGrfNd)
2846  pGrfNd->SetChgTwipSize( !bSizeFound );
2847  pFormat->Add(this);
2848  if(!m_sName.isEmpty())
2849  pDoc->SetFlyName(*pFormat, m_sName);
2850 
2851  }
2852  const ::uno::Any* pSurroundContour;
2853  if (m_pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurroundContour))
2854  setPropertyValue(UNO_NAME_SURROUND_CONTOUR, *pSurroundContour);
2855  const ::uno::Any* pContourOutside;
2856  if (m_pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE, pContourOutside))
2857  setPropertyValue(UNO_NAME_CONTOUR_OUTSIDE, *pContourOutside);
2858  const ::uno::Any* pContourPoly;
2859  if (m_pProps->GetProperty(FN_PARAM_CONTOUR_PP, 0, pContourPoly))
2861  const ::uno::Any* pPixelContour;
2862  if (m_pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0, pPixelContour))
2864  const ::uno::Any* pAutoContour;
2865  if (m_pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour))
2867  }
2868  else
2869  {
2870  const ::uno::Any* pCLSID = nullptr;
2871  const ::uno::Any* pStreamName = nullptr;
2872  const ::uno::Any* pEmbeddedObject = nullptr;
2873  if (!m_pProps->GetProperty(FN_UNO_CLSID, 0, pCLSID)
2874  && !m_pProps->GetProperty(FN_UNO_STREAM_NAME, 0, pStreamName)
2875  && !m_pProps->GetProperty(FN_EMBEDDED_OBJECT, 0, pEmbeddedObject))
2876  {
2877  throw uno::RuntimeException();
2878  }
2879  if(pCLSID)
2880  {
2881  OUString aCLSID;
2882  SvGlobalName aClassName;
2883  uno::Reference < embed::XEmbeddedObject > xIPObj;
2884  std::unique_ptr < comphelper::EmbeddedObjectContainer > pCnt;
2885  if( (*pCLSID) >>= aCLSID )
2886  {
2887  if( !aClassName.MakeId( aCLSID ) )
2888  {
2889  lang::IllegalArgumentException aExcept;
2890  aExcept.Message = "CLSID invalid";
2891  throw aExcept;
2892  }
2893 
2894  pCnt.reset( new comphelper::EmbeddedObjectContainer );
2895  OUString aName;
2896 
2897  OUString sDocumentBaseURL = pDoc->GetPersist()->getDocumentBaseURL();
2898  xIPObj = pCnt->CreateEmbeddedObject(aClassName.GetByteSequence(), aName,
2899  &sDocumentBaseURL);
2900  }
2901  if ( xIPObj.is() )
2902  {
2903  UnoActionContext aAction(pDoc);
2905 
2906  // tdf#99631 set imported VisibleArea settings of embedded XLSX OLE objects
2907  if ( m_nDrawAspect == embed::Aspects::MSOLE_CONTENT
2909  {
2910  sal_Int64 nAspect = m_nDrawAspect;
2911  MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xIPObj->getMapUnit( nAspect ) );
2913  MapMode(MapUnit::MapTwip), MapMode(aUnit)));
2914  awt::Size aSz;
2915  aSz.Width = aSize.Width();
2916  aSz.Height = aSize.Height();
2917  xIPObj->setVisualAreaSize(m_nDrawAspect, aSz);
2918  }
2919 
2920  if(!bSizeFound)
2921  {
2922  //TODO/LATER: how do I transport it to the OLENode?
2923  sal_Int64 nAspect = m_nDrawAspect;
2924 
2925  // TODO/LEAN: VisualArea still needs running state
2927 
2928  // set parent to get correct VisArea(in case of object needing parent printer)
2929  uno::Reference < container::XChild > xChild( xIPObj, uno::UNO_QUERY );
2930  if ( xChild.is() )
2931  xChild->setParent( pDoc->GetDocShell()->GetModel() );
2932 
2933  //The Size should be suggested by the OLE server if not manually set
2934  MapUnit aRefMap = VCLUnoHelper::UnoEmbed2VCLMapUnit( xIPObj->getMapUnit( nAspect ) );
2935  awt::Size aSize;
2936  try
2937  {
2938  aSize = xIPObj->getVisualAreaSize( nAspect );
2939  }
2940  catch ( embed::NoVisualAreaSizeException& )
2941  {
2942  // the default size will be set later
2943  }
2944 
2945  Size aSz( aSize.Width, aSize.Height );
2946  if ( !aSz.Width() || !aSz.Height() )
2947  {
2948  aSz.setWidth(5000);
2949  aSz.setHeight(5000);
2950  aSz = OutputDevice::LogicToLogic(aSz,
2951  MapMode(MapUnit::Map100thMM), MapMode(aRefMap));
2952  }
2953  MapMode aMyMap( MapUnit::MapTwip );
2954  aSz = OutputDevice::LogicToLogic(aSz, MapMode(aRefMap), aMyMap);
2955  SwFormatFrameSize aFrameSz;
2956  aFrameSz.SetSize(aSz);
2957  aFrameSet.Put(aFrameSz);
2958  }
2959  SwFlyFrameFormat* pFormat2 = nullptr;
2960 
2961  ::svt::EmbeddedObjectRef xObjRef( xIPObj, m_nDrawAspect);
2963  aPam, xObjRef, &aFrameSet );
2964 
2965  // store main document name to show in the title bar
2966  uno::Reference< frame::XTitle > xModelTitle( pDoc->GetDocShell()->GetModel(), css::uno::UNO_QUERY );
2967  if( xModelTitle.is() )
2968  xIPObj->setContainerName( xModelTitle->getTitle() );
2969 
2970  assert(pFormat2 && "Doc->Insert(notxt) failed.");
2971 
2972  pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
2973  pFormat2->Add(this);
2974  if(!m_sName.isEmpty())
2975  pDoc->SetFlyName(*pFormat2, m_sName);
2976  }
2977  }
2978  else if( pStreamName )
2979  {
2980  OUString sStreamName;
2981  (*pStreamName) >>= sStreamName;
2983 
2985  aPam, sStreamName, m_nDrawAspect, &aFrameSet, nullptr);
2986 
2987  // store main document name to show in the title bar
2988  SwOLENode* pNd = nullptr;
2989  const SwNodeIndex* pIdx = pFrameFormat->GetContent().GetContentIdx();
2990  if( pIdx )
2991  {
2992  SwNodeIndex aIdx( *pIdx, 1 );
2993  SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
2994  pNd = pNoText->GetOLENode();
2995  }
2996  if( pNd )
2997  {
2998  uno::Reference < embed::XEmbeddedObject > xObj = pNd->GetOLEObj().GetOleRef();
2999  if( xObj.is() )
3000  {
3001  uno::Reference< frame::XTitle > xModelTitle( pDoc->GetDocShell()->GetModel(), css::uno::UNO_QUERY );
3002  if( xModelTitle.is() )
3003  xObj->setContainerName( xModelTitle->getTitle() );
3004  }
3005  }
3006 
3007  pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
3008  pFrameFormat->Add(this);
3009  if(!m_sName.isEmpty())
3010  pDoc->SetFlyName(*pFrameFormat, m_sName);
3011  }
3012  else if (pEmbeddedObject)
3013  {
3014  uno::Reference< embed::XEmbeddedObject > obj;
3015  (*pEmbeddedObject) >>= obj;
3017  xObj.Assign( obj, embed::Aspects::MSOLE_CONTENT );
3018 
3020 
3021  // Not sure if these setParent() and InsertEmbeddedObject() calls are really
3022  // needed, it seems to work without, but logic from code elsewhere suggests
3023  // they should be done.
3024  SfxObjectShell& rPers = *pDoc->GetPersist();
3025  uno::Reference < container::XChild > xChild( obj, uno::UNO_QUERY );
3026  if ( xChild.is() )
3027  xChild->setParent( rPers.GetModel() );
3028  OUString rName;
3029  rPers.GetEmbeddedObjectContainer().InsertEmbeddedObject( obj, rName );
3030 
3031  SwFlyFrameFormat* pFrameFormat
3032  = pDoc->getIDocumentContentOperations().InsertEmbObject(aPam, xObj, &aFrameSet);
3033  pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
3034  pFrameFormat->Add(this);
3035  if(!m_sName.isEmpty())
3036  pDoc->SetFlyName(*pFrameFormat, m_sName);
3037  }
3038  }
3039  if( pFormat && pDoc->getIDocumentDrawModelAccess().GetDrawModel() )
3040  GetOrCreateSdrObject(*pFormat);
3041  const ::uno::Any* pOrder;
3042  if (m_pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder))
3044  const ::uno::Any* pReplacement;
3045  if (m_pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0, pReplacement))
3046  setPropertyValue(UNO_NAME_GRAPHIC, *pReplacement);
3047  // new attribute Title
3048  const ::uno::Any* pTitle;
3049  if (m_pProps->GetProperty(FN_UNO_TITLE, 0, pTitle))
3050  {
3051  setPropertyValue(UNO_NAME_TITLE, *pTitle);
3052  }
3053  // new attribute Description
3054  const ::uno::Any* pDescription;
3055  if (m_pProps->GetProperty(FN_UNO_DESCRIPTION, 0, pDescription))
3056  {
3057  setPropertyValue(UNO_NAME_DESCRIPTION, *pDescription);
3058  }
3059 
3060  // For grabbag
3061  const uno::Any* pFrameIntropgrabbagItem;
3062  if (m_pProps->GetProperty(RES_FRMATR_GRABBAG, 0, pFrameIntropgrabbagItem))
3063  {
3064  setPropertyValue(UNO_NAME_FRAME_INTEROP_GRAB_BAG, *pFrameIntropgrabbagItem);
3065  }
3066 
3067  // reset the flag and delete Descriptor pointer
3068  ResetDescriptor();
3069 }
3070 
3071 void SwXFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
3072 {
3073  SolarMutexGuard g;
3074 
3075  SwFrameFormat* pFormat;
3076  if(IsDescriptor())
3077  attachToRange(xTextRange);
3078  else if(nullptr != (pFormat = GetFrameFormat()))
3079  {
3080  SwDoc* pDoc = pFormat->GetDoc();
3081  SwUnoInternalPaM aIntPam(*pDoc);
3082  if (!::sw::XTextRangeToSwPaM(aIntPam, xTextRange))
3083  throw lang::IllegalArgumentException();
3084 
3086  aSet.SetParent(&pFormat->GetAttrSet());
3087  SwFormatAnchor aAnchor = aSet.Get(RES_ANCHOR);
3088  aAnchor.SetAnchor( aIntPam.Start() );
3089  aSet.Put(aAnchor);
3090  pDoc->SetFlyFrameAttr( *pFormat, aSet );
3091 
3092  }
3093 }
3094 
3096 {
3097  SolarMutexGuard aGuard;
3098  uno::RuntimeException aRuntime;
3099  aRuntime.Message = "position cannot be determined with this method";
3100  throw aRuntime;
3101 }
3102 
3103 void SwXFrame::setPosition(const awt::Point& /*aPosition*/)
3104 {
3105  SolarMutexGuard aGuard;
3106  uno::RuntimeException aRuntime;
3107  aRuntime.Message = "position cannot be changed with this method";
3108  throw aRuntime;
3109 }
3110 
3112 {
3113  const ::uno::Any aVal = getPropertyValue("Size");
3114  awt::Size const * pRet = o3tl::doAccess<awt::Size>(aVal);
3115  return *pRet;
3116 }
3117 
3118 void SwXFrame::setSize(const awt::Size& aSize)
3119 {
3120  const ::uno::Any aVal(&aSize, ::cppu::UnoType<awt::Size>::get());
3121  setPropertyValue("Size", aVal);
3122 }
3123 
3125 {
3126  return "FrameShape";
3127 }
3128 
3130  SwXText(nullptr, CursorType::Frame),
3132 {
3133 }
3134 
3136  SwXText(rFormat.GetDoc(), CursorType::Frame),
3138 {
3139 
3140 }
3141 
3143 {
3144 }
3145 
3146 uno::Reference<text::XTextFrame>
3148 {
3149  return CreateXFrame<text::XTextFrame, SwXTextFrame>(rDoc, pFrameFormat);
3150 }
3151 
3152 void SAL_CALL SwXTextFrame::acquire( )throw()
3153 {
3154  SwXFrame::acquire();
3155 }
3156 
3157 void SAL_CALL SwXTextFrame::release( )throw()
3158 {
3159  SwXFrame::release();
3160 }
3161 
3163 {
3164  ::uno::Any aRet = SwXFrame::queryInterface(aType);
3165  if(aRet.getValueType() == cppu::UnoType<void>::get())
3166  aRet = SwXText::queryInterface(aType);
3167  if(aRet.getValueType() == cppu::UnoType<void>::get())
3168  aRet = SwXTextFrameBaseClass::queryInterface(aType);
3169  return aRet;
3170 }
3171 
3172 uno::Sequence< uno::Type > SAL_CALL SwXTextFrame::getTypes( )
3173 {
3175  SwXTextFrameBaseClass::getTypes(),
3176  SwXFrame::getTypes(),
3178  );
3179 }
3180 
3181 uno::Sequence< sal_Int8 > SAL_CALL SwXTextFrame::getImplementationId( )
3182 {
3183  return css::uno::Sequence<sal_Int8>();
3184 }
3185 
3186 uno::Reference< text::XText > SwXTextFrame::getText()
3187 {
3188  return this;
3189 }
3190 
3192 {
3193  const SwStartNode *pSttNd = nullptr;
3194 
3195  const SwFrameFormat* pFormat = GetFrameFormat();
3196  if(pFormat)
3197  {
3198  const SwFormatContent& rFlyContent = pFormat->GetContent();
3199  if( rFlyContent.GetContentIdx() )
3200  pSttNd = rFlyContent.GetContentIdx()->GetNode().GetStartNode();
3201  }
3202 
3203  return pSttNd;
3204 }
3205 
3206 uno::Reference< text::XTextCursor >
3208 {
3209  return createTextCursor();
3210 }
3211 
3212 uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursor()
3213 {
3214  SolarMutexGuard aGuard;
3215  uno::Reference< text::XTextCursor > aRef;
3216  SwFrameFormat* pFormat = GetFrameFormat();
3217  if(!pFormat)
3218  throw uno::RuntimeException();
3219 
3220  //save current start node to be able to check if there is content after the table -
3221  //otherwise the cursor would be in the body text!
3222  const SwNode& rNode = pFormat->GetContent().GetContentIdx()->GetNode();
3223  const SwStartNode* pOwnStartNode = rNode.FindSttNodeByType(SwFlyStartNode);
3224 
3225  SwPaM aPam(rNode);
3226  aPam.Move(fnMoveForward, GoInNode);
3227  SwTableNode* pTableNode = aPam.GetNode().FindTableNode();
3228  SwContentNode* pCont = nullptr;
3229  while( pTableNode )
3230  {
3231  aPam.GetPoint()->nNode = *pTableNode->EndOfSectionNode();
3232  pCont = GetDoc()->GetNodes().GoNext(&aPam.GetPoint()->nNode);
3233  pTableNode = pCont->FindTableNode();
3234  }
3235  if(pCont)
3236  aPam.GetPoint()->nContent.Assign(pCont, 0);
3237 
3238  const SwStartNode* pNewStartNode =
3240  if(!pNewStartNode || pNewStartNode != pOwnStartNode)
3241  {
3242  uno::RuntimeException aExcept;
3243  aExcept.Message = "no text available";
3244  throw aExcept;
3245  }
3246 
3247  SwXTextCursor *const pXCursor = new SwXTextCursor(
3248  *pFormat->GetDoc(), this, CursorType::Frame, *aPam.GetPoint());
3249  aRef = static_cast<text::XWordCursor*>(pXCursor);
3250 
3251  return aRef;
3252 }
3253 
3254 uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursorByRange(const uno::Reference< text::XTextRange > & aTextPosition)
3255 {
3256  SolarMutexGuard aGuard;
3257  SwFrameFormat* pFormat = GetFrameFormat();
3258  if (!pFormat)
3259  throw uno::RuntimeException();
3260  SwUnoInternalPaM aPam(*GetDoc());
3261  if (!::sw::XTextRangeToSwPaM(aPam, aTextPosition))
3262  throw uno::RuntimeException();
3263 
3264  uno::Reference<text::XTextCursor> aRef;
3265  SwNode& rNode = pFormat->GetContent().GetContentIdx()->GetNode();
3266  if(aPam.GetNode().FindFlyStartNode() == rNode.FindFlyStartNode())
3267  {
3268  aRef = static_cast<text::XWordCursor*>(
3269  new SwXTextCursor(*pFormat->GetDoc(), this, CursorType::Frame,
3270  *aPam.GetPoint(), aPam.GetMark()));
3271  }
3272 
3273  return aRef;
3274 }
3275 
3276 uno::Reference< container::XEnumeration > SwXTextFrame::createEnumeration()
3277 {
3278  SolarMutexGuard aGuard;
3279  SwFrameFormat* pFormat = GetFrameFormat();
3280  if(!pFormat)
3281  return nullptr;
3282  SwPosition aPos(pFormat->GetContent().GetContentIdx()->GetNode());
3283  auto pUnoCursor(GetDoc()->CreateUnoCursor(aPos));
3284  pUnoCursor->Move(fnMoveForward, GoInNode);
3285  return SwXParagraphEnumeration::Create(this, pUnoCursor, CursorType::Frame);
3286 }
3287 
3289 {
3291 }
3292 
3294 {
3295  return true;
3296 }
3297 
3298 void SwXTextFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
3299 {
3300  SwXFrame::attach(xTextRange);
3301 }
3302 
3303 uno::Reference< text::XTextRange > SwXTextFrame::getAnchor()
3304 {
3305  SolarMutexGuard aGuard;
3306  return SwXFrame::getAnchor();
3307 }
3308 
3310 {
3311  SolarMutexGuard aGuard;
3313 }
3314 
3315 void SwXTextFrame::addEventListener(const uno::Reference< lang::XEventListener > & aListener)
3316 {
3317  SwXFrame::addEventListener(aListener);
3318 }
3319 
3320 void SwXTextFrame::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
3321 {
3322  SwXFrame::removeEventListener(aListener);
3323 }
3324 
3326 {
3327  return "SwXTextFrame";
3328 }
3329 
3330 sal_Bool SwXTextFrame::supportsService(const OUString& rServiceName)
3331 {
3332  return cppu::supportsService(this, rServiceName);
3333 }
3334 
3335 uno::Sequence< OUString > SwXTextFrame::getSupportedServiceNames()
3336 {
3337  uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
3338  aRet.realloc(aRet.getLength() + 2);
3339  OUString* pArray = aRet.getArray();
3340  pArray[aRet.getLength() - 2] = "com.sun.star.text.TextFrame";
3341  pArray[aRet.getLength() - 1] = "com.sun.star.text.Text";
3342  return aRet;
3343 }
3344 
3345 uno::Reference<container::XNameReplace > SAL_CALL SwXTextFrame::getEvents()
3346 {
3347  return new SwFrameEventDescriptor( *this );
3348 }
3349 
3350 sal_Int64 SAL_CALL SwXTextFrame::getSomething( const uno::Sequence< sal_Int8 >& rId )
3351 {
3352  sal_Int64 nRet = SwXFrame::getSomething( rId );
3353  if( !nRet )
3354  nRet = SwXText::getSomething( rId );
3355 
3356  return nRet;
3357 }
3358 
3359 ::uno::Any SwXTextFrame::getPropertyValue(const OUString& rPropertyName)
3360 {
3361  SolarMutexGuard aGuard;
3362  ::uno::Any aRet;
3363  if(rPropertyName == UNO_NAME_START_REDLINE||
3364  rPropertyName == UNO_NAME_END_REDLINE)
3365  {
3366  //redline can only be returned if it's a living object
3367  if(!IsDescriptor())
3368  aRet = SwXText::getPropertyValue(rPropertyName);
3369  }
3370  else
3371  aRet = SwXFrame::getPropertyValue(rPropertyName);
3372  return aRet;
3373 }
3374 
3377  aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC), pDoc)
3378 {
3379 }
3380 
3383  aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC))
3384 {
3385 }
3386 
3388 {
3389 }
3390 
3391 uno::Reference<text::XTextContent>
3393 {
3394  return CreateXFrame<text::XTextContent, SwXTextGraphicObject>(rDoc, pFrameFormat);
3395 }
3396 
3398 {
3399  return "SwXTextGraphicObject";
3400 }
3401 
3403 {
3404  return cppu::supportsService(this, rServiceName);
3405 }
3406 
3408 {
3409  uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
3410  aRet.realloc(aRet.getLength() + 1);
3411  OUString* pArray = aRet.getArray();
3412  pArray[aRet.getLength() - 1] = "com.sun.star.text.TextGraphicObject";
3413  return aRet;
3414 }
3415 
3416 uno::Reference<container::XNameReplace> SAL_CALL
3418 {
3419  return new SwFrameEventDescriptor( *this );
3420 }
3421 
3424  aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT), pDoc)
3425 {
3426 }
3427 
3431 {
3432 }
3433 
3435 {
3436 }
3437 
3438 uno::Reference<text::XTextContent>
3440 {
3441  return CreateXFrame<text::XTextContent, SwXTextEmbeddedObject>(rDoc, pFrameFormat);
3442 }
3443 
3444 uno::Reference< lang::XComponent > SwXTextEmbeddedObject::getEmbeddedObject()
3445 {
3446  uno::Reference<embed::XEmbeddedObject> xObj(getExtendedControlOverEmbeddedObject());
3447  return xObj.is() ? uno::Reference<lang::XComponent>(xObj->getComponent(), uno::UNO_QUERY) : nullptr;
3448 }
3449 
3450 uno::Reference< embed::XEmbeddedObject > SAL_CALL SwXTextEmbeddedObject::getExtendedControlOverEmbeddedObject()
3451 {
3452  uno::Reference< embed::XEmbeddedObject > xResult;
3453  SwFrameFormat* pFormat = GetFrameFormat();
3454  if(pFormat)
3455  {
3456  SwDoc* pDoc = pFormat->GetDoc();
3457  const SwFormatContent* pCnt = &pFormat->GetContent();
3458  OSL_ENSURE( pCnt->GetContentIdx() &&
3459  pDoc->GetNodes()[ pCnt->GetContentIdx()->
3460  GetIndex() + 1 ]->GetOLENode(), "no OLE-Node?");
3461 
3462  SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetContentIdx()
3463  ->GetIndex() + 1 ]->GetOLENode();
3464  xResult = pOleNode->GetOLEObj().GetOleRef();
3465  if ( svt::EmbeddedObjectRef::TryRunningState( xResult ) )
3466  {
3467  // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
3468  if ( pDoc->GetDocShell() )
3469  pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xResult, embed::Aspects::MSOLE_CONTENT ) );
3470 
3471  uno::Reference < lang::XComponent > xComp( xResult->getComponent(), uno::UNO_QUERY );
3472  uno::Reference< util::XModifyBroadcaster > xBrdcst( xComp, uno::UNO_QUERY);
3473  uno::Reference< frame::XModel > xModel( xComp, uno::UNO_QUERY);
3474  if(xBrdcst.is() && xModel.is() && !m_xOLEListener.is())
3475  {
3476  m_xOLEListener = new SwXOLEListener(*pFormat, xModel);
3477  xBrdcst->addModifyListener( m_xOLEListener );
3478  }
3479  }
3480  }
3481  return xResult;
3482 }
3483 
3485 {
3486  SwFrameFormat* pFormat = GetFrameFormat();
3487  if(pFormat)
3488  {
3489  SwDoc* pDoc = pFormat->GetDoc();
3490  const SwFormatContent* pCnt = &pFormat->GetContent();
3491  OSL_ENSURE( pCnt->GetContentIdx() &&
3492  pDoc->GetNodes()[ pCnt->GetContentIdx()->
3493  GetIndex() + 1 ]->GetOLENode(), "no OLE-Node?");
3494 
3495  return pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ]->GetOLENode()->GetAspect();
3496  }
3497 
3498  return embed::Aspects::MSOLE_CONTENT; // return the default value
3499 }
3500 
3501 void SAL_CALL SwXTextEmbeddedObject::setAspect( sal_Int64 nAspect )
3502 {
3503  SwFrameFormat* pFormat = GetFrameFormat();
3504  if(pFormat)
3505  {
3506  SwDoc* pDoc = pFormat->GetDoc();
3507  const SwFormatContent* pCnt = &pFormat->GetContent();
3508  OSL_ENSURE( pCnt->GetContentIdx() &&
3509  pDoc->GetNodes()[ pCnt->GetContentIdx()->
3510  GetIndex() + 1 ]->GetOLENode(), "no OLE-Node?");
3511 
3512  pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ]->GetOLENode()->SetAspect( nAspect );
3513  }
3514 }
3515 
3516 uno::Reference< graphic::XGraphic > SAL_CALL SwXTextEmbeddedObject::getReplacementGraphic()
3517 {
3518  SwFrameFormat* pFormat = GetFrameFormat();
3519  if(pFormat)
3520  {
3521  SwDoc* pDoc = pFormat->GetDoc();
3522  const SwFormatContent* pCnt = &pFormat->GetContent();
3523  OSL_ENSURE( pCnt->GetContentIdx() &&
3524  pDoc->GetNodes()[ pCnt->GetContentIdx()->
3525  GetIndex() + 1 ]->GetOLENode(), "no OLE-Node?");
3526 
3527  const Graphic* pGraphic = pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ]->GetOLENode()->GetGraphic();
3528  if ( pGraphic )
3529  return pGraphic->GetXGraphic();
3530  }
3531 
3532  return uno::Reference< graphic::XGraphic >();
3533 }
3534 
3536 {
3537  return "SwXTextEmbeddedObject";
3538 }
3539 
3541 {
3542  return cppu::supportsService(this, rServiceName);
3543 }
3544 
3546 {
3547  uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
3548  aRet.realloc(aRet.getLength() + 1);
3549  OUString* pArray = aRet.getArray();
3550  pArray[aRet.getLength() - 1] = "com.sun.star.text.TextEmbeddedObject";
3551  return aRet;
3552 }
3553 
3554 uno::Reference<container::XNameReplace> SAL_CALL
3556 {
3557  return new SwFrameEventDescriptor( *this );
3558 }
3559 
3560 namespace
3561 {
3562  SwOLENode* lcl_GetOLENode(const SwFormat* pFormat)
3563  {
3564  if(!pFormat)
3565  return nullptr;
3566  const SwNodeIndex* pIdx(pFormat->GetContent().GetContentIdx());
3567  if(!pIdx)
3568  return nullptr;
3569  const SwNodeIndex aIdx(*pIdx, 1);
3570  return aIdx.GetNode().GetNoTextNode()->GetOLENode();
3571  }
3572 }
3573 
3574 SwXOLEListener::SwXOLEListener( SwFormat& rOLEFormat, uno::Reference< XModel > const & xOLE)
3575  : m_pOLEFormat(&rOLEFormat)
3576  , m_xOLEModel(xOLE)
3577 {
3579 }
3580 
3582 {}
3583 
3584 void SwXOLEListener::modified( const lang::EventObject& /*rEvent*/ )
3585 {
3586  SolarMutexGuard aGuard;
3587  const auto pNd = lcl_GetOLENode(m_pOLEFormat);
3588  if(!pNd)
3589  throw uno::RuntimeException();
3590  const auto xIP = pNd->GetOLEObj().GetOleRef();
3591  if(xIP.is())
3592  {
3593  sal_Int32 nState = xIP->getCurrentState();
3594  if(nState == embed::EmbedStates::INPLACE_ACTIVE || nState == embed::EmbedStates::UI_ACTIVE)
3595  // if the OLE-Node is UI-Active do nothing
3596  return;
3597  }
3598  pNd->SetOLESizeInvalid(true);
3599  pNd->GetDoc()->SetOLEObjModified();
3600 }
3601 
3602 void SwXOLEListener::disposing( const lang::EventObject& rEvent )
3603 {
3604  SolarMutexGuard aGuard;
3605  uno::Reference<util::XModifyListener> xListener( this );
3606  uno::Reference<frame::XModel> xModel(rEvent.Source, uno::UNO_QUERY);
3607  uno::Reference<util::XModifyBroadcaster> xBrdcst(xModel, uno::UNO_QUERY);
3608  if(!xBrdcst.is())
3609  return;
3610  try
3611  {
3612  xBrdcst->removeModifyListener(xListener);
3613  }
3614  catch(uno::Exception const &)
3615  {
3616  OSL_FAIL("OLE Listener couldn't be removed");
3617  }
3618 }
3619 
3620 void SwXOLEListener::Notify( const SfxHint& rHint )
3621 {
3622  if(rHint.GetId() == SfxHintId::Dying)
3623  {
3624  m_xOLEModel = nullptr;
3625  m_pOLEFormat = nullptr;
3626  }
3627 }
3628 
3629 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SwStartNode * FindSttNodeByType(SwStartNodeType eTyp)
Definition: node.cxx:755
#define UNO_NAME_CONTOUR_OUTSIDE
Definition: unoprnms.hxx:242
#define MID_FILLGRADIENT
sal_uInt16 Count() const
long Width() const
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
Starts a section of nodes in the document model.
Definition: node.hxx:303
virtual bool AnyToItemSet(SwDoc *pDoc, SfxItemSet &rFrameSet, SfxItemSet &rSet, bool &rSizeFound) override
Definition: unoframe.cxx:1138
virtual OUString SAL_CALL getImplementationName() override
Definition: unoframe.cxx:1184
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:1387
virtual ~SwXOLEListener() override
Definition: unoframe.cxx:3581
void DeleteMark()
Definition: pam.hxx:177
#define RES_GRFATR_END
Definition: hintids.hxx:258
#define RES_FRM_SIZE
Definition: hintids.hxx:194
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
#define RES_COL
Definition: hintids.hxx:214
SwFlyDrawContact * GetOrCreateContact()
Definition: atrfrm.cxx:2832
#define XATTR_FILLHATCH
bool hasValue()
void Add(SwClient *pDepend)
Definition: calbck.cxx:217
virtual const SwDoc * GetDoc() const =0
const tools::Polygon & GetObject(sal_uInt16 nPos) const
#define RES_URL
Definition: hintids.hxx:216
#define MID_SURROUND_SURROUNDTYPE
Definition: unomid.h:29
virtual void SAL_CALL setName(const OUString &Name_) override
Definition: unoframe.cxx:1311
virtual void SAL_CALL setSize(const css::awt::Size &aSize) override
Definition: unoframe.cxx:3118
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
Marks a position in the document model.
Definition: pam.hxx:35
#define RES_EDIT_IN_READONLY
Definition: hintids.hxx:217
#define FN_UNO_VISIBLE_AREA_WIDTH
Definition: cmdid.h:612
void SvxUnoConvertFromMM(const MapUnit eDestinationMapUnit, uno::Any &rMetric)
OUString GetObjDescription() const
Definition: atrfrm.cxx:3138
SfxInPlaceClient * GetIPClient(const ::svt::EmbeddedObjectRef &xObjRef)
Definition: docsh2.cxx:1654
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx: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:602
void SetSelection(SwPaM &rCopySource)
Definition: unoframe.cxx:1358
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:2370
#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:1341
#define RES_HORI_ORIENT
Definition: hintids.hxx:208
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoframe.cxx:3545
#define WID_LAYOUT_SIZE
Definition: unomap.hxx:292
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
#define MID_FRMSIZE_SIZE_TYPE
Definition: unomid.h:76
bool IsNone() const
#define RES_FRMATR_GRABBAG
Definition: hintids.hxx:234
#define MID_NAME
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
long Height() const
#define COL_DEFAULT_SHAPE_FILLING
Frame
signed char sal_Int8
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unoframe.cxx:2352
#define MID_FTF_LAYOUT_IN_CELL
Definition: unomid.h:152
SwNodeIndex nNode
Definition: pam.hxx:37
#define UNO_NAME_END_REDLINE
Definition: unoprnms.hxx:561
SAL_DLLPRIVATE css::uno::WeakReference< css::uno::XInterface > const & GetXObject() const
Definition: frmfmt.hxx:167
virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override
Definition: unoframe.cxx:3417
#define RES_SHADOW
Definition: hintids.hxx:212
#define MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT
Definition: unomid.h:84
#define MID_FRMSIZE_REL_WIDTH
Definition: unomid.h:72
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:66
virtual Size GetTwipSize() const =0
#define MINFLY
Definition: swtypes.hxx:65
#define SAL_INFO_IF(condition, area, stream)
std::unique_ptr< BaseFrameProperties_Impl > m_pProps
Definition: unoframe.hxx:69
const SwFrameFormat * GetFrameFormat() const
Definition: unoframe.hxx:151
virtual css::uno::Reference< css::embed::XEmbeddedObject > SAL_CALL getExtendedControlOverEmbeddedObject() override
Definition: unoframe.cxx:3450
Reference< XFrame > xFrame
#define RES_FRAMEDIR
Definition: hintids.hxx:225
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unoframe.cxx:3071
const SwPosition * GetMark() const
Definition: pam.hxx:209
#define RES_SURROUND
Definition: hintids.hxx:206
virtual SdrLayerID GetHeavenId() const =0
#define PROPERTY_MAP_TEXT_GRAPHIC
Definition: unomap.hxx:41
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:913
std::shared_ptr< SvxBrushItem > getSvxBrushItemFromSourceSet(const SfxItemSet &rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack)
#define FN_UNO_CLSID
Definition: cmdid.h:570
#define MID_VERTORIENT_RELATION
Definition: unomid.h:35
#define MID_URL_HYPERLINKNAME
Definition: unomid.h:47
#define RES_FRMATR_END
Definition: hintids.hxx:236
#define LINE_STYLE
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
#define XATTR_FILLGRADIENT
bool IsInserted() const
bool bIsDescriptor
Definition: unoframe.hxx:70
Definition: doc.hxx:185
#define FN_UNO_MODEL
Definition: cmdid.h:571
#define FN_UNO_VISIBLE_AREA_HEIGHT
Definition: cmdid.h:613
uno::WeakReference< uno::XInterface > m_wThis
Definition: unoframe.cxx:1158
SwFormat * m_pOLEFormat
Definition: unoframe.hxx:313
#define MID_GRAPHIC_TRANSPARENT
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unoframe.cxx:3320
#define RIGHT_BORDER_DISTANCE
css::uno::Sequence< sal_Int8 > GetByteSequence() const
#define XATTR_FILLFLOATTRANSPARENCE
#define RES_GRFATR_CHANNELB
Definition: hintids.hxx:247
#define FN_UNO_STREAM_NAME
Definition: cmdid.h:584
SwNode & GetNode() const
Definition: ndindex.hxx:118
bool IsPixelContour() const
Definition: ndnotxt.cxx:215
SwDoc * m_pDoc
Definition: unoframe.hxx:64
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
#define MID_BACK_COLOR
const GraphicObject * GetReplacementGrfObj() const
Definition: ndgrf.cxx:380
virtual void SAL_CALL acquire() override
Definition: unoframe.cxx:3152
#define FN_UNO_ALTERNATIVE_TEXT
Definition: cmdid.h:560
#define MID_SURROUND_ANCHORONLY
Definition: unomid.h:30
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:176
css::uno::Reference< css::frame::XModel > GetModel() const
#define UNO_NAME_GRAPHIC
Definition: unoprnms.hxx:163
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
#define RES_WRAP_INFLUENCE_ON_OBJPOS
Definition: hintids.hxx:230
virtual SwFrameFormat * GetFrameFormatFromPool(sal_uInt16 nId)=0
Return required automatic format.
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:347
virtual const SwStartNode * GetStartNode() const override
Definition: unoframe.cxx:3191
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
void SetPoint(const Point &rPt, sal_uInt16 nPos)
virtual OUString getDocumentBaseURL() const override
#define RES_PROTECT
Definition: hintids.hxx:205
void ClientModify(SwClient *pClient, const SfxPoolItem *pOld, const SfxPoolItem *pNew)
helper function for implementing SwClient::Modify
Definition: unoobj2.cxx:296
Graphic loadFromURL(OUString const &rURL, weld::Window *pParentWin)
#define MID_GRAPHIC_TRANSPARENCY
#define MID_ANCHOR_PAGENUM
Definition: unomid.h:44
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
bool HasContour_() const
Definition: ndnotxt.hxx:73
#define UNO_NAME_ACTUAL_SIZE
Definition: unoprnms.hxx:308
#define RES_UNKNOWNATR_CONTAINER
Definition: hintids.hxx:267
SfxHintId GetId() const
#define LEFT_BORDER
bool isFrameAreaDefinitionValid() const
Definition: frame.hxx:167
Graphic GetTransformedGraphic(const Size &rDestSize, const MapMode &rDestMap, const GraphicAttr &rAttr) const
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
virtual void SAL_CALL dispose() override
Definition: unoframe.cxx:3309
#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:1043
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
Definition: unoframe.cxx:2463
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:3434
#define RES_GRFATR_MIRRORGRF
Definition: hintids.hxx:239
static css::uno::Reference< Interface > CreateXFrame(SwDoc &rDoc, SwFrameFormat *const pFrameFormat)
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:187
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
Definition: unoframe.cxx:3212
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoframe.cxx:3335
SwChainRet Chain(SwFrameFormat &rSource, const SwFrameFormat &rDest)
Definition: docfly.cxx:1077
void ResetDescriptor()
Definition: unoframe.cxx:2662
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
virtual css::awt::Size SAL_CALL getSize() override
Definition: unoframe.cxx:3111
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:789
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
Definition: unoframe.cxx:3584
SwFlyFrameFormat * MakeFlySection(RndStdIds eAnchorType, const SwPosition *pAnchorPos, const SfxItemSet *pSet=nullptr, SwFrameFormat *pParent=nullptr, bool bCalledFromShell=false)
Definition: doclay.cxx:302
css::uno::Reference< css::container::XNameAccess > mxStyleFamily
Definition: unoframe.hxx:82
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoframe.cxx:1194
#define UNO_NAME_CHAIN_NEXT_NAME
Definition: unoprnms.hxx:234
#define XATTR_FILL_LAST
bool isGRFATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:376
#define MID_FRMSIZE_SIZE
Definition: unomid.h:70
bool IsContourMapModeValid() const
Definition: ndnotxt.hxx:89
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unoframe.cxx:3359
SwIndex nContent
Definition: pam.hxx:38
virtual ~SwXFrame() override
Definition: unoframe.cxx:1266
const SwRect & getFrameArea() const
Definition: frame.hxx:175
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
GraphicAttr & GetGraphicAttr(GraphicAttr &, const SwFrame *pFrame) const
Returns the with our graphic attributes filled Graphic-Attr-Structure.
Definition: ndgrf.cxx:727
#define XATTR_FILL_FIRST
#define MID_FOLLOW_TEXT_FLOW
Definition: unomid.h:151
#define X
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:458
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoframe.cxx:1189
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:965
#define FN_PARAM_CONTOUR_PP
Definition: cmdid.h:788
const OUString & GetName() const
Definition: format.hxx:111
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
css::uno::Reference< css::beans::XPropertySet > mxStyleData
Definition: unoframe.hxx:81
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
#define FN_UNO_PARENT_TEXT
Definition: cmdid.h:530
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType)
Is the frame format a text box?
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
#define XATTR_FILLBMP_TILEOFFSETY
SwFrameFormat * GetFrameFormat()
Definition: docstyle.cxx:2225
#define RES_GRFATR_LUMINANCE
Definition: hintids.hxx:243
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: unoframe.cxx:3186
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unoframe.cxx:2641
void SetValue(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any &rAny)
SwFlyFrameFormat * MakeFlyAndMove(const SwPaM &rPam, const SfxItemSet &rSet, const SwSelBoxes *pSelBoxes, SwFrameFormat *pParent)
Definition: doclay.cxx:357
#define RES_UL_SPACE
Definition: hintids.hxx:197
bool GetContourAPI(tools::PolyPolygon &rPoly) const
Definition: ndnotxt.cxx:181
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoframe.cxx:3330
void Insert(const tools::Polygon &rPoly, sal_uInt16 nPos=POLYPOLY_APPEND)
#define MID_FILLHATCH
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
#define MID_MIRROR_HORZ_ODD_PAGES
Definition: unomid.h:24
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:153
void SetFlyName(SwFlyFrameFormat &rFormat, const OUString &rName)
Definition: doclay.cxx:1424
OUString GetObjTitle() const
Definition: atrfrm.cxx:3101
SAL_DLLPRIVATE void SetXObject(css::uno::Reference< css::uno::XInterface > const &xObject)
Definition: frmfmt.hxx:169
SwFrameFormat * GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes=false)
Definition: docfly.cxx:121
void getPropertyValue(const SfxItemPropertySimpleEntry &rEntry, const SfxItemSet &rSet, css::uno::Any &rAny) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
void Unchain(SwFrameFormat &rFormat)
Definition: docfly.cxx:1120
#define RES_PRINT
Definition: hintids.hxx:203
#define MID_COLUMNS
Definition: unomid.h:90
#define RES_GRFATR_CONTRAST
Definition: hintids.hxx:244
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange)
Definition: unoobj2.cxx:1008
virtual void SAL_CALL release() override
Definition: unoframe.cxx:3157
#define FN_UNO_GRAPHIC_FILTER
Definition: cmdid.h:563
virtual void SAL_CALL setAspect(::sal_Int64 _aspect) override
Definition: unoframe.cxx:3501
css::uno::Reference< css::frame::XModel > GetBaseModel() const
virtual SwFlyFrameFormat * InsertOLE(const SwPaM &rRg, const OUString &rObjName, sal_Int64 nAspect, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet)=0
#define XATTR_FILLBMP_POSOFFSETY
#define XATTR_FILLBMP_SIZELOG
#define RES_GRFATR_INVERT
Definition: hintids.hxx:249
static void lcl_FillCol(SfxItemSet &rToSet, const ::SfxItemSet &rFromSet, const ::uno::Any *pAny)
Definition: unoframe.cxx:979
#define XATTR_FILLBMP_POS
#define FN_UNO_TRANSFORMED_GRAPHIC
Definition: cmdid.h:615
#define PROPERTY_MAP_TEXT_FRAME
Definition: unomap.hxx:40
#define FN_UNO_Z_ORDER
Definition: cmdid.h:550
#define RES_FOLLOW_TEXT_FLOW
Definition: hintids.hxx:228
MapMode GetPrefMapMode() const
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
#define LEFT_BORDER_DISTANCE
virtual OUString SAL_CALL getImplementationName() override
Definition: unoframe.cxx:3535
#define MID_SURROUND_CONTOUR
Definition: unomid.h:31
Base class for various Writer styles.
Definition: format.hxx:43
void EndListeningAll()
Definition: calbck.cxx:124
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:164
bool PutValue(const css::uno::Any &rVal, sal_uInt8 aInt) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: unoframe.cxx:3181
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:210
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
Definition: unoframe.cxx:3162
css::uno::Reference< css::text::XText > m_xParentText
Definition: unoframe.hxx:78
#define RES_FLYFRMFMT
Definition: hintids.hxx:274
#define MID_FRMSIZE_WIDTH
Definition: unomid.h:74
#define FN_UNO_DESCRIPTION
Definition: cmdid.h:834
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:481
#define MID_L_MARGIN
#define RES_GRFATR_DRAWMODE
Definition: hintids.hxx:251
#define MID_ANCHOR_ANCHORTYPE
Definition: unomid.h:43
Style of a layout element.
Definition: frmfmt.hxx:57
virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getReplacementGraphic() override
Definition: unoframe.cxx:3516
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
const SfxItemSet * GetParent() const
#define MID_HORIORIENT_POSITION
Definition: unomid.h:40
#define RES_GRFATR_CHANNELG
Definition: hintids.hxx:246
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unoframe.cxx:3288
#define RES_ANCHOR
Definition: hintids.hxx:209
virtual SwFlyFrameFormat * InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef &xObj, const SfxItemSet *pFlyAttrSet)=0
Insert OLE-objects.
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:892
virtual css::uno::Reference< css::text::XTextCursor > CreateCursor() override
Definition: unoframe.cxx:3207
#define MID_URL_URL
Definition: unomid.h:50
virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override
Definition: unoframe.cxx:3555
virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override
Definition: unoframe.cxx:3345
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:1214
#define MID_FRMSIZE_WIDTH_TYPE
Definition: unomid.h:86
static bool SetFillAttribute(sal_uInt16 nWID, const OUString &rName, SfxItemSet &rSet, SdrModel const *pModel)
#define UNO_NAME_FRAME_INTEROP_GRAB_BAG
Definition: unoprnms.hxx:856
void SetContourAPI(const tools::PolyPolygon *pPoly)
Definition: ndnotxt.cxx:172
virtual OUString SAL_CALL getImplementationName() override
Definition: unoframe.cxx:3325
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
OUString GetHexName() const
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:323
#define RES_GRFATR_ROTATION
Definition: hintids.hxx:242
FlyCntType
Definition: flyenum.hxx:23
#define RES_GRFATR_GAMMA
Definition: hintids.hxx:248
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
bool GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any *&pAny)
Definition: unoframe.cxx:181
#define LINE_WIDTH
virtual css::awt::Point SAL_CALL getPosition() override
Definition: unoframe.cxx:3095
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unoframe.cxx:2364
#define RES_VERT_ORIENT
Definition: hintids.hxx:207
std::unique_ptr< SwPaM > m_pCopySource
Definition: unoframe.hxx:73
#define MID_VERTORIENT_POSITION
Definition: unomid.h:36
void SetFlyFrameDescription(SwFlyFrameFormat &rFlyFrameFormat, const OUString &sNewDescription)
Definition: docfly.cxx:599
#define TOP_BORDER
TElementType * First()
Definition: calbck.hxx:345
int i
void Assign(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
bool SetFrameFormatToFly(SwFrameFormat &rFlyFormat, SwFrameFormat &rNewFormat, SfxItemSet *pSet=nullptr, bool bKeepOrient=false)
Definition: docfly.cxx:622
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unoframe.cxx:3172
FlyAnchors.
Definition: fmtanchr.hxx:34
static SwXParagraphEnumeration * Create(css::uno::Reference< css::text::XText > const &xParent, const std::shared_ptr< SwUnoCursor > &pCursor, const CursorType eType, SwStartNode const *const pStartNode=nullptr, SwTable const *const pTable=nullptr)
Definition: unoobj2.cxx:507
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet &rSet, sal_uInt16 const nMID)
helper to check if fill style is set to color or bitmap and thus formerly used SvxBrushItem parts nee...
SwNoTextNode * GetNoTextNode()
Definition: ndnotxt.hxx:96
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: unoframe.cxx:2555
#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:572
static SW_DLLPUBLIC SdrObject * GetOrCreateSdrObject(SwFlyFrameFormat &rFormat)
Definition: unoframe.cxx:1365
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1159
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: unotext.cxx:194
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2617
unsigned char sal_Bool
#define BOTTOM_BORDER_DISTANCE
void SetAutomaticContour(bool bSet)
Definition: ndnotxt.hxx:77
const SfxItemPropertyMap & getPropertyMap() const
#define MID_BACK_COLOR_R_G_B
css::uno::Reference< css::util::XModifyListener > m_xOLEListener
Definition: unoframe.hxx:281
sal_uInt32 GetOrdNum() const
virtual void ReRead(SwPaM &, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic)=0
Transpose graphic (with undo)
void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem &rBrush, SfxItemSet &rToSet)
#define MID_BACK_COLOR_TRANSPARENCY
virtual ~SwXTextFrame() override
Definition: unoframe.cxx:3142
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:1598
void setPropertyValue(const SfxItemPropertySimpleEntry &rEntry, const css::uno::Any &aVal, SfxItemSet &rSet) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:396
#define FN_UNO_TITLE
Definition: cmdid.h:833
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:3254
#define MID_SURROUND_CONTOUROUTSIDE
Definition: unomid.h:32
bool GoInDoc(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:880
#define XATTR_GRADIENTSTEPCOUNT
virtual OUString SAL_CALL getImplementationName() override
Definition: unoframe.cxx:3397
static SwOLENode * lcl_GetOLENode(const SwFrameFormat *pFrameFormat)
Definition: xmltexti.cxx:199
#define MID_R_MARGIN
::comphelper::OInterfaceContainerHelper2 m_EventListeners
Definition: unoframe.cxx:1159
const FlyCntType eType
Definition: unoframe.hxx:66
#define MID_GRAPHIC_POSITION
#define XATTR_FILLSTYLE
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
cppu::ImplInheritanceHelper< SwXFrame, css::document::XEmbeddedObjectSupplier2, css::document::XEventsSupplier > SwXTextEmbeddedObjectBaseClass
Definition: unoframe.hxx:277
bool StartListening(SvtBroadcaster &rBroadcaster)
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: unoframe.cxx:2593
virtual ::sal_Int64 SAL_CALL getAspect() override
Definition: unoframe.cxx:3484
SwStartNode * GetStartNode()
Definition: node.hxx:591
DocumentType const eType
virtual void SAL_CALL setPosition(const css::awt::Point &aPosition) override
Definition: unoframe.cxx:3103
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:3444
const SfxItemPropertySet * m_pPropSet
Definition: unoframe.hxx:63
#define UNO_NAME_CHAIN_PREV_NAME
Definition: unoprnms.hxx:235
bool FillValue(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any *&pAny)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
const SfxItemPropertySimpleEntry * getByName(const OUString &rName) const
bool SetFlyFrameAttr(SwFrameFormat &rFlyFormat, SfxItemSet &rSet)
Definition: docfly.cxx:548
const GraphicObject & GetGrfObj(bool bWait=false) const
Definition: ndgrf.cxx:374
css::uno::Reference< css::frame::XModel > m_xOLEModel
Definition: unoframe.hxx:314
static void GetGrfNms(const SwFlyFrameFormat &rFormat, OUString *pGrfName, OUString *pFltName)
Definition: docfly.cxx:709
long X() const
bool IsInReading() const
Definition: doc.hxx:949
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:437
#define Y
const SwPosition * Start() const
Definition: pam.hxx:212
#define UNO_NAME_IS_AUTOMATIC_CONTOUR
Definition: unoprnms.hxx:501
::osl::Mutex m_Mutex
Definition: unoframe.cxx:1155
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoframe.cxx:3407
#define RES_GRFATR_BEGIN
Definition: hintids.hxx:238
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unoframe.cxx:3276
#define MID_PROTECT_CONTENT
virtual SdrLayerID GetHellId() const =0
#define RES_LR_SPACE
Definition: hintids.hxx:196
SwXTextEmbeddedObject(SwDoc *pDoc)
Definition: unoframe.cxx:3422
#define FN_UNO_GRAPHIC
Definition: cmdid.h:578
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unoframe.cxx:2346
virtual OUString SAL_CALL getShapeType() override
Definition: unoframe.cxx:3124
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:3298
#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:1174
virtual ~SwXTextGraphicObject() override
Definition: unoframe.cxx:3387
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:850
SwFormat * DerivedFrom() const
Definition: format.hxx:108
#define MID_GRAPHIC_URL
sal_Int64 m_nVisibleAreaWidth
Definition: unoframe.hxx:76
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
#define MID_HORIORIENT_ORIENT
Definition: unomid.h:38
void DeleteAttributes(const sal_uInt16 nWhich, const sal_Int32 nStart, const sal_Int32 nEnd=0)
delete all attributes of type nWhich at nStart (opt. end nEnd)
Definition: thints.cxx:1673
#define COL_DEFAULT_SHAPE_STROKE
#define MID_FRMSIZE_REL_HEIGHT_RELATION
Definition: unomid.h:88
const SwDoc * GetDoc() const
Definition: unotext.cxx:135
bool IsDescriptor() const
Definition: unoframe.hxx:161
#define XATTR_FILLBMP_TILE
SwXOLEListener(SwFormat &rOLEFormat, css::uno::Reference< css::frame::XModel > const &xOLE)
Definition: unoframe.cxx:3574
comphelper::EmbeddedObjectContainer & GetEmbeddedObjectContainer() const
#define OWN_ATTR_FILLBMP_MODE
Definition: unomap.hxx:324
#define MID_ANCHOR_ANCHORFRAME
Definition: unomid.h:45
#define BOTTOM_BORDER
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unoframe.cxx:3350
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1485
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:77
#define MM50
Definition: swtypes.hxx:59
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
SwUnoCursorHelper::SwAnyMapHelper aAnyMap
Definition: unoframe.cxx: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:277
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unoframe.cxx:2358
#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:561
#define FN_PARAM_LINK_DISPLAY_NAME
Definition: cmdid.h:786
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
#define MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH
Definition: unomid.h:85
#define MID_FRMSIZE_REL_WIDTH_RELATION
Definition: unomid.h:87
#define RES_GRFATR_CHANNELR
Definition: hintids.hxx:245
#define RES_OPAQUE
Definition: hintids.hxx:204
sal_Int32 GetIndex() const
Definition: index.hxx:95
virtual SwDrawModel * GetOrCreateDrawModel()=0
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
SwNodes & GetNodes()
Definition: doc.hxx:402
#define FN_UNO_REPLACEMENT_GRAPHIC_URL
Definition: cmdid.h:580
#define MID_SHADOW_TRANSPARENCE
size_t GetFlyCount(FlyCntType eType, bool bIgnoreTextBoxes=false) const
Access to frames.
Definition: docfly.cxx:74
#define BORDER_DISTANCE
const SwPosition * End() const
Definition: pam.hxx:217
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:157
SfxObjectShell * GetPersist() const
Definition: docnew.cxx:634
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3147
#define TOP_BORDER_DISTANCE
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
void SetSize(const Size &rSize)
void SetGraphic(const Graphic &rGraphic, const OUString &rMediaType)
#define RES_GRFATR_CROPGRF
Definition: hintids.hxx:240
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:131
#define MID_LO_MARGIN
#define MID_GRAPHIC_FILTER
void SvxUnoConvertToMM(const MapUnit eSourceMapUnit, uno::Any &rMetric)
#define FN_UNO_GRAPHIC_URL
Definition: cmdid.h:562
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
void SetFlyFrameTitle(SwFlyFrameFormat &rFlyFrameFormat, const OUString &sNewTitle)
Definition: docfly.cxx:576
#define RES_GRFATR_TRANSPARENCY
Definition: hintids.hxx:250
void Optimize(PolyOptimizeFlags nOptimizeFlags)
#define RES_TXTATR_FLYCNT
Definition: hintids.hxx:151
#define FN_UNO_ANCHOR_TYPES
Definition: cmdid.h:540
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:107
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:723
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
bool InsertEmbeddedObject(const css::uno::Reference< css::embed::XEmbeddedObject > &, OUString &)
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:351
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unoframe.hxx:60
#define MID_HORIORIENT_PAGETOGGLE
Definition: unomid.h:41
#define MID_HORIORIENT_RELATION
Definition: unomid.h:39
#define FN_UNO_REPLACEMENT_GRAPHIC
Definition: cmdid.h:586
void SetType(RndStdIds nRndId)
Definition: fmtanchr.hxx:71
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unoframe.cxx:1329
#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:989
#define RES_BOX
Definition: hintids.hxx:211
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unoframe.cxx:3315
constexpr sal_Int64 convertTwipToMm100(sal_Int64 n)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoframe.cxx:3402
#define FN_UNO_IS_AUTOMATIC_CONTOUR
Definition: cmdid.h:558
#define XATTR_FILLBITMAP
#define UNO_NAME_START_REDLINE
Definition: unoprnms.hxx:560
#define XATTR_FILLBMP_TILEOFFSETX
cppu::ImplInheritanceHelper< SwXFrame, css::document::XEventsSupplier > SwXTextGraphicObjectBaseClass
Definition: unoframe.hxx:249
MapUnit
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unoframe.cxx:1169
#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:2670
#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:3439
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unoframe.cxx:1976
static css::uno::Reference< css::text::XTextContent > CreateXTextGraphicObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3392
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:455
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
Definition: unoframe.cxx:3602
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unoframe.cxx:2579
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:1112
#define UNO_NAME_CONTOUR_POLY_POLYGON
Definition: unoprnms.hxx:497
#define FN_UNO_IS_PIXEL_CONTOUR
Definition: cmdid.h:559
#define PROPERTY_MAP_EMBEDDED_OBJECT
Definition: unomap.hxx:65
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unoframe.cxx:3303
#define MID_MIRROR_VERT
Definition: unomid.h:22
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoframe.cxx:3540
#define FN_UNO_FRAME_STYLE_NAME
Definition: cmdid.h:501
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:1119
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
OUString m_sName
Definition: unoframe.hxx:71
void setWidth(long nWidth)
Standard page.
Definition: poolfmt.hxx:171
SwXTextGraphicObject(SwDoc *pDoc)
Definition: unoframe.cxx:3375
#define RES_FRMATR_BEGIN
Definition: hintids.hxx:192
SdrObjUserCall * GetUserCall() const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
#define UNO_NAME_TITLE
Definition: unoprnms.hxx:323
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1273
SwXTextFrame(SwDoc *pDoc)
Definition: unoframe.cxx:3129
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:137
sal_Int64 m_nDrawAspect
Definition: unoframe.hxx:75
uno::Reference< text::XText > CreateParentXText(SwDoc &rDoc, const SwPosition &rPos)
Definition: unoobj2.cxx:1133
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2686
bool MakeId(const OUString &rId)
#define MID_BITMAP
const Graphic & GetGrf(bool bWait=false) const
Definition: ndgrf.cxx:368
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unoframe.cxx:2586
virtual sal_Bool SAL_CALL hasElements() override
Definition: unoframe.cxx:3293
virtual OUString SAL_CALL getName() override
Definition: unoframe.cxx:1300
virtual bool AnyToItemSet(SwDoc *pDoc, SfxItemSet &rFrameSet, SfxItemSet &rSet, bool &rSizeFound) override
Definition: unoframe.cxx:1058
#define FN_UNO_DRAW_ASPECT
Definition: cmdid.h:603
long Y() const
bool sw_ChkAndSetNewAnchor(const SwFlyFrame &rFly, SfxItemSet &rSet)
also used in unoframe.cxx
Definition: fefly1.cxx:217
bool IsInXMLImport() const
Definition: doc.hxx:962
void SetContour(const tools::PolyPolygon *pPoly, bool bAutomatic=false)
Definition: ndnotxt.cxx:87
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1308
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
Definition: unoframe.cxx:2378
PropertyMoreFlags nMoreFlags
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
#define RES_TEXT_VERT_ADJUST
Definition: hintids.hxx:235
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:843
#define XATTR_FILLBACKGROUND
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unoframe.cxx:1408
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1486
#define XATTR_FILLTRANSPARENCE
#define CONVERT_TWIPS
void SetPixelContour(bool bSet)
Definition: ndnotxt.hxx:86
virtual void Notify(const SfxHint &) override
Definition: unoframe.cxx:3620
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