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