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