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