Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / frmdlg / frmmgr.cxx
blob72989239899733adc18de7801e8a6951fb97dcca
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <cmdid.h>
21 #include <hintids.hxx>
23 #include <svl/stritem.hxx>
24 #include <editeng/boxitem.hxx>
25 #include <editeng/lrspitem.hxx>
26 #include <editeng/ulspitem.hxx>
27 #include <editeng/shaditem.hxx>
28 #include <svx/swframevalidation.hxx>
29 #include <svx/xdef.hxx>
30 #include <tools/globname.hxx>
31 #include <comphelper/classids.hxx>
32 #include <osl/diagnose.h>
33 #include <fmtclds.hxx>
34 #include <utility>
35 #include <wrtsh.hxx>
36 #include <view.hxx>
37 #include <viewopt.hxx>
38 #include <uitool.hxx>
39 #include <frmmgr.hxx>
40 #include <format.hxx>
41 #include <mdiexp.hxx>
42 #include <poolfmt.hxx>
43 #include <com/sun/star/text/HoriOrientation.hpp>
44 #include <com/sun/star/text/VertOrientation.hpp>
45 #include <com/sun/star/text/RelOrientation.hpp>
46 #include <grfatr.hxx>
48 using namespace ::com::sun::star;
50 const WhichRangesContainer aFrameMgrRange(svl::Items<
51 RES_FRMATR_BEGIN, RES_FRMATR_END-1, // 87-129
53 // RotGrfFlyFrame: Support here, but seems not to be
54 // added in range of m_pOwnSh->GetFlyFrameAttr result
55 // (see below). Tried to find, but could not identify
56 RES_GRFATR_ROTATION, RES_GRFATR_ROTATION, // 132
58 // FillAttribute support
59 XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1014-1033
61 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
62 FN_SET_FRM_NAME, FN_SET_FRM_NAME
63 >);
65 // determine frame attributes via Shell
66 SwFlyFrameAttrMgr::SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType, const SvGlobalName* pName ) :
67 m_aSet( static_cast<SwAttrPool&>(pSh->GetAttrPool()), aFrameMgrRange ),
68 m_pOwnSh( pSh ),
69 m_bAbsPos( false ),
70 m_bNewFrame( bNew ),
71 m_bIsInVertical( false ),
72 m_bIsInVerticalL2R( false )
74 if ( m_bNewFrame )
76 sal_uInt16 nId;
77 switch ( nType )
79 case Frmmgr_Type::TEXT: nId = RES_POOLFRM_FRAME; break;
80 case Frmmgr_Type::OLE: nId = RES_POOLFRM_OLE; break;
81 case Frmmgr_Type::GRF: nId = RES_POOLFRM_GRAPHIC; break;
82 // set defaults:
83 default: nId=0; break;
85 m_aSet.SetParent( &m_pOwnSh->GetFormatFromPool( nId )->GetAttrSet());
86 m_aSet.Put( SwFormatFrameSize( SwFrameSize::Minimum, DFLT_WIDTH, DFLT_HEIGHT ));
87 if ( 0 != ::GetHtmlMode(pSh->GetView().GetDocShell()) )
88 m_aSet.Put( SwFormatHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::PRINT_AREA ) );
90 if (nType == Frmmgr_Type::GRF || nType == Frmmgr_Type::OLE)
92 if (!pName || *pName != SvGlobalName( SO3_SM_CLASSID ))
94 // Default anchor for new graphics and objects is at-char, except for Math objects.
95 SwViewOption aViewOpt(*pSh->GetViewOptions());
97 RndStdIds eAnchorType = aViewOpt.GetDefaultAnchorType();
99 const SwFormatAnchor rStyleAnchor
100 = m_pOwnSh->GetFormatFromPool(nId)->GetAttrSet().GetAnchor();
101 if (rStyleAnchor.GetAnchorId() != RndStdIds::FLY_AT_PARA)
103 // The style has a custom anchor type, prefer that over the user profile
104 // default.
105 eAnchorType = rStyleAnchor.GetAnchorId();
108 m_aSet.Put(SwFormatAnchor(eAnchorType));
112 else if ( nType == Frmmgr_Type::NONE )
114 m_pOwnSh->GetFlyFrameAttr( m_aSet );
115 bool bRightToLeft;
116 m_bIsInVertical = m_pOwnSh->IsFrameVertical(true, bRightToLeft, m_bIsInVerticalL2R);
118 ::PrepareBoxInfo( m_aSet, *m_pOwnSh );
121 SwFlyFrameAttrMgr::SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, SfxItemSet aSet ) :
122 m_aSet(std::move( aSet )),
123 m_pOwnSh( pSh ),
124 m_bAbsPos( false ),
125 m_bNewFrame( bNew ),
126 m_bIsInVertical(false),
127 m_bIsInVerticalL2R(false)
129 if(!bNew)
131 bool bRightToLeft;
132 m_bIsInVertical = pSh->IsFrameVertical(true, bRightToLeft, m_bIsInVerticalL2R);
136 // Initialise
137 void SwFlyFrameAttrMgr::UpdateAttrMgr()
139 if ( !m_bNewFrame && m_pOwnSh->IsFrameSelected() )
140 m_pOwnSh->GetFlyFrameAttr( m_aSet );
141 ::PrepareBoxInfo( m_aSet, *m_pOwnSh );
144 void SwFlyFrameAttrMgr::UpdateFlyFrame_()
146 if (const SfxStringItem* pItem = m_aSet.GetItemIfSet(FN_SET_FRM_NAME, false))
147 m_pOwnSh->SetFlyName(pItem->GetValue());
149 m_pOwnSh->SetModified();
151 if ( m_bAbsPos )
153 m_pOwnSh->SetFlyPos( m_aAbsPos );
154 m_bAbsPos = false;
158 // change existing Fly-Frame
159 void SwFlyFrameAttrMgr::UpdateFlyFrame()
161 OSL_ENSURE( m_pOwnSh->IsFrameSelected(),
162 "no frame selected or no shell, update not possible");
164 if( !m_pOwnSh->IsFrameSelected() )
165 return;
167 //JP 6.8.2001: set never an invalid anchor into the core.
168 const SwFormatAnchor *pGItem, *pItem;
169 if( (pItem = m_aSet.GetItemIfSet( RES_ANCHOR, false )) )
171 SfxItemSetFixed<RES_ANCHOR, RES_ANCHOR> aGetSet( *m_aSet.GetPool() );
172 if( m_pOwnSh->GetFlyFrameAttr( aGetSet ) && 1 == aGetSet.Count() &&
173 (pGItem = aGetSet.GetItemIfSet( RES_ANCHOR, false ))
174 && pGItem->GetAnchorId() == pItem->GetAnchorId() )
175 m_aSet.ClearItem( RES_ANCHOR );
178 // return wg. BASIC
179 if( m_aSet.Count() )
181 m_pOwnSh->StartAllAction();
182 m_pOwnSh->SetFlyFrameAttr( m_aSet );
183 UpdateFlyFrame_();
184 m_pOwnSh->EndAllAction();
188 // insert frame
189 void SwFlyFrameAttrMgr::InsertFlyFrame()
191 m_pOwnSh->StartAllAction();
193 bool bRet = nullptr != m_pOwnSh->NewFlyFrame( m_aSet );
195 // turn on the right mode at the shell, frame got selected automatically.
196 if ( bRet )
198 UpdateFlyFrame_();
199 m_pOwnSh->EnterSelFrameMode();
200 FrameNotify(m_pOwnSh, FLY_DRAG_START);
202 m_pOwnSh->EndAllAction();
205 // Insert frames of type eAnchorType. Position and size are being set explicitly.
206 // Not-allowed values of the enumeration type get corrected.
207 void SwFlyFrameAttrMgr::InsertFlyFrame(RndStdIds eAnchorType,
208 const Point &rPos,
209 const Size &rSize )
211 OSL_ENSURE( eAnchorType == RndStdIds::FLY_AT_PAGE ||
212 eAnchorType == RndStdIds::FLY_AT_PARA ||
213 eAnchorType == RndStdIds::FLY_AT_CHAR ||
214 eAnchorType == RndStdIds::FLY_AT_FLY ||
215 eAnchorType == RndStdIds::FLY_AS_CHAR, "invalid frame type" );
217 SetPos( rPos );
219 SetSize( rSize );
220 SetAnchor( eAnchorType );
221 InsertFlyFrame();
224 // set anchor
225 void SwFlyFrameAttrMgr::SetAnchor( RndStdIds eId )
227 sal_uInt16 nPhyPageNum, nVirtPageNum;
228 m_pOwnSh->GetPageNum( nPhyPageNum, nVirtPageNum );
230 m_aSet.Put( SwFormatAnchor( eId, RndStdIds::FLY_AT_PAGE == eId ? nPhyPageNum : 0 ) );
231 if ((RndStdIds::FLY_AT_PAGE == eId) || (RndStdIds::FLY_AT_PARA == eId) || (RndStdIds::FLY_AT_CHAR == eId)
232 || (RndStdIds::FLY_AT_FLY == eId))
234 SwFormatVertOrient aVertOrient( GetVertOrient() );
235 SwFormatHoriOrient aHoriOrient( GetHoriOrient() );
236 aHoriOrient.SetRelationOrient( text::RelOrientation::FRAME );
237 aVertOrient.SetRelationOrient( text::RelOrientation::FRAME );
238 m_aSet.Put( aVertOrient );
239 m_aSet.Put( aHoriOrient );
243 // set the attribute for columns
244 void SwFlyFrameAttrMgr::SetCol( const SwFormatCol &rCol )
246 m_aSet.Put( rCol );
249 // set absolute position
250 void SwFlyFrameAttrMgr::SetAbsPos( const Point& rPoint )
252 m_bAbsPos = true;
253 m_aAbsPos = rPoint;
254 SwFormatVertOrient aVertOrient( GetVertOrient() );
255 SwFormatHoriOrient aHoriOrient( GetHoriOrient() );
256 aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE );
257 aVertOrient.SetVertOrient( text::VertOrientation::NONE );
258 m_aSet.Put( aVertOrient );
259 m_aSet.Put( aHoriOrient );
262 // check metrics for correctness
263 void SwFlyFrameAttrMgr::ValidateMetrics( SvxSwFrameValidation& rVal,
264 const SwFormatAnchor* pToCharContentPos,
265 bool bOnlyPercentRefValue )
267 if (!bOnlyPercentRefValue)
269 rVal.nMinHeight = MINFLY + CalcTopSpace() + CalcBottomSpace();
270 rVal.nMinWidth = MINFLY + CalcLeftSpace()+ CalcRightSpace();
273 SwRect aBoundRect;
275 // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
276 // aligned to page for fly frame anchored to paragraph or to character.
277 const RndStdIds eAnchorType = rVal.nAnchorType;
278 const SwFormatFrameSize& rSize = m_aSet.Get(RES_FRM_SIZE);
279 m_pOwnSh->CalcBoundRect( aBoundRect, eAnchorType,
280 rVal.nHRelOrient,
281 rVal.nVRelOrient,
282 pToCharContentPos,
283 rVal.bFollowTextFlow,
284 rVal.bMirror, nullptr, &rVal.aPercentSize,
285 &rSize);
287 if (bOnlyPercentRefValue)
288 return;
290 // #mongolianlayout#
291 if ( m_bIsInVertical || m_bIsInVerticalL2R )
293 Point aPos(aBoundRect.Pos());
294 tools::Long nTmp = aPos.X();
295 aPos.setX( aPos.Y() );
296 aPos.setY( nTmp );
297 Size aSize(aBoundRect.SSize());
298 nTmp = aSize.Width();
299 aSize.setWidth( aSize.Height() );
300 aSize.setHeight( nTmp );
301 aBoundRect.Chg( aPos, aSize );
302 //exchange width/height to enable correct values
303 nTmp = rVal.nWidth;
304 rVal.nWidth = rVal.nHeight;
305 rVal.nHeight = nTmp;
307 if ((eAnchorType == RndStdIds::FLY_AT_PAGE) || (eAnchorType == RndStdIds::FLY_AT_FLY))
309 // MinimalPosition
310 rVal.nMinHPos = aBoundRect.Left();
311 rVal.nMinVPos = aBoundRect.Top();
312 SwTwips nH = rVal.nHPos;
313 SwTwips nV = rVal.nVPos;
315 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
317 if (rVal.nHoriOrient == text::HoriOrientation::NONE)
319 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
320 nH = rVal.nHPos;
322 else
323 rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
326 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
327 rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
329 if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom())
331 if (rVal.nVertOrient == text::VertOrientation::NONE)
333 rVal.nVPos -= ((rVal.nVPos + rVal.nHeight) - aBoundRect.Bottom());
334 nV = rVal.nVPos;
336 else
337 rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos;
340 if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom())
341 rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos;
343 if ( rVal.nVertOrient != text::VertOrientation::NONE )
344 nV = aBoundRect.Top();
346 if ( rVal.nHoriOrient != text::HoriOrientation::NONE )
347 nH = aBoundRect.Left();
349 rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth;
350 rVal.nMaxHeight = aBoundRect.Bottom() - nV;
352 rVal.nMaxVPos = aBoundRect.Bottom() - rVal.nHeight;
353 rVal.nMaxWidth = aBoundRect.Right() - nH;
355 // OD 12.11.2003 #i22341# - handle to character anchored objects vertical
356 // aligned at character or top of line in a special case
357 else if ((eAnchorType == RndStdIds::FLY_AT_PARA) ||
358 ((eAnchorType == RndStdIds::FLY_AT_CHAR) &&
359 (rVal.nVRelOrient != text::RelOrientation::CHAR) &&
360 (rVal.nVRelOrient != text::RelOrientation::TEXT_LINE) ) )
362 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
364 if (rVal.nHoriOrient == text::HoriOrientation::NONE)
366 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
368 else
369 rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
372 // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow
373 // and alignment at page areas.
374 const bool bMaxVPosAtBottom = !rVal.bFollowTextFlow ||
375 rVal.nVRelOrient == text::RelOrientation::PAGE_FRAME ||
376 rVal.nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA;
378 SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom
379 ? aBoundRect.Bottom()
380 : aBoundRect.Height() ) -
381 rVal.nHeight;
382 if ( rVal.nVPos > nTmpMaxVPos )
384 if (rVal.nVertOrient == text::VertOrientation::NONE)
386 rVal.nVPos = nTmpMaxVPos;
388 else
390 rVal.nHeight = ( bMaxVPosAtBottom
391 ? aBoundRect.Bottom()
392 : aBoundRect.Height() ) - rVal.nVPos;
397 rVal.nMinHPos = aBoundRect.Left();
398 rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth;
400 rVal.nMinVPos = aBoundRect.Top();
401 // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position
402 if ( bMaxVPosAtBottom )
404 rVal.nMaxVPos = aBoundRect.Bottom() - rVal.nHeight;
406 else
408 rVal.nMaxVPos = aBoundRect.Height() - rVal.nHeight;
411 // maximum width height
412 const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE )
413 ? aBoundRect.Left()
414 : rVal.nHPos;
415 const SwTwips nV = ( rVal.nVertOrient != text::VertOrientation::NONE )
416 ? aBoundRect.Top()
417 : rVal.nVPos;
418 rVal.nMaxHeight = rVal.nMaxVPos + rVal.nHeight - nV;
419 rVal.nMaxWidth = rVal.nMaxHPos + rVal.nWidth - nH;
421 // OD 12.11.2003 #i22341# - special case for to character anchored objects
422 // vertical aligned at character or top of line.
423 // Note: (1) positive vertical values are positions above the top of line
424 // (2) negative vertical values are positions below the top of line
425 else if ( (eAnchorType == RndStdIds::FLY_AT_CHAR) &&
426 ( rVal.nVRelOrient == text::RelOrientation::CHAR ||
427 rVal.nVRelOrient == text::RelOrientation::TEXT_LINE ) )
429 // determine horizontal values
430 rVal.nMinHPos = aBoundRect.Left();
432 rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth;
433 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
435 if (rVal.nHoriOrient == text::HoriOrientation::NONE)
437 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
439 else
440 rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
443 const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE )
444 ? aBoundRect.Left()
445 : rVal.nHPos;
446 rVal.nMaxWidth = rVal.nMaxHPos + rVal.nWidth - nH;
448 // determine vertical values
449 rVal.nMinVPos = -( aBoundRect.Bottom() - rVal.nHeight );
450 if ( rVal.nVPos < rVal.nMinVPos &&
451 rVal.nVertOrient == text::VertOrientation::NONE )
453 rVal.nVPos = rVal.nMinVPos;
456 rVal.nMaxVPos = -aBoundRect.Top();
457 if ( rVal.nVPos > rVal.nMaxVPos &&
458 rVal.nVertOrient == text::VertOrientation::NONE )
460 rVal.nVPos = rVal.nMaxVPos;
463 if ( rVal.nVertOrient == text::VertOrientation::NONE )
465 rVal.nMaxHeight = aBoundRect.Bottom() + rVal.nVPos;
467 else
469 rVal.nMaxHeight = aBoundRect.Height();
472 else if ( eAnchorType == RndStdIds::FLY_AS_CHAR )
474 rVal.nMinHPos = 0;
475 rVal.nMaxHPos = 0;
477 rVal.nMaxHeight = aBoundRect.Height();
478 rVal.nMaxWidth = aBoundRect.Width();
480 rVal.nMaxVPos = aBoundRect.Height();
481 rVal.nMinVPos = -aBoundRect.Height() + rVal.nHeight;
482 if (rVal.nMaxVPos < rVal.nMinVPos)
484 rVal.nMinVPos = rVal.nMaxVPos;
485 rVal.nMaxVPos = -aBoundRect.Height();
488 // #mongolianlayout#
489 if ( m_bIsInVertical || m_bIsInVerticalL2R )
491 //restore width/height exchange
492 tools::Long nTmp = rVal.nWidth;
493 rVal.nWidth = rVal.nHeight;
494 rVal.nHeight = nTmp;
497 if (rVal.nMaxWidth < rVal.nWidth)
498 rVal.nWidth = rVal.nMaxWidth;
499 if (rVal.nMaxHeight < rVal.nHeight)
500 rVal.nHeight = rVal.nMaxHeight;
503 // correction for border
504 SwTwips SwFlyFrameAttrMgr::CalcTopSpace()
506 const SvxShadowItem& rShadow = GetShadow();
507 const SvxBoxItem& rBox = GetBox();
508 return rShadow.CalcShadowSpace(SvxShadowItemSide::TOP ) + rBox.CalcLineSpace(SvxBoxItemLine::TOP);
511 SwTwips SwFlyFrameAttrMgr::CalcBottomSpace()
513 const SvxShadowItem& rShadow = GetShadow();
514 const SvxBoxItem& rBox = GetBox();
515 return rShadow.CalcShadowSpace(SvxShadowItemSide::BOTTOM) + rBox.CalcLineSpace(SvxBoxItemLine::BOTTOM);
518 SwTwips SwFlyFrameAttrMgr::CalcLeftSpace()
520 const SvxShadowItem& rShadow = GetShadow();
521 const SvxBoxItem& rBox = GetBox();
522 return rShadow.CalcShadowSpace(SvxShadowItemSide::LEFT) + rBox.CalcLineSpace(SvxBoxItemLine::LEFT);
525 SwTwips SwFlyFrameAttrMgr::CalcRightSpace()
527 const SvxShadowItem& rShadow = GetShadow();
528 const SvxBoxItem& rBox = GetBox();
529 return rShadow.CalcShadowSpace(SvxShadowItemSide::RIGHT) + rBox.CalcLineSpace(SvxBoxItemLine::RIGHT);
532 // erase attribute from the set
533 void SwFlyFrameAttrMgr::DelAttr( sal_uInt16 nId )
535 m_aSet.ClearItem( nId );
538 void SwFlyFrameAttrMgr::SetLRSpace( tools::Long nLeft, tools::Long nRight )
540 OSL_ENSURE( LONG_MAX != nLeft && LONG_MAX != nRight, "Which border to set?" );
542 SvxLRSpaceItem aTmp( m_aSet.Get( RES_LR_SPACE ) );
543 if( LONG_MAX != nLeft )
544 aTmp.SetLeft( sal_uInt16(nLeft) );
545 if( LONG_MAX != nRight )
546 aTmp.SetRight( sal_uInt16(nRight) );
547 m_aSet.Put( aTmp );
550 void SwFlyFrameAttrMgr::SetULSpace( tools::Long nTop, tools::Long nBottom )
552 OSL_ENSURE(LONG_MAX != nTop && LONG_MAX != nBottom, "Which border to set?" );
554 SvxULSpaceItem aTmp( m_aSet.Get( RES_UL_SPACE ) );
555 if( LONG_MAX != nTop )
556 aTmp.SetUpper( sal_uInt16(nTop) );
557 if( LONG_MAX != nBottom )
558 aTmp.SetLower( sal_uInt16(nBottom) );
559 m_aSet.Put( aTmp );
562 void SwFlyFrameAttrMgr::SetPos( const Point& rPoint )
564 SwFormatVertOrient aVertOrient( GetVertOrient() );
565 SwFormatHoriOrient aHoriOrient( GetHoriOrient() );
567 aHoriOrient.SetPos ( rPoint.X() );
568 aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE );
570 aVertOrient.SetPos ( rPoint.Y() );
571 aVertOrient.SetVertOrient( text::VertOrientation::NONE );
573 m_aSet.Put( aVertOrient );
574 m_aSet.Put( aHoriOrient );
577 void SwFlyFrameAttrMgr::SetHorzOrientation( sal_Int16 eOrient )
579 SwFormatHoriOrient aHoriOrient( GetHoriOrient() );
580 aHoriOrient.SetHoriOrient( eOrient );
581 m_aSet.Put( aHoriOrient );
584 void SwFlyFrameAttrMgr::SetVertOrientation( sal_Int16 eOrient )
586 SwFormatVertOrient aVertOrient( GetVertOrient() );
587 aVertOrient.SetVertOrient( eOrient );
588 m_aSet.Put( aVertOrient );
591 void SwFlyFrameAttrMgr::SetHeightSizeType( SwFrameSize eType )
593 SwFormatFrameSize aSize( GetFrameSize() );
594 aSize.SetHeightSizeType( eType );
595 m_aSet.Put( aSize );
598 void SwFlyFrameAttrMgr::SetRotation(Degree10 nOld, Degree10 nNew, const Size& rUnrotatedSize)
600 // RotGrfFlyFrame: Central handling of real change of rotation here, all adaptations use this.
601 // Adaptation of pos/size may be wanted in the future. Already tried to keep last Size in
602 // UnrotatedSize in the SwRotationGrf Item, but this will lead to various problems. Also tried
603 // to use m_aSet.Put(...) as in other methods (also tried read methods for Rotation/UnrotatedSize) but
604 // somehow the needed ID (RES_GRFATR_ROTATION) is *not* in the SfxItemSet of the Frame, so for
605 // now set directly. Undo/Redo is preserved by AttributeChange
606 if(nOld != nNew)
608 m_pOwnSh->SetAttrItem(SwRotationGrf(nNew, rUnrotatedSize));
612 void SwFlyFrameAttrMgr::SetSize( const Size& rSize )
614 SwFormatFrameSize aSize( GetFrameSize() );
615 aSize.SetSize(Size(std::max(rSize.Width(), tools::Long(MINFLY)), std::max(rSize.Height(), tools::Long(MINFLY))));
616 m_aSet.Put( aSize );
619 void SwFlyFrameAttrMgr::SetAttrSet(const SfxItemSet& rSet)
621 m_aSet.ClearItem();
622 m_aSet.Put( rSet );
625 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */