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