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