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