1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewtab.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <tools/list.hxx>
37 #include <hintids.hxx>
39 #include <sfx2/app.hxx>
40 #include <svx/rulritem.hxx>
41 #include <svx/tstpitem.hxx>
42 #include <sfx2/request.hxx>
43 #include <svx/lrspitem.hxx>
44 #include <svx/ulspitem.hxx>
45 #include <svx/boxitem.hxx>
46 #include <svx/frmdiritem.hxx>
47 #include <svtools/eitem.hxx>
48 #include <svtools/whiter.hxx>
49 #include <svx/ruler.hxx>
50 #include <svx/protitem.hxx>
51 #include <svtools/rectitem.hxx>
52 #include <sfx2/bindings.hxx>
53 #include <fmtfsize.hxx>
54 #include <fmthdft.hxx>
55 #include <fmtclds.hxx>
56 #include <fmtornt.hxx>
63 #include "viewopt.hxx"
65 #include "frmfmt.hxx" // FrameFormat
66 #include "pagedesc.hxx" // Aktuelles Seitenformat
69 #include "section.hxx"
76 #include <IDocumentSettingAccess.hxx>
78 using namespace ::com::sun::star
;
81 /*--------------------------------------------------------------------
82 Beschreibung: Debug-Methode
83 --------------------------------------------------------------------*/
86 /*--------------------------------------------------------------------
87 Beschreibung: Columns eintueten
88 --------------------------------------------------------------------*/
91 void lcl_FillSvxColumn(const SwFmtCol
& rCol
,
93 SvxColumnItem
& rColItem
,
96 const SwColumns
& rCols
= rCol
.GetColumns();
99 BOOL bOrtho
= rCol
.IsOrtho() && rCols
.Count();
100 long nInnerWidth
= 0;
103 nInnerWidth
= nTotalWidth
;
104 for ( USHORT i
= 0; i
< rCols
.Count(); ++i
)
106 SwColumn
* pCol
= rCols
[i
];
107 nInnerWidth
-= pCol
->GetLeft() + pCol
->GetRight();
109 if( nInnerWidth
< 0 )
112 nInnerWidth
/= rCols
.Count();
114 for ( USHORT i
= 0; i
< rCols
.Count(); ++i
)
116 SwColumn
* pCol
= rCols
[i
];
117 const USHORT nStart
= USHORT(pCol
->GetLeft() + nWidth
+ nDistance
);
119 nWidth
= static_cast< USHORT
>(nWidth
+ nInnerWidth
+ pCol
->GetLeft() + pCol
->GetRight());
121 nWidth
= static_cast< USHORT
>(nWidth
+ rCol
.CalcColWidth(i
, nTotalWidth
));
122 const USHORT nEnd
= USHORT(nWidth
- pCol
->GetRight() + nDistance
);
124 SvxColumnDescription
aColDesc(nStart
, nEnd
, TRUE
);
125 rColItem
.Append(aColDesc
);
129 /*--------------------------------------------------------------------
130 Beschreibung: ColumnItem in ColumnInfo ueberfuehren
131 --------------------------------------------------------------------*/
134 void lcl_ConvertToCols(const SvxColumnItem
& rColItem
,
138 ASSERT( rCols
.GetNumCols() == rColItem
.Count(), "Column count mismatch" );
139 // #126939# ruler executes that change the columns shortly after the selection has changed
140 // can result in a crash
141 if(rCols
.GetNumCols() != rColItem
.Count())
145 SwTwips nSumAll
= 0; // Summiere alle Spalten und Raender auf
147 SwColumns
& rArr
= rCols
.GetColumns();
149 // Tabcols der Reihe nach
150 for( USHORT i
=0; i
< rColItem
.Count()-1; ++i
)
152 DBG_ASSERT(rColItem
[i
+1].nStart
>= rColItem
[i
].nEnd
,"\201berlappende Spalten" );
153 USHORT nStart
= static_cast< USHORT
>(rColItem
[i
+1].nStart
);
154 USHORT nEnd
= static_cast< USHORT
>(rColItem
[i
].nEnd
);
157 const USHORT nDiff
= nStart
- nEnd
;
158 const USHORT nRight
= nDiff
/ 2;
160 USHORT nWidth
= static_cast< USHORT
>(rColItem
[i
].nEnd
- rColItem
[i
].nStart
);
161 nWidth
+= nLeft
+ nRight
;
163 SwColumn
* pCol
= rArr
[i
];
164 pCol
->SetWishWidth( USHORT(long(rCols
.GetWishWidth()) * long(nWidth
) /
165 long(nTotalWidth
) ));
166 pCol
->SetLeft( nLeft
);
167 pCol
->SetRight( nRight
);
168 nSumAll
+= pCol
->GetWishWidth();
172 rArr
[rColItem
.Count()-1]->SetLeft( nLeft
);
174 //Die Differenz aus der Gesamtwunschbreite und der Summe der bisher berechneten
175 // Spalten und Raender sollte die Breite der letzten Spalte ergeben.
176 rArr
[rColItem
.Count()-1]->SetWishWidth( rCols
.GetWishWidth() - (USHORT
)nSumAll
);
178 rCols
.SetOrtho(FALSE
, 0, 0 );
181 /*--------------------------------------------------------------------
182 Beschreibung: Tabs loeschen
183 --------------------------------------------------------------------*/
186 void lcl_EraseDefTabs(SvxTabStopItem
& rTabStops
)
189 for ( USHORT i
= 0; i
< rTabStops
.Count(); )
191 // Hier auch den DefTab auf Null rausschmeissen
192 if ( SVX_TAB_ADJUST_DEFAULT
== rTabStops
[i
].GetAdjustment() ||
193 rTabStops
[i
].GetTabPos() == 0 )
202 /*--------------------------------------------------------------------
203 Beschreibung: Seitenrand umdrehen
204 --------------------------------------------------------------------*/
207 void SwView::SwapPageMargin(const SwPageDesc
& rDesc
, SvxLRSpaceItem
& rLRSpace
)
209 USHORT nPhyPage
, nVirPage
;
210 GetWrtShell().GetPageNum( nPhyPage
, nVirPage
);
212 if ( rDesc
.GetUseOn() == nsUseOnPage::PD_MIRROR
&& (nPhyPage
% 2) == 0 )
214 long nTmp
= rLRSpace
.GetRight();
215 rLRSpace
.SetRight( rLRSpace
.GetLeft() );
216 rLRSpace
.SetLeft( nTmp
);
220 /*--------------------------------------------------------------------
221 Beschreibung: Wenn der Rahmenrand verschoben wird, sollen die
222 Spaltentrenner an der gleichen absoluten Position bleiben
223 --------------------------------------------------------------------*/
226 void lcl_Scale(long& nVal
, long nScale
)
232 void ResizeFrameCols(SwFmtCol
& rCol
,
237 SwColumns
& rArr
= rCol
.GetColumns();
238 long nWishSum
= (long)rCol
.GetWishWidth();
239 long nWishDiff
= (nWishSum
* 100/nOldWidth
* nNewWidth
) / 100 - nWishSum
;
240 long nNewWishWidth
= nWishSum
+ nWishDiff
;
241 if(nNewWishWidth
> 0xffffl
)
243 // wenn die Wunschbreite zu gross wird, dann muessen alle Werte passend skaliert werden
244 long nScale
= (0xffffl
<< 8)/ nNewWishWidth
;
245 for(USHORT i
= 0; i
< rArr
.Count(); i
++)
247 SwColumn
* pCol
= rArr
.GetObject(i
);
248 long nVal
= pCol
->GetWishWidth();
249 lcl_Scale(nVal
, nScale
);
250 pCol
->SetWishWidth((USHORT
) nVal
);
251 nVal
= pCol
->GetLeft();
252 lcl_Scale(nVal
, nScale
);
253 pCol
->SetLeft((USHORT
) nVal
);
254 nVal
= pCol
->GetRight();
255 lcl_Scale(nVal
, nScale
);
256 pCol
->SetRight((USHORT
) nVal
);
258 lcl_Scale(nNewWishWidth
, nScale
);
259 lcl_Scale(nWishDiff
, nScale
);
261 rCol
.SetWishWidth( (USHORT
) (nNewWishWidth
) );
263 if( nLeftDelta
>= 2 || nLeftDelta
<= -2)
264 rArr
[0]->SetWishWidth(rArr
[0]->GetWishWidth() + (USHORT
)nWishDiff
);
266 rArr
[rArr
.Count()-1]->SetWishWidth(rArr
[rArr
.Count()-1]->GetWishWidth() + (USHORT
)nWishDiff
);
268 rCol
.SetOrtho(FALSE
, 0, 0 );
270 /*--------------------------------------------------------------------
271 Beschreibung: Hier werden alle Aenderungen der Tableiste
272 wieder in das Modell geschossen
273 --------------------------------------------------------------------*/
276 void SwView::ExecTabWin( SfxRequest
& rReq
)
278 SwWrtShell
&rSh
= GetWrtShell();
279 const USHORT nFrmType
= rSh
.IsObjSelected() ?
281 rSh
.GetFrmType(0,TRUE
);
282 const BOOL bFrmSelection
= rSh
.IsFrmSelected();
283 const BOOL bBrowse
= rSh
.getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE
);
286 const USHORT nSlot
= rReq
.GetSlot();
287 const USHORT nDescId
= rSh
.GetCurPageDesc();
288 const SwPageDesc
& rDesc
= rSh
.GetPageDesc( nDescId
);
290 const BOOL bVerticalWriting
= rSh
.IsInVerticalText();
291 const SwFmtHeader
& rHeaderFmt
= rDesc
.GetMaster().GetHeader();
292 SwFrmFmt
*pHeaderFmt
= (SwFrmFmt
*)rHeaderFmt
.GetHeaderFmt();
294 const SwFmtFooter
& rFooterFmt
= rDesc
.GetMaster().GetFooter();
295 SwFrmFmt
*pFooterFmt
= (SwFrmFmt
*)rFooterFmt
.GetFooterFmt();
297 const SwFmtFrmSize
&rFrmSize
= rDesc
.GetMaster().GetFrmSize();
299 const SwRect
& rPageRect
= rSh
.GetAnyCurRect(RECT_PAGE
);
300 const long nPageWidth
= bBrowse
? rPageRect
.Width() : rFrmSize
.GetWidth();
301 const long nPageHeight
= bBrowse
? rPageRect
.Height() : rFrmSize
.GetHeight();
303 BOOL bUnlockView
= FALSE
;
304 rSh
.StartAllAction();
305 BOOL bSect
= 0 != (nFrmType
& FRMTYPE_COLSECT
);
309 case SID_ATTR_LONG_LRSPACE
:
311 SvxLongLRSpaceItem
aLongLR( (const SvxLongLRSpaceItem
&)rReq
.GetArgs()->
312 Get( SID_ATTR_LONG_LRSPACE
) );
313 SvxLRSpaceItem
aLR(RES_LR_SPACE
);
314 if ( !bSect
&& (bFrmSelection
|| nFrmType
& FRMTYPE_FLY_ANY
) )
316 SwFrmFmt
* pFmt
= ((SwFrmFmt
*)rSh
.GetFlyFrmFmt());
317 const SwRect
&rRect
= rSh
.GetAnyCurRect(RECT_FLY_EMBEDDED
);
320 BOOL bVerticalFrame
= (bFrmSelection
&& rSh
.IsFrmVertical(TRUE
, bRTL
))|| (!bFrmSelection
&& bVerticalWriting
);
321 long nDeltaX
= bVerticalFrame
?
322 rRect
.Right() - rPageRect
.Right() + aLongLR
.GetRight() :
323 rPageRect
.Left() + aLongLR
.GetLeft() - rRect
.Left();
325 SfxItemSet
aSet( GetPool(), RES_FRM_SIZE
, RES_FRM_SIZE
,
326 RES_VERT_ORIENT
, RES_HORI_ORIENT
,
327 RES_COL
, RES_COL
, 0 );
331 SwFmtVertOrient
aVertOrient(pFmt
->GetVertOrient());
332 aVertOrient
.SetVertOrient(text::VertOrientation::NONE
);
333 aVertOrient
.SetPos(aVertOrient
.GetPos() + nDeltaX
);
334 aSet
.Put( aVertOrient
);
338 SwFmtHoriOrient
aHoriOrient( pFmt
->GetHoriOrient() );
339 aHoriOrient
.SetHoriOrient( text::HoriOrientation::NONE
);
340 aHoriOrient
.SetPos( aHoriOrient
.GetPos() + nDeltaX
);
341 aSet
.Put( aHoriOrient
);
344 SwFmtFrmSize
aSize( pFmt
->GetFrmSize() );
345 long nOldWidth
= (long) aSize
.GetWidth();
347 if(aSize
.GetWidthPercent())
350 rSh
.CalcBoundRect(aRect
, FLY_IN_CNTNT
);
351 long nPrtWidth
= aRect
.Width();
352 aSize
.SetWidthPercent(BYTE((nPageWidth
- aLongLR
.GetLeft() - aLongLR
.GetRight()) * 100 /nPrtWidth
));
355 aSize
.SetWidth( nPageWidth
-
356 (aLongLR
.GetLeft() + aLongLR
.GetRight()));
358 if( nFrmType
& FRMTYPE_COLUMN
)
360 SwFmtCol
aCol(pFmt
->GetCol());
362 ::ResizeFrameCols(aCol
, nOldWidth
, (long)aSize
.GetWidth(), nDeltaX
);
370 rSh
.SetFlyFrmAttr( aSet
);
371 //die Rahmenselektion wieder aufheben
372 if(!bFrmSelection
&& rSh
.IsFrmSelected())
375 rSh
.LeaveSelFrmMode();
380 else if ( nFrmType
& ( FRMTYPE_HEADER
| FRMTYPE_FOOTER
))
382 // Seitenraender rausrechnen
383 long nOld
= rDesc
.GetMaster().GetLRSpace().GetLeft();
384 aLongLR
.SetLeft( nOld
> aLongLR
.GetLeft() ? 0 : aLongLR
.GetLeft() - nOld
);
386 nOld
= rDesc
.GetMaster().GetLRSpace().GetRight();
387 aLongLR
.SetRight( nOld
> (USHORT
)aLongLR
.GetRight() ? 0 : aLongLR
.GetRight() - nOld
);
388 aLR
.SetLeft((USHORT
)aLongLR
.GetLeft());
389 aLR
.SetRight((USHORT
)aLongLR
.GetRight());
391 if ( nFrmType
& FRMTYPE_HEADER
&& pHeaderFmt
)
392 pHeaderFmt
->SetFmtAttr( aLR
);
393 else if( nFrmType
& FRMTYPE_FOOTER
&& pFooterFmt
)
394 pFooterFmt
->SetFmtAttr( aLR
);
396 else if( nFrmType
== FRMTYPE_DRAWOBJ
)
398 SwRect
aRect( rSh
.GetObjRect() );
399 aRect
.Left( aLongLR
.GetLeft() + rPageRect
.Left() );
400 aRect
.Right( rPageRect
.Right() - aLongLR
.GetRight());
401 rSh
.SetObjRect( aRect
);
403 else if(bSect
|| rSh
.IsDirectlyInSection())
405 //change the section indents and the columns if available
406 //at first determine the changes
407 SwRect aSectRect
= rSh
.GetAnyCurRect(RECT_SECTION_PRT
, 0);
408 const SwRect aTmpRect
= rSh
.GetAnyCurRect(RECT_SECTION
, 0);
409 aSectRect
.Pos() += aTmpRect
.Pos();
410 long nLeftDiff
= aLongLR
.GetLeft() - (long)(aSectRect
.Left() - rPageRect
.Left() );
411 long nRightDiff
= aLongLR
.GetRight() - (long)( rPageRect
.Right() - aSectRect
.Right());
412 //change the LRSpaceItem of the section accordingly
413 const SwSection
* pCurrSect
= rSh
.GetCurrSection();
414 const SwSectionFmt
* pSectFmt
= pCurrSect
->GetFmt();
415 SvxLRSpaceItem aLRTmp
= pSectFmt
->GetLRSpace();
416 aLRTmp
.SetLeft(aLRTmp
.GetLeft() + nLeftDiff
);
417 aLRTmp
.SetRight(aLRTmp
.GetRight() + nRightDiff
);
418 SfxItemSet
aSet(rSh
.GetAttrPool(), RES_LR_SPACE
, RES_LR_SPACE
, RES_COL
, RES_COL
, 0L);
420 //change the first/last column
423 SwFmtCol
aCols( pSectFmt
->GetCol() );
424 long nDiffWidth
= nLeftDiff
+ nRightDiff
;
425 ::ResizeFrameCols(aCols
, aSectRect
.Width(), aSectRect
.Width() - nDiffWidth
, nLeftDiff
);
428 rSh
.ChgSection( rSh
.GetSectionFmtPos(*pSectFmt
), *pCurrSect
, &aSet
);
431 { // Seitenraender einstellen
432 aLR
.SetLeft((USHORT
)aLongLR
.GetLeft());
433 aLR
.SetRight((USHORT
)aLongLR
.GetRight());
434 SwapPageMargin( rDesc
, aLR
);
435 SwPageDesc
aDesc( rDesc
);
436 aDesc
.GetMaster().SetFmtAttr( aLR
);
437 rSh
.ChgPageDesc( nDescId
, aDesc
);
441 case SID_ATTR_LONG_ULSPACE
:
443 SvxLongULSpaceItem
aLongULSpace( (const SvxLongULSpaceItem
&)rReq
.GetArgs()->
444 Get( SID_ATTR_LONG_ULSPACE
));
446 if( bFrmSelection
|| nFrmType
& FRMTYPE_FLY_ANY
)
448 SwFrmFmt
* pFmt
= ((SwFrmFmt
*)rSh
.GetFlyFrmFmt());
449 const SwRect
&rRect
= rSh
.GetAnyCurRect(RECT_FLY_EMBEDDED
);
450 const long nDeltaY
= rPageRect
.Top() + aLongULSpace
.GetUpper() - rRect
.Top();
451 const long nHeight
= nPageHeight
- (aLongULSpace
.GetUpper() + aLongULSpace
.GetLower());
453 SfxItemSet
aSet( GetPool(), RES_FRM_SIZE
, RES_FRM_SIZE
,
454 RES_VERT_ORIENT
, RES_HORI_ORIENT
, 0 );
455 //which of the orientation attributes is to be put depends on the frame's environment
457 if((bFrmSelection
&& rSh
.IsFrmVertical(TRUE
, bRTL
))|| (!bFrmSelection
&& bVerticalWriting
))
459 SwFmtHoriOrient
aHoriOrient(pFmt
->GetHoriOrient());
460 aHoriOrient
.SetHoriOrient(text::HoriOrientation::NONE
);
461 aHoriOrient
.SetPos(aHoriOrient
.GetPos() + nDeltaY
);
462 aSet
.Put( aHoriOrient
);
466 SwFmtVertOrient
aVertOrient(pFmt
->GetVertOrient());
467 aVertOrient
.SetVertOrient(text::VertOrientation::NONE
);
468 aVertOrient
.SetPos(aVertOrient
.GetPos() + nDeltaY
);
469 aSet
.Put( aVertOrient
);
471 SwFmtFrmSize
aSize(pFmt
->GetFrmSize());
472 if(aSize
.GetHeightPercent())
475 rSh
.CalcBoundRect(aRect
, FLY_IN_CNTNT
);
476 long nPrtHeight
= aRect
.Height();
477 aSize
.SetHeightPercent(BYTE(nHeight
* 100 /nPrtHeight
));
480 aSize
.SetHeight(nHeight
);
483 rSh
.SetFlyFrmAttr( aSet
);
485 else if( nFrmType
== FRMTYPE_DRAWOBJ
)
487 SwRect
aRect( rSh
.GetObjRect() );
488 aRect
.Top( aLongULSpace
.GetUpper() + rPageRect
.Top() );
489 aRect
.Bottom( rPageRect
.Bottom() - aLongULSpace
.GetLower() );
490 rSh
.SetObjRect( aRect
) ;
492 else if(bVerticalWriting
&& (bSect
|| rSh
.IsDirectlyInSection()))
494 //change the section indents and the columns if available
495 //at first determine the changes
496 SwRect aSectRect
= rSh
.GetAnyCurRect(RECT_SECTION_PRT
, 0);
497 const SwRect aTmpRect
= rSh
.GetAnyCurRect(RECT_SECTION
, 0);
498 aSectRect
.Pos() += aTmpRect
.Pos();
499 const long nLeftDiff
= aLongULSpace
.GetUpper() - (long)(aSectRect
.Top() - rPageRect
.Top());
500 const long nRightDiff
= aLongULSpace
.GetLower() - (long)(nPageHeight
- aSectRect
.Bottom() + rPageRect
.Top());
501 //change the LRSpaceItem of the section accordingly
502 const SwSection
* pCurrSect
= rSh
.GetCurrSection();
503 const SwSectionFmt
* pSectFmt
= pCurrSect
->GetFmt();
504 SvxLRSpaceItem aLR
= pSectFmt
->GetLRSpace();
505 aLR
.SetLeft(aLR
.GetLeft() + nLeftDiff
);
506 aLR
.SetRight(aLR
.GetRight() + nRightDiff
);
507 SfxItemSet
aSet(rSh
.GetAttrPool(), RES_LR_SPACE
, RES_LR_SPACE
, RES_COL
, RES_COL
, 0L);
509 //change the first/last column
512 SwFmtCol
aCols( pSectFmt
->GetCol() );
513 long nDiffWidth
= nLeftDiff
+ nRightDiff
;
514 ::ResizeFrameCols(aCols
, aSectRect
.Height(), aSectRect
.Height() - nDiffWidth
, nLeftDiff
);
517 rSh
.ChgSection( rSh
.GetSectionFmtPos(*pSectFmt
), *pCurrSect
, &aSet
);
521 { SwPageDesc
aDesc( rDesc
);
523 if ( nFrmType
& ( FRMTYPE_HEADER
| FRMTYPE_FOOTER
))
526 const BOOL bHead
= nFrmType
& FRMTYPE_HEADER
? TRUE
: FALSE
;
527 SvxULSpaceItem
aUL( rDesc
.GetMaster().GetULSpace() );
529 aUL
.SetUpper( (USHORT
)aLongULSpace
.GetUpper() );
531 aUL
.SetLower( (USHORT
)aLongULSpace
.GetLower() );
532 aDesc
.GetMaster().SetFmtAttr( aUL
);
534 if( bHead
&& pHeaderFmt
|| !bHead
&& pFooterFmt
)
536 SwFmtFrmSize
aSz( bHead
? pHeaderFmt
->GetFrmSize() :
537 pFooterFmt
->GetFrmSize() );
538 aSz
.SetHeightSizeType( ATT_FIX_SIZE
);
539 aSz
.SetHeight(nPageHeight
- aLongULSpace
.GetLower() -
540 aLongULSpace
.GetUpper() );
542 pHeaderFmt
->SetFmtAttr( aSz
);
544 pFooterFmt
->SetFmtAttr( aSz
);
549 SvxULSpaceItem
aUL(RES_UL_SPACE
);
550 aUL
.SetUpper((USHORT
)aLongULSpace
.GetUpper());
551 aUL
.SetLower((USHORT
)aLongULSpace
.GetLower());
552 aDesc
.GetMaster().SetFmtAttr(aUL
);
555 rSh
.ChgPageDesc( nDescId
, aDesc
);
559 case SID_ATTR_TABSTOP_VERTICAL
:
560 case SID_ATTR_TABSTOP
:
562 USHORT nWhich
= GetPool().GetWhich(nSlot
);
563 SvxTabStopItem
aTabStops( (const SvxTabStopItem
&)rReq
.GetArgs()->
565 aTabStops
.SetWhich(RES_PARATR_TABSTOP
);
566 const SvxTabStopItem
& rDefTabs
=
567 (const SvxTabStopItem
&)rSh
.GetDefault(RES_PARATR_TABSTOP
);
569 // Default-Tab an Pos 0
570 SfxItemSet
aSet( GetPool(), RES_LR_SPACE
, RES_LR_SPACE
);
571 rSh
.GetCurAttr( aSet
);
572 const SvxLRSpaceItem
& rLR
= (const SvxLRSpaceItem
&)aSet
.Get(RES_LR_SPACE
);
574 if ( rLR
.GetTxtFirstLineOfst() < 0 )
576 SvxTabStop
aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT
);
577 aTabStops
.Insert( aSwTabStop
);
580 // auffuellen mit Default-Tabs
581 USHORT nDef
= ::GetTabDist( rDefTabs
);
582 ::MakeDefTabs( nDef
, aTabStops
);
584 SwTxtFmtColl
* pColl
= rSh
.GetCurTxtFmtColl();
585 if( pColl
&& pColl
->IsAutoUpdateFmt() )
587 SfxItemSet
aTmp(GetPool(), RES_PARATR_TABSTOP
, RES_PARATR_TABSTOP
);
589 rSh
.AutoUpdatePara( pColl
, aTmp
);
592 rSh
.SetAttr( aTabStops
);
595 case SID_ATTR_PARA_LRSPACE_VERTICAL
:
596 case SID_ATTR_PARA_LRSPACE
:
598 SvxLRSpaceItem
aParaMargin((const SvxLRSpaceItem
&)rReq
.
599 GetArgs()->Get(nSlot
));
600 if(nFrmType
& FRMTYPE_FLY_ANY
)
602 sal_Bool bFirstColumn
= sal_True
;
603 sal_Bool bLastColumn
= sal_True
;
604 if(nFrmType
& FRMTYPE_COLUMN
)
606 USHORT nCurFrameCol
= rSh
.GetCurColNum() - 1;
607 bFirstColumn
= !nCurFrameCol
;
608 const SwFrmFmt
* pFmt
= rSh
.GetFlyFrmFmt();
609 const SwFmtCol
* pCols
= &pFmt
->GetCol();
610 const SwColumns
& rCols
= pCols
->GetColumns();
611 USHORT nColumnCount
= rCols
.Count();
612 bLastColumn
= nColumnCount
== nCurFrameCol
+ 1;
615 aParaMargin
.SetRight( aParaMargin
.GetRight() - nRightBorderDistance
);
616 aParaMargin
.SetTxtLeft(aParaMargin
.GetTxtLeft() - nLeftBorderDistance
);
618 aParaMargin
.SetWhich( RES_LR_SPACE
);
619 SwTxtFmtColl
* pColl
= rSh
.GetCurTxtFmtColl();
622 if (pNumRuleNodeFromDoc
)
624 // --> FME 2005-02-22 #i42922# Mouse move of numbering label
625 // has to consider the left indent of the paragraph
626 SfxItemSet
aSet( GetPool(), RES_LR_SPACE
, RES_LR_SPACE
);
627 rSh
.GetCurAttr( aSet
);
628 const SvxLRSpaceItem
& rLR
=
629 static_cast<const SvxLRSpaceItem
&>(aSet
.Get(RES_LR_SPACE
));
632 SwPosition
aPos(*pNumRuleNodeFromDoc
);
633 // --> OD 2008-06-09 #i90078#
634 rSh
.SetIndent( static_cast< short >(aParaMargin
.GetTxtLeft() - rLR
.GetTxtLeft()), aPos
);
636 // --> OD 2005-02-18 #i42921# - invalidate state of indent in order
637 // to get a ruler update.
638 aParaMargin
.SetWhich( nSlot
);
639 GetViewFrame()->GetBindings().SetState( aParaMargin
);
642 else if( pColl
&& pColl
->IsAutoUpdateFmt() )
644 SfxItemSet
aSet(GetPool(), RES_LR_SPACE
, RES_LR_SPACE
);
645 aSet
.Put(aParaMargin
);
646 rSh
.AutoUpdatePara( pColl
, aSet
);
649 rSh
.SetAttr( aParaMargin
);
651 if ( aParaMargin
.GetTxtFirstLineOfst() < 0 )
653 SfxItemSet
aSet( GetPool(), RES_PARATR_TABSTOP
, RES_PARATR_TABSTOP
);
655 rSh
.GetCurAttr( aSet
);
656 const SvxTabStopItem
& rTabStops
= (const SvxTabStopItem
&)aSet
.Get(RES_PARATR_TABSTOP
);
658 // Haben wir einen Tab an Stelle Null
661 for ( i
= 0; i
< rTabStops
.Count(); ++i
)
662 if ( rTabStops
[i
].GetTabPos() == 0 )
665 if ( i
>= rTabStops
.Count() )
668 SvxTabStopItem
aTabStops( RES_PARATR_TABSTOP
);
669 aTabStops
= rTabStops
;
671 ::lcl_EraseDefTabs(aTabStops
);
673 SvxTabStop
aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT
);
674 aTabStops
.Insert(aSwTabStop
);
676 const SvxTabStopItem
& rDefTabs
=
677 (const SvxTabStopItem
&)rSh
.GetDefault(RES_PARATR_TABSTOP
);
678 USHORT nDef
= ::GetTabDist(rDefTabs
);
679 ::MakeDefTabs( nDef
, aTabStops
);
681 if( pColl
&& pColl
->IsAutoUpdateFmt())
683 SfxItemSet
aSetTmp(GetPool(), RES_PARATR_TABSTOP
, RES_PARATR_TABSTOP
);
684 aSetTmp
.Put(aTabStops
);
685 rSh
.AutoUpdatePara( pColl
, aSetTmp
);
688 rSh
.SetAttr( aTabStops
);
693 case SID_RULER_BORDERS_VERTICAL
:
694 case SID_RULER_BORDERS
:
696 SvxColumnItem
aColItem((const SvxColumnItem
&)rReq
.
697 GetArgs()->Get(nSlot
));
699 if( bSetTabColFromDoc
|| !bSect
&& rSh
.GetTableFmt() )
701 ASSERT(aColItem
.Count(), "ColDesc ist leer!!");
703 const BOOL bSingleLine
= ((const SfxBoolItem
&)rReq
.
704 GetArgs()->Get(SID_RULER_ACT_LINE_ONLY
)).GetValue();
707 if ( bSetTabColFromDoc
)
708 rSh
.GetMouseTabCols( aTabCols
, aTabColFromDocPos
);
710 rSh
.GetTabCols(aTabCols
);
712 // linker Tabellenrand
713 long nBorder
= (long)(aColItem
.GetLeft() - aTabCols
.GetLeftMin());
714 aTabCols
.SetLeft( nBorder
);
716 nBorder
= (bVerticalWriting
? nPageHeight
: nPageWidth
) - aTabCols
.GetLeftMin() - aColItem
.GetRight();
719 long nTmp1
= nPageWidth
;
720 long nTmp2
= aTabCols
.GetLeftMin() + nBorder
;
725 if ( aColItem
.GetRight() > 0 )
726 aTabCols
.SetRight( nBorder
);
728 // Tabcols der Reihe nach
729 // Die letzte Col wird durch den Rand definiert
730 //columns in right-to-left tables need to be mirrored
733 rSh
.IsMouseTableRightToLeft(aTabColFromDocPos
)
734 : rSh
.IsTableRightToLeft();
737 USHORT nColCount
= aColItem
.Count() - 1;
738 for ( USHORT i
= 0; i
< nColCount
; ++i
)
740 const SvxColumnDescription
& rCol
= aColItem
[nColCount
- i
];
741 aTabCols
[i
] = aTabCols
.GetRight() - rCol
.nStart
;
742 aTabCols
.SetHidden( i
, !rCol
.bVisible
);
747 for ( USHORT i
= 0; i
< aColItem
.Count()-1; ++i
)
749 const SvxColumnDescription
& rCol
= aColItem
[i
];
750 aTabCols
[i
] = rCol
.nEnd
+ aTabCols
.GetLeft();
751 aTabCols
.SetHidden( i
, !rCol
.bVisible
);
755 if ( bSetTabColFromDoc
)
757 if( !rSh
.IsViewLocked() )
760 rSh
.LockView( TRUE
);
762 rSh
.SetMouseTabCols( aTabCols
, bSingleLine
,
766 rSh
.SetTabCols(aTabCols
, bSingleLine
);
771 if ( bFrmSelection
|| nFrmType
& FRMTYPE_FLY_ANY
|| bSect
)
773 SwSectionFmt
*pSectFmt
= 0;
774 SfxItemSet
aSet( GetPool(), RES_COL
, RES_COL
);
777 const SwSection
*pSect
= rSh
.GetAnySection();
778 ASSERT( pSect
, "Welcher Bereich?");
779 pSectFmt
= pSect
->GetFmt();
783 rSh
.GetFlyFrmAttr( aSet
);
788 (const SwFmtCol
&)aSet
.Get( RES_COL
, FALSE
));
789 SwRect aCurRect
= rSh
.GetAnyCurRect(bSect
? RECT_SECTION_PRT
: RECT_FLY_PRT_EMBEDDED
);
790 const long lWidth
= bVerticalWriting
? aCurRect
.Height() : aCurRect
.Width();
791 ::lcl_ConvertToCols( aColItem
, USHORT(lWidth
), aCols
);
794 rSh
.SetSectionAttr( aSet
, pSectFmt
);
799 rSh
.SetFlyFrmAttr( aSet
);
800 //die Rahmenselektion wieder aufheben
801 if(!bFrmSelection
&& rSh
.IsFrmSelected())
804 rSh
.LeaveSelFrmMode();
812 SwFmtCol
aCols( rDesc
.GetMaster().GetCol() );
813 const SwRect aPrtRect
= rSh
.GetAnyCurRect(RECT_PAGE_PRT
);
814 ::lcl_ConvertToCols( aColItem
,
815 USHORT(bVerticalWriting
? aPrtRect
.Height() : aPrtRect
.Width()),
817 SwPageDesc
aDesc( rDesc
);
818 aDesc
.GetMaster().SetFmtAttr( aCols
);
819 rSh
.ChgPageDesc( rSh
.GetCurPageDesc(), aDesc
);
825 case SID_RULER_ROWS
:
826 case SID_RULER_ROWS_VERTICAL
:
828 SvxColumnItem
aColItem((const SvxColumnItem
&)rReq
.
829 GetArgs()->Get(nSlot
));
831 if( bSetTabColFromDoc
|| !bSect
&& rSh
.GetTableFmt() )
833 ASSERT(aColItem
.Count(), "ColDesc ist leer!!");
836 if ( bSetTabRowFromDoc
)
837 rSh
.GetMouseTabRows( aTabCols
, aTabColFromDocPos
);
839 rSh
.GetTabRows(aTabCols
);
841 if ( bVerticalWriting
)
843 aTabCols
.SetRight(nPageWidth
- aColItem
.GetRight() - aColItem
.GetLeft());
844 aTabCols
.SetLeftMin(aColItem
.GetLeft());
848 long nBorder
= nPageHeight
- aTabCols
.GetLeftMin() - aColItem
.GetRight();
849 aTabCols
.SetRight( nBorder
);
854 for ( USHORT i
= aColItem
.Count() - 1; i
; --i
)
856 const SvxColumnDescription
& rCol
= aColItem
[i
- 1];
857 long nColumnPos
= aTabCols
.GetRight() - rCol
.nEnd
;
858 aTabCols
[i
- 1] = nColumnPos
;
859 aTabCols
.SetHidden( i
- 1, !rCol
.bVisible
);
864 for ( USHORT i
= 0; i
< aColItem
.Count()-1; ++i
)
866 const SvxColumnDescription
& rCol
= aColItem
[i
];
867 aTabCols
[i
] = rCol
.nEnd
+ aTabCols
.GetLeft();
868 aTabCols
.SetHidden( i
, !rCol
.bVisible
);
871 BOOL bSingleLine
= FALSE
;
872 const SfxPoolItem
* pSingleLine
;
873 if( SFX_ITEM_SET
== rReq
.GetArgs()->GetItemState(SID_RULER_ACT_LINE_ONLY
, FALSE
, &pSingleLine
))
874 bSingleLine
= ((const SfxBoolItem
*)pSingleLine
)->GetValue();
875 if ( bSetTabRowFromDoc
)
877 if( !rSh
.IsViewLocked() )
880 rSh
.LockView( TRUE
);
882 rSh
.SetMouseTabRows( aTabCols
, bSingleLine
, aTabColFromDocPos
);
885 rSh
.SetTabRows(aTabCols
, bSingleLine
);
891 ASSERT( !this, "Falsche SlotId");
896 rSh
.LockView( FALSE
);
898 bSetTabColFromDoc
= bSetTabRowFromDoc
= bTabColFromDoc
= bTabRowFromDoc
= FALSE
;
899 SetNumRuleNodeFromDoc(NULL
);
902 /*--------------------------------------------------------------------
903 Beschreibung: Hier wird der Status der Tableiste ermittelt
904 sprich alle relevanten Attribute an der CursorPos
905 werden der Tableiste uebermittelt
906 --------------------------------------------------------------------*/
909 void SwView::StateTabWin(SfxItemSet
& rSet
)
911 SwWrtShell
&rSh
= GetWrtShell();
913 const Point
* pPt
= IsTabColFromDoc() || IsTabRowFromDoc() ? &aTabColFromDocPos
: 0;
914 const USHORT nFrmType
= rSh
.IsObjSelected()
916 : rSh
.GetFrmType( pPt
, TRUE
);
918 const BOOL bFrmSelection
= rSh
.IsFrmSelected();
920 const BOOL bBrowse
= rSh
.getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE
);
921 // PageOffset/Begrenzer
922 const SwRect
& rPageRect
= rSh
.GetAnyCurRect( RECT_PAGE
, pPt
);
923 const SwRect
& rPagePrtRect
= rSh
.GetAnyCurRect( RECT_PAGE_PRT
, pPt
);
924 const long nPageWidth
= rPageRect
.Width();
925 const long nPageHeight
= rPageRect
.Height();
927 const SwPageDesc
& rDesc
= rSh
.GetPageDesc(
928 IsTabColFromDoc() || bTabRowFromDoc
?
929 rSh
.GetMousePageDesc(aTabColFromDocPos
) : rSh
.GetCurPageDesc() );
931 const SvxFrameDirectionItem
& rFrameDir
= rDesc
.GetMaster().GetFrmDir();
932 const BOOL bVerticalWriting
= rSh
.IsInVerticalText();
934 //enable tab stop display on the rulers depending on the writing direction
935 WinBits nRulerStyle
= pHRuler
->GetStyle() & ~WB_EXTRAFIELD
;
936 pHRuler
->SetStyle(bVerticalWriting
||bBrowse
? nRulerStyle
: nRulerStyle
|WB_EXTRAFIELD
);
937 nRulerStyle
= pVRuler
->GetStyle() & ~WB_EXTRAFIELD
;
938 pVRuler
->SetStyle(bVerticalWriting
? nRulerStyle
|WB_EXTRAFIELD
: nRulerStyle
);
940 //#i24363# tab stops relative to indent
941 bool bRelative
= rSh
.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT
);
942 pHRuler
->SetTabsRelativeToIndent( bRelative
);
943 pVRuler
->SetTabsRelativeToIndent( bRelative
);
945 SvxLRSpaceItem
aPageLRSpace( rDesc
.GetMaster().GetLRSpace() );
946 SwapPageMargin( rDesc
, aPageLRSpace
);
948 SfxItemSet
aCoreSet( GetPool(), RES_PARATR_TABSTOP
, RES_PARATR_TABSTOP
,
949 RES_LR_SPACE
, RES_UL_SPACE
, 0 );
950 // --> OD 2008-01-17 #newlistlevelattrs#
951 // get also the list level indent values merged as LR-SPACE item, if needed.
952 rSh
.GetCurAttr( aCoreSet
, true );
954 SelectionType nSelType
= rSh
.GetSelectionType();
956 SfxWhichIter
aIter( rSet
);
957 USHORT nWhich
= aIter
.FirstWhich();
958 sal_Bool bPutContentProtection
= sal_False
;
964 // case RES_LR_SPACE:
965 // case SID_ATTR_LRSPACE:
966 case SID_ATTR_LONG_LRSPACE
:
968 SvxLongLRSpaceItem
aLongLR( (long)aPageLRSpace
.GetLeft(),
969 (long)aPageLRSpace
.GetRight(),
970 SID_ATTR_LONG_LRSPACE
);
973 aLongLR
.SetLeft(rPagePrtRect
.Left());
974 aLongLR
.SetRight(nPageWidth
- rPagePrtRect
.Right());
976 if ( ( nFrmType
& FRMTYPE_HEADER
|| nFrmType
& FRMTYPE_FOOTER
) &&
977 !(nFrmType
& FRMTYPE_COLSECT
) )
979 SwFrmFmt
*pFmt
= (SwFrmFmt
*) (nFrmType
& FRMTYPE_HEADER
?
980 rDesc
.GetMaster().GetHeader().GetHeaderFmt() :
981 rDesc
.GetMaster().GetFooter().GetFooterFmt());
982 if( pFmt
)// #i80890# if rDesc is not the one belonging to the current page is might crash
984 SwRect
aRect( rSh
.GetAnyCurRect( RECT_HEADERFOOTER
, pPt
));
985 aRect
.Pos() -= rSh
.GetAnyCurRect( RECT_PAGE
, pPt
).Pos();
986 const SvxLRSpaceItem
& aLR
= pFmt
->GetLRSpace();
987 aLongLR
.SetLeft ( (long)aLR
.GetLeft() + (long)aRect
.Left() );
988 aLongLR
.SetRight( (nPageWidth
-
989 (long)aRect
.Right() + (long)aLR
.GetRight()));
995 if( !bFrmSelection
&& ((nFrmType
& FRMTYPE_COLSECT
) || rSh
.IsDirectlyInSection()) )
997 aRect
= rSh
.GetAnyCurRect(RECT_SECTION_PRT
, pPt
);
998 const SwRect aTmpRect
= rSh
.GetAnyCurRect(RECT_SECTION
, pPt
);
999 aRect
.Pos() += aTmpRect
.Pos();
1002 else if ( bFrmSelection
|| nFrmType
& FRMTYPE_FLY_ANY
)
1003 aRect
= rSh
.GetAnyCurRect(RECT_FLY_EMBEDDED
, pPt
);
1004 else if( nFrmType
& FRMTYPE_DRAWOBJ
)
1005 aRect
= rSh
.GetObjRect();
1010 // make relative to page position:
1011 aLongLR
.SetLeft ((long)( aRect
.Left() - rPageRect
.Left() ));
1012 aLongLR
.SetRight((long)( rPageRect
.Right() - aRect
.Right()));
1015 if( nWhich
== SID_ATTR_LONG_LRSPACE
)
1016 rSet
.Put( aLongLR
);
1019 SvxLRSpaceItem
aLR( aLongLR
.GetLeft(),
1027 case SID_ATTR_LONG_ULSPACE
:
1028 // case SID_ATTR_ULSPACE:
1029 // case RES_UL_SPACE:
1031 // Rand Seite Oben Unten
1032 SvxULSpaceItem
aUL( rDesc
.GetMaster().GetULSpace() );
1033 SvxLongULSpaceItem
aLongUL( (long)aUL
.GetUpper(),
1034 (long)aUL
.GetLower(),
1035 SID_ATTR_LONG_ULSPACE
);
1037 if ( bFrmSelection
|| nFrmType
& FRMTYPE_FLY_ANY
)
1039 // Dokumentkoordinaten Frame auf Seitenkoordinaten umbrechen
1040 const SwRect
&rRect
= rSh
.GetAnyCurRect(RECT_FLY_EMBEDDED
, pPt
);
1041 aLongUL
.SetUpper((USHORT
)(rRect
.Top() - rPageRect
.Top() ));
1042 aLongUL
.SetLower((USHORT
)(rPageRect
.Bottom() - rRect
.Bottom() ));
1044 else if ( nFrmType
& FRMTYPE_HEADER
|| nFrmType
& FRMTYPE_FOOTER
)
1046 SwRect
aRect( rSh
.GetAnyCurRect( RECT_HEADERFOOTER
, pPt
));
1047 aRect
.Pos() -= rSh
.GetAnyCurRect( RECT_PAGE
, pPt
).Pos();
1048 aLongUL
.SetUpper( (USHORT
)aRect
.Top() );
1049 aLongUL
.SetLower( (USHORT
)(nPageHeight
- aRect
.Bottom()) );
1051 else if( nFrmType
& FRMTYPE_DRAWOBJ
)
1053 const SwRect
&rRect
= rSh
.GetObjRect();
1054 aLongUL
.SetUpper((rRect
.Top() - rPageRect
.Top()));
1055 aLongUL
.SetLower((rPageRect
.Bottom() - rRect
.Bottom()));
1059 aLongUL
.SetUpper(rPagePrtRect
.Top());
1060 aLongUL
.SetLower(nPageHeight
- rPagePrtRect
.Bottom());
1062 if( nWhich
== SID_ATTR_LONG_ULSPACE
)
1063 rSet
.Put( aLongUL
);
1066 SvxULSpaceItem
aULTmp((USHORT
)aLongUL
.GetUpper(),
1067 (USHORT
)aLongUL
.GetLower(),
1073 case SID_ATTR_TABSTOP_VERTICAL
:
1074 case RES_PARATR_TABSTOP
:
1076 if ( ISA( SwWebView
) ||
1077 IsTabColFromDoc() ||
1078 IsTabRowFromDoc() ||
1079 ( nSelType
& nsSelectionType::SEL_GRF
) ||
1080 (nSelType
& nsSelectionType::SEL_FRM
) ||
1081 (nSelType
& nsSelectionType::SEL_OLE
) ||
1082 SFX_ITEM_AVAILABLE
> aCoreSet
.GetItemState(RES_LR_SPACE
)||
1083 !bVerticalWriting
&& (SID_ATTR_TABSTOP_VERTICAL
== nWhich
)||
1084 bVerticalWriting
&& (RES_PARATR_TABSTOP
== nWhich
)
1086 rSet
.DisableItem( nWhich
);
1089 SvxTabStopItem
aTabStops((const SvxTabStopItem
&)
1090 aCoreSet
.Get( RES_PARATR_TABSTOP
));
1092 const SvxTabStopItem
& rDefTabs
= (const SvxTabStopItem
&)
1093 rSh
.GetDefault(RES_PARATR_TABSTOP
);
1095 DBG_ASSERT(pHRuler
, "warum ist das Lineal nicht da?");
1096 long nDefTabDist
= ::GetTabDist(rDefTabs
);
1097 pHRuler
->SetDefTabDist( nDefTabDist
);
1098 pVRuler
->SetDefTabDist( nDefTabDist
);
1099 ::lcl_EraseDefTabs(aTabStops
);
1100 rSet
.Put(aTabStops
, nWhich
);
1104 case SID_ATTR_PARA_LRSPACE_VERTICAL
:
1105 case SID_ATTR_PARA_LRSPACE
:
1107 if ( nSelType
& nsSelectionType::SEL_GRF
||
1108 nSelType
& nsSelectionType::SEL_FRM
||
1109 nSelType
& nsSelectionType::SEL_OLE
||
1110 nFrmType
== FRMTYPE_DRAWOBJ
||
1111 !bVerticalWriting
&& (SID_ATTR_PARA_LRSPACE_VERTICAL
== nWhich
)||
1112 bVerticalWriting
&& (SID_ATTR_PARA_LRSPACE
== nWhich
)
1115 rSet
.DisableItem(nWhich
);
1119 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
1120 if ( !IsTabColFromDoc() )
1122 aLR
= (const SvxLRSpaceItem
&)aCoreSet
.Get(RES_LR_SPACE
);
1125 if (pNumRuleNodeFromDoc
)
1127 short nOffset
= static_cast< short >(aLR
.GetTxtLeft() +
1128 // --> FME 2005-02-22 #i42922# Mouse move of numbering label
1129 // has to consider the left indent of the paragraph
1130 pNumRuleNodeFromDoc
->GetLeftMarginWithNum( TRUE
) );
1134 pNumRuleNodeFromDoc
->GetFirstLineOfsWithNum( nFLOffset
);
1136 aLR
.SetLeft( nOffset
+ nFLOffset
);
1139 aLR
.SetWhich(nWhich
);
1144 case SID_RULER_BORDER_DISTANCE
:
1146 nLeftBorderDistance
= 0;
1147 nRightBorderDistance
= 0;
1148 if ( nSelType
& nsSelectionType::SEL_GRF
||
1149 nSelType
& nsSelectionType::SEL_FRM
||
1150 nSelType
& nsSelectionType::SEL_OLE
||
1151 nFrmType
== FRMTYPE_DRAWOBJ
)
1152 rSet
.DisableItem(SID_RULER_BORDER_DISTANCE
);
1155 SvxLRSpaceItem
aDistLR(SID_RULER_BORDER_DISTANCE
);
1156 if(nFrmType
& FRMTYPE_FLY_ANY
)
1158 if( IsTabColFromDoc() )
1160 const SwRect
& rFlyPrtRect
= rSh
.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED
, pPt
);
1161 aDistLR
.SetLeft(rFlyPrtRect
.Left());
1162 aDistLR
.SetRight(rFlyPrtRect
.Left());
1166 SfxItemSet
aCoreSet2( GetPool(),
1168 SID_ATTR_BORDER_INNER
, SID_ATTR_BORDER_INNER
, 0 );
1169 SvxBoxInfoItem
aBoxInfo( SID_ATTR_BORDER_INNER
);
1170 aCoreSet
.Put( aBoxInfo
);
1171 rSh
.GetFlyFrmAttr( aCoreSet
);
1172 const SvxBoxItem
& rBox
= (const SvxBoxItem
&)aCoreSet
.Get(RES_BOX
);
1173 aDistLR
.SetLeft((USHORT
)rBox
.GetDistance(BOX_LINE_LEFT
));
1174 aDistLR
.SetRight((USHORT
)rBox
.GetDistance(BOX_LINE_RIGHT
));
1176 //add the paragraph border distance
1177 SfxItemSet
aCoreSet1( GetPool(),
1180 rSh
.GetCurAttr( aCoreSet1
);
1181 const SvxBoxItem
& rParaBox
= (const SvxBoxItem
&)aCoreSet1
.Get(RES_BOX
);
1182 aDistLR
.SetLeft(aDistLR
.GetLeft() + (USHORT
)rParaBox
.GetDistance(BOX_LINE_LEFT
));
1183 aDistLR
.SetRight(aDistLR
.GetRight() + (USHORT
)rParaBox
.GetDistance(BOX_LINE_RIGHT
));
1186 nLeftBorderDistance
= static_cast< USHORT
>(aDistLR
.GetLeft());
1187 nRightBorderDistance
= static_cast< USHORT
>(aDistLR
.GetRight());
1189 else if ( IsTabColFromDoc() ||
1190 ( rSh
.GetTableFmt() && !bFrmSelection
&&
1191 !(nFrmType
& FRMTYPE_COLSECT
) ) )
1193 SfxItemSet
aCoreSet2( GetPool(),
1195 SID_ATTR_BORDER_INNER
, SID_ATTR_BORDER_INNER
, 0 );
1196 SvxBoxInfoItem
aBoxInfo( SID_ATTR_BORDER_INNER
);
1197 aBoxInfo
.SetTable(FALSE
);
1198 aBoxInfo
.SetDist((BOOL
) TRUE
);
1199 aCoreSet2
.Put(aBoxInfo
);
1200 rSh
.GetTabBorders( aCoreSet2
);
1201 const SvxBoxItem
& rBox
= (const SvxBoxItem
&)aCoreSet2
.Get(RES_BOX
);
1202 aDistLR
.SetLeft((USHORT
)rBox
.GetDistance(BOX_LINE_LEFT
));
1203 aDistLR
.SetRight((USHORT
)rBox
.GetDistance(BOX_LINE_RIGHT
));
1205 //add the border distance of the paragraph
1206 SfxItemSet
aCoreSet1( GetPool(),
1209 rSh
.GetCurAttr( aCoreSet1
);
1210 const SvxBoxItem
& rParaBox
= (const SvxBoxItem
&)aCoreSet1
.Get(RES_BOX
);
1211 aDistLR
.SetLeft(aDistLR
.GetLeft() + (USHORT
)rParaBox
.GetDistance(BOX_LINE_LEFT
));
1212 aDistLR
.SetRight(aDistLR
.GetRight() + (USHORT
)rParaBox
.GetDistance(BOX_LINE_RIGHT
));
1214 nLeftBorderDistance
= static_cast< USHORT
>(aDistLR
.GetLeft());
1215 nRightBorderDistance
= static_cast< USHORT
>(aDistLR
.GetRight());
1217 else if ( !rSh
.IsDirectlyInSection() )
1219 //get the page/header/footer border distance
1220 const SwFrmFmt
& rMaster
= rDesc
.GetMaster();
1221 const SvxBoxItem
& rBox
= (const SvxBoxItem
&)rMaster
.GetAttrSet().Get(RES_BOX
);
1222 aDistLR
.SetLeft((USHORT
)rBox
.GetDistance(BOX_LINE_LEFT
));
1223 aDistLR
.SetRight((USHORT
)rBox
.GetDistance(BOX_LINE_RIGHT
));
1225 const SvxBoxItem
* pBox
= 0;
1226 if(nFrmType
& FRMTYPE_HEADER
)
1228 rMaster
.GetHeader();
1229 const SwFmtHeader
& rHeaderFmt
= rMaster
.GetHeader();
1230 SwFrmFmt
*pHeaderFmt
= (SwFrmFmt
*)rHeaderFmt
.GetHeaderFmt();
1231 if( pHeaderFmt
)// #i80890# if rDesc is not the one belonging to the current page is might crash
1232 pBox
= & (const SvxBoxItem
&)pHeaderFmt
->GetBox();
1234 else if(nFrmType
& FRMTYPE_FOOTER
)
1236 const SwFmtFooter
& rFooterFmt
= rMaster
.GetFooter();
1237 SwFrmFmt
*pFooterFmt
= (SwFrmFmt
*)rFooterFmt
.GetFooterFmt();
1238 if( pFooterFmt
)// #i80890# if rDesc is not the one belonging to the current page is might crash
1239 pBox
= & (const SvxBoxItem
&)pFooterFmt
->GetBox();
1243 aDistLR
.SetLeft((USHORT
)pBox
->GetDistance(BOX_LINE_LEFT
));
1244 aDistLR
.SetRight((USHORT
)pBox
->GetDistance(BOX_LINE_RIGHT
));
1247 //add the border distance of the paragraph
1248 SfxItemSet
aCoreSetTmp( GetPool(),
1250 SID_ATTR_BORDER_INNER
, SID_ATTR_BORDER_INNER
, 0 );
1251 rSh
.GetCurAttr( aCoreSetTmp
);
1252 const SvxBoxItem
& rParaBox
= (const SvxBoxItem
&)aCoreSetTmp
.Get(RES_BOX
);
1253 aDistLR
.SetLeft(aDistLR
.GetLeft() + (USHORT
)rParaBox
.GetDistance(BOX_LINE_LEFT
));
1254 aDistLR
.SetRight(aDistLR
.GetRight() + (USHORT
)rParaBox
.GetDistance(BOX_LINE_RIGHT
));
1256 nLeftBorderDistance
= static_cast< USHORT
>(aDistLR
.GetLeft());
1257 nRightBorderDistance
= static_cast< USHORT
>(aDistLR
.GetRight());
1262 case SID_RULER_TEXT_RIGHT_TO_LEFT
:
1264 if ( nSelType
& nsSelectionType::SEL_GRF
||
1265 nSelType
& nsSelectionType::SEL_FRM
||
1266 nSelType
& nsSelectionType::SEL_OLE
||
1267 nFrmType
== FRMTYPE_DRAWOBJ
)
1268 rSet
.DisableItem(nWhich
);
1271 BOOL bFlag
= rSh
.IsInRightToLeftText();
1272 rSet
.Put(SfxBoolItem(nWhich
, bFlag
));
1276 case SID_RULER_BORDERS_VERTICAL
:
1277 case SID_RULER_BORDERS
:
1280 BOOL bFrameHasVerticalColumns
= rSh
.IsFrmVertical(FALSE
, bFrameRTL
) && bFrmSelection
;
1281 BOOL bHasTable
= ( IsTabColFromDoc() ||
1282 ( rSh
.GetTableFmt() && !bFrmSelection
&&
1283 !(nFrmType
& FRMTYPE_COLSECT
) ) );
1285 BOOL bTableVertical
= bHasTable
&& rSh
.IsTableVertical();
1287 if((SID_RULER_BORDERS_VERTICAL
== nWhich
) &&
1288 ((bHasTable
&& !bTableVertical
)||
1289 (!bVerticalWriting
&& !bFrmSelection
&& !bHasTable
) || (bFrmSelection
&& !bFrameHasVerticalColumns
)) ||
1290 ((SID_RULER_BORDERS
== nWhich
) &&
1291 ((bHasTable
&& bTableVertical
)||
1292 (bVerticalWriting
&& !bFrmSelection
&& !bHasTable
) || bFrameHasVerticalColumns
)))
1293 rSet
.DisableItem(nWhich
);
1294 else if ( bHasTable
)
1298 if ( 0 != ( bSetTabColFromDoc
= IsTabColFromDoc() ) )
1300 rSh
.GetMouseTabCols( aTabCols
, aTabColFromDocPos
);
1301 nNum
= rSh
.GetCurMouseTabColNum( aTabColFromDocPos
);
1305 rSh
.GetTabCols( aTabCols
);
1306 nNum
= rSh
.GetCurTabColNum();
1307 if(rSh
.IsTableRightToLeft())
1308 nNum
= aTabCols
.Count() - nNum
;
1311 ASSERT(nNum
<= aTabCols
.Count(), "TabCol not found");
1312 const int nLft
= aTabCols
.GetLeftMin() + aTabCols
.GetLeft();
1313 const int nRgt
= (USHORT
)(bTableVertical
? nPageHeight
: nPageWidth
) -
1314 (aTabCols
.GetLeftMin() +
1315 aTabCols
.GetRight());
1317 const USHORT nL
= static_cast< USHORT
>(nLft
> 0 ? nLft
: 0);
1318 const USHORT nR
= static_cast< USHORT
>(nRgt
> 0 ? nRgt
: 0);
1320 SvxColumnItem
aColItem(nNum
, nL
, nR
);
1325 //columns in right-to-left tables need to be mirrored
1328 rSh
.IsMouseTableRightToLeft(aTabColFromDocPos
)
1329 : rSh
.IsTableRightToLeft();
1332 for ( USHORT i
= aTabCols
.Count(); i
; --i
)
1334 const SwTabColsEntry
& rEntry
= aTabCols
.GetEntry( i
- 1 );
1335 nEnd
= (USHORT
)aTabCols
.GetRight();
1336 nEnd
= nEnd
- (USHORT
)rEntry
.nPos
;
1337 SvxColumnDescription
aColDesc( nStart
, nEnd
,
1338 (USHORT(aTabCols
.GetRight() - rEntry
.nMax
)),
1339 (USHORT(aTabCols
.GetRight() - rEntry
.nMin
)),
1340 !aTabCols
.IsHidden(i
- 1) );
1341 aColItem
.Append(aColDesc
);
1344 SvxColumnDescription
aColDesc(nStart
,
1345 aTabCols
.GetRight() - aTabCols
.GetLeft(), TRUE
);
1346 aColItem
.Append(aColDesc
);
1350 for ( USHORT i
= 0; i
< aTabCols
.Count(); ++i
)
1352 const SwTabColsEntry
& rEntry
= aTabCols
.GetEntry( i
);
1353 nEnd
= static_cast< USHORT
>(rEntry
.nPos
- aTabCols
.GetLeft());
1354 SvxColumnDescription
aColDesc( nStart
, nEnd
,
1355 rEntry
.nMin
- aTabCols
.GetLeft(), rEntry
.nMax
- aTabCols
.GetLeft(),
1356 !aTabCols
.IsHidden(i
) );
1357 aColItem
.Append(aColDesc
);
1360 SvxColumnDescription
aColDesc(nStart
, aTabCols
.GetRight() - aTabCols
.GetLeft(),
1363 aColItem
.Append(aColDesc
);
1365 rSet
.Put(aColItem
, nWhich
);
1367 else if ( bFrmSelection
|| nFrmType
& ( FRMTYPE_COLUMN
| FRMTYPE_COLSECT
) )
1369 // Aus Rahmen oder Seite ?
1373 const SwFrmFmt
* pFmt
= rSh
.GetFlyFrmFmt();
1375 nNum
= pFmt
->GetCol().GetNumCols();
1378 nNum
= rSh
.GetCurColNum();
1381 //eigentlich sollte FRMTYPE_COLSECT nicht enthalten sein, wenn der Rahmen selektiert ist!
1383 nFrmType
& FRMTYPE_COLSECT
)
1385 const SwSection
*pSect
= rSh
.GetAnySection(FALSE
, pPt
);
1386 ASSERT( pSect
, "Welcher Bereich?");
1389 SwSectionFmt
*pFmt
= pSect
->GetFmt();
1390 const SwFmtCol
& rCol
= pFmt
->GetCol();
1391 if(rSh
.IsInRightToLeftText())
1392 nNum
= rCol
.GetColumns().Count() - nNum
;
1395 SvxColumnItem
aColItem(nNum
);
1396 SwRect aRect
= rSh
.GetAnyCurRect(RECT_SECTION_PRT
, pPt
);
1397 const SwRect aTmpRect
= rSh
.GetAnyCurRect(RECT_SECTION
, pPt
);
1399 ::lcl_FillSvxColumn(rCol
, USHORT(bVerticalWriting
? aRect
.Height() : aRect
.Width()), aColItem
, 0);
1401 if(bVerticalWriting
)
1403 aRect
.Pos() += Point(aTmpRect
.Left(), aTmpRect
.Top());
1404 aRect
.Pos().Y() -= rPageRect
.Top();
1405 aColItem
.SetLeft ((USHORT
)(aRect
.Top()));
1406 aColItem
.SetRight((USHORT
)(nPageHeight
- aRect
.Bottom() ));
1410 aRect
.Pos() += aTmpRect
.Pos();
1413 // make relative to page position:
1414 aColItem
.SetLeft ((USHORT
)( aRect
.Left() - rPageRect
.Left() ));
1415 aColItem
.SetRight((USHORT
)( rPageRect
.Right() - aRect
.Right()));
1417 aColItem
.SetOrtho(aColItem
.CalcOrtho());
1419 rSet
.Put(aColItem
, nWhich
);
1422 else if( bFrmSelection
|| nFrmType
& FRMTYPE_FLY_ANY
)
1424 // Spalten in Rahmen
1427 const SwFrmFmt
* pFmt
= rSh
.GetFlyFrmFmt() ;
1429 const SwFmtCol
& rCol
= pFmt
->GetCol();
1430 if(rSh
.IsInRightToLeftText())
1431 nNum
= rCol
.GetColumns().Count() - nNum
;
1434 SvxColumnItem
aColItem(nNum
);
1435 const SwRect
&rSizeRect
= rSh
.GetAnyCurRect(RECT_FLY_PRT_EMBEDDED
, pPt
);
1437 BOOL bUseVertical
= bFrameHasVerticalColumns
|| (!bFrmSelection
&& bVerticalWriting
);
1438 const long lWidth
= bUseVertical
? rSizeRect
.Height() : rSizeRect
.Width();
1439 const SwRect
&rRect
= rSh
.GetAnyCurRect(RECT_FLY_EMBEDDED
, pPt
);
1440 long nDist2
= ((bUseVertical
? rRect
.Height() : rRect
.Width()) - lWidth
) /2;
1441 ::lcl_FillSvxColumn(rCol
, USHORT(lWidth
), aColItem
, nDist2
);
1443 SfxItemSet
aFrameSet(GetPool(), RES_LR_SPACE
, RES_LR_SPACE
);
1444 rSh
.GetFlyFrmAttr( aFrameSet
);
1448 aColItem
.SetLeft ((USHORT
)(rRect
.Top()- rPageRect
.Top()));
1449 aColItem
.SetRight((USHORT
)(nPageHeight
+ rPageRect
.Top() - rRect
.Bottom() ));
1453 aColItem
.SetLeft ((USHORT
)(rRect
.Left() - rPageRect
.Left() ));
1454 aColItem
.SetRight((USHORT
)(rPageRect
.Right() - rRect
.Right() ));
1457 aColItem
.SetOrtho(aColItem
.CalcOrtho());
1459 rSet
.Put(aColItem
, nWhich
);
1462 rSet
.DisableItem(nWhich
);
1465 { // Spalten auf der Seite
1466 const SwFrmFmt
& rMaster
= rDesc
.GetMaster();
1467 SwFmtCol
aCol(rMaster
.GetCol());
1468 if(rFrameDir
.GetValue() == FRMDIR_HORI_RIGHT_TOP
)
1469 nNum
= aCol
.GetColumns().Count() - nNum
;
1473 SvxColumnItem
aColItem(nNum
);
1474 const SwRect aPrtRect
= rSh
.GetAnyCurRect(RECT_PAGE_PRT
, pPt
);
1475 const SvxBoxItem
& rBox
= (const SvxBoxItem
&)rMaster
.GetFmtAttr(RES_BOX
);
1476 long nDist
= rBox
.GetDistance();
1477 ::lcl_FillSvxColumn(aCol
,
1478 USHORT(bVerticalWriting
? aPrtRect
.Height() : aPrtRect
.Width() ),
1483 aColItem
.SetLeft((USHORT
)rPagePrtRect
.Left());
1484 aColItem
.SetRight(USHORT(nPageWidth
- rPagePrtRect
.Right()));
1488 aColItem
.SetLeft (aPageLRSpace
.GetLeft());
1489 aColItem
.SetRight(aPageLRSpace
.GetRight());
1491 aColItem
.SetOrtho(aColItem
.CalcOrtho());
1493 rSet
.Put(aColItem
, nWhich
);
1497 rSet
.DisableItem(nWhich
);
1500 case SID_RULER_ROWS
:
1501 case SID_RULER_ROWS_VERTICAL
:
1504 BOOL bFrameHasVerticalColumns
= rSh
.IsFrmVertical(FALSE
, bFrameRTL
) && bFrmSelection
;
1506 if((SID_RULER_ROWS
== nWhich
) &&
1507 ((!bVerticalWriting
&& !bFrmSelection
) || (bFrmSelection
&& !bFrameHasVerticalColumns
)) ||
1508 ((SID_RULER_ROWS_VERTICAL
== nWhich
) &&
1509 ((bVerticalWriting
&& !bFrmSelection
) || bFrameHasVerticalColumns
)))
1510 rSet
.DisableItem(nWhich
);
1511 else if ( IsTabRowFromDoc() ||
1512 ( rSh
.GetTableFmt() && !bFrmSelection
&&
1513 !(nFrmType
& FRMTYPE_COLSECT
) ) )
1516 //no current value necessary
1518 if ( 0 != ( bSetTabRowFromDoc
= IsTabRowFromDoc() ) )
1520 rSh
.GetMouseTabRows( aTabCols
, aTabColFromDocPos
);
1524 rSh
.GetTabRows( aTabCols
);
1527 // ASSERT(nNum <= aTabCols.Count(), "TabCol not found");
1528 const int nLft
= aTabCols
.GetLeftMin();
1529 const int nRgt
= (USHORT
)(bVerticalWriting
? nPageWidth
: nPageHeight
) -
1530 (aTabCols
.GetLeftMin() +
1531 aTabCols
.GetRight());
1533 const USHORT nL
= static_cast< USHORT
>(nLft
> 0 ? nLft
: 0);
1534 const USHORT nR
= static_cast< USHORT
>(nRgt
> 0 ? nRgt
: 0);
1536 SvxColumnItem
aColItem(nNum
, nL
, nR
);
1541 for ( USHORT i
= 0; i
< aTabCols
.Count(); ++i
)
1543 const SwTabColsEntry
& rEntry
= aTabCols
.GetEntry( i
);
1544 if(bVerticalWriting
)
1546 nEnd
= USHORT(aTabCols
.GetRight() - rEntry
.nPos
);
1547 SvxColumnDescription
aColDesc( nStart
, nEnd
,
1548 aTabCols
.GetRight() - rEntry
.nMax
, aTabCols
.GetRight() - rEntry
.nMin
,
1549 !aTabCols
.IsHidden(i
) );
1550 aColItem
.Append(aColDesc
);
1554 nEnd
= USHORT(rEntry
.nPos
- aTabCols
.GetLeft());
1555 SvxColumnDescription
aColDesc( nStart
, nEnd
,
1556 USHORT(rEntry
.nMin
- aTabCols
.GetLeft()), USHORT(rEntry
.nMax
- aTabCols
.GetLeft()),
1557 !aTabCols
.IsHidden(i
) );
1558 aColItem
.Append(aColDesc
);
1562 if(bVerticalWriting
)
1563 nEnd
= static_cast< USHORT
>(aTabCols
.GetRight());
1565 nEnd
= static_cast< USHORT
>(aTabCols
.GetLeft());
1566 // put a position protection when the last row cannot be moved
1567 // due to a page break inside of a row
1568 if(!aTabCols
.IsLastRowAllowedToChange())
1569 bPutContentProtection
= sal_True
;
1571 SvxColumnDescription
aColDesc( nStart
, nEnd
,
1572 aTabCols
.GetRight(), aTabCols
.GetRight(),
1574 aColItem
.Append(aColDesc
);
1576 rSet
.Put(aColItem
, nWhich
);
1579 rSet
.DisableItem(nWhich
);
1582 case SID_RULER_PAGE_POS
:
1585 SvxPagePosSizeItem
aPagePosSize(
1586 Point( rPageRect
.Left(), rPageRect
.Top()) , nPageWidth
, nPageHeight
);
1588 rSet
.Put(aPagePosSize
);
1591 case SID_RULER_LR_MIN_MAX
:
1593 Rectangle aRectangle
;
1594 if( ( nFrmType
& FRMTYPE_COLSECT
) && !IsTabColFromDoc() &&
1595 ( nFrmType
& ( FRMTYPE_TABLE
|FRMTYPE_COLUMN
) ) )
1597 if( nFrmType
& FRMTYPE_TABLE
)
1599 const USHORT nNum
= rSh
.GetCurTabColNum();
1601 rSh
.GetTabCols( aTabCols
);
1603 const int nLft
= aTabCols
.GetLeftMin() + aTabCols
.GetLeft();
1604 const int nRgt
= (USHORT
)nPageWidth
-(aTabCols
.GetLeftMin() + aTabCols
.GetRight());
1606 const USHORT nL
= static_cast< USHORT
>(nLft
> 0 ? nLft
: 0);
1607 const USHORT nR
= static_cast< USHORT
>(nRgt
> 0 ? nRgt
: 0);
1609 aRectangle
.Left() = nL
;
1611 aRectangle
.Left() += aTabCols
[nNum
- 2];
1613 aRectangle
.Left() += MINLAY
;
1614 if(aTabCols
.Count() <= nNum
+ 1 )
1615 aRectangle
.Right() = nR
;
1617 aRectangle
.Right() = nPageWidth
- (nL
+ aTabCols
[nNum
+ 1]);
1619 if(nNum
< aTabCols
.Count())
1620 aRectangle
.Right() += MINLAY
;
1624 const SwFrmFmt
* pFmt
= rSh
.GetFlyFrmFmt();
1625 const SwFmtCol
* pCols
= pFmt
? &pFmt
->GetCol():
1626 &rDesc
.GetMaster().GetCol();
1627 const SwColumns
& rCols
= pCols
->GetColumns();
1628 USHORT nNum
= rSh
.GetCurOutColNum();
1629 USHORT nCount
= Min(USHORT(nNum
+ 1), rCols
.Count());
1630 const SwRect
aRect( rSh
.GetAnyCurRect( pFmt
1631 ? RECT_FLY_PRT_EMBEDDED
1632 : RECT_PAGE_PRT
, pPt
));
1633 const SwRect
aAbsRect( rSh
.GetAnyCurRect( pFmt
1635 : RECT_PAGE
, pPt
));
1637 //die Breite im Rahmen bzw. innerhalbe der Seitenraender
1638 const USHORT nTotalWidth
= (USHORT
)aRect
.Width();
1639 //die gesamte Rahmenbreite - die Differenz ist der doppelte Abstand zum Rand
1640 const USHORT nOuterWidth
= (USHORT
)aAbsRect
.Width();
1644 aRectangle
.Left() = 0;
1645 for ( USHORT i
= 0; i
< nCount
; ++i
)
1647 SwColumn
* pCol
= rCols
[i
];
1648 nStart
= pCol
->GetLeft() + nWidth
;
1650 aRectangle
.Left() = nStart
;
1651 nWidth
+= pCols
->CalcColWidth( i
, nTotalWidth
);
1652 nEnd
= nWidth
- pCol
->GetRight();
1654 aRectangle
.Right() = rPageRect
.Right() - nEnd
;
1655 aRectangle
.Left() -= rPageRect
.Left();
1659 aRectangle
.Left() += MINLAY
;
1660 aRectangle
.Left() += aRect
.Left();
1662 if(pFmt
) //Bereich in Rahmen - hier darf man bis zum Rand
1663 aRectangle
.Left() = aRectangle
.Right() = 0;
1666 // das Rechteck an die richtige absolute Position verschieben
1667 aRectangle
.Left() += aAbsRect
.Left();
1668 aRectangle
.Right() -= aAbsRect
.Left();
1669 // Abstand zur Umrandung mit einbeziehen
1670 aRectangle
.Right() -= (nOuterWidth
- nTotalWidth
) / 2;
1673 if(nNum
< rCols
.Count())
1675 aRectangle
.Right() += MINLAY
;
1678 // rechts ist jetzt nur noch der Seitenrand
1679 aRectangle
.Right() = 0;
1684 else if ( ((nFrmType
& FRMTYPE_TABLE
) || IsTabColFromDoc()) &&
1688 if ( IsTabColFromDoc() )
1689 bColumn
= rSh
.GetCurMouseColNum( aTabColFromDocPos
) != 0;
1691 bColumn
= (nFrmType
& (FRMTYPE_COLUMN
|FRMTYPE_FLY_ANY
|
1692 FRMTYPE_COLSECTOUTTAB
)) ?
1696 if( nFrmType
& FRMTYPE_FLY_ANY
&& IsTabColFromDoc() )
1698 SwRect
aRect( rSh
.GetAnyCurRect(
1699 RECT_FLY_PRT_EMBEDDED
, pPt
) );
1700 aRect
.Pos() += rSh
.GetAnyCurRect( RECT_FLY_EMBEDDED
,
1703 aRectangle
.Left() = aRect
.Left() - rPageRect
.Left();
1704 aRectangle
.Right() = rPageRect
.Right() - aRect
.Right();
1708 aRectangle
.Left() = rPagePrtRect
.Left();
1709 aRectangle
.Right() = nPageWidth
- rPagePrtRect
.Right();
1713 aRectangle
.Left() = aPageLRSpace
.GetLeft();
1714 aRectangle
.Right() = aPageLRSpace
.GetRight();
1718 { //hier nur fuer Tabelle in mehrspaltigen Seiten und Rahmen
1719 BOOL bSectOutTbl
= (nFrmType
& FRMTYPE_TABLE
) ? TRUE
: FALSE
;
1720 BOOL bFrame
= (nFrmType
& FRMTYPE_FLY_ANY
) ? TRUE
: FALSE
;
1721 BOOL bColSct
= (nFrmType
& ( bSectOutTbl
1722 ? FRMTYPE_COLSECTOUTTAB
1725 //Damit man auch mit der Mouse ziehen kann,
1726 //ohne in der Tabelle zu stehen
1727 CurRectType eRecType
= RECT_PAGE_PRT
;
1728 USHORT nNum
= IsTabColFromDoc() ?
1729 rSh
.GetCurMouseColNum( aTabColFromDocPos
):
1730 rSh
.GetCurOutColNum();
1731 const SwFrmFmt
* pFmt
= NULL
;
1734 eRecType
= bSectOutTbl
? RECT_OUTTABSECTION
1736 const SwSection
*pSect
= rSh
.GetAnySection( bSectOutTbl
, pPt
);
1737 ASSERT( pSect
, "Welcher Bereich?");
1738 pFmt
= pSect
->GetFmt();
1742 pFmt
= rSh
.GetFlyFrmFmt();
1743 eRecType
= RECT_FLY_PRT_EMBEDDED
;
1746 const SwFmtCol
* pCols
= pFmt
? &pFmt
->GetCol():
1747 &rDesc
.GetMaster().GetCol();
1748 const SwColumns
& rCols
= pCols
->GetColumns();
1749 const USHORT nBorder
= pFmt
? pFmt
->GetBox().GetDistance() :
1750 rDesc
.GetMaster().GetBox().GetDistance();
1752 /* RECT_FLY_PRT_EMBEDDED returns the relative position to
1754 the absolute position must be added here
1756 SwRect
aRect( rSh
.GetAnyCurRect( eRecType
, pPt
) );
1757 if(RECT_FLY_PRT_EMBEDDED
== eRecType
)
1758 aRect
.Pos() += rSh
.GetAnyCurRect( RECT_FLY_EMBEDDED
,
1761 const USHORT nTotalWidth
= (USHORT
)aRect
.Width();
1762 //nStart und nEnd initialisieren fuer nNum == 0
1767 if( nNum
> rCols
.Count() )
1769 ASSERT( !this, "es wird auf dem falschen FmtCol gearbeitet!" );
1770 nNum
= rCols
.Count();
1773 for( USHORT i
= 0; i
< nNum
; ++i
)
1775 SwColumn
* pCol
= rCols
[i
];
1776 nStart
= pCol
->GetLeft() + nWidth
;
1777 nWidth
+= pCols
->CalcColWidth( i
, nTotalWidth
);
1778 nEnd
= nWidth
- pCol
->GetRight();
1780 if( bFrame
| bColSct
)
1782 aRectangle
.Left() = aRect
.Left() - rPageRect
.Left() + nStart
;
1783 aRectangle
.Right() = nPageWidth
- aRectangle
.Left() - nEnd
+ nStart
;
1787 aRectangle
.Left() = aPageLRSpace
.GetLeft() + nStart
;
1788 aRectangle
.Right() = nPageWidth
- nEnd
- aPageLRSpace
.GetLeft();
1792 long nLeft
= rPagePrtRect
.Left();
1793 aRectangle
.Left() = nStart
+ nLeft
;
1794 aRectangle
.Right() = nPageWidth
- nEnd
- nLeft
;
1798 aRectangle
.Left() += nBorder
;
1799 aRectangle
.Right() -= nBorder
;
1803 else if ( nFrmType
& ( FRMTYPE_HEADER
| FRMTYPE_FOOTER
))
1805 aRectangle
.Left() = aPageLRSpace
.GetLeft();
1806 aRectangle
.Right() = aPageLRSpace
.GetRight();
1809 aRectangle
.Left() = aRectangle
.Right() = 0;
1811 SfxRectangleItem
aLR( SID_RULER_LR_MIN_MAX
, aRectangle
);
1815 case SID_RULER_PROTECT
:
1819 BYTE nProtect
= pWrtShell
->IsSelObjProtected( FLYPROTECT_SIZE
|FLYPROTECT_POS
|FLYPROTECT_CONTENT
);
1821 SvxProtectItem
aProt(SID_RULER_PROTECT
);
1822 aProt
.SetCntntProtect((nProtect
& FLYPROTECT_CONTENT
) != 0);
1823 aProt
.SetSizeProtect ((nProtect
& FLYPROTECT_SIZE
) != 0);
1824 aProt
.SetPosProtect ((nProtect
& FLYPROTECT_POS
) != 0);
1829 SvxProtectItem
aProtect(SID_RULER_PROTECT
);
1830 if(bBrowse
&& !(nFrmType
& (FRMTYPE_DRAWOBJ
|FRMTYPE_COLUMN
)) && !rSh
.GetTableFmt())
1832 aProtect
.SetSizeProtect(TRUE
);
1833 aProtect
.SetPosProtect(TRUE
);
1840 nWhich
= aIter
.NextWhich();
1842 if(bPutContentProtection
)
1844 SvxProtectItem
aProtect(SID_RULER_PROTECT
);
1845 aProtect
.SetCntntProtect(TRUE
);