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