1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26
27 #include "cmdid.h"
28 #include "hintids.hxx"
29
30 #include <svl/stritem.hxx>
31 #include <editeng/protitem.hxx>
32 #include <editeng/boxitem.hxx>
33 #include <editeng/opaqitem.hxx>
34 #include <editeng/lrspitem.hxx>
35 #include <editeng/ulspitem.hxx>
36 #include <editeng/shaditem.hxx>
37 #include <svx/swframevalidation.hxx>
38 #include <fmtclds.hxx>
39 #include "wrtsh.hxx"
40 #include "view.hxx"
41 #include "viewopt.hxx"
42 #include "uitool.hxx"
43 #include "frmmgr.hxx"
44 #include "format.hxx"
45 #include "mdiexp.hxx"
46 #include "poolfmt.hxx"
47 #include <com/sun/star/text/TextContentAnchorType.hpp>
48 #include <com/sun/star/text/HoriOrientation.hpp>
49 #include <com/sun/star/text/VertOrientation.hpp>
50 #include <com/sun/star/text/RelOrientation.hpp>
51
52 using namespace ::com::sun::star;
53 //using namespace text;
54
55 static sal_uInt16 __FAR_DATA aFrmMgrRange[] = {
56 RES_FRMATR_BEGIN, RES_FRMATR_END-1,
57 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
58 FN_SET_FRM_NAME, FN_SET_FRM_NAME,
59 0};
60
61 /*--------------------------------------------------------------------
62 Beschreibung: Rahmen-Attribute ueber Shell ermitteln
63 --------------------------------------------------------------------*/
64
SwFlyFrmAttrMgr(sal_Bool bNew,SwWrtShell * pSh,sal_uInt8 nType)65 SwFlyFrmAttrMgr::SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell* pSh, sal_uInt8 nType ) :
66 aSet( (SwAttrPool&)pSh->GetAttrPool(), aFrmMgrRange ),
67 pOwnSh( pSh ),
68 bAbsPos( sal_False ),
69 bNewFrm( bNew ),
70 bIsInVertical( sal_False ),
71 bIsInVerticalL2R( sal_False )
72 {
73 if ( bNewFrm )
74 {
75 // Defaults einstellen:
76 sal_uInt16 nId = 0;
77 switch ( nType )
78 {
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 }
83 aSet.SetParent( &pOwnSh->GetFmtFromPool( nId )->GetAttrSet());
84 aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE, DFLT_WIDTH, DFLT_HEIGHT ));
85 if ( 0 != ::GetHtmlMode(pSh->GetView().GetDocShell()) )
86 aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::PRINT_AREA ) );
87 }
88 else if ( nType == FRMMGR_TYPE_NONE )
89 {
90 pOwnSh->GetFlyFrmAttr( aSet );
91 sal_Bool bRightToLeft;
92 bIsInVertical = pOwnSh->IsFrmVertical(sal_True, bRightToLeft, bIsInVerticalL2R);
93 }
94 ::PrepareBoxInfo( aSet, *pOwnSh );
95 }
96
SwFlyFrmAttrMgr(sal_Bool bNew,SwWrtShell * pSh,const SfxItemSet & rSet)97 SwFlyFrmAttrMgr::SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell* pSh, const SfxItemSet &rSet ) :
98 aSet( rSet ),
99 pOwnSh( pSh ),
100 bAbsPos( sal_False ),
101 bNewFrm( bNew ),
102 bIsInVertical(sal_False),
103 bIsInVerticalL2R(sal_False)
104 {
105 if(!bNew)
106 {
107 sal_Bool bRightToLeft;
108 bIsInVertical = pSh->IsFrmVertical(sal_True, bRightToLeft, bIsInVerticalL2R);
109 }
110 }
111
112
113 /*--------------------------------------------------------------------
114 Beschreibung: Initialisieren
115 --------------------------------------------------------------------*/
116
UpdateAttrMgr()117 void SwFlyFrmAttrMgr::UpdateAttrMgr()
118 {
119 if ( !bNewFrm && pOwnSh->IsFrmSelected() )
120 pOwnSh->GetFlyFrmAttr( aSet );
121 ::PrepareBoxInfo( aSet, *pOwnSh );
122 }
123
_UpdateFlyFrm()124 void SwFlyFrmAttrMgr::_UpdateFlyFrm()
125 {
126 const SfxPoolItem* pItem = 0;
127
128 if (aSet.GetItemState(FN_SET_FRM_NAME, sal_False, &pItem) == SFX_ITEM_SET)
129 pOwnSh->SetFlyName(((SfxStringItem *)pItem)->GetValue());
130
131 pOwnSh->SetModified();
132
133 if ( bAbsPos )
134 {
135 pOwnSh->SetFlyPos( aAbsPos );
136 bAbsPos = sal_False;
137 }
138 }
139
140 /*--------------------------------------------------------------------
141 Beschreibung: Bestehenden Fly-Frame aendern
142 --------------------------------------------------------------------*/
143
UpdateFlyFrm()144 void SwFlyFrmAttrMgr::UpdateFlyFrm()
145 {
146 ASSERT( pOwnSh->IsFrmSelected(),
147 "Kein Rahmen selektiert oder keine Shell, Update nicht moeglich");
148
149 if( pOwnSh->IsFrmSelected() )
150 {
151 //JP 6.8.2001: set never an invalid anchor into the core.
152 const SfxPoolItem *pGItem, *pItem;
153 if( SFX_ITEM_SET == aSet.GetItemState( RES_ANCHOR, sal_False, &pItem ))
154 {
155 SfxItemSet aGetSet( *aSet.GetPool(), RES_ANCHOR, RES_ANCHOR );
156 if( pOwnSh->GetFlyFrmAttr( aGetSet ) && 1 == aGetSet.Count() &&
157 SFX_ITEM_SET == aGetSet.GetItemState( RES_ANCHOR, sal_False, &pGItem )
158 && ((SwFmtAnchor*)pGItem)->GetAnchorId() ==
159 ((SwFmtAnchor*)pItem)->GetAnchorId() )
160 aSet.ClearItem( RES_ANCHOR );
161 }
162
163 // return wg. BASIC
164 if( aSet.Count() )
165 {
166 pOwnSh->StartAllAction();
167 pOwnSh->SetFlyFrmAttr( aSet );
168 _UpdateFlyFrm();
169 pOwnSh->EndAllAction();
170 }
171 }
172 }
173
174 /*--------------------------------------------------------------------
175 Beschreibung: Rahmen einfuegen
176 --------------------------------------------------------------------*/
177
InsertFlyFrm()178 sal_Bool SwFlyFrmAttrMgr::InsertFlyFrm()
179 {
180 pOwnSh->StartAllAction();
181
182 sal_Bool bRet = 0 != pOwnSh->NewFlyFrm( aSet );
183
184 // richtigen Mode an der Shell einschalten, Rahmen wurde aut. selektiert.
185 if ( bRet )
186 {
187 _UpdateFlyFrm();
188 pOwnSh->EnterSelFrmMode();
189 FrameNotify(pOwnSh, FLY_DRAG_START);
190 }
191 pOwnSh->EndAllAction();
192 return bRet;
193 }
194
195 /*------------------------------------------------------------------------
196 Beschreibung: Rahmen des Typs eAnchorType einfuegen. Position und
197 Groesse werden explizit angegeben.
198 Nicht erlaubte Werte des Aufzaehlungstypes werden
199 korrigiert.
200 ------------------------------------------------------------------------*/
201
InsertFlyFrm(RndStdIds eAnchorType,const Point & rPos,const Size & rSize,sal_Bool bAbs)202 void SwFlyFrmAttrMgr::InsertFlyFrm(RndStdIds eAnchorType,
203 const Point &rPos,
204 const Size &rSize,
205 sal_Bool bAbs )
206 {
207 ASSERT( eAnchorType == FLY_AT_PAGE ||
208 eAnchorType == FLY_AT_PARA ||
209 eAnchorType == FLY_AT_CHAR ||
210 eAnchorType == FLY_AT_FLY ||
211 eAnchorType == FLY_AS_CHAR, "invalid frame type" );
212
213 if ( bAbs )
214 SetAbsPos( rPos );
215 else
216 SetPos( rPos );
217
218 SetSize( rSize );
219 SetAnchor( eAnchorType );
220 InsertFlyFrm();
221 }
222
223 /*--------------------------------------------------------------------
224 Beschreibung: Anker setzen
225 --------------------------------------------------------------------*/
226
SetAnchor(RndStdIds eId)227 void SwFlyFrmAttrMgr::SetAnchor( RndStdIds eId )
228 {
229 sal_uInt16 nPhyPageNum, nVirtPageNum;
230 pOwnSh->GetPageNum( nPhyPageNum, nVirtPageNum );
231
232 aSet.Put( SwFmtAnchor( eId, nPhyPageNum ) );
233 if ((FLY_AT_PAGE == eId) || (FLY_AT_PARA == eId) || (FLY_AT_CHAR == eId)
234 || (FLY_AT_FLY == eId))
235 {
236 SwFmtVertOrient aVertOrient( GetVertOrient() );
237 SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
238 aHoriOrient.SetRelationOrient( text::RelOrientation::FRAME );
239 aVertOrient.SetRelationOrient( text::RelOrientation::FRAME );
240 aSet.Put( aVertOrient );
241 aSet.Put( aHoriOrient );
242 }
243 }
244
245 /*------------------------------------------------------------------------
246 Beschreibung: Setzen des Attributs fuer Spalten
247 ------------------------------------------------------------------------*/
248
SetCol(const SwFmtCol & rCol)249 void SwFlyFrmAttrMgr::SetCol( const SwFmtCol &rCol )
250 {
251 aSet.Put( rCol );
252 }
253 /*--------------------------------------------------------------------
254 Beschreibung: Absolute Position setzen
255 --------------------------------------------------------------------*/
256
SetAbsPos(const Point & rPoint)257 void SwFlyFrmAttrMgr::SetAbsPos( const Point& rPoint )
258 {
259 bAbsPos = sal_True;
260 aAbsPos = rPoint;
261
262 SwFmtVertOrient aVertOrient( GetVertOrient() );
263 SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
264 aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE );
265 aVertOrient.SetVertOrient( text::VertOrientation::NONE );
266 aSet.Put( aVertOrient );
267 aSet.Put( aHoriOrient );
268 }
269
270 /*--------------------------------------------------------------------
271 Beschreibung: Metriken auf Korrektheit pruefen
272 --------------------------------------------------------------------*/
ValidateMetrics(SvxSwFrameValidation & rVal,const SwPosition * pToCharCntntPos,sal_Bool bOnlyPercentRefValue)273 void SwFlyFrmAttrMgr::ValidateMetrics( SvxSwFrameValidation& rVal,
274 const SwPosition* pToCharCntntPos,
275 sal_Bool bOnlyPercentRefValue )
276 {
277 if (!bOnlyPercentRefValue)
278 {
279 rVal.nMinHeight = MINFLY + CalcTopSpace() + CalcBottomSpace();
280 rVal.nMinWidth = MINFLY + CalcLeftSpace()+ CalcRightSpace();
281 }
282
283 SwRect aBoundRect;
284
285 // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
286 // aligned to page for fly frame anchored to paragraph or to character.
287 const RndStdIds eAnchorType = static_cast<RndStdIds >(rVal.nAnchorType);
288 pOwnSh->CalcBoundRect( aBoundRect, eAnchorType,
289 rVal.nHRelOrient,
290 rVal.nVRelOrient,
291 pToCharCntntPos,
292 rVal.bFollowTextFlow,
293 rVal.bMirror, NULL, &rVal.aPercentSize);
294
295 if (bOnlyPercentRefValue)
296 return;
297
298 // --> OD 2009-09-01 #mongolianlayout#
299 if ( bIsInVertical || bIsInVerticalL2R )
300 // <--
301 {
302 Point aPos(aBoundRect.Pos());
303 long nTmp = aPos.X();
304 aPos.X() = aPos.Y();
305 aPos.Y() = nTmp;
306 Size aSize(aBoundRect.SSize());
307 nTmp = aSize.Width();
308 aSize.Width() = aSize.Height();
309 aSize.Height() = nTmp;
310 aBoundRect.Chg( aPos, aSize );
311 //exchange width/height to enable correct values
312 nTmp = rVal.nWidth;
313 rVal.nWidth = rVal.nHeight;
314 rVal.nHeight = nTmp;
315 }
316 if ((eAnchorType == FLY_AT_PAGE) || (eAnchorType == FLY_AT_FLY))
317 {
318 // MinimalPosition
319 rVal.nMinHPos = aBoundRect.Left();
320 rVal.nMinVPos = aBoundRect.Top();
321 SwTwips nH = rVal.nHPos;
322 SwTwips nV = rVal.nVPos;
323
324 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
325 {
326 if (rVal.nHoriOrient == text::HoriOrientation::NONE)
327 {
328 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
329 nH = rVal.nHPos;
330 }
331 else
332 rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
333 }
334
335 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
336 rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
337
338 if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom())
339 {
340 if (rVal.nVertOrient == text::VertOrientation::NONE)
341 {
342 rVal.nVPos -= ((rVal.nVPos + rVal.nHeight) - aBoundRect.Bottom());
343 nV = rVal.nVPos;
344 }
345 else
346 rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos;
347 }
348
349 if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom())
350 rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos;
351
352 if ( rVal.nVertOrient != text::VertOrientation::NONE )
353 nV = aBoundRect.Top();
354
355 if ( rVal.nHoriOrient != text::HoriOrientation::NONE )
356 nH = aBoundRect.Left();
357
358 rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth;
359 rVal.nMaxHeight = aBoundRect.Bottom() - nV;
360
361 rVal.nMaxVPos = aBoundRect.Bottom() - rVal.nHeight;
362 rVal.nMaxWidth = aBoundRect.Right() - nH;
363 }
364 // OD 12.11.2003 #i22341# - handle to character anchored objects vertical
365 // aligned at character or top of line in a special case
366 else if ((eAnchorType == FLY_AT_PARA) ||
367 ((eAnchorType == FLY_AT_CHAR) &&
368 !(rVal.nVRelOrient == text::RelOrientation::CHAR) &&
369 !(rVal.nVRelOrient == text::RelOrientation::TEXT_LINE) ) )
370 {
371 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
372 {
373 if (rVal.nHoriOrient == text::HoriOrientation::NONE)
374 {
375 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
376 }
377 else
378 rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
379 }
380
381 // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow
382 // and alignment at page areas.
383 const bool bMaxVPosAtBottom = !rVal.bFollowTextFlow ||
384 rVal.nVRelOrient == text::RelOrientation::PAGE_FRAME ||
385 rVal.nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA;
386 {
387 SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom
388 ? aBoundRect.Bottom()
389 : aBoundRect.Height() ) -
390 rVal.nHeight;
391 if ( rVal.nVPos > nTmpMaxVPos )
392 {
393 if (rVal.nVertOrient == text::VertOrientation::NONE)
394 {
395 rVal.nVPos = nTmpMaxVPos;
396 }
397 else
398 {
399 rVal.nHeight = ( bMaxVPosAtBottom
400 ? aBoundRect.Bottom()
401 : aBoundRect.Height() ) - rVal.nVPos;
402 }
403 }
404 }
405
406 rVal.nMinHPos = aBoundRect.Left();
407 rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth;
408
409 rVal.nMinVPos = aBoundRect.Top();
410 // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position
411 if ( bMaxVPosAtBottom )
412 {
413 rVal.nMaxVPos = aBoundRect.Bottom() - rVal.nHeight;
414 }
415 else
416 {
417 rVal.nMaxVPos = aBoundRect.Height() - rVal.nHeight;
418 }
419
420 // Maximale Breite Hoehe
421 const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE )
422 ? aBoundRect.Left()
423 : rVal.nHPos;
424 const SwTwips nV = ( rVal.nVertOrient != text::VertOrientation::NONE )
425 ? aBoundRect.Top()
426 : rVal.nVPos;
427 rVal.nMaxHeight = rVal.nMaxVPos + rVal.nHeight - nV;
428 rVal.nMaxWidth = rVal.nMaxHPos + rVal.nWidth - nH;
429 }
430 // OD 12.11.2003 #i22341# - special case for to character anchored objects
431 // vertical aligned at character or top of line.
432 // Note: (1) positive vertical values are positions above the top of line
433 // (2) negative vertical values are positions below the top of line
434 else if ( (eAnchorType == FLY_AT_CHAR) &&
435 ( rVal.nVRelOrient == text::RelOrientation::CHAR ||
436 rVal.nVRelOrient == text::RelOrientation::TEXT_LINE ) )
437 {
438 // determine horizontal values
439 rVal.nMinHPos = aBoundRect.Left();
440
441 rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth;
442 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
443 {
444 if (rVal.nHoriOrient == text::HoriOrientation::NONE)
445 {
446 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
447 }
448 else
449 rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
450 }
451
452 const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE )
453 ? aBoundRect.Left()
454 : rVal.nHPos;
455 rVal.nMaxWidth = rVal.nMaxHPos + rVal.nWidth - nH;
456
457 // determine vertical values
458 rVal.nMinVPos = -( aBoundRect.Bottom() - rVal.nHeight );
459 if ( rVal.nVPos < rVal.nMinVPos &&
460 rVal.nVertOrient == text::VertOrientation::NONE )
461 {
462 rVal.nVPos = rVal.nMinVPos;
463 }
464
465 rVal.nMaxVPos = -aBoundRect.Top();
466 if ( rVal.nVPos > rVal.nMaxVPos &&
467 rVal.nVertOrient == text::VertOrientation::NONE )
468 {
469 rVal.nVPos = rVal.nMaxVPos;
470 }
471
472 if ( rVal.nVertOrient == text::VertOrientation::NONE )
473 {
474 rVal.nMaxHeight = aBoundRect.Bottom() + rVal.nVPos;
475 }
476 else
477 {
478 rVal.nMaxHeight = aBoundRect.Height();
479 }
480 }
481 else if ( eAnchorType == FLY_AS_CHAR )
482 {
483 rVal.nMinHPos = 0;
484 rVal.nMaxHPos = 0;
485
486 rVal.nMaxHeight = aBoundRect.Height();
487 rVal.nMaxWidth = aBoundRect.Width();
488
489 rVal.nMaxVPos = aBoundRect.Height();
490 rVal.nMinVPos = -aBoundRect.Height() + rVal.nHeight;
491 if (rVal.nMaxVPos < rVal.nMinVPos)
492 {
493 rVal.nMinVPos = rVal.nMaxVPos;
494 rVal.nMaxVPos = -aBoundRect.Height();
495 }
496 }
497 // --> OD 2009-09-01 #mongolianlayout#
498 if ( bIsInVertical || bIsInVerticalL2R )
499 // <--
500 {
501 //restore width/height exchange
502 long nTmp = rVal.nWidth;
503 rVal.nWidth = rVal.nHeight;
504 rVal.nHeight = nTmp;
505 }
506
507 if (rVal.nMaxWidth < rVal.nWidth)
508 rVal.nWidth = rVal.nMaxWidth;
509 if (rVal.nMaxHeight < rVal.nHeight)
510 rVal.nHeight = rVal.nMaxHeight;
511 }
512
513 /*--------------------------------------------------------------------
514 Beschreibung: Korrektur fuer Umrandung
515 --------------------------------------------------------------------*/
516
CalcTopSpace()517 SwTwips SwFlyFrmAttrMgr::CalcTopSpace()
518 {
519 const SvxShadowItem& rShadow = GetShadow();
520 const SvxBoxItem& rBox = GetBox();
521 return rShadow.CalcShadowSpace(SHADOW_TOP ) + rBox.CalcLineSpace(BOX_LINE_TOP);
522 }
523
CalcBottomSpace()524 SwTwips SwFlyFrmAttrMgr::CalcBottomSpace()
525 {
526 const SvxShadowItem& rShadow = GetShadow();
527 const SvxBoxItem& rBox = GetBox();
528 return rShadow.CalcShadowSpace(SHADOW_BOTTOM) + rBox.CalcLineSpace(BOX_LINE_BOTTOM);
529 }
530
CalcLeftSpace()531 SwTwips SwFlyFrmAttrMgr::CalcLeftSpace()
532 {
533 const SvxShadowItem& rShadow = GetShadow();
534 const SvxBoxItem& rBox = GetBox();
535 return rShadow.CalcShadowSpace(SHADOW_LEFT) + rBox.CalcLineSpace(BOX_LINE_LEFT);
536 }
537
CalcRightSpace()538 SwTwips SwFlyFrmAttrMgr::CalcRightSpace()
539 {
540 const SvxShadowItem& rShadow = GetShadow();
541 const SvxBoxItem& rBox = GetBox();
542 return rShadow.CalcShadowSpace(SHADOW_RIGHT) + rBox.CalcLineSpace(BOX_LINE_RIGHT);
543 }
544
545
546 /*--------------------------------------------------------------------
547 Beschreibung: Attribut aus dem Set loeschen
548 --------------------------------------------------------------------*/
DelAttr(sal_uInt16 nId)549 void SwFlyFrmAttrMgr::DelAttr( sal_uInt16 nId )
550 {
551 aSet.ClearItem( nId );
552 }
553
SetLRSpace(long nLeft,long nRight)554 void SwFlyFrmAttrMgr::SetLRSpace( long nLeft, long nRight )
555 {
556 ASSERT( LONG_MAX != nLeft && LONG_MAX != nRight, "Welchen Raend setzen?" );
557
558 SvxLRSpaceItem aTmp( (SvxLRSpaceItem&)aSet.Get( RES_LR_SPACE ) );
559 if( LONG_MAX != nLeft )
560 aTmp.SetLeft( sal_uInt16(nLeft) );
561 if( LONG_MAX != nRight )
562 aTmp.SetRight( sal_uInt16(nRight) );
563 aSet.Put( aTmp );
564 }
565
SetULSpace(long nTop,long nBottom)566 void SwFlyFrmAttrMgr::SetULSpace( long nTop, long nBottom )
567 {
568 ASSERT(LONG_MAX != nTop && LONG_MAX != nBottom, "Welchen Raend setzen?" );
569
570 SvxULSpaceItem aTmp( (SvxULSpaceItem&)aSet.Get( RES_UL_SPACE ) );
571 if( LONG_MAX != nTop )
572 aTmp.SetUpper( sal_uInt16(nTop) );
573 if( LONG_MAX != nBottom )
574 aTmp.SetLower( sal_uInt16(nBottom) );
575 aSet.Put( aTmp );
576 }
577
SetPos(const Point & rPoint)578 void SwFlyFrmAttrMgr::SetPos( const Point& rPoint )
579 {
580 SwFmtVertOrient aVertOrient( GetVertOrient() );
581 SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
582
583 aHoriOrient.SetPos ( rPoint.X() );
584 aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE );
585
586 aVertOrient.SetPos ( rPoint.Y() );
587 aVertOrient.SetVertOrient( text::VertOrientation::NONE );
588
589 aSet.Put( aVertOrient );
590 aSet.Put( aHoriOrient );
591 }
592
SetHorzOrientation(sal_Int16 eOrient)593 void SwFlyFrmAttrMgr::SetHorzOrientation( sal_Int16 eOrient )
594 {
595 SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
596 aHoriOrient.SetHoriOrient( eOrient );
597 aSet.Put( aHoriOrient );
598 }
599
SetVertOrientation(sal_Int16 eOrient)600 void SwFlyFrmAttrMgr::SetVertOrientation( sal_Int16 eOrient )
601 {
602 SwFmtVertOrient aVertOrient( GetVertOrient() );
603 aVertOrient.SetVertOrient( eOrient );
604 aSet.Put( aVertOrient );
605 }
606
SetHeightSizeType(SwFrmSize eType)607 void SwFlyFrmAttrMgr::SetHeightSizeType( SwFrmSize eType )
608 {
609 SwFmtFrmSize aSize( GetFrmSize() );
610 aSize.SetHeightSizeType( eType );
611 aSet.Put( aSize );
612 }
613
SetSize(const Size & rSize)614 void SwFlyFrmAttrMgr::SetSize( const Size& rSize )
615 {
616 SwFmtFrmSize aSize( GetFrmSize() );
617 aSize.SetSize(Size(Max(rSize.Width(), long(MINFLY)), Max(rSize.Height(), long(MINFLY))));
618 aSet.Put( aSize );
619 }
620
SetAttrSet(const SfxItemSet & rSet)621 void SwFlyFrmAttrMgr::SetAttrSet(const SfxItemSet& rSet)
622 {
623 aSet.ClearItem();
624 aSet.Put( rSet );
625 }
626