LibreOffice Module sw (master)  1
viewtab.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <hintids.hxx>
21 #include <uitool.hxx>
22 #include <svx/rulritem.hxx>
23 #include <svx/xflclit.hxx>
24 #include <svx/xflgrit.hxx>
25 #include <svx/xflhtit.hxx>
26 #include <svx/xbtmpit.hxx>
27 #include <svx/xfillit0.hxx>
28 #include <editeng/tstpitem.hxx>
29 #include <sfx2/request.hxx>
30 #include <sfx2/viewfrm.hxx>
31 #include <editeng/lrspitem.hxx>
32 #include <editeng/ulspitem.hxx>
33 #include <editeng/boxitem.hxx>
34 #include <editeng/frmdiritem.hxx>
35 #include <svl/eitem.hxx>
36 #include <svl/whiter.hxx>
37 #include <svx/ruler.hxx>
38 #include <editeng/protitem.hxx>
39 #include <svl/rectitem.hxx>
40 #include <sfx2/bindings.hxx>
41 #include <fmtfsize.hxx>
42 #include <fmthdft.hxx>
43 #include <fmtclds.hxx>
44 #include <fmtornt.hxx>
45 #include <frmatr.hxx>
46 #include <view.hxx>
47 #include <wrtsh.hxx>
48 #include <cmdid.h>
49 #include <viewopt.hxx>
50 #include <tabcol.hxx>
51 #include <frmfmt.hxx>
52 #include <pagedesc.hxx>
53 #include <wview.hxx>
54 #include <fmtcol.hxx>
55 #include <section.hxx>
56 #include <ndtxt.hxx>
57 #include <pam.hxx>
58 
60 
61 using namespace ::com::sun::star;
62 
63 // Pack columns
64 static void lcl_FillSvxColumn(const SwFormatCol& rCol,
65  long nTotalWidth,
66  SvxColumnItem& rColItem,
67  long nDistance)
68 {
69  const SwColumns& rCols = rCol.GetColumns();
70 
71  bool bOrtho = rCol.IsOrtho() && !rCols.empty();
72  long nInnerWidth = 0;
73  if( bOrtho )
74  {
75  nInnerWidth = nTotalWidth;
76  for (const auto & i : rCols)
77  {
78  nInnerWidth -= i.GetLeft() + i.GetRight();
79  }
80  if( nInnerWidth < 0 )
81  nInnerWidth = 0;
82  else
83  nInnerWidth /= rCols.size();
84  }
85 
86  long nWidth = 0;
87  for ( size_t i = 0; i < rCols.size(); ++i )
88  {
89  const SwColumn* pCol = &rCols[i];
90  const long nStart = pCol->GetLeft() + nWidth + nDistance;
91  if( bOrtho )
92  nWidth += nInnerWidth + pCol->GetLeft() + pCol->GetRight();
93  else
94  nWidth += rCol.CalcColWidth(i, static_cast< sal_uInt16 >(nTotalWidth));
95  const long nEnd = nWidth - pCol->GetRight() + nDistance;
96 
97  SvxColumnDescription aColDesc(nStart, nEnd, true);
98  rColItem.Append(aColDesc);
99  }
100 }
101 
102 // Transfer ColumnItem in ColumnInfo
103 static void lcl_ConvertToCols(const SvxColumnItem& rColItem,
104  long nTotalWidth,
105  SwFormatCol& rCols)
106 {
107  OSL_ENSURE( rCols.GetNumCols() == rColItem.Count(), "Column count mismatch" );
108  // ruler executes that change the columns shortly after the selection has changed
109  // can result in a crash
110  if(rCols.GetNumCols() != rColItem.Count())
111  return;
112 
113  sal_uInt16 nLeft = 0;
114  SwTwips nSumAll= 0; // Sum up all columns and margins
115 
116  SwColumns& rArr = rCols.GetColumns();
117 
118  // Tabcols sequentially
119  for( sal_uInt16 i=0; i < rColItem.Count()-1; ++i )
120  {
121  OSL_ENSURE(rColItem[i+1].nStart >= rColItem[i].nEnd,"overlapping columns" );
122  const long nStart = std::max(rColItem[i+1].nStart, rColItem[i].nEnd);
123  const sal_uInt16 nRight = static_cast<sal_uInt16>((nStart - rColItem[i].nEnd) / 2);
124 
125  const long nWidth = rColItem[i].nEnd - rColItem[i].nStart + nLeft + nRight;
126 
127  SwColumn* pCol = &rArr[i];
128  pCol->SetWishWidth( sal_uInt16(long(rCols.GetWishWidth()) * nWidth / nTotalWidth ));
129  pCol->SetLeft( nLeft );
130  pCol->SetRight( nRight );
131  nSumAll += pCol->GetWishWidth();
132 
133  nLeft = nRight;
134  }
135  rArr[rColItem.Count()-1].SetLeft( nLeft );
136 
137  // The difference between the total sum of the desired width and the so far
138  // calculated columns and margins should result in the width of the last column.
139  rArr[rColItem.Count()-1].SetWishWidth( rCols.GetWishWidth() - static_cast<sal_uInt16>(nSumAll) );
140 
141  rCols.SetOrtho(false, 0, 0 );
142 }
143 
144 // Delete tabs
145 static void lcl_EraseDefTabs(SvxTabStopItem& rTabStops)
146 {
147  // Delete DefTabs
148  for ( sal_uInt16 i = 0; i < rTabStops.Count(); )
149  {
150  // Here also throw out the DefTab to zero
151  if ( SvxTabAdjust::Default == rTabStops[i].GetAdjustment() ||
152  rTabStops[i].GetTabPos() == 0 )
153  {
154  rTabStops.Remove(i);
155  continue;
156  }
157  ++i;
158  }
159 }
160 
161 // Flip page margin
162 void SwView::SwapPageMargin(const SwPageDesc& rDesc, SvxLRSpaceItem& rLRSpace)
163 {
164  sal_uInt16 nPhyPage, nVirPage;
165  GetWrtShell().GetPageNum( nPhyPage, nVirPage );
166 
167  if ( rDesc.GetUseOn() == UseOnPage::Mirror && (nPhyPage % 2) == 0 )
168  {
169  long nTmp = rLRSpace.GetRight();
170  rLRSpace.SetRight( rLRSpace.GetLeft() );
171  rLRSpace.SetLeft( nTmp );
172  }
173 }
174 
175 // If the frame border is moved, the column separator
176 // should stay in the same absolute position.
177 static void lcl_Scale(long& nVal, long nScale)
178 {
179  nVal *= nScale;
180  nVal >>= 8;
181 }
182 
183 static void ResizeFrameCols(SwFormatCol& rCol,
184  long nOldWidth,
185  long nNewWidth,
186  long nLeftDelta )
187 {
188  SwColumns& rArr = rCol.GetColumns();
189  long nWishSum = static_cast<long>(rCol.GetWishWidth());
190  long nWishDiff = (nWishSum * 100/nOldWidth * nNewWidth) / 100 - nWishSum;
191  long nNewWishWidth = nWishSum + nWishDiff;
192  if(nNewWishWidth > 0xffffl)
193  {
194  // If the desired width is getting too large, then all values
195  // must be scaled appropriately.
196  long nScale = (0xffffl << 8)/ nNewWishWidth;
197  for(SwColumn & i : rArr)
198  {
199  SwColumn* pCol = &i;
200  long nVal = pCol->GetWishWidth();
201  lcl_Scale(nVal, nScale);
202  pCol->SetWishWidth(static_cast<sal_uInt16>(nVal));
203  nVal = pCol->GetLeft();
204  lcl_Scale(nVal, nScale);
205  pCol->SetLeft(static_cast<sal_uInt16>(nVal));
206  nVal = pCol->GetRight();
207  lcl_Scale(nVal, nScale);
208  pCol->SetRight(static_cast<sal_uInt16>(nVal));
209  }
210  lcl_Scale(nNewWishWidth, nScale);
211  lcl_Scale(nWishDiff, nScale);
212  }
213  rCol.SetWishWidth( static_cast<sal_uInt16>(nNewWishWidth) );
214 
215  if( nLeftDelta >= 2 || nLeftDelta <= -2)
216  rArr.front().SetWishWidth(rArr.front().GetWishWidth() + static_cast<sal_uInt16>(nWishDiff));
217  else
218  rArr.back().SetWishWidth(rArr.back().GetWishWidth() + static_cast<sal_uInt16>(nWishDiff));
219  // Reset auto width
220  rCol.SetOrtho(false, 0, 0 );
221 }
222 
223 // Here all changes to the tab bar will be shot again into the model.
224 void SwView::ExecTabWin( SfxRequest const & rReq )
225 {
226  SwWrtShell &rSh = GetWrtShell();
227  const FrameTypeFlags nFrameType = rSh.IsObjSelected() ?
229  rSh.GetFrameType(nullptr,true);
230  const bool bFrameSelection = rSh.IsFrameSelected();
231  const bool bBrowse = rSh.GetViewOptions()->getBrowseMode();
232 
233  const sal_uInt16 nSlot = rReq.GetSlot();
234  const SfxItemSet* pReqArgs = rReq.GetArgs();
235  const size_t nDescId = rSh.GetCurPageDesc();
236  const SwPageDesc& rDesc = rSh.GetPageDesc( nDescId );
237 
238  const bool bVerticalWriting = rSh.IsInVerticalText();
239  const SwFormatHeader& rHeaderFormat = rDesc.GetMaster().GetHeader();
240  SwFrameFormat *pHeaderFormat = const_cast<SwFrameFormat*>(rHeaderFormat.GetHeaderFormat());
241 
242  const SwFormatFooter& rFooterFormat = rDesc.GetMaster().GetFooter();
243  SwFrameFormat *pFooterFormat = const_cast<SwFrameFormat*>(rFooterFormat.GetFooterFormat());
244 
245  const SwFormatFrameSize &rFrameSize = rDesc.GetMaster().GetFrameSize();
246 
247  const SwRect& rPageRect = rSh.GetAnyCurRect(CurRectType::Page);
248  const long nPageWidth = bBrowse ? rPageRect.Width() : rFrameSize.GetWidth();
249  const long nPageHeight = bBrowse ? rPageRect.Height() : rFrameSize.GetHeight();
250 
251  bool bUnlockView = false;
252  rSh.StartAllAction();
253  bool bSect = bool(nFrameType & FrameTypeFlags::COLSECT);
254 
255  switch (nSlot)
256  {
257  case SID_ATTR_LONG_LRSPACE:
258  if ( pReqArgs )
259  {
260  SvxLongLRSpaceItem aLongLR( static_cast<const SvxLongLRSpaceItem&>(pReqArgs->
261  Get( SID_ATTR_LONG_LRSPACE )) );
263  if ( !bSect && (bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY) )
264  {
265  SwFrameFormat* pFormat = rSh.GetFlyFrameFormat();
266  const SwRect &rRect = rSh.GetAnyCurRect(CurRectType::FlyEmbedded);
267 
268  bool bVerticalFrame(false);
269  {
270  bool bRTL;
271  bool bVertL2R;
272  bVerticalFrame = ( bFrameSelection &&
273  rSh.IsFrameVertical(true, bRTL, bVertL2R) ) ||
274  ( !bFrameSelection && bVerticalWriting);
275  }
276  long nDeltaX = bVerticalFrame ?
277  rRect.Right() - rPageRect.Right() + aLongLR.GetRight() :
278  rPageRect.Left() + aLongLR.GetLeft() - rRect.Left();
279 
282  RES_COL, RES_COL>{} );
283 
284  if(bVerticalFrame)
285  {
286  SwFormatVertOrient aVertOrient(pFormat->GetVertOrient());
288  aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaX );
289  aSet.Put( aVertOrient );
290  }
291  else
292  {
293  SwFormatHoriOrient aHoriOrient( pFormat->GetHoriOrient() );
295  aHoriOrient.SetPos( aHoriOrient.GetPos() + nDeltaX );
296  aSet.Put( aHoriOrient );
297  }
298 
299  SwFormatFrameSize aSize( pFormat->GetFrameSize() );
300  long nOldWidth = aSize.GetWidth();
301 
302  if(aSize.GetWidthPercent())
303  {
304  SwRect aRect;
305  rSh.CalcBoundRect(aRect, RndStdIds::FLY_AS_CHAR);
306  long nPrtWidth = aRect.Width();
307  aSize.SetWidthPercent(sal_uInt8((nPageWidth - aLongLR.GetLeft() - aLongLR.GetRight()) * 100 /nPrtWidth));
308  }
309  else
310  aSize.SetWidth( nPageWidth -
311  (aLongLR.GetLeft() + aLongLR.GetRight()));
312 
313  if( nFrameType & FrameTypeFlags::COLUMN )
314  {
315  SwFormatCol aCol(pFormat->GetCol());
316 
317  ::ResizeFrameCols(aCol, nOldWidth, aSize.GetWidth(), nDeltaX );
318  aSet.Put(aCol);
319  }
320 
321  aSet.Put( aSize );
322 
323  rSh.StartAction();
324  rSh.Push();
325  rSh.SetFlyFrameAttr( aSet );
326  // Cancel the frame selection
327  if(!bFrameSelection && rSh.IsFrameSelected())
328  {
329  rSh.UnSelectFrame();
330  rSh.LeaveSelFrameMode();
331  }
332  rSh.Pop();
333  rSh.EndAction();
334  }
335  else if ( nFrameType & ( FrameTypeFlags::HEADER | FrameTypeFlags::FOOTER ))
336  {
337  // Subtract out page margins
338  long nOld = rDesc.GetMaster().GetLRSpace().GetLeft();
339  aLongLR.SetLeft( nOld > aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld );
340 
341  nOld = rDesc.GetMaster().GetLRSpace().GetRight();
342  aLongLR.SetRight( nOld > aLongLR.GetRight() ? 0 : aLongLR.GetRight() - nOld );
343  aLR.SetLeft(aLongLR.GetLeft());
344  aLR.SetRight(aLongLR.GetRight());
345 
346  if ( nFrameType & FrameTypeFlags::HEADER && pHeaderFormat )
347  pHeaderFormat->SetFormatAttr( aLR );
348  else if( nFrameType & FrameTypeFlags::FOOTER && pFooterFormat )
349  pFooterFormat->SetFormatAttr( aLR );
350  }
351  else if( nFrameType == FrameTypeFlags::DRAWOBJ)
352  {
353  SwRect aRect( rSh.GetObjRect() );
354  aRect.Left( aLongLR.GetLeft() + rPageRect.Left() );
355  aRect.Right( rPageRect.Right() - aLongLR.GetRight());
356  rSh.SetObjRect( aRect );
357  }
358  else if(bSect || rSh.IsDirectlyInSection())
359  {
360  //change the section indents and the columns if available
361  //at first determine the changes
363  const SwRect aTmpRect = rSh.GetAnyCurRect(CurRectType::Section);
364  aSectRect.Pos() += aTmpRect.Pos();
365  long nLeftDiff = aLongLR.GetLeft() - static_cast<long>(aSectRect.Left() - rPageRect.Left() );
366  long nRightDiff = aLongLR.GetRight() - static_cast<long>( rPageRect.Right() - aSectRect.Right());
367  //change the LRSpaceItem of the section accordingly
368  const SwSection* pCurrSect = rSh.GetCurrSection();
369  const SwSectionFormat* pSectFormat = pCurrSect->GetFormat();
370  SvxLRSpaceItem aLRTmp = pSectFormat->GetLRSpace();
371  aLRTmp.SetLeft(aLRTmp.GetLeft() + nLeftDiff);
372  aLRTmp.SetRight(aLRTmp.GetRight() + nRightDiff);
374  aSet.Put(aLRTmp);
375  //change the first/last column
376  if(bSect)
377  {
378  SwFormatCol aCols( pSectFormat->GetCol() );
379  long nDiffWidth = nLeftDiff + nRightDiff;
380  ::ResizeFrameCols(aCols, aSectRect.Width(), aSectRect.Width() - nDiffWidth, nLeftDiff );
381  aSet.Put( aCols );
382  }
383  SwSectionData aData(*pCurrSect);
384  rSh.UpdateSection(rSh.GetSectionFormatPos(*pSectFormat), aData, &aSet);
385  }
386  else
387  { // Adjust page margins
388  aLR.SetLeft(aLongLR.GetLeft());
389  aLR.SetRight(aLongLR.GetRight());
390  SwapPageMargin( rDesc, aLR );
391  SwPageDesc aDesc( rDesc );
392  aDesc.GetMaster().SetFormatAttr( aLR );
393  rSh.ChgPageDesc( nDescId, aDesc );
394  }
395  }
396  break;
397 
398  // apply new left and right margins to current page style
399  case SID_ATTR_PAGE_LRSPACE:
400  if ( pReqArgs )
401  {
402  const SvxLongLRSpaceItem& aLongLR( pReqArgs->Get( SID_ATTR_PAGE_LRSPACE ) );
403 
404  SwPageDesc aDesc( rDesc );
405  {
407  aLR.SetLeft(aLongLR.GetLeft());
408  aLR.SetRight(aLongLR.GetRight());
409  SwapPageMargin( rDesc, aLR );
410  aDesc.GetMaster().SetFormatAttr( aLR );
411  }
412  rSh.ChgPageDesc( nDescId, aDesc );
413  }
414  break;
415 
416  case SID_ATTR_LONG_ULSPACE:
417  if ( pReqArgs )
418  {
419  SvxLongULSpaceItem aLongULSpace( static_cast<const SvxLongULSpaceItem&>(pReqArgs->
420  Get( SID_ATTR_LONG_ULSPACE )));
421 
422  if( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY )
423  {
424  SwFrameFormat* pFormat = rSh.GetFlyFrameFormat();
425  const SwRect &rRect = rSh.GetAnyCurRect(CurRectType::FlyEmbedded);
426  const long nDeltaY = rPageRect.Top() + aLongULSpace.GetUpper() - rRect.Top();
427  const long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower());
428 
431  //which of the orientation attributes is to be put depends on the frame's environment
432  bool bRTL;
433  bool bVertL2R;
434  if ( ( bFrameSelection &&
435  rSh.IsFrameVertical(true, bRTL, bVertL2R ) ) ||
436  ( !bFrameSelection && bVerticalWriting ) )
437  {
438  SwFormatHoriOrient aHoriOrient(pFormat->GetHoriOrient());
440  aHoriOrient.SetPos(aHoriOrient.GetPos() + nDeltaY );
441  aSet.Put( aHoriOrient );
442  }
443  else
444  {
445  SwFormatVertOrient aVertOrient(pFormat->GetVertOrient());
447  aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaY );
448  aSet.Put( aVertOrient );
449  }
450  SwFormatFrameSize aSize(pFormat->GetFrameSize());
451  if(aSize.GetHeightPercent())
452  {
453  SwRect aRect;
454  rSh.CalcBoundRect(aRect, RndStdIds::FLY_AS_CHAR);
455  long nPrtHeight = aRect.Height();
456  aSize.SetHeightPercent(sal_uInt8(nHeight * 100 /nPrtHeight));
457  }
458  else
459  aSize.SetHeight(nHeight );
460 
461  aSet.Put( aSize );
462  rSh.SetFlyFrameAttr( aSet );
463  }
464  else if( nFrameType == FrameTypeFlags::DRAWOBJ )
465  {
466  SwRect aRect( rSh.GetObjRect() );
467  aRect.Top( aLongULSpace.GetUpper() + rPageRect.Top() );
468  aRect.Bottom( rPageRect.Bottom() - aLongULSpace.GetLower() );
469  rSh.SetObjRect( aRect ) ;
470  }
471  else if(bVerticalWriting && (bSect || rSh.IsDirectlyInSection()))
472  {
473  //change the section indents and the columns if available
474  //at first determine the changes
476  const SwRect aTmpRect = rSh.GetAnyCurRect(CurRectType::Section);
477  aSectRect.Pos() += aTmpRect.Pos();
478  const long nLeftDiff = aLongULSpace.GetUpper() - static_cast<long>(aSectRect.Top() - rPageRect.Top());
479  const long nRightDiff = aLongULSpace.GetLower() - static_cast<long>(nPageHeight - aSectRect.Bottom() + rPageRect.Top());
480  //change the LRSpaceItem of the section accordingly
481  const SwSection* pCurrSect = rSh.GetCurrSection();
482  const SwSectionFormat* pSectFormat = pCurrSect->GetFormat();
483  SvxLRSpaceItem aLR = pSectFormat->GetLRSpace();
484  aLR.SetLeft(aLR.GetLeft() + nLeftDiff);
485  aLR.SetRight(aLR.GetRight() + nRightDiff);
487  aSet.Put(aLR);
488  //change the first/last column
489  if(bSect)
490  {
491  SwFormatCol aCols( pSectFormat->GetCol() );
492  long nDiffWidth = nLeftDiff + nRightDiff;
493  ::ResizeFrameCols(aCols, aSectRect.Height(), aSectRect.Height() - nDiffWidth, nLeftDiff );
494  aSet.Put( aCols );
495  }
496  SwSectionData aData(*pCurrSect);
497  rSh.UpdateSection(rSh.GetSectionFormatPos(*pSectFormat), aData, &aSet);
498  }
499  else
500  { SwPageDesc aDesc( rDesc );
501 
502  if ( nFrameType & ( FrameTypeFlags::HEADER | FrameTypeFlags::FOOTER ))
503  {
504 
505  const bool bHead = bool(nFrameType & FrameTypeFlags::HEADER);
506  SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
507  if ( bHead )
508  aUL.SetUpper( static_cast<sal_uInt16>(aLongULSpace.GetUpper()) );
509  else
510  aUL.SetLower( static_cast<sal_uInt16>(aLongULSpace.GetLower()) );
511  aDesc.GetMaster().SetFormatAttr( aUL );
512 
513  if( (bHead && pHeaderFormat) || (!bHead && pFooterFormat) )
514  {
515  SwFormatFrameSize aSz( bHead ? pHeaderFormat->GetFrameSize() :
516  pFooterFormat->GetFrameSize() );
518  aSz.SetHeight(nPageHeight - aLongULSpace.GetLower() -
519  aLongULSpace.GetUpper() );
520  if ( bHead )
521  pHeaderFormat->SetFormatAttr( aSz );
522  else
523  pFooterFormat->SetFormatAttr( aSz );
524  }
525  }
526  else
527  {
529  aUL.SetUpper(static_cast<sal_uInt16>(aLongULSpace.GetUpper()));
530  aUL.SetLower(static_cast<sal_uInt16>(aLongULSpace.GetLower()));
531  aDesc.GetMaster().SetFormatAttr(aUL);
532  }
533 
534  rSh.ChgPageDesc( nDescId, aDesc );
535  }
536  }
537  break;
538 
539  // apply new top and bottom margins to current page style
540  case SID_ATTR_PAGE_ULSPACE:
541  if ( pReqArgs )
542  {
543  const SvxLongULSpaceItem& aLongULSpace( pReqArgs->Get( SID_ATTR_PAGE_ULSPACE ) );
544 
545  SwPageDesc aDesc( rDesc );
546  {
548  aUL.SetUpper(static_cast<sal_uInt16>(aLongULSpace.GetUpper()));
549  aUL.SetLower(static_cast<sal_uInt16>(aLongULSpace.GetLower()));
550  aDesc.GetMaster().SetFormatAttr(aUL);
551  }
552  rSh.ChgPageDesc( nDescId, aDesc );
553  }
554  break;
555 
557  if ( pReqArgs )
558  {
559  const SfxInt16Item aColumnItem( static_cast<const SfxInt16Item&>(pReqArgs->Get(nSlot)) );
560  const sal_uInt16 nPageColumnType = aColumnItem.GetValue();
561 
562  // nPageColumnType =
563  // 1 - single-columned page
564  // 2 - two-columned page
565  // 3 - three-columned page
566  // 4 - two-columned page with left column width of 2/3 of page width
567  // 5 - two-columned page with right column width of 2/3 of page width
568 
569  sal_uInt16 nCount = 2;
570  if ( nPageColumnType == 1 )
571  {
572  nCount = 0;
573  }
574  else if ( nPageColumnType == 3 )
575  {
576  nCount = 3;
577  }
578 
579  const sal_uInt16 nGutterWidth = 0;
580 
581  const SvxLRSpaceItem aLR( rDesc.GetMaster().GetLRSpace() );
582  const long nLeft = aLR.GetLeft();
583  const long nRight = aLR.GetRight();
584  const long nWidth = nPageWidth - nLeft - nRight;
585 
586  SwFormatCol aCols( rDesc.GetMaster().GetCol() );
587  aCols.Init( nCount, nGutterWidth, nWidth );
588  aCols.SetWishWidth( nWidth );
589  aCols.SetGutterWidth( nGutterWidth, nWidth );
590  aCols.SetOrtho( false, nGutterWidth, nWidth );
591 
592  long nColumnLeft = 0;
593  long nColumnRight = 0;
594  if ( nPageColumnType == 4 )
595  {
596  nColumnRight = static_cast<long>(nWidth/3);
597  nColumnLeft = nWidth - nColumnRight;
598  aCols.GetColumns()[0].SetWishWidth( nColumnLeft );
599  aCols.GetColumns()[1].SetWishWidth( nColumnRight );
600  }
601  else if ( nPageColumnType == 5 )
602  {
603  nColumnLeft = static_cast<long>(nWidth/3);
604  nColumnRight = nWidth - nColumnLeft;
605  aCols.GetColumns()[0].SetWishWidth( nColumnLeft );
606  aCols.GetColumns()[1].SetWishWidth( nColumnRight );
607  }
608 
609  SwPageDesc aDesc( rDesc );
610  aDesc.GetMaster().SetFormatAttr( aCols );
611  rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc );
612  }
613  break;
614 
615  case SID_ATTR_TABSTOP_VERTICAL:
616  case SID_ATTR_TABSTOP:
617  if (pReqArgs)
618  {
619  const sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
620  SvxTabStopItem aTabStops( static_cast<const SvxTabStopItem&>(pReqArgs->
621  Get( nWhich )));
622  aTabStops.SetWhich(RES_PARATR_TABSTOP);
623  const SvxTabStopItem& rDefTabs = rSh.GetDefault(RES_PARATR_TABSTOP);
624 
625  // Default tab at pos 0
627  rSh.GetCurAttr( aSet );
628  const SvxLRSpaceItem& rLR = aSet.Get(RES_LR_SPACE);
629 
630  if ( rLR.GetTextFirstLineOffset() < 0 )
631  {
632  SvxTabStop aSwTabStop( 0, SvxTabAdjust::Default );
633  aTabStops.Insert( aSwTabStop );
634  }
635 
636  // Populate with default tabs.
637  ::MakeDefTabs( ::GetTabDist( rDefTabs ), aTabStops );
638 
639  SwTextFormatColl* pColl = rSh.GetCurTextFormatColl();
640  if( pColl && pColl->IsAutoUpdateFormat() )
641  {
643  aTmp.Put(aTabStops);
644  rSh.AutoUpdatePara( pColl, aTmp );
645  }
646  else
647  rSh.SetAttrItem( aTabStops );
648  }
649  break;
650 
651  case SID_HANGING_INDENT:
652  {
654  rSh.GetCurAttr( aLRSpaceSet );
655  SvxLRSpaceItem aParaMargin( aLRSpaceSet.Get( RES_LR_SPACE ) );
656 
657  SvxLRSpaceItem aNewMargin( RES_LR_SPACE );
658  aNewMargin.SetTextLeft( aParaMargin.GetTextLeft() + aParaMargin.GetTextFirstLineOffset() );
659  aNewMargin.SetRight( aParaMargin.GetRight() );
660  aNewMargin.SetTextFirstLineOffset( (aParaMargin.GetTextFirstLineOffset()) * -1 );
661 
662  rSh.SetAttrItem( aNewMargin );
663  break;
664  }
665 
666  case SID_ATTR_PARA_LRSPACE_VERTICAL:
667  case SID_ATTR_PARA_LRSPACE:
668  if ( pReqArgs )
669  {
670  SvxLRSpaceItem aParaMargin(static_cast<const SvxLRSpaceItem&>(pReqArgs->Get(nSlot)));
671 
672  aParaMargin.SetRight( aParaMargin.GetRight() - m_nRightBorderDistance );
673  aParaMargin.SetTextLeft(aParaMargin.GetTextLeft() - m_nLeftBorderDistance );
674 
675  aParaMargin.SetWhich( RES_LR_SPACE );
676  SwTextFormatColl* pColl = rSh.GetCurTextFormatColl();
677 
678  // #i23726#
680  {
681  // --> #i42922# Mouse move of numbering label
682  // has to consider the left indent of the paragraph
684  rSh.GetCurAttr( aSet );
685  const SvxLRSpaceItem& rLR = aSet.Get(RES_LR_SPACE);
686 
688  // #i90078#
689  rSh.SetIndent( static_cast< short >(aParaMargin.GetTextLeft() - rLR.GetTextLeft()), aPos);
690  // #i42921# invalidate state of indent in order to get a ruler update.
691  aParaMargin.SetWhich( nSlot );
692  GetViewFrame()->GetBindings().SetState( aParaMargin );
693  }
694  else if( pColl && pColl->IsAutoUpdateFormat() )
695  {
697  aSet.Put(aParaMargin);
698  rSh.AutoUpdatePara( pColl, aSet);
699  }
700  else
701  rSh.SetAttrItem( aParaMargin );
702 
703  if ( aParaMargin.GetTextFirstLineOffset() < 0 )
704  {
706 
707  rSh.GetCurAttr( aSet );
708  const SvxTabStopItem& rTabStops = aSet.Get(RES_PARATR_TABSTOP);
709 
710  // Do we have a tab at position zero?
711  sal_uInt16 i;
712 
713  for ( i = 0; i < rTabStops.Count(); ++i )
714  if ( rTabStops[i].GetTabPos() == 0 )
715  break;
716 
717  if ( i >= rTabStops.Count() )
718  {
719  // No DefTab
720  std::shared_ptr<SvxTabStopItem> aTabStops(rTabStops.Clone());
721 
722  ::lcl_EraseDefTabs(*aTabStops);
723 
724  SvxTabStop aSwTabStop( 0, SvxTabAdjust::Default );
725  aTabStops->Insert(aSwTabStop);
726 
727  const SvxTabStopItem& rDefTabs = rSh.GetDefault(RES_PARATR_TABSTOP);
728  ::MakeDefTabs( ::GetTabDist(rDefTabs), *aTabStops );
729 
730  if( pColl && pColl->IsAutoUpdateFormat())
731  {
733  aSetTmp.Put(*aTabStops);
734  rSh.AutoUpdatePara( pColl, aSetTmp );
735  }
736  else
737  rSh.SetAttrItem( *aTabStops );
738  }
739  }
740  }
741  break;
742 
743  case SID_ATTR_PARA_ULSPACE:
744  if ( pReqArgs )
745  {
746  SvxULSpaceItem aParaMargin(static_cast<const SvxULSpaceItem&>(pReqArgs->Get(nSlot)));
747 
748  aParaMargin.SetUpper( aParaMargin.GetUpper() );
749  aParaMargin.SetLower(aParaMargin.GetLower());
750 
751  aParaMargin.SetWhich( RES_UL_SPACE );
752  SwTextFormatColl* pColl = rSh.GetCurTextFormatColl();
753  if( pColl && pColl->IsAutoUpdateFormat() )
754  {
756  aSet.Put(aParaMargin);
757  rSh.AutoUpdatePara( pColl, aSet);
758  }
759  else
760  rSh.SetAttrItem( aParaMargin );
761  }
762  break;
763  case SID_PARASPACE_INCREASE:
764  case SID_PARASPACE_DECREASE:
765  {
767  rSh.GetCurAttr( aULSpaceSet );
768  SvxULSpaceItem aULSpace( aULSpaceSet.Get( RES_UL_SPACE ) );
769  sal_uInt16 nUpper = aULSpace.GetUpper();
770  sal_uInt16 nLower = aULSpace.GetLower();
771 
772  if ( nSlot == SID_PARASPACE_INCREASE )
773  {
774  nUpper = std::min< sal_uInt16 >( nUpper + 57, 5670 );
775  nLower = std::min< sal_uInt16 >( nLower + 57, 5670 );
776  }
777  else
778  {
779  nUpper = std::max< sal_Int16 >( nUpper - 57, 0 );
780  nLower = std::max< sal_Int16 >( nLower - 57, 0 );
781  }
782 
783  aULSpace.SetUpper( nUpper );
784  aULSpace.SetLower( nLower );
785 
786  SwTextFormatColl* pColl = rSh.GetCurTextFormatColl();
787  if( pColl && pColl->IsAutoUpdateFormat() )
788  {
789  aULSpaceSet.Put( aULSpace );
790  rSh.AutoUpdatePara( pColl, aULSpaceSet );
791  }
792  else
793  rSh.SetAttrItem( aULSpace, SetAttrMode::DEFAULT, true );
794  }
795  break;
796 
797  case SID_RULER_CHANGE_STATE:
798  {
799  const SfxPoolItem *pMargin1, *pMargin2;
800  if ( pReqArgs &&
801  pReqArgs->GetItemState(SID_RULER_MARGIN1,true,&pMargin1) == SfxItemState::SET )
802  {
803  const OUString ratio = static_cast<const SfxStringItem*>(pMargin1)->GetValue();
804  GetHRuler().SetValues(RulerChangeType::MARGIN1, GetHRuler().GetPageWidth() * ratio.toFloat());
805  }
806  else if ( pReqArgs &&
807  pReqArgs->GetItemState(SID_RULER_MARGIN2,true,&pMargin2) == SfxItemState::SET )
808  {
809  const OUString ratio = static_cast<const SfxStringItem*>(pMargin2)->GetValue();
810  GetHRuler().SetValues(RulerChangeType::MARGIN2, GetHRuler().GetPageWidth() * ratio.toFloat());
811  }
812  }
813  break;
814  case SID_RULER_BORDERS_VERTICAL:
815  case SID_RULER_BORDERS:
816  if ( pReqArgs )
817  {
818  SvxColumnItem aColItem(static_cast<const SvxColumnItem&>(pReqArgs->Get(nSlot)));
819 
820  if( m_bSetTabColFromDoc || (!bSect && rSh.GetTableFormat()) )
821  {
822  OSL_ENSURE(aColItem.Count(), "ColDesc is empty!!");
823 
824  const bool bSingleLine = rReq.
825  GetArgs()->Get(SID_RULER_ACT_LINE_ONLY).GetValue();
826 
827  SwTabCols aTabCols;
828  if ( m_bSetTabColFromDoc )
829  rSh.GetMouseTabCols( aTabCols, m_aTabColFromDocPos );
830  else
831  rSh.GetTabCols(aTabCols);
832 
833  // left table border
834  long nBorder = static_cast<long>(aColItem.GetLeft() - aTabCols.GetLeftMin());
835  aTabCols.SetLeft( nBorder );
836 
837  nBorder = (bVerticalWriting ? nPageHeight : nPageWidth) - aTabCols.GetLeftMin() - aColItem.GetRight();
838 
839  if ( aColItem.GetRight() > 0 )
840  aTabCols.SetRight( nBorder );
841 
842  // Tabcols sequentially
843  // The last column is defined by the edge.
844  // Columns in right-to-left tables need to be mirrored
845  bool bIsTableRTL =
846  IsTabColFromDoc() ?
848  : rSh.IsTableRightToLeft();
849  const size_t nColCount = aColItem.Count() - 1;
850  if(bIsTableRTL)
851  {
852  for ( size_t i = 0; i < nColCount && i < aTabCols.Count(); ++i )
853  {
854  const SvxColumnDescription& rCol = aColItem[nColCount - i];
855  aTabCols[i] = aTabCols.GetRight() - rCol.nStart;
856  aTabCols.SetHidden( i, !rCol.bVisible );
857  }
858  }
859  else
860  {
861  for ( size_t i = 0; i < nColCount && i < aTabCols.Count(); ++i )
862  {
863  const SvxColumnDescription& rCol = aColItem[i];
864  aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
865  aTabCols.SetHidden( i, !rCol.bVisible );
866  }
867  }
868 
869  if ( m_bSetTabColFromDoc )
870  {
871  if( !rSh.IsViewLocked() )
872  {
873  bUnlockView = true;
874  rSh.LockView( true );
875  }
876  rSh.SetMouseTabCols( aTabCols, bSingleLine,
878  }
879  else
880  rSh.SetTabCols(aTabCols, bSingleLine);
881 
882  }
883  else
884  {
885  if ( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY || bSect)
886  {
887  SwSectionFormat *pSectFormat = nullptr;
889  if(bSect)
890  {
891  SwSection *pSect = rSh.GetAnySection();
892  OSL_ENSURE( pSect, "Which section?");
893  pSectFormat = pSect->GetFormat();
894  }
895  else
896  {
897  rSh.GetFlyFrameAttr( aSet );
898  }
899  SwFormatCol aCols(
900  bSect ?
901  pSectFormat->GetCol() :
902  aSet.Get( RES_COL, false ));
904  const long lWidth = bVerticalWriting ? aCurRect.Height() : aCurRect.Width();
905  ::lcl_ConvertToCols( aColItem, lWidth, aCols );
906  aSet.Put( aCols );
907  if(bSect)
908  rSh.SetSectionAttr( aSet, pSectFormat );
909  else
910  {
911  rSh.StartAction();
912  rSh.Push();
913  rSh.SetFlyFrameAttr( aSet );
914  // Cancel the frame selection again
915  if(!bFrameSelection && rSh.IsFrameSelected())
916  {
917  rSh.UnSelectFrame();
918  rSh.LeaveSelFrameMode();
919  }
920  rSh.Pop();
921  rSh.EndAction();
922  }
923  }
924  else
925  {
926  SwFormatCol aCols( rDesc.GetMaster().GetCol() );
927  const SwRect aPrtRect = rSh.GetAnyCurRect(CurRectType::PagePrt);
928  ::lcl_ConvertToCols( aColItem,
929  bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width(),
930  aCols );
931  SwPageDesc aDesc( rDesc );
932  aDesc.GetMaster().SetFormatAttr( aCols );
933  rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc );
934  }
935  }
936  }
937  break;
938 
939  case SID_RULER_ROWS :
940  case SID_RULER_ROWS_VERTICAL:
941  if (pReqArgs)
942  {
943  SvxColumnItem aColItem(static_cast<const SvxColumnItem&>(pReqArgs->Get(nSlot)));
944 
945  if( m_bSetTabColFromDoc || (!bSect && rSh.GetTableFormat()) )
946  {
947  OSL_ENSURE(aColItem.Count(), "ColDesc is empty!!");
948 
949  SwTabCols aTabCols;
950  if ( m_bSetTabRowFromDoc )
951  rSh.GetMouseTabRows( aTabCols, m_aTabColFromDocPos );
952  else
953  rSh.GetTabRows(aTabCols);
954 
955  if ( bVerticalWriting )
956  {
957  aTabCols.SetRight(nPageWidth - aColItem.GetRight() - aColItem.GetLeft());
958  aTabCols.SetLeftMin(aColItem.GetLeft());
959  }
960  else
961  {
962  long nBorder = nPageHeight - aTabCols.GetLeftMin() - aColItem.GetRight();
963  aTabCols.SetRight( nBorder );
964  }
965 
966  const size_t nColItems = aColItem.Count() - 1;
967  if(bVerticalWriting)
968  {
969  for ( size_t i = nColItems; i; --i )
970  {
971  const SvxColumnDescription& rCol = aColItem[i - 1];
972  long nColumnPos = aTabCols.GetRight() - rCol.nEnd ;
973  aTabCols[i - 1] = nColumnPos;
974  aTabCols.SetHidden( i - 1, !rCol.bVisible );
975  }
976  }
977  else
978  {
979  for ( size_t i = 0; i < nColItems; ++i )
980  {
981  const SvxColumnDescription& rCol = aColItem[i];
982  aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
983  aTabCols.SetHidden( i, !rCol.bVisible );
984  }
985  }
986  bool bSingleLine = false;
987  const SfxPoolItem* pSingleLine;
988  if( SfxItemState::SET == rReq.GetArgs()->GetItemState(SID_RULER_ACT_LINE_ONLY, false, &pSingleLine))
989  bSingleLine = static_cast<const SfxBoolItem*>(pSingleLine)->GetValue();
990  if ( m_bSetTabRowFromDoc )
991  {
992  if( !rSh.IsViewLocked() )
993  {
994  bUnlockView = true;
995  rSh.LockView( true );
996  }
997  rSh.SetMouseTabRows( aTabCols, bSingleLine, m_aTabColFromDocPos );
998  }
999  else
1000  rSh.SetTabRows(aTabCols, bSingleLine);
1001  }
1002  }
1003  break;
1004  case SID_TABLE_CHANGE_CURRENT_BORDER_POSITION:
1005  {
1006  if (pReqArgs)
1007  {
1008  const SfxPoolItem *pBorderType;
1009  const SfxPoolItem *pIndex;
1010  const SfxPoolItem *pOffset;
1011  constexpr long constDistanceOffset = 40;
1012 
1013  if (pReqArgs->GetItemState(SID_TABLE_BORDER_TYPE, true, &pBorderType) == SfxItemState::SET
1014  && pReqArgs->GetItemState(SID_TABLE_BORDER_INDEX, true, &pIndex) == SfxItemState::SET
1015  && pReqArgs->GetItemState(SID_TABLE_BORDER_OFFSET, true, &pOffset) == SfxItemState::SET)
1016  {
1017  const OUString sType = static_cast<const SfxStringItem*>(pBorderType)->GetValue();
1018  const sal_uInt16 nIndex = static_cast<const SfxUInt16Item*>(pIndex)->GetValue();
1019  const sal_Int32 nOffset = static_cast<const SfxInt32Item*>(pOffset)->GetValue();
1020 
1021  if (sType.startsWith("column"))
1022  {
1023  SwTabCols aTabCols;
1024  rSh.GetTabCols(aTabCols);
1025 
1026  if (sType == "column-left")
1027  {
1028  auto & rEntry = aTabCols.GetEntry(0);
1029  long nNewPosition = aTabCols.GetLeft() + long(nOffset);
1030  long nPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
1031  aTabCols.SetLeft(nPosition);
1032  }
1033  else if (sType == "column-right")
1034  {
1035  auto & rEntry = aTabCols.GetEntry(aTabCols.Count() - 1);
1036  long nNewPosition = aTabCols.GetRight() + long(nOffset);
1037  long nPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
1038  aTabCols.SetRight(nPosition);
1039  }
1040  else if (sType == "column-middle" && nIndex < aTabCols.Count())
1041  {
1042  auto & rEntry = aTabCols.GetEntry(nIndex);
1043  long nNewPosition = rEntry.nPos + long(nOffset);
1044  long nPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
1045  rEntry.nPos = nPosition;
1046  }
1047 
1048  rSh.SetTabCols(aTabCols, false);
1049  }
1050  else if (sType.startsWith("row"))
1051  {
1052  SwTabCols aTabRows;
1053  rSh.GetTabRows(aTabRows);
1054 
1055  if (sType == "row-left")
1056  {
1057  auto & rEntry = aTabRows.GetEntry(0);
1058  long nNewPosition = aTabRows.GetLeft() + long(nOffset);
1059  long nPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
1060  aTabRows.SetLeft(nPosition);
1061  }
1062  else if (sType == "row-right")
1063  {
1064  auto & rEntry = aTabRows.GetEntry(aTabRows.Count() - 1);
1065  long nNewPosition = aTabRows.GetRight() + long(nOffset);
1066  long nPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
1067  aTabRows.SetRight(nPosition);
1068  }
1069  else if (sType == "row-middle" && nIndex < aTabRows.Count())
1070  {
1071  auto & rEntry = aTabRows.GetEntry(nIndex);
1072  long nNewPosition = rEntry.nPos + long(nOffset);
1073  long nPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
1074  rEntry.nPos = nPosition;
1075  }
1076 
1077  rSh.SetTabRows(aTabRows, false);
1078  }
1079  }
1080  }
1081  }
1082  break;
1083  case SID_ATTR_PAGE_HEADER:
1084  {
1085  if ( pReqArgs )
1086  {
1087  const bool bHeaderOn = static_cast<const SfxBoolItem&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER)).GetValue();
1088  SwPageDesc aDesc(rDesc);
1089  SwFrameFormat &rMaster = aDesc.GetMaster();
1090  rMaster.SetFormatAttr( SwFormatHeader( bHeaderOn ));
1091  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1092  }
1093  }
1094  break;
1096  {
1097  if ( pReqArgs && rDesc.GetMaster().GetHeader().IsActive() )
1098  {
1099  const SvxLongLRSpaceItem& aLongLR = static_cast<const SvxLongLRSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER_LRMARGIN));
1101  SwPageDesc aDesc(rDesc);
1102  aLR.SetLeft(aLongLR.GetLeft());
1103  aLR.SetRight(aLongLR.GetRight());
1104  SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetHeader().GetHeaderFormat());
1105  pFormat->SetFormatAttr( aLR );
1106  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1107  }
1108  }
1109  break;
1111  {
1112  if ( pReqArgs && rDesc.GetMaster().GetHeader().IsActive())
1113  {
1114  const SvxLongULSpaceItem& aLongUL = static_cast<const SvxLongULSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER_SPACING));
1115  SwPageDesc aDesc(rDesc);
1116  SvxULSpaceItem aUL(0, aLongUL.GetLower(), RES_UL_SPACE );
1117  SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetHeader().GetHeaderFormat());
1118  pFormat->SetFormatAttr( aUL );
1119  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1120  }
1121  }
1122  break;
1124  {
1125  if ( pReqArgs && rDesc.GetMaster().GetHeader().IsActive())
1126  {
1127  const SfxInt16Item& aLayoutItem = static_cast<const SfxInt16Item&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER_LAYOUT));
1128  sal_uInt16 nLayout = aLayoutItem.GetValue();
1129  SwPageDesc aDesc(rDesc);
1130  aDesc.ChgHeaderShare((nLayout>>1) == 0);
1131  aDesc.ChgFirstShare((nLayout % 2) == 0); // FIXME control changes for both header footer - tdf#100287
1132  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1133  }
1134  }
1135  break;
1136  case SID_ATTR_PAGE_FOOTER:
1137  {
1138  if ( pReqArgs )
1139  {
1140  const bool bFooterOn = static_cast<const SfxBoolItem&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER)).GetValue();
1141  SwPageDesc aDesc(rDesc);
1142  SwFrameFormat &rMaster = aDesc.GetMaster();
1143  rMaster.SetFormatAttr( SwFormatFooter( bFooterOn ));
1144  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1145  }
1146  }
1147  break;
1149  {
1150  if ( pReqArgs && rDesc.GetMaster().GetFooter().IsActive() )
1151  {
1152  const SvxLongLRSpaceItem& aLongLR = static_cast<const SvxLongLRSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER_LRMARGIN));
1154  SwPageDesc aDesc(rDesc);
1155  aLR.SetLeft(aLongLR.GetLeft());
1156  aLR.SetRight(aLongLR.GetRight());
1157  SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetFooter().GetFooterFormat());
1158  pFormat->SetFormatAttr( aLR );
1159  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1160  }
1161  }
1162  break;
1164  {
1165  if ( pReqArgs && rDesc.GetMaster().GetFooter().IsActive())
1166  {
1167  const SvxLongULSpaceItem& aLongUL = static_cast<const SvxLongULSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER_SPACING));
1168  SwPageDesc aDesc(rDesc);
1169  SvxULSpaceItem aUL(aLongUL.GetUpper(), 0, RES_UL_SPACE );
1170  SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetFooter().GetFooterFormat());
1171  pFormat->SetFormatAttr( aUL );
1172  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1173  }
1174  }
1175  break;
1177  {
1178  if ( pReqArgs && rDesc.GetMaster().GetFooter().IsActive())
1179  {
1180  const SfxInt16Item& aLayoutItem = static_cast<const SfxInt16Item&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER_LAYOUT));
1181  sal_uInt16 nLayout = aLayoutItem.GetValue();
1182  SwPageDesc aDesc(rDesc);
1183  aDesc.ChgFooterShare((nLayout>>1) == 0);
1184  aDesc.ChgFirstShare((nLayout % 2) == 0); // FIXME control changes for both header footer - tdf#100287
1185  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1186  }
1187  }
1188  break;
1189 
1190  case SID_ATTR_PAGE_COLOR:
1191  case SID_ATTR_PAGE_FILLSTYLE:
1192  case SID_ATTR_PAGE_GRADIENT:
1193  case SID_ATTR_PAGE_HATCH:
1194  case SID_ATTR_PAGE_BITMAP:
1195  {
1196  if(pReqArgs)
1197  {
1198  SwPageDesc aDesc(rDesc);
1199  SwFrameFormat &rMaster = aDesc.GetMaster();
1200  switch (nSlot)
1201  {
1202  case SID_ATTR_PAGE_FILLSTYLE:
1203  {
1204  XFillStyleItem aFSItem( pReqArgs->Get( XATTR_FILLSTYLE ) );
1205  drawing::FillStyle eXFS = aFSItem.GetValue();
1206 
1207  if ( eXFS == drawing::FillStyle_NONE )
1208  rMaster.SetFormatAttr( XFillStyleItem( eXFS ) );
1209  }
1210  break;
1211 
1212  case SID_ATTR_PAGE_COLOR:
1213  {
1214  XFillColorItem aColorItem( pReqArgs->Get( XATTR_FILLCOLOR ) );
1215  rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_SOLID ) );
1216  rMaster.SetFormatAttr( aColorItem );
1217  }
1218  break;
1219 
1220  case SID_ATTR_PAGE_GRADIENT:
1221  {
1222  XFillGradientItem aGradientItem( pReqArgs->Get( XATTR_FILLGRADIENT ) );
1223  rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_GRADIENT ) );
1224  rMaster.SetFormatAttr( aGradientItem );
1225  }
1226  break;
1227 
1228  case SID_ATTR_PAGE_HATCH:
1229  {
1230  XFillHatchItem aHatchItem( pReqArgs->Get( XATTR_FILLHATCH ) );
1231  rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_HATCH ) );
1232  rMaster.SetFormatAttr( aHatchItem );
1233  }
1234  break;
1235 
1236  case SID_ATTR_PAGE_BITMAP:
1237  {
1238  XFillBitmapItem aBitmapItem( pReqArgs->Get( XATTR_FILLBITMAP ) );
1239  rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_BITMAP ) );
1240  rMaster.SetFormatAttr( aBitmapItem );
1241  }
1242  break;
1243 
1244  default:
1245  break;
1246  }
1247  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1248  }
1249  }
1250  break;
1251 
1252  default:
1253  OSL_ENSURE( false, "wrong SlotId");
1254  }
1255  rSh.EndAllAction();
1256 
1257  if( bUnlockView )
1258  rSh.LockView( false );
1259 
1261  SetNumRuleNodeFromDoc(nullptr);
1262 }
1263 
1264 // Here the status of the tab bar will be determined.
1265 // This means that all relevant attributes at the CursorPos
1266 // will be submitted to the tab bar.
1268 {
1269  SwWrtShell &rSh = GetWrtShell();
1270 
1271  const Point* pPt = IsTabColFromDoc() || IsTabRowFromDoc() ? &m_aTabColFromDocPos : nullptr;
1272  const FrameTypeFlags nFrameType = rSh.IsObjSelected()
1274  : rSh.GetFrameType( pPt, true );
1275 
1276  const bool bFrameSelection = rSh.IsFrameSelected();
1277  const bool bBrowse = rSh.GetViewOptions()->getBrowseMode();
1278  // PageOffset/limiter
1279  const SwRect& rPageRect = rSh.GetAnyCurRect( CurRectType::Page, pPt );
1280  const SwRect& rPagePrtRect = rSh.GetAnyCurRect( CurRectType::PagePrt, pPt );
1281  const long nPageWidth = rPageRect.Width();
1282  const long nPageHeight = rPageRect.Height();
1283 
1284  const SwPageDesc& rDesc = rSh.GetPageDesc(
1287 
1288  const SvxFrameDirectionItem& rFrameDir = rDesc.GetMaster().GetFrameDir();
1289  const bool bVerticalWriting = rSh.IsInVerticalText();
1290 
1291  //enable tab stop display on the rulers depending on the writing direction
1292  WinBits nRulerStyle = m_pHRuler->GetStyle() & ~WB_EXTRAFIELD;
1293  m_pHRuler->SetStyle(bVerticalWriting||bBrowse ? nRulerStyle : nRulerStyle|WB_EXTRAFIELD);
1294  nRulerStyle = m_pVRuler->GetStyle() & ~WB_EXTRAFIELD;
1295  m_pVRuler->SetStyle(bVerticalWriting ? nRulerStyle|WB_EXTRAFIELD : nRulerStyle);
1296 
1297  //#i24363# tab stops relative to indent
1299  m_pHRuler->SetTabsRelativeToIndent( bRelative );
1300  m_pVRuler->SetTabsRelativeToIndent( bRelative );
1301 
1302  SvxLRSpaceItem aPageLRSpace( rDesc.GetMaster().GetLRSpace() );
1303  SwapPageMargin( rDesc, aPageLRSpace );
1304 
1306  RES_LR_SPACE, RES_UL_SPACE>{} );
1307  // get also the list level indent values merged as LR-SPACE item, if needed.
1308  rSh.GetCurAttr( aCoreSet, true );
1309  const SelectionType nSelType = rSh.GetSelectionType();
1310 
1311  SfxWhichIter aIter( rSet );
1312  sal_uInt16 nWhich = aIter.FirstWhich();
1313 
1314  while ( nWhich )
1315  {
1316  switch ( nWhich )
1317  {
1318 
1319  case SID_ATTR_PAGE_COLUMN:
1320  {
1321  sal_uInt16 nColumnType = 0;
1322 
1323  const SwFrameFormat& rMaster = rDesc.GetMaster();
1324  const SwFormatCol& aCol(rMaster.GetCol());
1325  const sal_uInt16 nCols = aCol.GetNumCols();
1326  if ( nCols == 0 )
1327  {
1328  nColumnType = 1;
1329  }
1330  else if ( nCols == 2 )
1331  {
1332  const sal_uInt16 nColLeft = aCol.CalcPrtColWidth(0, aCol.GetWishWidth());
1333  const sal_uInt16 nColRight = aCol.CalcPrtColWidth(1, aCol.GetWishWidth());
1334 
1335  if ( abs(nColLeft - nColRight) <= 10 )
1336  {
1337  nColumnType = 2;
1338  }
1339  else if( abs(nColLeft - nColRight*2) < 20 )
1340  {
1341  nColumnType = 4;
1342  }
1343  else if( abs(nColLeft*2 - nColRight) < 20 )
1344  {
1345  nColumnType = 5;
1346  }
1347  }
1348  else if( nCols == 3 )
1349  {
1350  nColumnType = 3;
1351  }
1352  else
1353  nColumnType = nCols;
1354 
1355  rSet.Put( SfxInt16Item( SID_ATTR_PAGE_COLUMN, nColumnType ) );
1356  }
1357  break;
1358 
1359  case SID_ATTR_LONG_LRSPACE:
1360  {
1361  SvxLongLRSpaceItem aLongLR( aPageLRSpace.GetLeft(),
1362  aPageLRSpace.GetRight(),
1363  SID_ATTR_LONG_LRSPACE);
1364  if(bBrowse)
1365  {
1366  aLongLR.SetLeft(rPagePrtRect.Left());
1367  aLongLR.SetRight(nPageWidth - rPagePrtRect.Right());
1368  }
1369  if ( ( nFrameType & FrameTypeFlags::HEADER || nFrameType & FrameTypeFlags::FOOTER ) &&
1370  !(nFrameType & FrameTypeFlags::COLSECT) )
1371  {
1372  SwFrameFormat *pFormat = const_cast<SwFrameFormat*>((nFrameType & FrameTypeFlags::HEADER) ?
1373  rDesc.GetMaster().GetHeader().GetHeaderFormat() :
1374  rDesc.GetMaster().GetFooter().GetFooterFormat());
1375  if( pFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash
1376  {
1377  SwRect aRect( rSh.GetAnyCurRect( CurRectType::HeaderFooter, pPt));
1378  aRect.Pos() -= rSh.GetAnyCurRect( CurRectType::Page, pPt ).Pos();
1379  const SvxLRSpaceItem& aLR = pFormat->GetLRSpace();
1380  aLongLR.SetLeft ( aLR.GetLeft() + aRect.Left() );
1381  aLongLR.SetRight( nPageWidth - aRect.Right() + aLR.GetRight() );
1382  }
1383  }
1384  else
1385  {
1386  SwRect aRect;
1387  if( !bFrameSelection && ((nFrameType & FrameTypeFlags::COLSECT) || rSh.IsDirectlyInSection()) )
1388  {
1389  aRect = rSh.GetAnyCurRect(CurRectType::SectionPrt, pPt);
1390  const SwRect aTmpRect = rSh.GetAnyCurRect(CurRectType::Section, pPt);
1391  aRect.Pos() += aTmpRect.Pos();
1392  }
1393 
1394  else if ( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY )
1395  aRect = rSh.GetAnyCurRect(CurRectType::FlyEmbedded, pPt);
1396  else if( nFrameType & FrameTypeFlags::DRAWOBJ)
1397  aRect = rSh.GetObjRect();
1398 
1399  if( aRect.Width() )
1400  {
1401  // make relative to page position:
1402  aLongLR.SetLeft(aRect.Left() - rPageRect.Left());
1403  aLongLR.SetRight(rPageRect.Right() - aRect.Right());
1404  }
1405  }
1406  rSet.Put( aLongLR );
1407  }
1408  break;
1409 
1410  // provide left and right margins of current page style
1411  case SID_ATTR_PAGE_LRSPACE:
1412  {
1413  const SvxLRSpaceItem aTmpPageLRSpace( rDesc.GetMaster().GetLRSpace() );
1414  const SvxLongLRSpaceItem aLongLR(
1415  aTmpPageLRSpace.GetLeft(),
1416  aTmpPageLRSpace.GetRight(),
1417  SID_ATTR_PAGE_LRSPACE );
1418  rSet.Put( aLongLR );
1419  }
1420  break;
1421 
1422  case SID_ATTR_LONG_ULSPACE:
1423  {
1424  // Page margin top bottom
1425  SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
1426  SvxLongULSpaceItem aLongUL( static_cast<long>(aUL.GetUpper()),
1427  static_cast<long>(aUL.GetLower()),
1428  SID_ATTR_LONG_ULSPACE);
1429 
1430  if ( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY )
1431  {
1432  // Convert document coordinates into page coordinates.
1433  const SwRect &rRect = rSh.GetAnyCurRect(CurRectType::FlyEmbedded, pPt);
1434  aLongUL.SetUpper(rRect.Top() - rPageRect.Top());
1435  aLongUL.SetLower(rPageRect.Bottom() - rRect.Bottom());
1436  }
1437  else if ( nFrameType & FrameTypeFlags::HEADER || nFrameType & FrameTypeFlags::FOOTER )
1438  {
1439  SwRect aRect( rSh.GetAnyCurRect( CurRectType::HeaderFooter, pPt));
1440  aRect.Pos() -= rSh.GetAnyCurRect( CurRectType::Page, pPt ).Pos();
1441  aLongUL.SetUpper( aRect.Top() );
1442  aLongUL.SetLower( nPageHeight - aRect.Bottom() );
1443  }
1444  else if( nFrameType & FrameTypeFlags::DRAWOBJ)
1445  {
1446  const SwRect &rRect = rSh.GetObjRect();
1447  aLongUL.SetUpper(rRect.Top() - rPageRect.Top());
1448  aLongUL.SetLower(rPageRect.Bottom() - rRect.Bottom());
1449  }
1450  else if(bBrowse)
1451  {
1452  aLongUL.SetUpper(rPagePrtRect.Top());
1453  aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom());
1454  }
1455  rSet.Put( aLongUL );
1456  }
1457  break;
1458 
1459  // provide top and bottom margins of current page style
1460  case SID_ATTR_PAGE_ULSPACE:
1461  {
1462  const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
1463  SvxLongULSpaceItem aLongUL(
1464  static_cast<long>(aUL.GetUpper()),
1465  static_cast<long>(aUL.GetLower()),
1466  SID_ATTR_PAGE_ULSPACE );
1467 
1468  rSet.Put( aLongUL );
1469  }
1470  break;
1471 
1472  case SID_ATTR_TABSTOP_VERTICAL :
1473  case RES_PARATR_TABSTOP:
1474  {
1475  if ( dynamic_cast< const SwWebView *>( this ) != nullptr ||
1476  IsTabColFromDoc() ||
1477  IsTabRowFromDoc() ||
1478  ( nSelType & SelectionType::Graphic ) ||
1479  ( nSelType & SelectionType::Frame ) ||
1480  ( nSelType & SelectionType::Ole ) ||
1481  ( SfxItemState::DEFAULT > aCoreSet.GetItemState(RES_LR_SPACE) ) ||
1482  (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich) ) ||
1483  ( bVerticalWriting && (RES_PARATR_TABSTOP == nWhich))
1484  )
1485  rSet.DisableItem( nWhich );
1486  else
1487  {
1488  SvxTabStopItem aTabStops(aCoreSet.Get( RES_PARATR_TABSTOP ));
1489 
1490  const SvxTabStopItem& rDefTabs = rSh.GetDefault(RES_PARATR_TABSTOP);
1491 
1492  OSL_ENSURE(m_pHRuler, "why is there no ruler?");
1493  const long nDefTabDist = ::GetTabDist(rDefTabs);
1494  m_pHRuler->SetDefTabDist( nDefTabDist );
1495  m_pVRuler->SetDefTabDist( nDefTabDist );
1496  ::lcl_EraseDefTabs(aTabStops);
1497  aTabStops.SetWhich(nWhich);
1498  rSet.Put(aTabStops);
1499  }
1500  break;
1501  }
1502 
1503  case SID_HANGING_INDENT:
1504  {
1505  SfxItemState e = aCoreSet.GetItemState(RES_LR_SPACE);
1506  if( e == SfxItemState::DISABLED )
1507  rSet.DisableItem(nWhich);
1508  break;
1509  }
1510 
1511  case SID_ATTR_PARA_LRSPACE_VERTICAL:
1512  case SID_ATTR_PARA_LRSPACE:
1513  case SID_ATTR_PARA_LEFTSPACE:
1514  case SID_ATTR_PARA_RIGHTSPACE:
1515  case SID_ATTR_PARA_FIRSTLINESPACE:
1516  {
1517  if ( nSelType & SelectionType::Graphic ||
1518  nSelType & SelectionType::Frame ||
1519  nSelType & SelectionType::Ole ||
1520  nFrameType == FrameTypeFlags::DRAWOBJ ||
1521  (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich)) ||
1522  ( bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich))
1523  )
1524  {
1525  rSet.DisableItem(nWhich);
1526  }
1527  else
1528  {
1529  std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE));
1530  if ( !IsTabColFromDoc() )
1531  {
1532  aLR.reset(aCoreSet.Get(RES_LR_SPACE).Clone());
1533 
1534  // #i23726#
1536  {
1537  short nOffset = static_cast< short >(aLR->GetTextLeft() +
1538  // #i42922# Mouse move of numbering label
1539  // has to consider the left indent of the paragraph
1541 
1542  short nFLOffset;
1544 
1545  aLR->SetLeft( nOffset + nFLOffset );
1546  }
1547  }
1548  aLR->SetWhich(nWhich);
1549  rSet.Put(*aLR);
1550  }
1551  break;
1552  }
1553 
1554  case SID_ATTR_PARA_ULSPACE:
1555  case SID_ATTR_PARA_ABOVESPACE:
1556  case SID_ATTR_PARA_BELOWSPACE:
1557  case SID_PARASPACE_INCREASE:
1558  case SID_PARASPACE_DECREASE:
1559  {
1560  SvxULSpaceItem aUL = aCoreSet.Get(RES_UL_SPACE);
1561  SfxItemState e = aCoreSet.GetItemState(RES_UL_SPACE);
1562  if( e >= SfxItemState::DEFAULT )
1563  {
1564  if ( !aUL.GetUpper() && !aUL.GetLower() )
1565  rSet.DisableItem( SID_PARASPACE_DECREASE );
1566  else if ( aUL.GetUpper() >= 5670 && aUL.GetLower() >= 5670 )
1567  rSet.DisableItem( SID_PARASPACE_INCREASE );
1568  if ( nWhich == SID_ATTR_PARA_ULSPACE
1569  || nWhich == SID_ATTR_PARA_ABOVESPACE
1570  || nWhich == SID_ATTR_PARA_BELOWSPACE
1571  )
1572  {
1573  aUL.SetWhich( nWhich );
1574  rSet.Put( aUL );
1575  }
1576  }
1577  else
1578  {
1579  rSet.DisableItem( SID_PARASPACE_INCREASE );
1580  rSet.DisableItem( SID_PARASPACE_DECREASE );
1581  rSet.InvalidateItem( SID_ATTR_PARA_ULSPACE );
1582  rSet.InvalidateItem( SID_ATTR_PARA_ABOVESPACE );
1583  rSet.InvalidateItem( SID_ATTR_PARA_BELOWSPACE );
1584  }
1585  }
1586  break;
1587 
1588  case SID_RULER_BORDER_DISTANCE:
1589  {
1592  if ( nSelType & SelectionType::Graphic ||
1593  nSelType & SelectionType::Frame ||
1594  nSelType & SelectionType::Ole ||
1595  nFrameType == FrameTypeFlags::DRAWOBJ )
1596  rSet.DisableItem(SID_RULER_BORDER_DISTANCE);
1597  else
1598  {
1599  SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE);
1600  if(nFrameType & FrameTypeFlags::FLY_ANY)
1601  {
1602  if( IsTabColFromDoc() )
1603  {
1604  const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( CurRectType::FlyEmbeddedPrt, pPt );
1605  aDistLR.SetLeft(rFlyPrtRect.Left());
1606  aDistLR.SetRight(rFlyPrtRect.Left());
1607  }
1608  else
1609  {
1610  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1611  aCoreSet.Put( aBoxInfo );
1612  rSh.GetFlyFrameAttr( aCoreSet );
1613  const SvxBoxItem& rBox = aCoreSet.Get(RES_BOX);
1614  aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT));
1615  aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT));
1616 
1617  //add the paragraph border distance
1619  rSh.GetCurAttr( aCoreSet1 );
1620  const SvxBoxItem& rParaBox = aCoreSet1.Get(RES_BOX);
1621  aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
1622  aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
1623  }
1624  rSet.Put(aDistLR);
1625  m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1626  m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
1627  }
1628  else if ( IsTabColFromDoc() ||
1629  ( rSh.GetTableFormat() && !bFrameSelection &&
1630  !(nFrameType & FrameTypeFlags::COLSECT ) ) )
1631  {
1632  SfxItemSet aCoreSet2( GetPool(),
1634  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>{} );
1635  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1636  aBoxInfo.SetTable(false);
1637  aBoxInfo.SetDist(true);
1638  aCoreSet2.Put(aBoxInfo);
1639  rSh.GetTabBorders( aCoreSet2 );
1640  const SvxBoxItem& rBox = aCoreSet2.Get(RES_BOX);
1641  aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT));
1642  aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT));
1643 
1644  //add the border distance of the paragraph
1646  rSh.GetCurAttr( aCoreSet1 );
1647  const SvxBoxItem& rParaBox = aCoreSet1.Get(RES_BOX);
1648  aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
1649  aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
1650  rSet.Put(aDistLR);
1651  m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1652  m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
1653  }
1654  else if ( !rSh.IsDirectlyInSection() )
1655  {
1656  //get the page/header/footer border distance
1657  const SwFrameFormat& rMaster = rDesc.GetMaster();
1658  const SvxBoxItem& rBox = rMaster.GetAttrSet().Get(RES_BOX);
1659  aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT));
1660  aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT));
1661 
1662  const SvxBoxItem* pBox = nullptr;
1663  if(nFrameType & FrameTypeFlags::HEADER)
1664  {
1665  rMaster.GetHeader();
1666  const SwFormatHeader& rHeaderFormat = rMaster.GetHeader();
1667  SwFrameFormat *pHeaderFormat = const_cast<SwFrameFormat*>(rHeaderFormat.GetHeaderFormat());
1668  if( pHeaderFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash
1669  pBox = & pHeaderFormat->GetBox();
1670  }
1671  else if(nFrameType & FrameTypeFlags::FOOTER )
1672  {
1673  const SwFormatFooter& rFooterFormat = rMaster.GetFooter();
1674  SwFrameFormat *pFooterFormat = const_cast<SwFrameFormat*>(rFooterFormat.GetFooterFormat());
1675  if( pFooterFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash
1676  pBox = & pFooterFormat->GetBox();
1677  }
1678  if(pBox)
1679  {
1680  aDistLR.SetLeft(pBox->GetDistance(SvxBoxItemLine::LEFT));
1681  aDistLR.SetRight(pBox->GetDistance(SvxBoxItemLine::RIGHT));
1682  }
1683 
1684  //add the border distance of the paragraph
1685  SfxItemSet aCoreSetTmp( GetPool(), svl::Items<RES_BOX, RES_BOX>{} );
1686  rSh.GetCurAttr( aCoreSetTmp );
1687  const SvxBoxItem& rParaBox = aCoreSetTmp.Get(RES_BOX);
1688  aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
1689  aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
1690  rSet.Put(aDistLR);
1691  m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1692  m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
1693  }
1694  }
1695  }
1696  break;
1697 
1698  case SID_RULER_TEXT_RIGHT_TO_LEFT:
1699  {
1700  if ( nSelType & SelectionType::Graphic ||
1701  nSelType & SelectionType::Frame ||
1702  nSelType & SelectionType::Ole ||
1703  nFrameType == FrameTypeFlags::DRAWOBJ)
1704  rSet.DisableItem(nWhich);
1705  else
1706  {
1707  bool bFlag = rSh.IsInRightToLeftText();
1708  rSet.Put(SfxBoolItem(nWhich, bFlag));
1709  }
1710  }
1711  break;
1712 
1713  case SID_RULER_BORDERS_VERTICAL:
1714  case SID_RULER_BORDERS:
1715  {
1716  bool bFrameHasVerticalColumns(false);
1717  {
1718  bool bFrameRTL;
1719  bool bFrameVertL2R;
1720  bFrameHasVerticalColumns = rSh.IsFrameVertical(false, bFrameRTL, bFrameVertL2R) &&
1721  bFrameSelection;
1722  }
1723  bool bHasTable = ( IsTabColFromDoc() ||
1724  ( rSh.GetTableFormat() && !bFrameSelection &&
1725  !(nFrameType & FrameTypeFlags::COLSECT ) ) );
1726 
1727  bool bTableVertical = bHasTable && rSh.IsTableVertical();
1728 
1729  if(((SID_RULER_BORDERS_VERTICAL == nWhich) &&
1730  ((bHasTable && !bTableVertical) ||
1731  (!bVerticalWriting && !bFrameSelection && !bHasTable ) ||
1732  ( bFrameSelection && !bFrameHasVerticalColumns))) ||
1733  ((SID_RULER_BORDERS == nWhich) &&
1734  ((bHasTable && bTableVertical) ||
1735  (bVerticalWriting && !bFrameSelection&& !bHasTable) || bFrameHasVerticalColumns)))
1736  rSet.DisableItem(nWhich);
1737  else if ( bHasTable )
1738  {
1739  SwTabCols aTabCols;
1740  size_t nNum = 0;
1742  if ( m_bSetTabColFromDoc )
1743  {
1744  rSh.GetMouseTabCols( aTabCols, m_aTabColFromDocPos );
1746  }
1747  else
1748  {
1749  rSh.GetTabCols( aTabCols );
1750  nNum = rSh.GetCurTabColNum();
1751  if(rSh.IsTableRightToLeft())
1752  nNum = aTabCols.Count() - nNum;
1753  }
1754 
1755  OSL_ENSURE(nNum <= aTabCols.Count(), "TabCol not found");
1756  const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
1757  const int nRgt = (bTableVertical ? nPageHeight : nPageWidth) -
1758  (aTabCols.GetLeftMin() + aTabCols.GetRight());
1759 
1760  const sal_uInt16 nL = static_cast< sal_uInt16 >(std::max(nLft, 0));
1761  const sal_uInt16 nR = static_cast< sal_uInt16 >(std::max(nRgt, 0));
1762 
1763  SvxColumnItem aColItem(nNum, nL, nR);
1764 
1765  long nStart = 0;
1766  long nEnd = 0;
1767 
1768  //columns in right-to-left tables need to be mirrored
1769  bool bIsTableRTL =
1770  IsTabColFromDoc() ?
1772  : rSh.IsTableRightToLeft();
1773  if(bIsTableRTL)
1774  {
1775  for ( size_t i = aTabCols.Count(); i; --i )
1776  {
1777  const SwTabColsEntry& rEntry = aTabCols.GetEntry( i - 1 );
1778  nEnd = aTabCols.GetRight() - rEntry.nPos;
1779  SvxColumnDescription aColDesc( nStart, nEnd,
1780  aTabCols.GetRight() - rEntry.nMax,
1781  aTabCols.GetRight() - rEntry.nMin,
1782  !aTabCols.IsHidden(i - 1) );
1783  aColItem.Append(aColDesc);
1784  nStart = nEnd;
1785  }
1786  SvxColumnDescription aColDesc(nStart,
1787  aTabCols.GetRight() - aTabCols.GetLeft(), true);
1788  aColItem.Append(aColDesc);
1789  }
1790  else
1791  {
1792  for ( size_t i = 0; i < aTabCols.Count(); ++i )
1793  {
1794  const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
1795  nEnd = rEntry.nPos - aTabCols.GetLeft();
1796  SvxColumnDescription aColDesc( nStart, nEnd,
1797  rEntry.nMin - aTabCols.GetLeft(), rEntry.nMax - aTabCols.GetLeft(),
1798  !aTabCols.IsHidden(i) );
1799  aColItem.Append(aColDesc);
1800  nStart = nEnd;
1801  }
1802  SvxColumnDescription aColDesc(nStart, aTabCols.GetRight() - aTabCols.GetLeft(),
1803  0, 0, true);
1804  aColItem.Append(aColDesc);
1805  }
1806  aColItem.SetWhich(nWhich);
1807  rSet.Put(aColItem);
1808  }
1809  else if ( bFrameSelection || nFrameType & ( FrameTypeFlags::COLUMN | FrameTypeFlags::COLSECT ) )
1810  {
1811  // Out of frame or page?
1812  sal_uInt16 nNum = 0;
1813  if(bFrameSelection)
1814  {
1815  const SwFrameFormat* pFormat = rSh.GetFlyFrameFormat();
1816  if(pFormat)
1817  nNum = pFormat->GetCol().GetNumCols();
1818  }
1819  else
1820  nNum = rSh.GetCurColNum();
1821 
1822  if(
1823  // For that matter FrameTypeFlags::COLSECT should not be included
1824  // if the border is selected!
1825  !bFrameSelection &&
1826  nFrameType & FrameTypeFlags::COLSECT )
1827  {
1828  const SwSection *pSect = rSh.GetAnySection(false, pPt);
1829  OSL_ENSURE( pSect, "Which section?");
1830  if( pSect )
1831  {
1832  SwSectionFormat const *pFormat = pSect->GetFormat();
1833  const SwFormatCol& rCol = pFormat->GetCol();
1834  if (rSh.IsColRightToLeft())
1835  nNum = rCol.GetColumns().size() - nNum;
1836  else
1837  --nNum;
1838  SvxColumnItem aColItem(nNum);
1839  SwRect aRect = rSh.GetAnyCurRect(CurRectType::SectionPrt, pPt);
1840  const SwRect aTmpRect = rSh.GetAnyCurRect(CurRectType::Section, pPt);
1841 
1842  ::lcl_FillSvxColumn(rCol, bVerticalWriting ? aRect.Height() : aRect.Width(), aColItem, 0);
1843 
1844  if(bVerticalWriting)
1845  {
1846  aRect.Pos() += Point(aTmpRect.Left(), aTmpRect.Top());
1847  aRect.Pos().AdjustY( -(rPageRect.Top()) );
1848  aColItem.SetLeft(aRect.Top());
1849  aColItem.SetRight(nPageHeight - aRect.Bottom());
1850  }
1851  else
1852  {
1853  aRect.Pos() += aTmpRect.Pos();
1854 
1855  // make relative to page position:
1856  aColItem.SetLeft (static_cast<sal_uInt16>( aRect.Left() - rPageRect.Left() ));
1857  aColItem.SetRight(static_cast<sal_uInt16>( rPageRect.Right() - aRect.Right()));
1858  }
1859  aColItem.SetOrtho(aColItem.CalcOrtho());
1860 
1861  aColItem.SetWhich(nWhich);
1862  rSet.Put(aColItem);
1863  }
1864  }
1865  else if( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY )
1866  {
1867  // Columns in frame
1868  if ( nNum )
1869  {
1870  const SwFrameFormat* pFormat = rSh.GetFlyFrameFormat() ;
1871 
1872  const SwFormatCol& rCol = pFormat->GetCol();
1873  if (rSh.IsColRightToLeft())
1874  nNum = rCol.GetColumns().size() - nNum;
1875  else
1876  nNum--;
1877  SvxColumnItem aColItem(nNum);
1878  const SwRect &rSizeRect = rSh.GetAnyCurRect(CurRectType::FlyEmbeddedPrt, pPt);
1879 
1880  bool bUseVertical = bFrameHasVerticalColumns || (!bFrameSelection && bVerticalWriting);
1881  const long lWidth = bUseVertical ? rSizeRect.Height() : rSizeRect.Width();
1882  const SwRect &rRect = rSh.GetAnyCurRect(CurRectType::FlyEmbedded, pPt);
1883  long nDist2 = ((bUseVertical ? rRect.Height() : rRect.Width()) - lWidth) /2;
1884  ::lcl_FillSvxColumn(rCol, lWidth, aColItem, nDist2);
1885 
1886  if(bUseVertical)
1887  {
1888  aColItem.SetLeft(rRect.Top()- rPageRect.Top());
1889  aColItem.SetRight(nPageHeight + rPageRect.Top() - rRect.Bottom());
1890  }
1891  else
1892  {
1893  aColItem.SetLeft(rRect.Left() - rPageRect.Left());
1894  aColItem.SetRight(rPageRect.Right() - rRect.Right());
1895  }
1896 
1897  aColItem.SetOrtho(aColItem.CalcOrtho());
1898 
1899  aColItem.SetWhich(nWhich);
1900  rSet.Put(aColItem);
1901  }
1902  else
1903  rSet.DisableItem(nWhich);
1904  }
1905  else
1906  { // Columns on the page
1907  const SwFrameFormat& rMaster = rDesc.GetMaster();
1908  SwFormatCol aCol(rMaster.GetCol());
1909  if(rFrameDir.GetValue() == SvxFrameDirection::Horizontal_RL_TB)
1910  nNum = aCol.GetColumns().size() - nNum;
1911  else
1912  nNum--;
1913 
1914  SvxColumnItem aColItem(nNum);
1915  const SwRect aPrtRect = rSh.GetAnyCurRect(CurRectType::PagePrt, pPt);
1916  const SvxBoxItem& rBox = rMaster.GetFormatAttr(RES_BOX);
1917  long nDist = rBox.GetSmallestDistance();
1918 
1920  aCol,
1921  bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width(),
1922  aColItem, nDist);
1923 
1924  if(bBrowse)
1925  {
1926  if (bVerticalWriting)
1927  {
1928  aColItem.SetLeft(static_cast<sal_uInt16>(rPagePrtRect.Top()));
1929  aColItem.SetRight(sal_uInt16(nPageHeight - rPagePrtRect.Bottom()));
1930  }
1931  else
1932  {
1933  aColItem.SetLeft(static_cast<sal_uInt16>(rPagePrtRect.Left()));
1934  aColItem.SetRight(sal_uInt16(nPageWidth - rPagePrtRect.Right()));
1935  }
1936  }
1937  else
1938  {
1939  if (bVerticalWriting)
1940  {
1941  SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
1942  aColItem.SetLeft (aUL.GetUpper());
1943  aColItem.SetRight(aUL.GetLower());
1944  }
1945  else
1946  {
1947  aColItem.SetLeft (aPageLRSpace.GetLeft());
1948  aColItem.SetRight(aPageLRSpace.GetRight());
1949  }
1950  }
1951  aColItem.SetOrtho(aColItem.CalcOrtho());
1952 
1953  aColItem.SetWhich(nWhich);
1954  rSet.Put(aColItem);
1955  }
1956  }
1957  else
1958  rSet.DisableItem(nWhich);
1959  break;
1960  }
1961 
1962  case SID_RULER_ROWS :
1963  case SID_RULER_ROWS_VERTICAL:
1964  {
1965  bool bFrameHasVerticalColumns(false);
1966  {
1967  bool bFrameRTL;
1968  bool bFrameVertL2R;
1969  bFrameHasVerticalColumns = rSh.IsFrameVertical(false, bFrameRTL, bFrameVertL2R) &&
1970  bFrameSelection;
1971  }
1972 
1973  if(((SID_RULER_ROWS == nWhich) &&
1974  ((!bVerticalWriting && !bFrameSelection) || (bFrameSelection && !bFrameHasVerticalColumns))) ||
1975  ((SID_RULER_ROWS_VERTICAL == nWhich) &&
1976  ((bVerticalWriting && !bFrameSelection) || bFrameHasVerticalColumns)))
1977  rSet.DisableItem(nWhich);
1978  else if ( IsTabRowFromDoc() ||
1979  ( rSh.GetTableFormat() && !bFrameSelection &&
1980  !(nFrameType & FrameTypeFlags::COLSECT ) ) )
1981  {
1982  SwTabCols aTabCols;
1984  if ( m_bSetTabRowFromDoc )
1985  {
1986  rSh.GetMouseTabRows( aTabCols, m_aTabColFromDocPos );
1987  }
1988  else
1989  {
1990  rSh.GetTabRows( aTabCols );
1991  }
1992 
1993  const int nLft = aTabCols.GetLeftMin();
1994  const int nRgt = (bVerticalWriting ? nPageWidth : nPageHeight) -
1995  (aTabCols.GetLeftMin() + aTabCols.GetRight());
1996 
1997  const sal_uInt16 nL = static_cast< sal_uInt16 >(std::max(nLft, 0));
1998  const sal_uInt16 nR = static_cast< sal_uInt16 >(std::max(nRgt, 0));
1999 
2000  SvxColumnItem aColItem(0, nL, nR);
2001 
2002  long nStart = 0;
2003  long nEnd = 0;
2004 
2005  for ( size_t i = 0; i < aTabCols.Count(); ++i )
2006  {
2007  const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
2008  if(bVerticalWriting)
2009  {
2010  nEnd = aTabCols.GetRight() - rEntry.nPos;
2011  SvxColumnDescription aColDesc( nStart, nEnd,
2012  std::max(0L, aTabCols.GetRight() - rEntry.nMax),
2013  std::max(0L, aTabCols.GetRight() - rEntry.nMin),
2014  !aTabCols.IsHidden(i) );
2015  aColItem.Append(aColDesc);
2016  }
2017  else
2018  {
2019  nEnd = rEntry.nPos - aTabCols.GetLeft();
2020  SvxColumnDescription aColDesc( nStart, nEnd,
2021  rEntry.nMin - aTabCols.GetLeft(),
2022  rEntry.nMax - aTabCols.GetLeft(),
2023  !aTabCols.IsHidden(i) );
2024  aColItem.Append(aColDesc);
2025  }
2026  nStart = nEnd;
2027  }
2028  if(bVerticalWriting)
2029  nEnd = aTabCols.GetRight();
2030  else
2031  nEnd = aTabCols.GetLeft();
2032 
2033  SvxColumnDescription aColDesc( nStart, nEnd,
2034  aTabCols.GetRight(),
2035  aTabCols.GetRight(),
2036  false );
2037  aColItem.Append(aColDesc);
2038 
2039  aColItem.SetWhich(nWhich);
2040  rSet.Put(aColItem);
2041  }
2042  else
2043  rSet.DisableItem(nWhich);
2044  }
2045  break;
2046 
2047  case SID_RULER_PAGE_POS:
2048  {
2049  SvxPagePosSizeItem aPagePosSize(
2050  Point( rPageRect.Left(), rPageRect.Top()) , nPageWidth, nPageHeight);
2051 
2052  rSet.Put(aPagePosSize);
2053  break;
2054  }
2055 
2056  case SID_RULER_LR_MIN_MAX:
2057  {
2058  tools::Rectangle aRectangle;
2059  if( ( nFrameType & FrameTypeFlags::COLSECT ) && !IsTabColFromDoc() &&
2060  ( nFrameType & ( FrameTypeFlags::TABLE|FrameTypeFlags::COLUMN ) ) )
2061  {
2062  if( nFrameType & FrameTypeFlags::TABLE )
2063  {
2064  const size_t nNum = rSh.GetCurTabColNum();
2065  SwTabCols aTabCols;
2066  rSh.GetTabCols( aTabCols );
2067 
2068  const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
2069  const int nRgt = nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight());
2070 
2071  const sal_uInt16 nL = static_cast< sal_uInt16 >(std::max(nLft, 0));
2072  const sal_uInt16 nR = static_cast< sal_uInt16 >(std::max(nRgt, 0));
2073 
2074  aRectangle.SetLeft( nL );
2075  if(nNum > 1)
2076  aRectangle.AdjustLeft(aTabCols[nNum - 2] );
2077  if(nNum)
2078  aRectangle.AdjustLeft(MINLAY );
2079  if(aTabCols.Count() <= nNum + 1 )
2080  aRectangle.SetRight( nR );
2081  else
2082  aRectangle.SetRight( nPageWidth - (nL + aTabCols[nNum + 1]) );
2083 
2084  if(nNum < aTabCols.Count())
2085  aRectangle.AdjustRight(MINLAY );
2086  }
2087  else
2088  {
2089  const SwFrameFormat* pFormat = rSh.GetFlyFrameFormat();
2090  const SwFormatCol* pCols = pFormat ? &pFormat->GetCol():
2091  &rDesc.GetMaster().GetCol();
2092  const SwColumns& rCols = pCols->GetColumns();
2093  sal_uInt16 nNum = rSh.GetCurOutColNum();
2094  const sal_uInt16 nCount = std::min(sal_uInt16(nNum + 1), sal_uInt16(rCols.size()));
2095  const SwRect aRect( rSh.GetAnyCurRect( pFormat
2097  : CurRectType::PagePrt, pPt ));
2098  const SwRect aAbsRect( rSh.GetAnyCurRect( pFormat
2100  : CurRectType::Page, pPt ));
2101 
2102  // The width of the frame or within the page margins.
2103  const sal_uInt16 nTotalWidth = static_cast<sal_uInt16>(aRect.Width());
2104  // The entire frame width - The difference is twice the distance to the edge.
2105  const sal_uInt16 nOuterWidth = static_cast<sal_uInt16>(aAbsRect.Width());
2106  int nWidth = 0,
2107  nEnd = 0;
2108  aRectangle.SetLeft( 0 );
2109  for ( sal_uInt16 i = 0; i < nCount; ++i )
2110  {
2111  const SwColumn* pCol = &rCols[i];
2112  const int nStart = pCol->GetLeft() + nWidth;
2113  if(i == nNum - 2)
2114  aRectangle.SetLeft( nStart );
2115  nWidth += pCols->CalcColWidth( i, nTotalWidth );
2116  nEnd = nWidth - pCol->GetRight();
2117  }
2118  aRectangle.SetRight( rPageRect.Right() - nEnd );
2119  aRectangle.AdjustLeft( -(rPageRect.Left()) );
2120 
2121  if(nNum > 1)
2122  {
2123  aRectangle.AdjustLeft(MINLAY );
2124  aRectangle.AdjustLeft(aRect.Left() );
2125  }
2126  if(pFormat) // Range in frame - here you may up to the edge
2127  {
2128  aRectangle.SetLeft(0);
2129  aRectangle.SetRight(0);
2130  }
2131  else
2132  {
2133  // Move the rectangle to the correct absolute position.
2134  aRectangle.AdjustLeft(aAbsRect.Left() );
2135  aRectangle.AdjustRight( -(aAbsRect.Left()) );
2136  // Include distance to the border.
2137  aRectangle.AdjustRight( -((nOuterWidth - nTotalWidth) / 2) );
2138  }
2139 
2140  if(nNum < rCols.size())
2141  {
2142  aRectangle.AdjustRight(MINLAY );
2143  }
2144  else
2145  // Right is only the margin now.
2146  aRectangle.SetRight( 0 );
2147 
2148  }
2149  }
2150  else if ( ((nFrameType & FrameTypeFlags::TABLE) || IsTabColFromDoc()) &&
2151  !bFrameSelection )
2152  {
2153  bool bColumn;
2154  if ( IsTabColFromDoc() )
2155  bColumn = rSh.GetCurMouseColNum( m_aTabColFromDocPos ) != 0;
2156  else
2158 
2159  if ( !bColumn )
2160  {
2161  if( nFrameType & FrameTypeFlags::FLY_ANY && IsTabColFromDoc() )
2162  {
2163  SwRect aRect( rSh.GetAnyCurRect(
2164  CurRectType::FlyEmbeddedPrt, pPt ) );
2165  aRect.Pos() += rSh.GetAnyCurRect( CurRectType::FlyEmbedded,
2166  pPt ).Pos();
2167 
2168  aRectangle.SetLeft( aRect.Left() - rPageRect.Left() );
2169  aRectangle.SetRight( rPageRect.Right() - aRect.Right() );
2170  }
2171  else if( bBrowse )
2172  {
2173  aRectangle.SetLeft( rPagePrtRect.Left() );
2174  aRectangle.SetRight( nPageWidth - rPagePrtRect.Right() );
2175  }
2176  else
2177  {
2178  aRectangle.SetLeft( aPageLRSpace.GetLeft() );
2179  aRectangle.SetRight( aPageLRSpace.GetRight() );
2180  }
2181  }
2182  else
2183  { // Here only for table in multi-column pages and borders.
2184  bool bSectOutTable = bool(nFrameType & FrameTypeFlags::TABLE);
2185  bool bFrame = bool(nFrameType & FrameTypeFlags::FLY_ANY);
2186  bool bColSct = bool(nFrameType & ( bSectOutTable
2188  : FrameTypeFlags::COLSECT )
2189  );
2190  //So you can also drag with the mouse, without being in the table.
2191  CurRectType eRecType = CurRectType::PagePrt;
2192  size_t nNum = IsTabColFromDoc() ?
2194  rSh.GetCurOutColNum();
2195  const SwFrameFormat* pFormat = nullptr;
2196  if( bColSct )
2197  {
2198  eRecType = bSectOutTable ? CurRectType::SectionOutsideTable
2200  const SwSection *pSect = rSh.GetAnySection( bSectOutTable, pPt );
2201  OSL_ENSURE( pSect, "Which section?");
2202  pFormat = pSect->GetFormat();
2203  }
2204  else if( bFrame )
2205  {
2206  pFormat = rSh.GetFlyFrameFormat();
2207  eRecType = CurRectType::FlyEmbeddedPrt;
2208  }
2209 
2210  const SwFormatCol* pCols = pFormat ? &pFormat->GetCol():
2211  &rDesc.GetMaster().GetCol();
2212  const SwColumns& rCols = pCols->GetColumns();
2213  const sal_uInt16 nBorder = pFormat
2214  ? pFormat->GetBox().GetSmallestDistance()
2215  : rDesc.GetMaster().GetBox().GetSmallestDistance();
2216 
2217  // RECT_FLY_PRT_EMBEDDED returns the relative position to RECT_FLY_EMBEDDED
2218  // the absolute position must be added here
2219 
2220  SwRect aRect( rSh.GetAnyCurRect( eRecType, pPt ) );
2221  if(CurRectType::FlyEmbeddedPrt == eRecType)
2222  aRect.Pos() += rSh.GetAnyCurRect( CurRectType::FlyEmbedded,
2223  pPt ).Pos();
2224 
2225  const sal_uInt16 nTotalWidth = static_cast<sal_uInt16>(aRect.Width());
2226  // Initialize nStart and nEnd for nNum == 0
2227  int nWidth = 0,
2228  nStart = 0,
2229  nEnd = nTotalWidth;
2230 
2231  if( nNum > rCols.size() )
2232  {
2233  OSL_ENSURE( false, "wrong FormatCol is being edited!" );
2234  nNum = rCols.size();
2235  }
2236 
2237  for( size_t i = 0; i < nNum; ++i )
2238  {
2239  const SwColumn* pCol = &rCols[i];
2240  nStart = pCol->GetLeft() + nWidth;
2241  nWidth += pCols->CalcColWidth( static_cast<sal_uInt16>(i), nTotalWidth );
2242  nEnd = nWidth - pCol->GetRight();
2243  }
2244  if( bFrame || bColSct )
2245  {
2246  aRectangle.SetLeft( aRect.Left() - rPageRect.Left() + nStart );
2247  aRectangle.SetRight( nPageWidth - aRectangle.Left() - nEnd + nStart );
2248  }
2249  else if(!bBrowse)
2250  {
2251  aRectangle.SetLeft( aPageLRSpace.GetLeft() + nStart );
2252  aRectangle.SetRight( nPageWidth - nEnd - aPageLRSpace.GetLeft() );
2253  }
2254  else
2255  {
2256  long nLeft = rPagePrtRect.Left();
2257  aRectangle.SetLeft( nStart + nLeft );
2258  aRectangle.SetRight( nPageWidth - nEnd - nLeft );
2259  }
2260  if(!bFrame)
2261  {
2262  aRectangle.AdjustLeft(nBorder );
2263  aRectangle.AdjustRight( -nBorder );
2264  }
2265  }
2266  }
2267  else if ( nFrameType & ( FrameTypeFlags::HEADER | FrameTypeFlags::FOOTER ))
2268  {
2269  aRectangle.SetLeft( aPageLRSpace.GetLeft() );
2270  aRectangle.SetRight( aPageLRSpace.GetRight() );
2271  }
2272  else
2273  {
2274  aRectangle.SetLeft(0);
2275  aRectangle.SetRight(0);
2276  }
2277 
2278  SfxRectangleItem aLR( SID_RULER_LR_MIN_MAX , aRectangle);
2279  rSet.Put(aLR);
2280  }
2281  break;
2282 
2283  case SID_RULER_PROTECT:
2284  {
2285  if(bFrameSelection)
2286  {
2288 
2289  SvxProtectItem aProt(SID_RULER_PROTECT);
2290  aProt.SetContentProtect(bool(nProtect & FlyProtectFlags::Content));
2291  aProt.SetSizeProtect (bool(nProtect & FlyProtectFlags::Size));
2292  aProt.SetPosProtect (bool(nProtect & FlyProtectFlags::Pos));
2293  rSet.Put(aProt);
2294  }
2295  else
2296  {
2297  SvxProtectItem aProtect(SID_RULER_PROTECT);
2298  if(bBrowse && !(nFrameType & (FrameTypeFlags::DRAWOBJ|FrameTypeFlags::COLUMN)) && !rSh.GetTableFormat())
2299  {
2300  aProtect.SetSizeProtect(true);
2301  aProtect.SetPosProtect(true);
2302  }
2303  rSet.Put(aProtect);
2304  }
2305  }
2306  break;
2307 
2308  case SID_ATTR_PAGE_HEADER:
2312  {
2313  const SwFormatHeader& rHeader = rDesc.GetMaster().GetHeader();
2314  bool bHeaderOn = rHeader.IsActive();
2315  rSet.Put( SfxBoolItem(SID_ATTR_PAGE_HEADER, bHeaderOn ) );
2316  if(bHeaderOn)
2317  {
2318  const SvxLRSpaceItem* rLR = static_cast<const SvxLRSpaceItem*>(
2319  rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_LRSPACE));
2320  const SvxULSpaceItem* rUL = static_cast<const SvxULSpaceItem*>(
2321  rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_ULSPACE));
2323  rSet.Put(aLR);
2325  rSet.Put(aUL);
2326 
2327  bool bShared = !rDesc.IsHeaderShared();
2328  bool bFirst = !rDesc.IsFirstShared(); // FIXME control changes for both header footer - tdf#100287
2329  sal_uInt16 nLayout = (static_cast<int>(bShared)<<1) + static_cast<int>(bFirst);
2330  SfxInt16Item aLayoutItem(SID_ATTR_PAGE_HEADER_LAYOUT, nLayout);
2331  rSet.Put(aLayoutItem);
2332  }
2333  }
2334  break;
2335  case SID_ATTR_PAGE_FOOTER:
2339  {
2340  const SwFormatFooter& rFooter = rDesc.GetMaster().GetFooter();
2341  bool bFooterOn = rFooter.IsActive();
2342  rSet.Put( SfxBoolItem(SID_ATTR_PAGE_FOOTER, bFooterOn ) );
2343  if(bFooterOn)
2344  {
2345  const SvxLRSpaceItem* rLR = rFooter.GetFooterFormat()->GetAttrSet().GetItem<SvxLRSpaceItem>(SID_ATTR_LRSPACE);
2346  const SvxULSpaceItem* rUL = rFooter.GetFooterFormat()->GetAttrSet().GetItem<SvxULSpaceItem>(SID_ATTR_ULSPACE);
2348  rSet.Put(aLR);
2349  SvxLongULSpaceItem aUL( rUL->GetUpper(), rUL->GetLower(), SID_ATTR_PAGE_FOOTER_SPACING);
2350  rSet.Put(aUL);
2351 
2352  bool bShared = !rDesc.IsFooterShared();
2353  bool bFirst = !rDesc.IsFirstShared(); // FIXME control changes for both header footer - tdf#100287
2354  sal_uInt16 nLayout = (static_cast<int>(bShared)<<1) + static_cast<int>(bFirst);
2355  SfxInt16Item aLayoutItem(SID_ATTR_PAGE_FOOTER_LAYOUT, nLayout);
2356  rSet.Put(aLayoutItem);
2357  }
2358  }
2359  break;
2360 
2361  case SID_ATTR_PAGE_COLOR:
2362  case SID_ATTR_PAGE_FILLSTYLE:
2363  case SID_ATTR_PAGE_GRADIENT:
2364  case SID_ATTR_PAGE_HATCH:
2365  case SID_ATTR_PAGE_BITMAP:
2366  {
2367  SfxItemSet aSet = rDesc.GetMaster().GetAttrSet();
2368  if (const auto pFillStyleItem = aSet.GetItem(XATTR_FILLSTYLE))
2369  {
2370  drawing::FillStyle eXFS = pFillStyleItem->GetValue();
2371  XFillStyleItem aFillStyleItem( eXFS );
2372  aFillStyleItem.SetWhich( SID_ATTR_PAGE_FILLSTYLE );
2373  rSet.Put(aFillStyleItem);
2374 
2375  switch(eXFS)
2376  {
2377  case drawing::FillStyle_SOLID:
2378  {
2379  if (const auto pItem = aSet.GetItem<XFillColorItem>(XATTR_FILLCOLOR, false))
2380  {
2381  Color aColor = pItem->GetColorValue();
2382  XFillColorItem aFillColorItem( OUString(), aColor );
2383  aFillColorItem.SetWhich( SID_ATTR_PAGE_COLOR );
2384  rSet.Put( aFillColorItem );
2385  }
2386  break;
2387  }
2388 
2389  case drawing::FillStyle_GRADIENT:
2390  {
2391  const XGradient& xGradient = aSet.GetItem<XFillGradientItem>( XATTR_FILLGRADIENT )->GetGradientValue();
2392  XFillGradientItem aFillGradientItem( OUString(), xGradient, SID_ATTR_PAGE_GRADIENT );
2393  rSet.Put( aFillGradientItem );
2394  }
2395  break;
2396 
2397  case drawing::FillStyle_HATCH:
2398  {
2399  const XFillHatchItem *pFillHatchItem( aSet.GetItem<XFillHatchItem>( XATTR_FILLHATCH ) );
2400  XFillHatchItem aFillHatchItem( pFillHatchItem->GetName(), pFillHatchItem->GetHatchValue());
2401  aFillHatchItem.SetWhich( SID_ATTR_PAGE_HATCH );
2402  rSet.Put( aFillHatchItem );
2403  }
2404  break;
2405 
2406  case drawing::FillStyle_BITMAP:
2407  {
2408  const XFillBitmapItem *pFillBitmapItem = aSet.GetItem<XFillBitmapItem>( XATTR_FILLBITMAP );
2409  XFillBitmapItem aFillBitmapItem( pFillBitmapItem->GetName(), pFillBitmapItem->GetGraphicObject() );
2410  aFillBitmapItem.SetWhich( SID_ATTR_PAGE_BITMAP );
2411  rSet.Put( aFillBitmapItem );
2412  }
2413  break;
2414  case drawing::FillStyle_NONE:
2415  {
2416  }
2417  break;
2418 
2419  default:
2420  break;
2421  }
2422  }
2423  break;
2424  }
2425 
2426  }
2427  nWhich = aIter.NextWhich();
2428  }
2429 }
2430 
2431 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long GetLeft() const
SfxViewFrame * GetViewFrame() const
const int nColCount
void SetMouseTabCols(const SwTabCols &rNew, bool bCurRowOnly, const Point &rPt)
Definition: fetab.cxx:2036
sal_uInt16 m_nRightBorderDistance
Definition: view.hxx:223
void SetWishWidth(sal_uInt16 nNew)
Definition: fmtclds.hxx:134
bool Insert(const SvxTabStop &rTab)
#define RES_FRM_SIZE
Definition: hintids.hxx:289
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:245
#define RES_COL
Definition: hintids.hxx:309
#define SID_ATTR_PAGE_HEADER_LRMARGIN
Definition: cmdid.h:848
#define XATTR_FILLHATCH
bool IsTabRowFromDoc() const
Definition: view.hxx:434
sal_Int32 nIndex
size_t GetSectionFormatPos(const SwSectionFormat &) const
Definition: edsect.cxx:135
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:168
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
bool IsInVerticalText(const Point *pPt=nullptr) const
Definition: crsrsh.cxx:3384
Rect of current FlyFrame.
sal_uInt16 Count() const
Marks a position in the document model.
Definition: pam.hxx:35
#define SID_ATTR_PAGE_HEADER
Definition: cmdid.h:847
std::vector< SwColumn > SwColumns
Definition: fmtclds.hxx:57
long GetLeftMarginWithNum(bool bTextLeft=false) const
Returns the additional indents of this text node and its numbering.
Definition: ndtxt.cxx:3152
sal_uInt16 GetLower() const
bool IsOrtho() const
Definition: fmtclds.hxx:121
constexpr WinBits WB_EXTRAFIELD
#define SID_ATTR_PAGE_HEADER_LAYOUT
Definition: cmdid.h:850
#define SID_ATTR_PAGE_COLUMN
Definition: cmdid.h:846
const char aData[]
Definition: ww8scan.hxx:47
void SetState(const SfxItemSet &rSet)
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
void ChgHeaderShare(bool bNew)
Definition: pagedesc.hxx:306
#define RES_HORI_ORIENT
Definition: hintids.hxx:303
std::string GetValue
std::unique_ptr< SwWrtShell > m_pWrtShell
Definition: view.hxx:183
void SetLeft(sal_uInt16 nNew)
Definition: fmtclds.hxx:47
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:106
void Append(const SvxColumnDescription &rDesc)
long GetWidth() const
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
Definition: fews.cxx:90
VclPtr< SvxRuler > m_pHRuler
Definition: view.hxx:200
long AdjustLeft(long nHorzMoveDelta)
bool GetFirstLineOfsWithNum(short &rFirstOffset) const
Returns the combined first line indent of this text node and its numbering.
Definition: ndtxt.cxx:3195
long GetLeftMin() const
Definition: tabcol.hxx:76
sal_uInt16 GetCurColNum(SwGetCurColNumPara *pPara=nullptr) const
The ruler needs some information too.
Definition: fews.cxx:682
#define MINLAY
Definition: swtypes.hxx:66
const SvxFrameDirectionItem & GetFrameDir(bool=true) const
Definition: frmatr.hxx:94
void SetRight(sal_uInt16 nNew)
Definition: fmtclds.hxx:48
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1708
#define XATTR_FILLGRADIENT
void GetTabRows(SwTabCols &rToFill) const
Definition: fetab.cxx:650
void Height(long nNew)
Definition: swrect.hxx:189
void InvalidateItem(sal_uInt16 nWhich)
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
void GetPageNum(sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, bool bAtCursorPos=true, const bool bCalcFrame=true)
Definition: crsrsh.cxx:1200
sal_uInt16 FirstWhich()
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2578
SW_DLLPUBLIC SwTwips GetTabDist(const SvxTabStopItem &rTabs)
Definition: uitool.cxx:594
void SetTextLeft(const long nL, const sal_uInt16 nProp=100)
long SwTwips
Definition: swtypes.hxx:49
SwSectionFormat * GetFormat()
Definition: section.hxx:337
void StateTabWin(SfxItemSet &)
Definition: viewtab.cxx:1267
void Pos(const Point &rNew)
Definition: swrect.hxx:167
void SetLeft(long aLeft)
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
void AutoUpdatePara(SwTextFormatColl *pColl, const SfxItemSet &rStyleSet, SwPaM *pPaM=nullptr)
Definition: wrtsh1.cxx:1573
const SfxItemSet * GetArgs() const
bool IsDirectlyInSection() const
Definition: fews.cxx:230
void GetMouseTabCols(SwTabCols &rToFill, const Point &rPt) const
Definition: fetab.cxx:2029
void EndAllAction()
Definition: edws.cxx:96
CurRectType
Definition: fesh.hxx:135
UseOnPage GetUseOn() const
Definition: pagedesc.hxx:332
size_t GetMousePageDesc(const Point &rPt) const
Definition: fedesc.cxx:147
const SwTabColsEntry & GetEntry(size_t nPos) const
Definition: tabcol.hxx:73
#define XATTR_FILLCOLOR
sal_uInt16 NextWhich()
sal_uInt16 GetCurMouseColNum(const Point &rPt) const
Definition: fetab.cxx:2049
long GetRight() const
Definition: tabcol.hxx:78
void SetOrtho(bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This too re-arranges columns automatically if flag is set.
Definition: atrfrm.cxx:960
SwWrtShell & GetWrtShell() const
Definition: view.hxx:400
const SvxBoxItem & GetBox(bool=true) const
Definition: frmatr.hxx:84
bool IsActive() const
Definition: fmthdft.hxx:89
const SwSection * GetCurrSection() const
Definition: edsect.cxx:70
void UpdateSection(size_t const nSect, SwSectionData &, SfxItemSet const *const =nullptr)
Definition: edsect.cxx:155
#define SID_ATTR_PAGE_FOOTER_SPACING
Definition: cmdid.h:853
#define SID_ATTR_PAGE_FOOTER_LAYOUT
Definition: cmdid.h:854
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
bool IsTableVertical() const
Definition: fetab.cxx:2315
sal_Int64 WinBits
void SetLeft(const long nL, const sal_uInt16 nProp=100)
void SetValues(RulerChangeType type, long value)
Rect of current PrtArea of section.
void Top(const long nTop)
Definition: swrect.hxx:202
void SetHoriOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:89
void Remove(const sal_uInt16 nPos, const sal_uInt16 nLen=1)
static void lcl_EraseDefTabs(SvxTabStopItem &rTabStops)
Definition: viewtab.cxx:145
bool getBrowseMode() const
Definition: viewopt.hxx:444
bool IsTableRightToLeft() const
Definition: fetab.cxx:2298
void SetRight(long lArgRight)
#define RES_PARATR_TABSTOP
Definition: hintids.hxx:260
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
int nCount
static void lcl_ConvertToCols(const SvxColumnItem &rColItem, long nTotalWidth, SwFormatCol &rCols)
Definition: viewtab.cxx:103
#define RES_UL_SPACE
Definition: hintids.hxx:292
long GetRight() const
SwTextNode * m_pNumRuleNodeFromDoc
Definition: view.hxx:177
long GetLower() const
void Right(const long nRight)
Definition: swrect.hxx:198
bool IsHidden(size_t nPos) const
Definition: tabcol.hxx:66
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
SfxItemPool & GetPool() const
const GraphicObject & GetGraphicObject() const
const XHatch & GetHatchValue() const
bool m_bSetTabColFromDoc
Definition: view.hxx:229
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1018
SwSection * GetAnySection(bool bOutOfTab=false, const Point *pPt=nullptr)
Deliver the responsible area of the columns.
Definition: edsect.cxx:82
bool IsHeaderShared() const
Definition: pagedesc.hxx:298
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:614
bool CalcOrtho() const
void SetRight(const long nR, const sal_uInt16 nProp=100)
sal_uInt16 m_nLeftBorderDistance
Definition: view.hxx:222
virtual SvxTabStopItem * Clone(SfxItemPool *pPool=nullptr) const override
void SetTabCols(const SwTabCols &rNew, bool bCurRowOnly)
Definition: fetab.cxx:615
Style of a layout element.
Definition: frmfmt.hxx:57
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Query default attribute of document.
Definition: edatmisc.cxx:93
#define SID_ATTR_PAGE_FOOTER
Definition: cmdid.h:851
bool IsInRightToLeftText() const
Definition: crsrsh.cxx:3391
Rect of current PrtArea of page.
sal_Int16 GetValue() const
OptionalString sType
size_t GetCurMouseTabColNum(const Point &rPt) const
Definition: fetab.cxx:2054
static void lcl_FillSvxColumn(const SwFormatCol &rCol, long nTotalWidth, SvxColumnItem &rColItem, long nDistance)
Definition: viewtab.cxx:64
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SwColumns & GetColumns() const
Definition: fmtclds.hxx:112
Rect of current section but outside of table.
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
void SetVertOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:56
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
Definition: crsrsh.cxx:232
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2229
#define RES_VERT_ORIENT
Definition: hintids.hxx:302
void SetTabRows(const SwTabCols &rNew, bool bCurColOnly)
Definition: fetab.cxx:666
void ChgFirstShare(bool bNew)
Definition: pagedesc.cxx:381
void SetTabsRelativeToIndent(bool bRel)
void ChgFooterShare(bool bNew)
Definition: pagedesc.hxx:313
SfxBindings & GetBindings()
int i
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:112
void SetLeft(long nNew)
Definition: tabcol.hxx:82
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:125
bool SetFlyFrameAttr(SfxItemSet &rSet)
Definition: fefly1.cxx:1061
sal_uInt16 CalcColWidth(sal_uInt16 nCol, sal_uInt16 nAct) const
Calculates current width of column nCol.
Definition: atrfrm.cxx:967
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:62
void SetRight(long v)
#define SID_ATTR_PAGE_FOOTER_LRMARGIN
Definition: cmdid.h:852
FlyProtectFlags
values can be combined via logical or
Definition: fesh.hxx:104
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
long const nBorder
SAL_DLLPRIVATE void SwapPageMargin(const SwPageDesc &, SvxLRSpaceItem &rLR)
Definition: viewtab.cxx:162
short GetTextFirstLineOffset() const
void GetMouseTabRows(SwTabCols &rToFill, const Point &rPt) const
Definition: fetab.cxx:684
bool IsFooterShared() const
Definition: pagedesc.hxx:302
void GetTabCols(SwTabCols &rToFill) const
Info about columns and margins.
Definition: fetab.cxx:633
static void ResizeFrameCols(SwFormatCol &rCol, long nOldWidth, long nNewWidth, long nLeftDelta)
Definition: viewtab.cxx:183
#define XATTR_FILLSTYLE
bool IsAutoUpdateFormat() const
Query / set bAutoUpdateFormat-flag.
Definition: format.hxx:168
void SetObjRect(const SwRect &rRect)
Set size of draw objects.
Definition: fefly1.cxx:1267
SW_DLLPUBLIC void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem &rTabs)
Definition: uitool.cxx:582
VclPtr< SvxRuler > m_pVRuler
Definition: view.hxx:200
Frame cannot be moved in Var-direction.
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:182
bool m_bTabRowFromDoc
Definition: view.hxx:229
long GetRight() const
sal_uInt16 Count() const
void CalcBoundRect(SwRect &_orRect, const RndStdIds _nAnchorId, const sal_Int16 _eHoriRelOrient=css::text::RelOrientation::FRAME, const sal_Int16 _eVertRelOrient=css::text::RelOrientation::FRAME, const SwPosition *_pToCharContentPos=nullptr, const bool _bFollowTextFlow=false, bool _bMirror=false, Point *_opRef=nullptr, Size *_opPercent=nullptr, const SwFormatFrameSize *pFormatFrameSize=nullptr) const
i#17567 - adjustments to allow negative vertical positions for fly frames anchored to paragraph or to...
Definition: fews.cxx:732
#define RES_LR_SPACE
Definition: hintids.hxx:291
Rect of current page.
void StartAction()
Definition: crsrsh.cxx:215
SelectionType
Definition: wrtsh.hxx:58
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
bool IsColRightToLeft() const
Definition: fews.cxx:627
sal_uInt16 GetWishWidth() const
Definition: fmtclds.hxx:122
void Left(const long nLeft)
Definition: swrect.hxx:193
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:217
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void Bottom(const long nBottom)
Definition: swrect.hxx:207
sal_uInt16 GetSlot() const
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:76
void SetSizeProtect(bool bNew)
sal_uInt16 GetWishWidth() const
Definition: fmtclds.hxx:50
void SetWishWidth(sal_uInt16 nNew)
Definition: fmtclds.hxx:46
SfxItemState
void DisableItem(sal_uInt16 nWhich)
bool IsFrameVertical(const bool bEnvironment, bool &bRightToLeft, bool &bVertL2R) const
Determines whether a frame or its environment is vertically formatted and right-to-left.
Definition: fews.cxx:1298
void SetPosProtect(bool bNew)
long AdjustRight(long nHorzMoveDelta)
sal_uInt16 GetRight() const
Definition: fmtclds.hxx:52
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
bool IsTabColFromDoc() const
Definition: view.hxx:432
void SetHidden(size_t nPos, bool bValue)
Definition: tabcol.hxx:67
long GetLeft() const
unsigned char sal_uInt8
void LockView(bool b)
Definition: viewsh.hxx:465
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
void Width(long nNew)
Definition: swrect.hxx:185
sal_uInt16 GetCurOutColNum() const
Current outer column.
Definition: fews.cxx:688
static SfxViewShell * Get(const css::uno::Reference< css::frame::XController > &i_rController)
static void lcl_Scale(long &nVal, long nScale)
Definition: viewtab.cxx:177
SwRect GetObjRect() const
For adjustment of PosAttr when anchor changes.
Definition: fefly1.cxx:1256
void ChgPageDesc(size_t i, const SwPageDesc &)
Definition: fedesc.cxx:110
Point m_aTabColFromDocPos
Definition: view.hxx:176
bool IsMouseTableRightToLeft(const Point &rPt) const
Definition: fetab.cxx:2307
size_t IsObjSelected() const
Definition: feshview.cxx:1150
bool m_bSetTabRowFromDoc
Definition: view.hxx:229
void UnSelectFrame()
Definition: select.cxx:322
void SetRight(long aRight)
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:377
Rect of current header/footer.
bool m_bTabColFromDoc
Definition: view.hxx:229
ColumnDescriptor.
Definition: fmtclds.hxx:33
long Left() const
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:176
SvxRuler & GetHRuler()
Definition: view.hxx:481
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
void GetTabBorders(SfxItemSet &rSet) const
Definition: fetab.cxx:771
long GetRight() const
void LeaveSelFrameMode()
Definition: select.cxx:719
sal_uInt16 GetLeft() const
Definition: fmtclds.hxx:51
void SetDefTabDist(long)
#define RES_BOX
Definition: hintids.hxx:306
sal_uInt16 GetNumCols() const
Definition: fmtclds.hxx:114
#define XATTR_FILLBITMAP
void SetLeft(long v)
const SwFrameFormat * GetFlyFrameFormat() const
Get FlyFrameFormat; for UI macro linkage at Flys.
Definition: fefly1.cxx:1228
OUString const & GetName() const
Rect of current section.
void SetContentProtect(bool bNew)
void SetSectionAttr(const SfxItemSet &rSet, SwSectionFormat *pSectFormat=nullptr)
Set attributes.
Definition: edsect.cxx:170
bool IsFirstShared() const
Definition: pagedesc.cxx:376
long GetLeft() const
void ExecTabWin(SfxRequest const &)
Definition: viewtab.cxx:224
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
long GetUpper() const
bool IsActive() const
Definition: fmthdft.hxx:58
void SetNumRuleNodeFromDoc(SwTextNode *pNumRuleNode)
Definition: view.hxx:436
void SetIndent(short nIndent, const SwPosition &rPos)
Definition: ednumber.cxx:361
void SetMouseTabRows(const SwTabCols &rNew, bool bCurColOnly, const Point &rPt)
Definition: fetab.cxx:691
void Init(sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This function allows to (repeatedly) initialize the columns.
Definition: atrfrm.cxx:945
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1388
void SetOrtho(bool bVal)
sal_uInt16 GetSmallestDistance() const
void StartAllAction()
For all views of this document.
Definition: edws.cxx:85
long GetHeight() const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
void SetRight(long nNew)
Definition: tabcol.hxx:83
long GetTextLeft() const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
void SetHeightSizeType(SwFrameSize eSize)
Definition: fmtfsize.hxx:81
size_t GetCurPageDesc(const bool bCalcFrame=true) const
Definition: fedesc.cxx:166
#define SID_ATTR_PAGE_HEADER_SPACING
Definition: cmdid.h:849
size_t GetCurTabColNum() const
Definition: fetab.cxx:1316
Rect of PrtArea of FlyFrame.
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:236
bool IsFrameSelected() const
Definition: feshview.cxx:1158
bool IsViewLocked() const
Definition: viewsh.hxx:464
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
long GetLeft() const
Definition: tabcol.hxx:77
size_t Count() const
Definition: tabcol.hxx:64
sal_uInt16 GetUpper() const
void SetLeft(long lArgLeft)
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74