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