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