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 = static_cast<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() - static_cast<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(static_cast<sal_uInt16>(nVal));
208  nVal = pCol->GetLeft();
209  lcl_Scale(nVal, nScale);
210  pCol->SetLeft(static_cast<sal_uInt16>(nVal));
211  nVal = pCol->GetRight();
212  lcl_Scale(nVal, nScale);
213  pCol->SetRight(static_cast<sal_uInt16>(nVal));
214  }
215  lcl_Scale(nNewWishWidth, nScale);
216  lcl_Scale(nWishDiff, nScale);
217  }
218  rCol.SetWishWidth( static_cast<sal_uInt16>(nNewWishWidth) );
219 
220  if( nLeftDelta >= 2 || nLeftDelta <= -2)
221  rArr.front().SetWishWidth(rArr.front().GetWishWidth() + static_cast<sal_uInt16>(nWishDiff));
222  else
223  rArr.back().SetWishWidth(rArr.back().GetWishWidth() + static_cast<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);
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);
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( static_cast<sal_uInt16>(aLongULSpace.GetUpper()) );
514  else
515  aUL.SetLower( static_cast<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(static_cast<sal_uInt16>(aLongULSpace.GetUpper()));
535  aUL.SetLower(static_cast<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(static_cast<sal_uInt16>(aLongULSpace.GetUpper()));
554  aUL.SetLower(static_cast<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
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  {
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 
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  {
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  {
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
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  {
778  aSet.Put(aParaMargin);
779  rSh.AutoUpdatePara( pColl, aSet);
780  }
781  else
782  rSh.SetAttrItem( aParaMargin );
783 
784  if ( aParaMargin.GetTextFirstLineOffset() < 0 )
785  {
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  {
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  {
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  {
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;
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  auto & rEntry = aTabCols.GetEntry(0);
1110  tools::Long nNewPosition = aTabCols.GetLeft() + tools::Long(nOffset);
1111  tools::Long nPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
1112  aTabCols.SetLeft(nPosition);
1113  }
1114  else if (sType == "column-right")
1115  {
1116  auto & rEntry = aTabCols.GetEntry(aTabCols.Count() - 1);
1117  tools::Long nNewPosition = aTabCols.GetRight() + tools::Long(nOffset);
1118  tools::Long nPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
1119  aTabCols.SetRight(nPosition);
1120  }
1121  else if (sType == "column-middle" && nIndex < aTabCols.Count())
1122  {
1123  auto & rEntry = aTabCols.GetEntry(nIndex);
1124  tools::Long nNewPosition = rEntry.nPos + tools::Long(nOffset);
1125  tools::Long nPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
1126  rEntry.nPos = nPosition;
1127  }
1128 
1129  rSh.SetTabCols(aTabCols, false);
1130  }
1131  else if (sType.startsWith("row"))
1132  {
1133  SwTabCols aTabRows;
1134  rSh.GetTabRows(aTabRows);
1135 
1136  if (sType == "row-left")
1137  {
1138  auto & rEntry = aTabRows.GetEntry(0);
1139  tools::Long nNewPosition = aTabRows.GetLeft() + tools::Long(nOffset);
1140  tools::Long nPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
1141  aTabRows.SetLeft(nPosition);
1142  }
1143  else if (sType == "row-right")
1144  {
1145  auto & rEntry = aTabRows.GetEntry(aTabRows.Count() - 1);
1146  tools::Long nNewPosition = aTabRows.GetRight() + tools::Long(nOffset);
1147  tools::Long nPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
1148  aTabRows.SetRight(nPosition);
1149  }
1150  else if (sType == "row-middle" && nIndex < aTabRows.Count())
1151  {
1152  auto & rEntry = aTabRows.GetEntry(nIndex);
1153  tools::Long nNewPosition = rEntry.nPos + tools::Long(nOffset);
1154  tools::Long nPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
1155  rEntry.nPos = nPosition;
1156  }
1157 
1158  rSh.SetTabRows(aTabRows, false);
1159  }
1160  }
1161  }
1162  }
1163  break;
1164  case SID_ATTR_PAGE_HEADER:
1165  {
1166  if ( pReqArgs )
1167  {
1168  const bool bHeaderOn = static_cast<const SfxBoolItem&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER)).GetValue();
1169  SwPageDesc aDesc(rDesc);
1170  SwFrameFormat &rMaster = aDesc.GetMaster();
1171  rMaster.SetFormatAttr( SwFormatHeader( bHeaderOn ));
1172  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1173  }
1174  }
1175  break;
1177  {
1178  if ( pReqArgs && rDesc.GetMaster().GetHeader().IsActive() )
1179  {
1180  const SvxLongLRSpaceItem& aLongLR = static_cast<const SvxLongLRSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER_LRMARGIN));
1182  SwPageDesc aDesc(rDesc);
1183  aLR.SetLeft(aLongLR.GetLeft());
1184  aLR.SetRight(aLongLR.GetRight());
1185  SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetHeader().GetHeaderFormat());
1186  pFormat->SetFormatAttr( aLR );
1187  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1188  }
1189  }
1190  break;
1192  {
1193  if ( pReqArgs && rDesc.GetMaster().GetHeader().IsActive())
1194  {
1195  const SvxLongULSpaceItem& aLongUL = static_cast<const SvxLongULSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER_SPACING));
1196  SwPageDesc aDesc(rDesc);
1197  SvxULSpaceItem aUL(0, aLongUL.GetLower(), RES_UL_SPACE );
1198  SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetHeader().GetHeaderFormat());
1199  pFormat->SetFormatAttr( aUL );
1200  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1201  }
1202  }
1203  break;
1205  {
1206  if ( pReqArgs && rDesc.GetMaster().GetHeader().IsActive())
1207  {
1208  const SfxInt16Item& aLayoutItem = static_cast<const SfxInt16Item&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER_LAYOUT));
1209  sal_uInt16 nLayout = aLayoutItem.GetValue();
1210  SwPageDesc aDesc(rDesc);
1211  aDesc.ChgHeaderShare((nLayout>>1) == 0);
1212  aDesc.ChgFirstShare((nLayout % 2) == 0); // FIXME control changes for both header footer - tdf#100287
1213  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1214  }
1215  }
1216  break;
1217  case SID_ATTR_PAGE_FOOTER:
1218  {
1219  if ( pReqArgs )
1220  {
1221  const bool bFooterOn = static_cast<const SfxBoolItem&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER)).GetValue();
1222  SwPageDesc aDesc(rDesc);
1223  SwFrameFormat &rMaster = aDesc.GetMaster();
1224  rMaster.SetFormatAttr( SwFormatFooter( bFooterOn ));
1225  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1226  }
1227  }
1228  break;
1230  {
1231  if ( pReqArgs && rDesc.GetMaster().GetFooter().IsActive() )
1232  {
1233  const SvxLongLRSpaceItem& aLongLR = static_cast<const SvxLongLRSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER_LRMARGIN));
1235  SwPageDesc aDesc(rDesc);
1236  aLR.SetLeft(aLongLR.GetLeft());
1237  aLR.SetRight(aLongLR.GetRight());
1238  SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetFooter().GetFooterFormat());
1239  pFormat->SetFormatAttr( aLR );
1240  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1241  }
1242  }
1243  break;
1245  {
1246  if ( pReqArgs && rDesc.GetMaster().GetFooter().IsActive())
1247  {
1248  const SvxLongULSpaceItem& aLongUL = static_cast<const SvxLongULSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER_SPACING));
1249  SwPageDesc aDesc(rDesc);
1250  SvxULSpaceItem aUL(aLongUL.GetUpper(), 0, RES_UL_SPACE );
1251  SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetFooter().GetFooterFormat());
1252  pFormat->SetFormatAttr( aUL );
1253  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1254  }
1255  }
1256  break;
1258  {
1259  if ( pReqArgs && rDesc.GetMaster().GetFooter().IsActive())
1260  {
1261  const SfxInt16Item& aLayoutItem = static_cast<const SfxInt16Item&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER_LAYOUT));
1262  sal_uInt16 nLayout = aLayoutItem.GetValue();
1263  SwPageDesc aDesc(rDesc);
1264  aDesc.ChgFooterShare((nLayout>>1) == 0);
1265  aDesc.ChgFirstShare((nLayout % 2) == 0); // FIXME control changes for both header footer - tdf#100287
1266  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1267  }
1268  }
1269  break;
1270 
1271  case SID_ATTR_PAGE_COLOR:
1272  case SID_ATTR_PAGE_FILLSTYLE:
1273  case SID_ATTR_PAGE_GRADIENT:
1274  case SID_ATTR_PAGE_HATCH:
1275  case SID_ATTR_PAGE_BITMAP:
1276  {
1277  if(pReqArgs)
1278  {
1279  SwPageDesc aDesc(rDesc);
1280  SwFrameFormat &rMaster = aDesc.GetMaster();
1281  switch (nSlot)
1282  {
1283  case SID_ATTR_PAGE_FILLSTYLE:
1284  {
1285  XFillStyleItem aFSItem( pReqArgs->Get( XATTR_FILLSTYLE ) );
1286  drawing::FillStyle eXFS = aFSItem.GetValue();
1287 
1288  if ( eXFS == drawing::FillStyle_NONE )
1289  rMaster.SetFormatAttr( XFillStyleItem( eXFS ) );
1290  }
1291  break;
1292 
1293  case SID_ATTR_PAGE_COLOR:
1294  {
1295  XFillColorItem aColorItem( pReqArgs->Get( XATTR_FILLCOLOR ) );
1296  rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_SOLID ) );
1297  rMaster.SetFormatAttr( aColorItem );
1298  }
1299  break;
1300 
1301  case SID_ATTR_PAGE_GRADIENT:
1302  {
1303  XFillGradientItem aGradientItem( pReqArgs->Get( XATTR_FILLGRADIENT ) );
1304  rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_GRADIENT ) );
1305  rMaster.SetFormatAttr( aGradientItem );
1306  }
1307  break;
1308 
1309  case SID_ATTR_PAGE_HATCH:
1310  {
1311  XFillHatchItem aHatchItem( pReqArgs->Get( XATTR_FILLHATCH ) );
1312  rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_HATCH ) );
1313  rMaster.SetFormatAttr( aHatchItem );
1314  }
1315  break;
1316 
1317  case SID_ATTR_PAGE_BITMAP:
1318  {
1319  XFillBitmapItem aBitmapItem( pReqArgs->Get( XATTR_FILLBITMAP ) );
1320  rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_BITMAP ) );
1321  rMaster.SetFormatAttr( aBitmapItem );
1322  }
1323  break;
1324 
1325  default:
1326  break;
1327  }
1328  rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
1329  }
1330  }
1331  break;
1332 
1333  default:
1334  OSL_ENSURE( false, "wrong SlotId");
1335  }
1336  rSh.EndAllAction();
1337 
1338  if( bUnlockView )
1339  rSh.LockView( false );
1340 
1342  SetNumRuleNodeFromDoc(nullptr);
1343 }
1344 
1345 // Here the status of the tab bar will be determined.
1346 // This means that all relevant attributes at the CursorPos
1347 // will be submitted to the tab bar.
1349 {
1350  SwWrtShell &rSh = GetWrtShell();
1351 
1352  const Point* pPt = IsTabColFromDoc() || IsTabRowFromDoc() ? &m_aTabColFromDocPos : nullptr;
1353  const FrameTypeFlags nFrameType = rSh.IsObjSelected()
1355  : rSh.GetFrameType( pPt, true );
1356 
1357  const bool bFrameSelection = rSh.IsFrameSelected();
1358  const bool bBrowse = rSh.GetViewOptions()->getBrowseMode();
1359  // PageOffset/limiter
1360  const SwRect& rPageRect = rSh.GetAnyCurRect( CurRectType::Page, pPt );
1361  const SwRect& rPagePrtRect = rSh.GetAnyCurRect( CurRectType::PagePrt, pPt );
1362  const tools::Long nPageWidth = rPageRect.Width();
1363  const tools::Long nPageHeight = rPageRect.Height();
1364 
1365  const SwPageDesc& rDesc = rSh.GetPageDesc(
1368 
1369  const SvxFrameDirectionItem& rFrameDir = rDesc.GetMaster().GetFrameDir();
1370  const bool bVerticalWriting = rSh.IsInVerticalText();
1371 
1372  //enable tab stop display on the rulers depending on the writing direction
1373  WinBits nRulerStyle = m_pHRuler->GetStyle() & ~WB_EXTRAFIELD;
1374  m_pHRuler->SetStyle(bVerticalWriting||bBrowse ? nRulerStyle : nRulerStyle|WB_EXTRAFIELD);
1375  nRulerStyle = m_pVRuler->GetStyle() & ~WB_EXTRAFIELD;
1376  m_pVRuler->SetStyle(bVerticalWriting ? nRulerStyle|WB_EXTRAFIELD : nRulerStyle);
1377 
1378  //#i24363# tab stops relative to indent
1380  m_pHRuler->SetTabsRelativeToIndent( bRelative );
1381  m_pVRuler->SetTabsRelativeToIndent( bRelative );
1382 
1383  SvxLRSpaceItem aPageLRSpace( rDesc.GetMaster().GetLRSpace() );
1384  SwapPageMargin( rDesc, aPageLRSpace );
1385 
1387  RES_LR_SPACE, RES_UL_SPACE>{} );
1388  // get also the list level indent values merged as LR-SPACE item, if needed.
1389  rSh.GetCurAttr( aCoreSet, true );
1390  const SelectionType nSelType = rSh.GetSelectionType();
1391 
1392  SfxWhichIter aIter( rSet );
1393  sal_uInt16 nWhich = aIter.FirstWhich();
1394 
1395  while ( nWhich )
1396  {
1397  switch ( nWhich )
1398  {
1399 
1400  case SID_ATTR_PAGE_COLUMN:
1401  {
1402  sal_uInt16 nColumnType = 0;
1403 
1404  const SwFrameFormat& rMaster = rDesc.GetMaster();
1405  const SwFormatCol& aCol(rMaster.GetCol());
1406  const sal_uInt16 nCols = aCol.GetNumCols();
1407  if ( nCols == 0 )
1408  {
1409  nColumnType = 1;
1410  }
1411  else if ( nCols == 2 )
1412  {
1413  const sal_uInt16 nColLeft = aCol.CalcPrtColWidth(0, aCol.GetWishWidth());
1414  const sal_uInt16 nColRight = aCol.CalcPrtColWidth(1, aCol.GetWishWidth());
1415 
1416  if ( abs(nColLeft - nColRight) <= 10 )
1417  {
1418  nColumnType = 2;
1419  }
1420  else if( abs(nColLeft - nColRight*2) < 20 )
1421  {
1422  nColumnType = 4;
1423  }
1424  else if( abs(nColLeft*2 - nColRight) < 20 )
1425  {
1426  nColumnType = 5;
1427  }
1428  }
1429  else if( nCols == 3 )
1430  {
1431  nColumnType = 3;
1432  }
1433  else
1434  nColumnType = nCols;
1435 
1436  rSet.Put( SfxInt16Item( SID_ATTR_PAGE_COLUMN, nColumnType ) );
1437  }
1438  break;
1439 
1440  case SID_ATTR_LONG_LRSPACE:
1441  {
1442  SvxLongLRSpaceItem aLongLR( aPageLRSpace.GetLeft(),
1443  aPageLRSpace.GetRight(),
1444  SID_ATTR_LONG_LRSPACE);
1445  if(bBrowse)
1446  {
1447  aLongLR.SetLeft(rPagePrtRect.Left());
1448  aLongLR.SetRight(nPageWidth - rPagePrtRect.Right());
1449  }
1450  if ( ( nFrameType & FrameTypeFlags::HEADER || nFrameType & FrameTypeFlags::FOOTER ) &&
1451  !(nFrameType & FrameTypeFlags::COLSECT) )
1452  {
1453  SwFrameFormat *pFormat = const_cast<SwFrameFormat*>((nFrameType & FrameTypeFlags::HEADER) ?
1454  rDesc.GetMaster().GetHeader().GetHeaderFormat() :
1455  rDesc.GetMaster().GetFooter().GetFooterFormat());
1456  if( pFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash
1457  {
1458  SwRect aRect( rSh.GetAnyCurRect( CurRectType::HeaderFooter, pPt));
1459  aRect.Pos() -= rSh.GetAnyCurRect( CurRectType::Page, pPt ).Pos();
1460  const SvxLRSpaceItem& aLR = pFormat->GetLRSpace();
1461  aLongLR.SetLeft ( aLR.GetLeft() + aRect.Left() );
1462  aLongLR.SetRight( nPageWidth - aRect.Right() + aLR.GetRight() );
1463  }
1464  }
1465  else
1466  {
1467  SwRect aRect;
1468  if( !bFrameSelection && ((nFrameType & FrameTypeFlags::COLSECT) || rSh.IsDirectlyInSection()) )
1469  {
1470  aRect = rSh.GetAnyCurRect(CurRectType::SectionPrt, pPt);
1471  const SwRect aTmpRect = rSh.GetAnyCurRect(CurRectType::Section, pPt);
1472  aRect.Pos() += aTmpRect.Pos();
1473  }
1474 
1475  else if ( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY )
1476  aRect = rSh.GetAnyCurRect(CurRectType::FlyEmbedded, pPt);
1477  else if( nFrameType & FrameTypeFlags::DRAWOBJ)
1478  aRect = rSh.GetObjRect();
1479 
1480  if( aRect.Width() )
1481  {
1482  // make relative to page position:
1483  aLongLR.SetLeft(aRect.Left() - rPageRect.Left());
1484  aLongLR.SetRight(rPageRect.Right() - aRect.Right());
1485  }
1486  }
1487  rSet.Put( aLongLR );
1488  }
1489  break;
1490 
1491  // provide left and right margins of current page style
1492  case SID_ATTR_PAGE_LRSPACE:
1493  {
1494  const SvxLRSpaceItem aTmpPageLRSpace( rDesc.GetMaster().GetLRSpace() );
1495  const SvxLongLRSpaceItem aLongLR(
1496  aTmpPageLRSpace.GetLeft(),
1497  aTmpPageLRSpace.GetRight(),
1498  SID_ATTR_PAGE_LRSPACE );
1499  rSet.Put( aLongLR );
1500  }
1501  break;
1502 
1503  case SID_ATTR_LONG_ULSPACE:
1504  {
1505  // Page margin top bottom
1506  SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
1507  SvxLongULSpaceItem aLongUL( static_cast<tools::Long>(aUL.GetUpper()),
1508  static_cast<tools::Long>(aUL.GetLower()),
1509  SID_ATTR_LONG_ULSPACE);
1510 
1511  if ( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY )
1512  {
1513  // Convert document coordinates into page coordinates.
1514  const SwRect &rRect = rSh.GetAnyCurRect(CurRectType::FlyEmbedded, pPt);
1515  aLongUL.SetUpper(rRect.Top() - rPageRect.Top());
1516  aLongUL.SetLower(rPageRect.Bottom() - rRect.Bottom());
1517  }
1518  else if ( nFrameType & FrameTypeFlags::HEADER || nFrameType & FrameTypeFlags::FOOTER )
1519  {
1520  SwRect aRect( rSh.GetAnyCurRect( CurRectType::HeaderFooter, pPt));
1521  aRect.Pos() -= rSh.GetAnyCurRect( CurRectType::Page, pPt ).Pos();
1522  aLongUL.SetUpper( aRect.Top() );
1523  aLongUL.SetLower( nPageHeight - aRect.Bottom() );
1524  }
1525  else if( nFrameType & FrameTypeFlags::DRAWOBJ)
1526  {
1527  const SwRect &rRect = rSh.GetObjRect();
1528  aLongUL.SetUpper(rRect.Top() - rPageRect.Top());
1529  aLongUL.SetLower(rPageRect.Bottom() - rRect.Bottom());
1530  }
1531  else if(bBrowse)
1532  {
1533  aLongUL.SetUpper(rPagePrtRect.Top());
1534  aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom());
1535  }
1536  rSet.Put( aLongUL );
1537  }
1538  break;
1539 
1540  // provide top and bottom margins of current page style
1541  case SID_ATTR_PAGE_ULSPACE:
1542  {
1543  const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
1544  SvxLongULSpaceItem aLongUL(
1545  static_cast<tools::Long>(aUL.GetUpper()),
1546  static_cast<tools::Long>(aUL.GetLower()),
1547  SID_ATTR_PAGE_ULSPACE );
1548 
1549  rSet.Put( aLongUL );
1550  }
1551  break;
1552 
1553  case SID_ATTR_TABSTOP_VERTICAL :
1554  case RES_PARATR_TABSTOP:
1555  {
1556  if ( dynamic_cast< const SwWebView *>( this ) != nullptr ||
1557  IsTabColFromDoc() ||
1558  IsTabRowFromDoc() ||
1559  ( nSelType & SelectionType::Graphic ) ||
1560  ( nSelType & SelectionType::Frame ) ||
1561  ( nSelType & SelectionType::Ole ) ||
1562  ( SfxItemState::DEFAULT > aCoreSet.GetItemState(RES_LR_SPACE) ) ||
1563  (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich) ) ||
1564  ( bVerticalWriting && (RES_PARATR_TABSTOP == nWhich))
1565  )
1566  rSet.DisableItem( nWhich );
1567  else
1568  {
1569  SvxTabStopItem aTabStops(aCoreSet.Get( RES_PARATR_TABSTOP ));
1570 
1571  const SvxTabStopItem& rDefTabs = rSh.GetDefault(RES_PARATR_TABSTOP);
1572 
1573  OSL_ENSURE(m_pHRuler, "why is there no ruler?");
1574  const tools::Long nDefTabDist = ::GetTabDist(rDefTabs);
1575  m_pHRuler->SetDefTabDist( nDefTabDist );
1576  m_pVRuler->SetDefTabDist( nDefTabDist );
1577  ::lcl_EraseDefTabs(aTabStops);
1578  aTabStops.SetWhich(nWhich);
1579  rSet.Put(aTabStops);
1580 
1582  {
1583  boost::property_tree::ptree aRootTree;
1584  boost::property_tree::ptree aEntries;
1585 
1586  for (sal_uInt16 i = 0; i < aTabStops.Count(); ++i)
1587  {
1588  SvxTabStop const & rTabStop = aTabStops[i];
1589  boost::property_tree::ptree aEntry;
1590  aEntry.put("position", convertTwipToMm100(rTabStop.GetTabPos()));
1591  aEntry.put("type", sal_uInt16(rTabStop.GetAdjustment()));
1592  aEntry.put("decimal", OUString(rTabStop.GetDecimal()));
1593  aEntry.put("fill", OUString(rTabStop.GetFill()));
1594  aEntries.push_back(std::make_pair("", aEntry));
1595  }
1596  aRootTree.push_back(std::make_pair("tabstops", aEntries));
1597 
1598  std::stringstream aStream;
1599  boost::property_tree::write_json(aStream, aRootTree);
1600  rSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TAB_STOP_LIST, aStream.str().c_str());
1601  }
1602  }
1603  break;
1604  }
1605 
1606  case SID_HANGING_INDENT:
1607  {
1608  SfxItemState e = aCoreSet.GetItemState(RES_LR_SPACE);
1609  if( e == SfxItemState::DISABLED )
1610  rSet.DisableItem(nWhich);
1611  break;
1612  }
1613 
1614  case SID_ATTR_PARA_LRSPACE_VERTICAL:
1615  case SID_ATTR_PARA_LRSPACE:
1616  case SID_ATTR_PARA_LEFTSPACE:
1617  case SID_ATTR_PARA_RIGHTSPACE:
1618  case SID_ATTR_PARA_FIRSTLINESPACE:
1619  {
1620  if ( nSelType & SelectionType::Graphic ||
1621  nSelType & SelectionType::Frame ||
1622  nSelType & SelectionType::Ole ||
1623  nFrameType == FrameTypeFlags::DRAWOBJ ||
1624  (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich)) ||
1625  ( bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich))
1626  )
1627  {
1628  rSet.DisableItem(nWhich);
1629  }
1630  else
1631  {
1632  std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE));
1633  if ( !IsTabColFromDoc() )
1634  {
1635  aLR.reset(aCoreSet.Get(RES_LR_SPACE).Clone());
1636 
1637  // #i23726#
1639  {
1640  short nOffset = static_cast< short >(aLR->GetTextLeft() +
1641  // #i42922# Mouse move of numbering label
1642  // has to consider the left indent of the paragraph
1644 
1645  short nFLOffset;
1647 
1648  aLR->SetLeft( nOffset + nFLOffset );
1649  }
1650  }
1651  aLR->SetWhich(nWhich);
1652  rSet.Put(*aLR);
1653  }
1654  break;
1655  }
1656 
1657  case SID_ATTR_PARA_ULSPACE:
1658  case SID_ATTR_PARA_ABOVESPACE:
1659  case SID_ATTR_PARA_BELOWSPACE:
1660  case SID_PARASPACE_INCREASE:
1661  case SID_PARASPACE_DECREASE:
1662  {
1663  SvxULSpaceItem aUL = aCoreSet.Get(RES_UL_SPACE);
1664  SfxItemState e = aCoreSet.GetItemState(RES_UL_SPACE);
1665  if( e >= SfxItemState::DEFAULT )
1666  {
1667  if ( !aUL.GetUpper() && !aUL.GetLower() )
1668  rSet.DisableItem( SID_PARASPACE_DECREASE );
1669  else if ( aUL.GetUpper() >= 5670 && aUL.GetLower() >= 5670 )
1670  rSet.DisableItem( SID_PARASPACE_INCREASE );
1671  if ( nWhich == SID_ATTR_PARA_ULSPACE
1672  || nWhich == SID_ATTR_PARA_ABOVESPACE
1673  || nWhich == SID_ATTR_PARA_BELOWSPACE
1674  )
1675  {
1676  aUL.SetWhich( nWhich );
1677  rSet.Put( aUL );
1678  }
1679  }
1680  else
1681  {
1682  rSet.DisableItem( SID_PARASPACE_INCREASE );
1683  rSet.DisableItem( SID_PARASPACE_DECREASE );
1684  rSet.InvalidateItem( SID_ATTR_PARA_ULSPACE );
1685  rSet.InvalidateItem( SID_ATTR_PARA_ABOVESPACE );
1686  rSet.InvalidateItem( SID_ATTR_PARA_BELOWSPACE );
1687  }
1688  }
1689  break;
1690 
1691  case SID_RULER_BORDER_DISTANCE:
1692  {
1695  if ( nSelType & SelectionType::Graphic ||
1696  nSelType & SelectionType::Frame ||
1697  nSelType & SelectionType::Ole ||
1698  nFrameType == FrameTypeFlags::DRAWOBJ )
1699  rSet.DisableItem(SID_RULER_BORDER_DISTANCE);
1700  else
1701  {
1702  SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE);
1703  if(nFrameType & FrameTypeFlags::FLY_ANY)
1704  {
1705  if( IsTabColFromDoc() )
1706  {
1707  const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( CurRectType::FlyEmbeddedPrt, pPt );
1708  aDistLR.SetLeft(rFlyPrtRect.Left());
1709  aDistLR.SetRight(rFlyPrtRect.Left());
1710  }
1711  else
1712  {
1713  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1714  aCoreSet.Put( aBoxInfo );
1715  rSh.GetFlyFrameAttr( aCoreSet );
1716  const SvxBoxItem& rBox = aCoreSet.Get(RES_BOX);
1717  aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT));
1718  aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT));
1719 
1720  //add the paragraph border distance
1722  rSh.GetCurAttr( aCoreSet1 );
1723  const SvxBoxItem& rParaBox = aCoreSet1.Get(RES_BOX);
1724  aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
1725  aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
1726  }
1727  rSet.Put(aDistLR);
1728  m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1729  m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
1730  }
1731  else if ( IsTabColFromDoc() ||
1732  ( rSh.GetTableFormat() && !bFrameSelection &&
1733  !(nFrameType & FrameTypeFlags::COLSECT ) ) )
1734  {
1735  SfxItemSet aCoreSet2( GetPool(),
1737  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>{} );
1738  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1739  aBoxInfo.SetTable(false);
1740  aBoxInfo.SetDist(true);
1741  aCoreSet2.Put(aBoxInfo);
1742  rSh.GetTabBorders( aCoreSet2 );
1743  const SvxBoxItem& rBox = aCoreSet2.Get(RES_BOX);
1744  aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT));
1745  aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT));
1746 
1747  //add the border distance of the paragraph
1749  rSh.GetCurAttr( aCoreSet1 );
1750  const SvxBoxItem& rParaBox = aCoreSet1.Get(RES_BOX);
1751  aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
1752  aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
1753  rSet.Put(aDistLR);
1754  m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1755  m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
1756  }
1757  else if ( !rSh.IsDirectlyInSection() )
1758  {
1759  //get the page/header/footer border distance
1760  const SwFrameFormat& rMaster = rDesc.GetMaster();
1761  const SvxBoxItem& rBox = rMaster.GetAttrSet().Get(RES_BOX);
1762  aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT));
1763  aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT));
1764 
1765  const SvxBoxItem* pBox = nullptr;
1766  if(nFrameType & FrameTypeFlags::HEADER)
1767  {
1768  rMaster.GetHeader();
1769  const SwFormatHeader& rHeaderFormat = rMaster.GetHeader();
1770  SwFrameFormat *pHeaderFormat = const_cast<SwFrameFormat*>(rHeaderFormat.GetHeaderFormat());
1771  if( pHeaderFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash
1772  pBox = & pHeaderFormat->GetBox();
1773  }
1774  else if(nFrameType & FrameTypeFlags::FOOTER )
1775  {
1776  const SwFormatFooter& rFooterFormat = rMaster.GetFooter();
1777  SwFrameFormat *pFooterFormat = const_cast<SwFrameFormat*>(rFooterFormat.GetFooterFormat());
1778  if( pFooterFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash
1779  pBox = & pFooterFormat->GetBox();
1780  }
1781  if(pBox)
1782  {
1783  aDistLR.SetLeft(pBox->GetDistance(SvxBoxItemLine::LEFT));
1784  aDistLR.SetRight(pBox->GetDistance(SvxBoxItemLine::RIGHT));
1785  }
1786 
1787  //add the border distance of the paragraph
1788  SfxItemSet aCoreSetTmp( GetPool(), svl::Items<RES_BOX, RES_BOX>{} );
1789  rSh.GetCurAttr( aCoreSetTmp );
1790  const SvxBoxItem& rParaBox = aCoreSetTmp.Get(RES_BOX);
1791  aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
1792  aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
1793  rSet.Put(aDistLR);
1794  m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1795  m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
1796  }
1797  }
1798  }
1799  break;
1800 
1801  case SID_RULER_TEXT_RIGHT_TO_LEFT:
1802  {
1803  if ( nSelType & SelectionType::Graphic ||
1804  nSelType & SelectionType::Frame ||
1805  nSelType & SelectionType::Ole ||
1806  nFrameType == FrameTypeFlags::DRAWOBJ)
1807  rSet.DisableItem(nWhich);
1808  else
1809  {
1810  bool bFlag = rSh.IsInRightToLeftText();
1811  rSet.Put(SfxBoolItem(nWhich, bFlag));
1812  }
1813  }
1814  break;
1815 
1816  case SID_RULER_BORDERS_VERTICAL:
1817  case SID_RULER_BORDERS:
1818  {
1819  bool bFrameHasVerticalColumns(false);
1820  {
1821  bool bFrameRTL;
1822  bool bFrameVertL2R;
1823  bFrameHasVerticalColumns = rSh.IsFrameVertical(false, bFrameRTL, bFrameVertL2R) &&
1824  bFrameSelection;
1825  }
1826  bool bHasTable = ( IsTabColFromDoc() ||
1827  ( rSh.GetTableFormat() && !bFrameSelection &&
1828  !(nFrameType & FrameTypeFlags::COLSECT ) ) );
1829 
1830  bool bTableVertical = bHasTable && rSh.IsTableVertical();
1831 
1832  if(((SID_RULER_BORDERS_VERTICAL == nWhich) &&
1833  ((bHasTable && !bTableVertical) ||
1834  (!bVerticalWriting && !bFrameSelection && !bHasTable ) ||
1835  ( bFrameSelection && !bFrameHasVerticalColumns))) ||
1836  ((SID_RULER_BORDERS == nWhich) &&
1837  ((bHasTable && bTableVertical) ||
1838  (bVerticalWriting && !bFrameSelection&& !bHasTable) || bFrameHasVerticalColumns)))
1839  rSet.DisableItem(nWhich);
1840  else if ( bHasTable )
1841  {
1842  SwTabCols aTabCols;
1843  size_t nNum = 0;
1845  if ( m_bSetTabColFromDoc )
1846  {
1847  rSh.GetMouseTabCols( aTabCols, m_aTabColFromDocPos );
1849  }
1850  else
1851  {
1852  rSh.GetTabCols( aTabCols );
1853  nNum = rSh.GetCurTabColNum();
1854  if(rSh.IsTableRightToLeft())
1855  nNum = aTabCols.Count() - nNum;
1856  }
1857 
1858  OSL_ENSURE(nNum <= aTabCols.Count(), "TabCol not found");
1859  const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
1860  const int nRgt = (bTableVertical ? nPageHeight : nPageWidth) -
1861  (aTabCols.GetLeftMin() + aTabCols.GetRight());
1862 
1863  const sal_uInt16 nL = static_cast< sal_uInt16 >(std::max(nLft, 0));
1864  const sal_uInt16 nR = static_cast< sal_uInt16 >(std::max(nRgt, 0));
1865 
1866  SvxColumnItem aColItem(nNum, nL, nR);
1867 
1868  tools::Long nStart = 0;
1869  tools::Long nEnd = 0;
1870 
1871  //columns in right-to-left tables need to be mirrored
1872  bool bIsTableRTL =
1873  IsTabColFromDoc() ?
1875  : rSh.IsTableRightToLeft();
1876  if(bIsTableRTL)
1877  {
1878  for ( size_t i = aTabCols.Count(); i; --i )
1879  {
1880  const SwTabColsEntry& rEntry = aTabCols.GetEntry( i - 1 );
1881  nEnd = aTabCols.GetRight() - rEntry.nPos;
1882  SvxColumnDescription aColDesc( nStart, nEnd,
1883  aTabCols.GetRight() - rEntry.nMax,
1884  aTabCols.GetRight() - rEntry.nMin,
1885  !aTabCols.IsHidden(i - 1) );
1886  aColItem.Append(aColDesc);
1887  nStart = nEnd;
1888  }
1889  SvxColumnDescription aColDesc(nStart,
1890  aTabCols.GetRight() - aTabCols.GetLeft(), true);
1891  aColItem.Append(aColDesc);
1892  }
1893  else
1894  {
1895  for ( size_t i = 0; i < aTabCols.Count(); ++i )
1896  {
1897  const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
1898  nEnd = rEntry.nPos - aTabCols.GetLeft();
1899  SvxColumnDescription aColDesc( nStart, nEnd,
1900  rEntry.nMin - aTabCols.GetLeft(), rEntry.nMax - aTabCols.GetLeft(),
1901  !aTabCols.IsHidden(i) );
1902  aColItem.Append(aColDesc);
1903  nStart = nEnd;
1904  }
1905  SvxColumnDescription aColDesc(nStart, aTabCols.GetRight() - aTabCols.GetLeft(),
1906  0, 0, true);
1907  aColItem.Append(aColDesc);
1908  }
1909  aColItem.SetWhich(nWhich);
1910  rSet.Put(aColItem);
1911  }
1912  else if ( bFrameSelection || nFrameType & ( FrameTypeFlags::COLUMN | FrameTypeFlags::COLSECT ) )
1913  {
1914  // Out of frame or page?
1915  sal_uInt16 nNum = 0;
1916  if(bFrameSelection)
1917  {
1918  const SwFrameFormat* pFormat = rSh.GetFlyFrameFormat();
1919  if(pFormat)
1920  nNum = pFormat->GetCol().GetNumCols();
1921  }
1922  else
1923  nNum = rSh.GetCurColNum();
1924 
1925  if(
1926  // For that matter FrameTypeFlags::COLSECT should not be included
1927  // if the border is selected!
1928  !bFrameSelection &&
1929  nFrameType & FrameTypeFlags::COLSECT )
1930  {
1931  const SwSection *pSect = rSh.GetAnySection(false, pPt);
1932  OSL_ENSURE( pSect, "Which section?");
1933  if( pSect )
1934  {
1935  SwSectionFormat const *pFormat = pSect->GetFormat();
1936  const SwFormatCol& rCol = pFormat->GetCol();
1937  if (rSh.IsColRightToLeft())
1938  nNum = rCol.GetColumns().size() - nNum;
1939  else
1940  --nNum;
1941  SvxColumnItem aColItem(nNum);
1942  SwRect aRect = rSh.GetAnyCurRect(CurRectType::SectionPrt, pPt);
1943  const SwRect aTmpRect = rSh.GetAnyCurRect(CurRectType::Section, pPt);
1944 
1945  ::lcl_FillSvxColumn(rCol, bVerticalWriting ? aRect.Height() : aRect.Width(), aColItem, 0);
1946 
1947  if(bVerticalWriting)
1948  {
1949  aRect.Pos() += Point(aTmpRect.Left(), aTmpRect.Top());
1950  aRect.Pos().AdjustY( -(rPageRect.Top()) );
1951  aColItem.SetLeft(aRect.Top());
1952  aColItem.SetRight(nPageHeight - aRect.Bottom());
1953  }
1954  else
1955  {
1956  aRect.Pos() += aTmpRect.Pos();
1957 
1958  // make relative to page position:
1959  aColItem.SetLeft (static_cast<sal_uInt16>( aRect.Left() - rPageRect.Left() ));
1960  aColItem.SetRight(static_cast<sal_uInt16>( rPageRect.Right() - aRect.Right()));
1961  }
1962  aColItem.SetOrtho(aColItem.CalcOrtho());
1963 
1964  aColItem.SetWhich(nWhich);
1965  rSet.Put(aColItem);
1966  }
1967  }
1968  else if( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY )
1969  {
1970  // Columns in frame
1971  if ( nNum )
1972  {
1973  const SwFrameFormat* pFormat = rSh.GetFlyFrameFormat() ;
1974 
1975  const SwFormatCol& rCol = pFormat->GetCol();
1976  if (rSh.IsColRightToLeft())
1977  nNum = rCol.GetColumns().size() - nNum;
1978  else
1979  nNum--;
1980  SvxColumnItem aColItem(nNum);
1981  const SwRect &rSizeRect = rSh.GetAnyCurRect(CurRectType::FlyEmbeddedPrt, pPt);
1982 
1983  bool bUseVertical = bFrameHasVerticalColumns || (!bFrameSelection && bVerticalWriting);
1984  const tools::Long lWidth = bUseVertical ? rSizeRect.Height() : rSizeRect.Width();
1985  const SwRect &rRect = rSh.GetAnyCurRect(CurRectType::FlyEmbedded, pPt);
1986  tools::Long nDist2 = ((bUseVertical ? rRect.Height() : rRect.Width()) - lWidth) /2;
1987  ::lcl_FillSvxColumn(rCol, lWidth, aColItem, nDist2);
1988 
1989  if(bUseVertical)
1990  {
1991  aColItem.SetLeft(rRect.Top()- rPageRect.Top());
1992  aColItem.SetRight(nPageHeight + rPageRect.Top() - rRect.Bottom());
1993  }
1994  else
1995  {
1996  aColItem.SetLeft(rRect.Left() - rPageRect.Left());
1997  aColItem.SetRight(rPageRect.Right() - rRect.Right());
1998  }
1999 
2000  aColItem.SetOrtho(aColItem.CalcOrtho());
2001 
2002  aColItem.SetWhich(nWhich);
2003  rSet.Put(aColItem);
2004  }
2005  else
2006  rSet.DisableItem(nWhich);
2007  }
2008  else
2009  { // Columns on the page
2010  const SwFrameFormat& rMaster = rDesc.GetMaster();
2011  SwFormatCol aCol(rMaster.GetCol());
2012  if(rFrameDir.GetValue() == SvxFrameDirection::Horizontal_RL_TB)
2013  nNum = aCol.GetColumns().size() - nNum;
2014  else
2015  nNum--;
2016 
2017  SvxColumnItem aColItem(nNum);
2018  const SwRect aPrtRect = rSh.GetAnyCurRect(CurRectType::PagePrt, pPt);
2019  const SvxBoxItem& rBox = rMaster.GetFormatAttr(RES_BOX);
2020  tools::Long nDist = rBox.GetSmallestDistance();
2021 
2023  aCol,
2024  bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width(),
2025  aColItem, nDist);
2026 
2027  if(bBrowse)
2028  {
2029  if (bVerticalWriting)
2030  {
2031  aColItem.SetLeft(static_cast<sal_uInt16>(rPagePrtRect.Top()));
2032  aColItem.SetRight(sal_uInt16(nPageHeight - rPagePrtRect.Bottom()));
2033  }
2034  else
2035  {
2036  aColItem.SetLeft(static_cast<sal_uInt16>(rPagePrtRect.Left()));
2037  aColItem.SetRight(sal_uInt16(nPageWidth - rPagePrtRect.Right()));
2038  }
2039  }
2040  else
2041  {
2042  if (bVerticalWriting)
2043  {
2044  SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
2045  aColItem.SetLeft (aUL.GetUpper());
2046  aColItem.SetRight(aUL.GetLower());
2047  }
2048  else
2049  {
2050  aColItem.SetLeft (aPageLRSpace.GetLeft());
2051  aColItem.SetRight(aPageLRSpace.GetRight());
2052  }
2053  }
2054  aColItem.SetOrtho(aColItem.CalcOrtho());
2055 
2056  aColItem.SetWhich(nWhich);
2057  rSet.Put(aColItem);
2058  }
2059  }
2060  else
2061  rSet.DisableItem(nWhich);
2062  break;
2063  }
2064 
2065  case SID_RULER_ROWS :
2066  case SID_RULER_ROWS_VERTICAL:
2067  {
2068  bool bFrameHasVerticalColumns(false);
2069  {
2070  bool bFrameRTL;
2071  bool bFrameVertL2R;
2072  bFrameHasVerticalColumns = rSh.IsFrameVertical(false, bFrameRTL, bFrameVertL2R) &&
2073  bFrameSelection;
2074  }
2075 
2076  if(((SID_RULER_ROWS == nWhich) &&
2077  ((!bVerticalWriting && !bFrameSelection) || (bFrameSelection && !bFrameHasVerticalColumns))) ||
2078  ((SID_RULER_ROWS_VERTICAL == nWhich) &&
2079  ((bVerticalWriting && !bFrameSelection) || bFrameHasVerticalColumns)))
2080  rSet.DisableItem(nWhich);
2081  else if ( IsTabRowFromDoc() ||
2082  ( rSh.GetTableFormat() && !bFrameSelection &&
2083  !(nFrameType & FrameTypeFlags::COLSECT ) ) )
2084  {
2085  SwTabCols aTabCols;
2087  if ( m_bSetTabRowFromDoc )
2088  {
2089  rSh.GetMouseTabRows( aTabCols, m_aTabColFromDocPos );
2090  }
2091  else
2092  {
2093  rSh.GetTabRows( aTabCols );
2094  }
2095 
2096  const int nLft = aTabCols.GetLeftMin();
2097  const int nRgt = (bVerticalWriting ? nPageWidth : nPageHeight) -
2098  (aTabCols.GetLeftMin() + aTabCols.GetRight());
2099 
2100  const sal_uInt16 nL = static_cast< sal_uInt16 >(std::max(nLft, 0));
2101  const sal_uInt16 nR = static_cast< sal_uInt16 >(std::max(nRgt, 0));
2102 
2103  SvxColumnItem aColItem(0, nL, nR);
2104 
2105  tools::Long nStart = 0;
2106  tools::Long nEnd = 0;
2107 
2108  for ( size_t i = 0; i < aTabCols.Count(); ++i )
2109  {
2110  const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
2111  if(bVerticalWriting)
2112  {
2113  nEnd = aTabCols.GetRight() - rEntry.nPos;
2114  SvxColumnDescription aColDesc( nStart, nEnd,
2115  std::max(tools::Long(0), aTabCols.GetRight() - rEntry.nMax),
2116  std::max(tools::Long(0), aTabCols.GetRight() - rEntry.nMin),
2117  !aTabCols.IsHidden(i) );
2118  aColItem.Append(aColDesc);
2119  }
2120  else
2121  {
2122  nEnd = rEntry.nPos - aTabCols.GetLeft();
2123  SvxColumnDescription aColDesc( nStart, nEnd,
2124  rEntry.nMin - aTabCols.GetLeft(),
2125  rEntry.nMax - aTabCols.GetLeft(),
2126  !aTabCols.IsHidden(i) );
2127  aColItem.Append(aColDesc);
2128  }
2129  nStart = nEnd;
2130  }
2131  if(bVerticalWriting)
2132  nEnd = aTabCols.GetRight();
2133  else
2134  nEnd = aTabCols.GetLeft();
2135 
2136  SvxColumnDescription aColDesc( nStart, nEnd,
2137  aTabCols.GetRight(),
2138  aTabCols.GetRight(),
2139  false );
2140  aColItem.Append(aColDesc);
2141 
2142  aColItem.SetWhich(nWhich);
2143  rSet.Put(aColItem);
2144  }
2145  else
2146  rSet.DisableItem(nWhich);
2147  }
2148  break;
2149 
2150  case SID_RULER_PAGE_POS:
2151  {
2152  SvxPagePosSizeItem aPagePosSize(
2153  Point( rPageRect.Left(), rPageRect.Top()) , nPageWidth, nPageHeight);
2154 
2155  rSet.Put(aPagePosSize);
2156  break;
2157  }
2158 
2159  case SID_RULER_LR_MIN_MAX:
2160  {
2161  tools::Rectangle aRectangle;
2162  if( ( nFrameType & FrameTypeFlags::COLSECT ) && !IsTabColFromDoc() &&
2163  ( nFrameType & ( FrameTypeFlags::TABLE|FrameTypeFlags::COLUMN ) ) )
2164  {
2165  if( nFrameType & FrameTypeFlags::TABLE )
2166  {
2167  const size_t nNum = rSh.GetCurTabColNum();
2168  SwTabCols aTabCols;
2169  rSh.GetTabCols( aTabCols );
2170 
2171  const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
2172  const int nRgt = nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight());
2173 
2174  const sal_uInt16 nL = static_cast< sal_uInt16 >(std::max(nLft, 0));
2175  const sal_uInt16 nR = static_cast< sal_uInt16 >(std::max(nRgt, 0));
2176 
2177  aRectangle.SetLeft( nL );
2178  if(nNum > 1)
2179  aRectangle.AdjustLeft(aTabCols[nNum - 2] );
2180  if(nNum)
2181  aRectangle.AdjustLeft(MINLAY );
2182  if(aTabCols.Count() <= nNum + 1 )
2183  aRectangle.SetRight( nR );
2184  else
2185  aRectangle.SetRight( nPageWidth - (nL + aTabCols[nNum + 1]) );
2186 
2187  if(nNum < aTabCols.Count())
2188  aRectangle.AdjustRight(MINLAY );
2189  }
2190  else
2191  {
2192  const SwFrameFormat* pFormat = rSh.GetFlyFrameFormat();
2193  const SwFormatCol* pCols = pFormat ? &pFormat->GetCol():
2194  &rDesc.GetMaster().GetCol();
2195  const SwColumns& rCols = pCols->GetColumns();
2196  sal_uInt16 nNum = rSh.GetCurOutColNum();
2197  const sal_uInt16 nCount = std::min(sal_uInt16(nNum + 1), sal_uInt16(rCols.size()));
2198  const SwRect aRect( rSh.GetAnyCurRect( pFormat
2200  : CurRectType::PagePrt, pPt ));
2201  const SwRect aAbsRect( rSh.GetAnyCurRect( pFormat
2203  : CurRectType::Page, pPt ));
2204 
2205  // The width of the frame or within the page margins.
2206  const sal_uInt16 nTotalWidth = static_cast<sal_uInt16>(aRect.Width());
2207  // The entire frame width - The difference is twice the distance to the edge.
2208  const sal_uInt16 nOuterWidth = static_cast<sal_uInt16>(aAbsRect.Width());
2209  int nWidth = 0,
2210  nEnd = 0;
2211  aRectangle.SetLeft( 0 );
2212  for ( sal_uInt16 i = 0; i < nCount; ++i )
2213  {
2214  const SwColumn* pCol = &rCols[i];
2215  const int nStart = pCol->GetLeft() + nWidth;
2216  if(i == nNum - 2)
2217  aRectangle.SetLeft( nStart );
2218  nWidth += pCols->CalcColWidth( i, nTotalWidth );
2219  nEnd = nWidth - pCol->GetRight();
2220  }
2221  aRectangle.SetRight( rPageRect.Right() - nEnd );
2222  aRectangle.AdjustLeft( -(rPageRect.Left()) );
2223 
2224  if(nNum > 1)
2225  {
2226  aRectangle.AdjustLeft(MINLAY );
2227  aRectangle.AdjustLeft(aRect.Left() );
2228  }
2229  if(pFormat) // Range in frame - here you may up to the edge
2230  {
2231  aRectangle.SetLeft(0);
2232  aRectangle.SetRight(0);
2233  }
2234  else
2235  {
2236  // Move the rectangle to the correct absolute position.
2237  aRectangle.AdjustLeft(aAbsRect.Left() );
2238  aRectangle.AdjustRight( -(aAbsRect.Left()) );
2239  // Include distance to the border.
2240  aRectangle.AdjustRight( -((nOuterWidth - nTotalWidth) / 2) );
2241  }
2242 
2243  if(nNum < rCols.size())
2244  {
2245  aRectangle.AdjustRight(MINLAY );
2246  }
2247  else
2248  // Right is only the margin now.
2249  aRectangle.SetRight( 0 );
2250 
2251  }
2252  }
2253  else if ( ((nFrameType & FrameTypeFlags::TABLE) || IsTabColFromDoc()) &&
2254  !bFrameSelection )
2255  {
2256  bool bColumn;
2257  if ( IsTabColFromDoc() )
2258  bColumn = rSh.GetCurMouseColNum( m_aTabColFromDocPos ) != 0;
2259  else
2261 
2262  if ( !bColumn )
2263  {
2264  if( nFrameType & FrameTypeFlags::FLY_ANY && IsTabColFromDoc() )
2265  {
2266  SwRect aRect( rSh.GetAnyCurRect(
2267  CurRectType::FlyEmbeddedPrt, pPt ) );
2268  aRect.Pos() += rSh.GetAnyCurRect( CurRectType::FlyEmbedded,
2269  pPt ).Pos();
2270 
2271  aRectangle.SetLeft( aRect.Left() - rPageRect.Left() );
2272  aRectangle.SetRight( rPageRect.Right() - aRect.Right() );
2273  }
2274  else if( bBrowse )
2275  {
2276  aRectangle.SetLeft( rPagePrtRect.Left() );
2277  aRectangle.SetRight( nPageWidth - rPagePrtRect.Right() );
2278  }
2279  else
2280  {
2281  aRectangle.SetLeft( aPageLRSpace.GetLeft() );
2282  aRectangle.SetRight( aPageLRSpace.GetRight() );
2283  }
2284  }
2285  else
2286  { // Here only for table in multi-column pages and borders.
2287  bool bSectOutTable = bool(nFrameType & FrameTypeFlags::TABLE);
2288  bool bFrame = bool(nFrameType & FrameTypeFlags::FLY_ANY);
2289  bool bColSct = bool(nFrameType & ( bSectOutTable
2291  : FrameTypeFlags::COLSECT )
2292  );
2293  //So you can also drag with the mouse, without being in the table.
2294  CurRectType eRecType = CurRectType::PagePrt;
2295  size_t nNum = IsTabColFromDoc() ?
2297  rSh.GetCurOutColNum();
2298  const SwFrameFormat* pFormat = nullptr;
2299  if( bColSct )
2300  {
2301  eRecType = bSectOutTable ? CurRectType::SectionOutsideTable
2303  const SwSection *pSect = rSh.GetAnySection( bSectOutTable, pPt );
2304  OSL_ENSURE( pSect, "Which section?");
2305  pFormat = pSect->GetFormat();
2306  }
2307  else if( bFrame )
2308  {
2309  pFormat = rSh.GetFlyFrameFormat();
2310  eRecType = CurRectType::FlyEmbeddedPrt;
2311  }
2312 
2313  const SwFormatCol* pCols = pFormat ? &pFormat->GetCol():
2314  &rDesc.GetMaster().GetCol();
2315  const SwColumns& rCols = pCols->GetColumns();
2316  const sal_uInt16 nBorder = pFormat
2317  ? pFormat->GetBox().GetSmallestDistance()
2318  : rDesc.GetMaster().GetBox().GetSmallestDistance();
2319 
2320  // RECT_FLY_PRT_EMBEDDED returns the relative position to RECT_FLY_EMBEDDED
2321  // the absolute position must be added here
2322 
2323  SwRect aRect( rSh.GetAnyCurRect( eRecType, pPt ) );
2324  if(CurRectType::FlyEmbeddedPrt == eRecType)
2325  aRect.Pos() += rSh.GetAnyCurRect( CurRectType::FlyEmbedded,
2326  pPt ).Pos();
2327 
2328  const sal_uInt16 nTotalWidth = static_cast<sal_uInt16>(aRect.Width());
2329  // Initialize nStart and nEnd for nNum == 0
2330  int nWidth = 0,
2331  nStart = 0,
2332  nEnd = nTotalWidth;
2333 
2334  if( nNum > rCols.size() )
2335  {
2336  OSL_ENSURE( false, "wrong FormatCol is being edited!" );
2337  nNum = rCols.size();
2338  }
2339 
2340  for( size_t i = 0; i < nNum; ++i )
2341  {
2342  const SwColumn* pCol = &rCols[i];
2343  nStart = pCol->GetLeft() + nWidth;
2344  nWidth += pCols->CalcColWidth( static_cast<sal_uInt16>(i), nTotalWidth );
2345  nEnd = nWidth - pCol->GetRight();
2346  }
2347  if( bFrame || bColSct )
2348  {
2349  aRectangle.SetLeft( aRect.Left() - rPageRect.Left() + nStart );
2350  aRectangle.SetRight( nPageWidth - aRectangle.Left() - nEnd + nStart );
2351  }
2352  else if(!bBrowse)
2353  {
2354  aRectangle.SetLeft( aPageLRSpace.GetLeft() + nStart );
2355  aRectangle.SetRight( nPageWidth - nEnd - aPageLRSpace.GetLeft() );
2356  }
2357  else
2358  {
2359  tools::Long nLeft = rPagePrtRect.Left();
2360  aRectangle.SetLeft( nStart + nLeft );
2361  aRectangle.SetRight( nPageWidth - nEnd - nLeft );
2362  }
2363  if(!bFrame)
2364  {
2365  aRectangle.AdjustLeft(nBorder );
2366  aRectangle.AdjustRight( -nBorder );
2367  }
2368  }
2369  }
2370  else if ( nFrameType & ( FrameTypeFlags::HEADER | FrameTypeFlags::FOOTER ))
2371  {
2372  aRectangle.SetLeft( aPageLRSpace.GetLeft() );
2373  aRectangle.SetRight( aPageLRSpace.GetRight() );
2374  }
2375  else
2376  {
2377  aRectangle.SetLeft(0);
2378  aRectangle.SetRight(0);
2379  }
2380 
2381  SfxRectangleItem aLR( SID_RULER_LR_MIN_MAX , aRectangle);
2382  rSet.Put(aLR);
2383  }
2384  break;
2385 
2386  case SID_RULER_PROTECT:
2387  {
2388  if(bFrameSelection)
2389  {
2391 
2392  SvxProtectItem aProt(SID_RULER_PROTECT);
2393  aProt.SetContentProtect(bool(nProtect & FlyProtectFlags::Content));
2394  aProt.SetSizeProtect (bool(nProtect & FlyProtectFlags::Size));
2395  aProt.SetPosProtect (bool(nProtect & FlyProtectFlags::Pos));
2396  rSet.Put(aProt);
2397  }
2398  else
2399  {
2400  SvxProtectItem aProtect(SID_RULER_PROTECT);
2401  if(bBrowse && !(nFrameType & (FrameTypeFlags::DRAWOBJ|FrameTypeFlags::COLUMN)) && !rSh.GetTableFormat())
2402  {
2403  aProtect.SetSizeProtect(true);
2404  aProtect.SetPosProtect(true);
2405  }
2406  rSet.Put(aProtect);
2407  }
2408  }
2409  break;
2410 
2411  case SID_ATTR_PAGE_HEADER:
2415  {
2416  const SwFormatHeader& rHeader = rDesc.GetMaster().GetHeader();
2417  bool bHeaderOn = rHeader.IsActive();
2418  rSet.Put( SfxBoolItem(SID_ATTR_PAGE_HEADER, bHeaderOn ) );
2419  if(bHeaderOn)
2420  {
2421  const SvxLRSpaceItem* pLR = static_cast<const SvxLRSpaceItem*>(
2422  rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_LRSPACE));
2423  const SvxULSpaceItem* pUL = static_cast<const SvxULSpaceItem*>(
2424  rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_ULSPACE));
2425  if (pLR && pUL)
2426  {
2428  rSet.Put(aLR);
2430  rSet.Put(aUL);
2431  }
2432 
2433  bool bShared = !rDesc.IsHeaderShared();
2434  bool bFirst = !rDesc.IsFirstShared(); // FIXME control changes for both header footer - tdf#100287
2435  sal_uInt16 nLayout = (static_cast<int>(bShared)<<1) + static_cast<int>(bFirst);
2436  SfxInt16Item aLayoutItem(SID_ATTR_PAGE_HEADER_LAYOUT, nLayout);
2437  rSet.Put(aLayoutItem);
2438  }
2439  }
2440  break;
2441  case SID_ATTR_PAGE_FOOTER:
2445  {
2446  const SwFormatFooter& rFooter = rDesc.GetMaster().GetFooter();
2447  bool bFooterOn = rFooter.IsActive();
2448  rSet.Put( SfxBoolItem(SID_ATTR_PAGE_FOOTER, bFooterOn ) );
2449  if(bFooterOn)
2450  {
2451  const SvxLRSpaceItem* rLR = rFooter.GetFooterFormat()->GetAttrSet().GetItem<SvxLRSpaceItem>(SID_ATTR_LRSPACE);
2452  const SvxULSpaceItem* rUL = rFooter.GetFooterFormat()->GetAttrSet().GetItem<SvxULSpaceItem>(SID_ATTR_ULSPACE);
2454  rSet.Put(aLR);
2455  SvxLongULSpaceItem aUL( rUL->GetUpper(), rUL->GetLower(), SID_ATTR_PAGE_FOOTER_SPACING);
2456  rSet.Put(aUL);
2457 
2458  bool bShared = !rDesc.IsFooterShared();
2459  bool bFirst = !rDesc.IsFirstShared(); // FIXME control changes for both header footer - tdf#100287
2460  sal_uInt16 nLayout = (static_cast<int>(bShared)<<1) + static_cast<int>(bFirst);
2461  SfxInt16Item aLayoutItem(SID_ATTR_PAGE_FOOTER_LAYOUT, nLayout);
2462  rSet.Put(aLayoutItem);
2463  }
2464  }
2465  break;
2466 
2467  case SID_ATTR_PAGE_COLOR:
2468  case SID_ATTR_PAGE_FILLSTYLE:
2469  case SID_ATTR_PAGE_GRADIENT:
2470  case SID_ATTR_PAGE_HATCH:
2471  case SID_ATTR_PAGE_BITMAP:
2472  {
2473  SfxItemSet aSet = rDesc.GetMaster().GetAttrSet();
2474  if (const auto pFillStyleItem = aSet.GetItem(XATTR_FILLSTYLE))
2475  {
2476  drawing::FillStyle eXFS = pFillStyleItem->GetValue();
2477  XFillStyleItem aFillStyleItem( eXFS );
2478  aFillStyleItem.SetWhich( SID_ATTR_PAGE_FILLSTYLE );
2479  rSet.Put(aFillStyleItem);
2480 
2481  switch(eXFS)
2482  {
2483  case drawing::FillStyle_SOLID:
2484  {
2485  if (const auto pItem = aSet.GetItem<XFillColorItem>(XATTR_FILLCOLOR, false))
2486  {
2487  Color aColor = pItem->GetColorValue();
2488  XFillColorItem aFillColorItem( OUString(), aColor );
2489  aFillColorItem.SetWhich( SID_ATTR_PAGE_COLOR );
2490  rSet.Put( aFillColorItem );
2491  }
2492  break;
2493  }
2494 
2495  case drawing::FillStyle_GRADIENT:
2496  {
2497  const XGradient& xGradient = aSet.GetItem<XFillGradientItem>( XATTR_FILLGRADIENT )->GetGradientValue();
2498  XFillGradientItem aFillGradientItem( OUString(), xGradient, SID_ATTR_PAGE_GRADIENT );
2499  rSet.Put( aFillGradientItem );
2500  }
2501  break;
2502 
2503  case drawing::FillStyle_HATCH:
2504  {
2505  const XFillHatchItem *pFillHatchItem( aSet.GetItem<XFillHatchItem>( XATTR_FILLHATCH ) );
2506  XFillHatchItem aFillHatchItem( pFillHatchItem->GetName(), pFillHatchItem->GetHatchValue());
2507  aFillHatchItem.SetWhich( SID_ATTR_PAGE_HATCH );
2508  rSet.Put( aFillHatchItem );
2509  }
2510  break;
2511 
2512  case drawing::FillStyle_BITMAP:
2513  {
2514  const XFillBitmapItem *pFillBitmapItem = aSet.GetItem<XFillBitmapItem>( XATTR_FILLBITMAP );
2515  XFillBitmapItem aFillBitmapItem( pFillBitmapItem->GetName(), pFillBitmapItem->GetGraphicObject() );
2516  aFillBitmapItem.SetWhich( SID_ATTR_PAGE_BITMAP );
2517  rSet.Put( aFillBitmapItem );
2518  }
2519  break;
2520  case drawing::FillStyle_NONE:
2521  {
2522  }
2523  break;
2524 
2525  default:
2526  break;
2527  }
2528  }
2529  break;
2530  }
2531 
2532  }
2533  nWhich = aIter.NextWhich();
2534  }
2535 }
2536 
2537 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
void SetMouseTabCols(const SwTabCols &rNew, bool bCurRowOnly, const Point &rPt)
Definition: fetab.cxx:2036
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:246
void Right(const tools::Long nRight)
Definition: swrect.hxx:200
#define SID_ATTR_PAGE_HEADER_LRMARGIN
Definition: cmdid.h:862
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:3409
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:861
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:864
#define SID_ATTR_PAGE_COLUMN
Definition: cmdid.h:860
void SetState(const SfxItemSet &rSet)
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
void ChgHeaderShare(bool bNew)
Definition: pagedesc.hxx:328
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
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:106
void Append(const SvxColumnDescription &rDesc)
void Left(const tools::Long nLeft)
Definition: swrect.hxx:195
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:3195
long Long
tools::Long GetRight() const
sal_uInt16 GetCurColNum(SwGetCurColNumPara *pPara=nullptr) const
The ruler needs some information too.
Definition: fews.cxx:641
#define MINLAY
Definition: swtypes.hxx:66
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:1715
void GetTabRows(SwTabCols &rToFill) const
Definition: fetab.cxx:650
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:1208
sal_uInt16 FirstWhich()
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2661
SW_DLLPUBLIC SwTwips GetTabDist(const SvxTabStopItem &rTabs)
Definition: uitool.cxx:619
SwSectionFormat * GetFormat()
Definition: section.hxx:336
tools::Long GetRight() const
void StateTabWin(SfxItemSet &)
Definition: viewtab.cxx:1348
void Pos(const Point &rNew)
Definition: swrect.hxx:169
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
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:1580
const SfxItemSet * GetArgs() const
bool IsDirectlyInSection() const
Definition: fews.cxx:231
void GetMouseTabCols(SwTabCols &rToFill, const Point &rPt) const
Definition: fetab.cxx:2029
void EndAllAction()
Definition: edws.cxx:97
tools::Long GetUpper() const
CurRectType
Definition: fesh.hxx:135
UseOnPage GetUseOn() const
Definition: pagedesc.hxx:354
void SetRight(tools::Long v)
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:2049
void SetOrtho(bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This too re-arranges columns automatically if flag is set.
Definition: atrfrm.cxx:977
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:867
#define SID_ATTR_PAGE_FOOTER_LAYOUT
Definition: cmdid.h:868
Used by the UI to modify the document model.
Definition: wrtsh.hxx:91
bool IsTableVertical() const
Definition: fetab.cxx:2315
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
tools::Long Left() const
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
void SetLeft(tools::Long v)
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:2298
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:187
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:47
bool m_bSetTabColFromDoc
Definition: view.hxx:240
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1038
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:320
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:615
Style of a layout element.
Definition: frmfmt.hxx:58
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Query default attribute of document.
Definition: edatmisc.cxx:93
#define SID_ATTR_PAGE_FOOTER
Definition: cmdid.h:865
bool IsInRightToLeftText() const
Definition: crsrsh.cxx:3416
Rect of current PrtArea of page.
sal_Int16 GetValue() const
OptionalString sType
size_t GetCurMouseTabColNum(const Point &rPt) const
Definition: fetab.cxx:2054
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
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2237
void SetTabRows(const SwTabCols &rNew, bool bCurColOnly)
Definition: fetab.cxx:666
void ChgFirstShare(bool bNew)
Definition: pagedesc.cxx:401
void SetTabsRelativeToIndent(bool bRel)
void ChgFooterShare(bool bNew)
Definition: pagedesc.hxx:335
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:1081
sal_uInt16 CalcColWidth(sal_uInt16 nCol, sal_uInt16 nAct) const
Calculates current width of column nCol.
Definition: atrfrm.cxx:984
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:866
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:684
bool IsFooterShared() const
Definition: pagedesc.hxx:324
tools::Long GetLeftMarginWithNum(bool bTextLeft=false) const
Returns the additional indents of this text node and its numbering.
Definition: ndtxt.cxx:3152
void GetTabCols(SwTabCols &rToFill) const
Info about columns and margins.
Definition: fetab.cxx:633
bool IsAutoUpdateFormat() const
Query / set bAutoUpdateFormat-flag.
Definition: format.hxx:172
void SetObjRect(const SwRect &rRect)
Set size of draw objects.
Definition: fefly1.cxx:1287
tools::Long GetHeight() const
SW_DLLPUBLIC void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem &rTabs)
Definition: uitool.cxx:607
VclPtr< SvxRuler > m_pVRuler
Definition: view.hxx:210
Frame cannot be moved in Var-direction.
tools::Long SwTwips
Definition: swtypes.hxx:49
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:226
tools::Long const nBorder
void SetRight(tools::Long aRight)
SelectionType
Definition: wrtsh.hxx:59
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:239
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:209
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:1276
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:2307
void Top(const tools::Long nTop)
Definition: swrect.hxx:204
size_t IsObjSelected() const
Definition: feshview.cxx:1158
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:771
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:1248
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:396
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:691
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:962
void SetLeft(tools::Long lArgLeft)
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1395
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:191
#define SID_ATTR_PAGE_HEADER_SPACING
Definition: cmdid.h:863
tools::Long GetRight() const
Definition: tabcol.hxx:79
size_t GetCurTabColNum() const
Definition: fetab.cxx:1317
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:1166
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 EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74