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