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