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