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 = 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 = 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
1405 RES_UL_SPACE, RES_UL_SPACE> aCoreSet( GetPool() );
1406 // get also the list level indent values, if needed.
1407 rSh.GetCurAttr( aCoreSet, true );
1408 const SelectionType nSelType = rSh.GetSelectionType();
1409
1410 SfxWhichIter aIter( rSet );
1411 sal_uInt16 nWhich = aIter.FirstWhich();
1412
1413 while ( nWhich )
1414 {
1415 switch ( nWhich )
1416 {
1417
1419 {
1420 sal_uInt16 nColumnType = 0;
1421
1422 const SwFrameFormat& rMaster = rDesc.GetMaster();
1423 const SwFormatCol& aCol(rMaster.GetCol());
1424 const sal_uInt16 nCols = aCol.GetNumCols();
1425 if ( nCols == 0 )
1426 {
1427 nColumnType = 1;
1428 }
1429 else if ( nCols == 2 )
1430 {
1431 const sal_uInt16 nColLeft = aCol.CalcPrtColWidth(0, aCol.GetWishWidth());
1432 const sal_uInt16 nColRight = aCol.CalcPrtColWidth(1, aCol.GetWishWidth());
1433
1434 if ( abs(nColLeft - nColRight) <= 10 )
1435 {
1436 nColumnType = 2;
1437 }
1438 else if( abs(nColLeft - nColRight*2) < 20 )
1439 {
1440 nColumnType = 4;
1441 }
1442 else if( abs(nColLeft*2 - nColRight) < 20 )
1443 {
1444 nColumnType = 5;
1445 }
1446 }
1447 else if( nCols == 3 )
1448 {
1449 nColumnType = 3;
1450 }
1451 else
1452 nColumnType = nCols;
1453
1454 rSet.Put( SfxInt16Item( SID_ATTR_PAGE_COLUMN, nColumnType ) );
1455 }
1456 break;
1457
1458 case SID_ATTR_LONG_LRSPACE:
1459 {
1460 SvxLongLRSpaceItem aLongLR( aPageLRSpace.GetLeft(),
1461 aPageLRSpace.GetRight(),
1462 SID_ATTR_LONG_LRSPACE);
1463 if(bBrowse)
1464 {
1465 aLongLR.SetLeft(rPagePrtRect.Left());
1466 aLongLR.SetRight(nPageWidth - rPagePrtRect.Right());
1467 }
1468 if ( ( nFrameType & FrameTypeFlags::HEADER || nFrameType & FrameTypeFlags::FOOTER ) &&
1469 !(nFrameType & FrameTypeFlags::COLSECT) )
1470 {
1471 SwFrameFormat *pFormat = const_cast<SwFrameFormat*>((nFrameType & FrameTypeFlags::HEADER) ?
1472 rDesc.GetMaster().GetHeader().GetHeaderFormat() :
1473 rDesc.GetMaster().GetFooter().GetFooterFormat());
1474 if( pFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash
1475 {
1477 aRect.Pos() -= rSh.GetAnyCurRect( CurRectType::Page, pPt ).Pos();
1478 const SvxLRSpaceItem& aLR = pFormat->GetLRSpace();
1479 aLongLR.SetLeft ( aLR.GetLeft() + aRect.Left() );
1480 aLongLR.SetRight( nPageWidth - aRect.Right() + aLR.GetRight() );
1481 }
1482 }
1483 else
1484 {
1485 SwRect aRect;
1486 if( !bFrameSelection && ((nFrameType & FrameTypeFlags::COLSECT) || rSh.IsDirectlyInSection()) )
1487 {
1488 aRect = rSh.GetAnyCurRect(CurRectType::SectionPrt, pPt);
1489 const SwRect aTmpRect = rSh.GetAnyCurRect(CurRectType::Section, pPt);
1490 aRect.Pos() += aTmpRect.Pos();
1491 }
1492
1493 else if ( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY )
1494 aRect = rSh.GetAnyCurRect(CurRectType::FlyEmbedded, pPt);
1495 else if( nFrameType & FrameTypeFlags::DRAWOBJ)
1496 aRect = rSh.GetObjRect();
1497
1498 if( aRect.Width() )
1499 {
1500 // make relative to page position:
1501 aLongLR.SetLeft(aRect.Left() - rPageRect.Left());
1502 aLongLR.SetRight(rPageRect.Right() - aRect.Right());
1503 }
1504 }
1505 rSet.Put( aLongLR );
1506 }
1507 break;
1508
1509 // provide left and right margins of current page style
1510 case SID_ATTR_PAGE_LRSPACE:
1511 {
1512 const SvxLRSpaceItem aTmpPageLRSpace( rDesc.GetMaster().GetLRSpace() );
1513 const SvxLongLRSpaceItem aLongLR(
1514 aTmpPageLRSpace.GetLeft(),
1515 aTmpPageLRSpace.GetRight(),
1516 SID_ATTR_PAGE_LRSPACE );
1517 rSet.Put( aLongLR );
1518 }
1519 break;
1520
1521 case SID_ATTR_LONG_ULSPACE:
1522 {
1523 // Page margin top bottom
1524 SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
1525 SvxLongULSpaceItem aLongUL( static_cast<tools::Long>(aUL.GetUpper()),
1526 static_cast<tools::Long>(aUL.GetLower()),
1527 SID_ATTR_LONG_ULSPACE);
1528
1529 if ( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY )
1530 {
1531 // Convert document coordinates into page coordinates.
1532 const SwRect &rRect = rSh.GetAnyCurRect(CurRectType::FlyEmbedded, pPt);
1533 aLongUL.SetUpper(rRect.Top() - rPageRect.Top());
1534 aLongUL.SetLower(rPageRect.Bottom() - rRect.Bottom());
1535 }
1536 else if ( nFrameType & FrameTypeFlags::HEADER || nFrameType & FrameTypeFlags::FOOTER )
1537 {
1539 aRect.Pos() -= rSh.GetAnyCurRect( CurRectType::Page, pPt ).Pos();
1540 aLongUL.SetUpper( aRect.Top() );
1541 aLongUL.SetLower( nPageHeight - aRect.Bottom() );
1542 }
1543 else if( nFrameType & FrameTypeFlags::DRAWOBJ)
1544 {
1545 const SwRect &rRect = rSh.GetObjRect();
1546 aLongUL.SetUpper(rRect.Top() - rPageRect.Top());
1547 aLongUL.SetLower(rPageRect.Bottom() - rRect.Bottom());
1548 }
1549 else if(bBrowse)
1550 {
1551 aLongUL.SetUpper(rPagePrtRect.Top());
1552 aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom());
1553 }
1554 rSet.Put( aLongUL );
1555 }
1556 break;
1557
1558 // provide top and bottom margins of current page style
1559 case SID_ATTR_PAGE_ULSPACE:
1560 {
1561 const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
1562 SvxLongULSpaceItem aLongUL(
1563 static_cast<tools::Long>(aUL.GetUpper()),
1564 static_cast<tools::Long>(aUL.GetLower()),
1565 SID_ATTR_PAGE_ULSPACE );
1566
1567 rSet.Put( aLongUL );
1568 }
1569 break;
1570
1571 case SID_ATTR_TABSTOP_VERTICAL :
1572 case RES_PARATR_TABSTOP:
1573 {
1574 if ( dynamic_cast< const SwWebView *>( this ) != nullptr ||
1575 IsTabColFromDoc() ||
1576 IsTabRowFromDoc() ||
1577 ( nSelType & SelectionType::Graphic ) ||
1578 ( nSelType & SelectionType::Frame ) ||
1579 ( nSelType & SelectionType::Ole ) ||
1580 (aCoreSet.GetItemState(RES_MARGIN_FIRSTLINE) < SfxItemState::DEFAULT) ||
1581 (aCoreSet.GetItemState(RES_MARGIN_TEXTLEFT) < SfxItemState::DEFAULT) ||
1582 (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich) ) ||
1583 ( bVerticalWriting && (RES_PARATR_TABSTOP == nWhich))
1584 )
1585 rSet.DisableItem( nWhich );
1586 else
1587 {
1588 SvxTabStopItem aTabStops(aCoreSet.Get( RES_PARATR_TABSTOP ));
1589
1590 const SvxTabStopItem& rDefTabs = rSh.GetDefault(RES_PARATR_TABSTOP);
1591
1592 OSL_ENSURE(m_pHRuler, "why is there no ruler?");
1593 const tools::Long nDefTabDist = ::GetTabDist(rDefTabs);
1594 m_pHRuler->SetDefTabDist( nDefTabDist );
1595 m_pVRuler->SetDefTabDist( nDefTabDist );
1596 ::lcl_EraseDefTabs(aTabStops);
1597 aTabStops.SetWhich(nWhich);
1598 rSet.Put(aTabStops);
1599
1601 {
1602 boost::property_tree::ptree aRootTree;
1603 boost::property_tree::ptree aEntries;
1604
1605 for (sal_uInt16 i = 0; i < aTabStops.Count(); ++i)
1606 {
1607 SvxTabStop const & rTabStop = aTabStops[i];
1608 boost::property_tree::ptree aEntry;
1609 aEntry.put("position", convertTwipToMm100(rTabStop.GetTabPos()));
1610 aEntry.put("type", sal_uInt16(rTabStop.GetAdjustment()));
1611 aEntry.put("decimal", OUString(rTabStop.GetDecimal()));
1612 aEntry.put("fill", OUString(rTabStop.GetFill()));
1613 aEntries.push_back(std::make_pair("", aEntry));
1614 }
1615 aRootTree.push_back(std::make_pair("tabstops", aEntries));
1616
1617 std::stringstream aStream;
1618 boost::property_tree::write_json(aStream, aRootTree);
1619 rSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TAB_STOP_LIST, OString(aStream.str()));
1620 }
1621 }
1622 break;
1623 }
1624
1625 case SID_HANGING_INDENT:
1626 {
1627 SfxItemState e = aCoreSet.GetItemState(RES_MARGIN_FIRSTLINE);
1628 if( e == SfxItemState::DISABLED )
1629 rSet.DisableItem(nWhich);
1630 break;
1631 }
1632
1633 case SID_ATTR_PARA_LRSPACE_VERTICAL:
1634 case SID_ATTR_PARA_LRSPACE:
1635 case SID_ATTR_PARA_LEFTSPACE:
1636 case SID_ATTR_PARA_RIGHTSPACE:
1637 case SID_ATTR_PARA_FIRSTLINESPACE:
1638 {
1639 if ( nSelType & SelectionType::Graphic ||
1640 nSelType & SelectionType::Frame ||
1641 nSelType & SelectionType::Ole ||
1642 nFrameType == FrameTypeFlags::DRAWOBJ ||
1643 (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich)) ||
1644 ( bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich))
1645 )
1646 {
1647 rSet.DisableItem(nWhich);
1648 }
1649 else
1650 {
1651 std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE));
1652 if ( !IsTabColFromDoc() )
1653 {
1654 SvxFirstLineIndentItem const& rFirstLine(aCoreSet.Get(RES_MARGIN_FIRSTLINE));
1655 SvxTextLeftMarginItem const& rLeftMargin(aCoreSet.Get(RES_MARGIN_TEXTLEFT));
1656 SvxRightMarginItem const& rRightMargin(aCoreSet.Get(RES_MARGIN_RIGHT));
1657 aLR->SetTextFirstLineOffset(rFirstLine.GetTextFirstLineOffset(), rFirstLine.GetPropTextFirstLineOffset());
1658 aLR->SetAutoFirst(rFirstLine.IsAutoFirst());
1659 aLR->SetTextLeft(rLeftMargin.GetTextLeft(), rLeftMargin.GetPropLeft());
1660 aLR->SetRight(rRightMargin.GetRight(), rRightMargin.GetPropRight());
1661
1662 // #i23726#
1664 {
1665 short nOffset = static_cast< short >(aLR->GetTextLeft() +
1666 // #i42922# Mouse move of numbering label
1667 // has to consider the left indent of the paragraph
1669
1670 short nFLOffset;
1672
1673 aLR->SetLeft( nOffset + nFLOffset );
1674 }
1675 }
1676 aLR->SetWhich(nWhich);
1677 rSet.Put(*aLR);
1678 }
1679 break;
1680 }
1681
1682 case SID_ATTR_PARA_ULSPACE:
1683 case SID_ATTR_PARA_ABOVESPACE:
1684 case SID_ATTR_PARA_BELOWSPACE:
1685 case SID_PARASPACE_INCREASE:
1686 case SID_PARASPACE_DECREASE:
1687 {
1688 SvxULSpaceItem aUL = aCoreSet.Get(RES_UL_SPACE);
1689 SfxItemState e = aCoreSet.GetItemState(RES_UL_SPACE);
1690 if( e >= SfxItemState::DEFAULT )
1691 {
1692 if ( !aUL.GetUpper() && !aUL.GetLower() )
1693 rSet.DisableItem( SID_PARASPACE_DECREASE );
1694 else if ( aUL.GetUpper() >= 5670 && aUL.GetLower() >= 5670 )
1695 rSet.DisableItem( SID_PARASPACE_INCREASE );
1696 if ( nWhich == SID_ATTR_PARA_ULSPACE
1697 || nWhich == SID_ATTR_PARA_ABOVESPACE
1698 || nWhich == SID_ATTR_PARA_BELOWSPACE
1699 )
1700 {
1701 aUL.SetWhich( nWhich );
1702 rSet.Put( aUL );
1703 }
1704 }
1705 else
1706 {
1707 rSet.DisableItem( SID_PARASPACE_INCREASE );
1708 rSet.DisableItem( SID_PARASPACE_DECREASE );
1709 rSet.InvalidateItem( SID_ATTR_PARA_ULSPACE );
1710 rSet.InvalidateItem( SID_ATTR_PARA_ABOVESPACE );
1711 rSet.InvalidateItem( SID_ATTR_PARA_BELOWSPACE );
1712 }
1713 }
1714 break;
1715
1716 case SID_RULER_BORDER_DISTANCE:
1717 {
1721 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aCoreSet2(GetPool());
1722 if ( nSelType & SelectionType::Graphic ||
1723 nSelType & SelectionType::Frame ||
1724 nSelType & SelectionType::Ole ||
1725 nFrameType == FrameTypeFlags::DRAWOBJ )
1726 rSet.DisableItem(SID_RULER_BORDER_DISTANCE);
1727 else
1728 {
1729 SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE);
1730 if(nFrameType & FrameTypeFlags::FLY_ANY)
1731 {
1732 if( IsTabColFromDoc() )
1733 {
1734 const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( CurRectType::FlyEmbeddedPrt, pPt );
1735 aDistLR.SetLeft(rFlyPrtRect.Left());
1736 aDistLR.SetRight(rFlyPrtRect.Left());
1737 rSet.Put(aDistLR);
1738 }
1739 else
1740 {
1741 SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1742 aCoreSet2.Put(aBoxInfo);
1743 rSh.GetFlyFrameAttr(aCoreSet2);
1744 const SvxBoxItem& rBox = aCoreSet2.Get(RES_BOX);
1745 aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT));
1746 aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT));
1747 rSet.Put(aDistLR);
1748
1749 //add the paragraph border distance
1751 rSh.GetCurAttr( aCoreSet1 );
1752 const SvxBoxItem& rParaBox = aCoreSet1.Get(RES_BOX);
1753 aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
1754 aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
1755 }
1756 m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1757 m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
1758 }
1759 else if ( IsTabColFromDoc() ||
1760 ( rSh.GetTableFormat() && !bFrameSelection &&
1761 !(nFrameType & FrameTypeFlags::COLSECT ) ) )
1762 {
1763 SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1764 aBoxInfo.SetTable(false);
1765 aBoxInfo.SetDist(true);
1766 aCoreSet2.Put(aBoxInfo);
1767 rSh.GetTabBorders( aCoreSet2 );
1768 const SvxBoxItem& rBox = aCoreSet2.Get(RES_BOX);
1769 aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT));
1770 aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT));
1771 rSet.Put(aDistLR);
1772
1773 //add the border distance of the paragraph
1775 rSh.GetCurAttr( aCoreSet1 );
1776 const SvxBoxItem& rParaBox = aCoreSet1.Get(RES_BOX);
1777 aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
1778 aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
1779 m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1780 m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
1781 }
1782 else if ( !rSh.IsDirectlyInSection() )
1783 {
1784 //get the page/header/footer border distance
1785 const SwFrameFormat& rMaster = rDesc.GetMaster();
1786 const SvxBoxItem& rBox = rMaster.GetAttrSet().Get(RES_BOX);
1787 aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT));
1788 aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT));
1789
1790 const SvxBoxItem* pBox = nullptr;
1791 if(nFrameType & FrameTypeFlags::HEADER)
1792 {
1793 rMaster.GetHeader();
1794 const SwFormatHeader& rHeaderFormat = rMaster.GetHeader();
1795 SwFrameFormat *pHeaderFormat = const_cast<SwFrameFormat*>(rHeaderFormat.GetHeaderFormat());
1796 if( pHeaderFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash
1797 pBox = & pHeaderFormat->GetBox();
1798 }
1799 else if(nFrameType & FrameTypeFlags::FOOTER )
1800 {
1801 const SwFormatFooter& rFooterFormat = rMaster.GetFooter();
1802 SwFrameFormat *pFooterFormat = const_cast<SwFrameFormat*>(rFooterFormat.GetFooterFormat());
1803 if( pFooterFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash
1804 pBox = & pFooterFormat->GetBox();
1805 }
1806 if(pBox)
1807 {
1808 aDistLR.SetLeft(pBox->GetDistance(SvxBoxItemLine::LEFT));
1809 aDistLR.SetRight(pBox->GetDistance(SvxBoxItemLine::RIGHT));
1810 }
1811 rSet.Put(aDistLR);
1812
1813 //add the border distance of the paragraph
1814 rSh.GetCurAttr(aCoreSet2);
1815 const SvxBoxItem& rParaBox = aCoreSet2.Get(RES_BOX);
1816 aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
1817 aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
1818 m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
1819 m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
1820 }
1821 }
1822 }
1823 break;
1824
1825 case SID_RULER_TEXT_RIGHT_TO_LEFT:
1826 {
1827 if ( nSelType & SelectionType::Graphic ||
1828 nSelType & SelectionType::Frame ||
1829 nSelType & SelectionType::Ole ||
1830 nFrameType == FrameTypeFlags::DRAWOBJ)
1831 rSet.DisableItem(nWhich);
1832 else
1833 {
1834 bool bFlag = rSh.IsInRightToLeftText();
1835 rSet.Put(SfxBoolItem(nWhich, bFlag));
1836 }
1837 }
1838 break;
1839
1840 case SID_RULER_BORDERS_VERTICAL:
1841 case SID_RULER_BORDERS:
1842 {
1843 bool bFrameHasVerticalColumns(false);
1844 {
1845 bool bFrameRTL;
1846 bool bFrameVertL2R;
1847 bFrameHasVerticalColumns = rSh.IsFrameVertical(false, bFrameRTL, bFrameVertL2R) &&
1848 bFrameSelection;
1849 }
1850 bool bHasTable = ( IsTabColFromDoc() ||
1851 ( rSh.GetTableFormat() && !bFrameSelection &&
1852 !(nFrameType & FrameTypeFlags::COLSECT ) ) );
1853
1854 bool bTableVertical = bHasTable && rSh.IsTableVertical();
1855
1856 if(((SID_RULER_BORDERS_VERTICAL == nWhich) &&
1857 ((bHasTable && !bTableVertical) ||
1858 (!bVerticalWriting && !bFrameSelection && !bHasTable ) ||
1859 ( bFrameSelection && !bFrameHasVerticalColumns))) ||
1860 ((SID_RULER_BORDERS == nWhich) &&
1861 ((bHasTable && bTableVertical) ||
1862 (bVerticalWriting && !bFrameSelection&& !bHasTable) || bFrameHasVerticalColumns)))
1863 rSet.DisableItem(nWhich);
1864 else if ( bHasTable )
1865 {
1866 SwTabCols aTabCols;
1867 size_t nNum = 0;
1869 if ( m_bSetTabColFromDoc )
1870 {
1871 rSh.GetMouseTabCols( aTabCols, m_aTabColFromDocPos );
1873 }
1874 else
1875 {
1876 rSh.GetTabCols( aTabCols );
1877 nNum = rSh.GetCurTabColNum();
1878 if(rSh.IsTableRightToLeft())
1879 nNum = aTabCols.Count() - nNum;
1880 }
1881
1882 OSL_ENSURE(nNum <= aTabCols.Count(), "TabCol not found");
1883 const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
1884 const int nRgt = (bTableVertical ? nPageHeight : nPageWidth) -
1885 (aTabCols.GetLeftMin() + aTabCols.GetRight());
1886
1887 const sal_uInt16 nL = static_cast< sal_uInt16 >(std::max(nLft, 0));
1888 const sal_uInt16 nR = static_cast< sal_uInt16 >(std::max(nRgt, 0));
1889
1890 SvxColumnItem aColItem(nNum, nL, nR);
1891
1892 tools::Long nStart = 0;
1893 tools::Long nEnd = 0;
1894
1895 //columns in right-to-left tables need to be mirrored
1896 bool bIsTableRTL =
1897 IsTabColFromDoc() ?
1899 : rSh.IsTableRightToLeft();
1900 if(bIsTableRTL)
1901 {
1902 for ( size_t i = aTabCols.Count(); i; --i )
1903 {
1904 const SwTabColsEntry& rEntry = aTabCols.GetEntry( i - 1 );
1905 nEnd = aTabCols.GetRight() - rEntry.nPos;
1906 SvxColumnDescription aColDesc( nStart, nEnd,
1907 aTabCols.GetRight() - rEntry.nMax,
1908 aTabCols.GetRight() - rEntry.nMin,
1909 !aTabCols.IsHidden(i - 1) );
1910 aColItem.Append(aColDesc);
1911 nStart = nEnd;
1912 }
1913 SvxColumnDescription aColDesc(nStart,
1914 aTabCols.GetRight() - aTabCols.GetLeft(), true);
1915 aColItem.Append(aColDesc);
1916 }
1917 else
1918 {
1919 for ( size_t i = 0; i < aTabCols.Count(); ++i )
1920 {
1921 const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
1922 nEnd = rEntry.nPos - aTabCols.GetLeft();
1923 SvxColumnDescription aColDesc( nStart, nEnd,
1924 rEntry.nMin - aTabCols.GetLeft(), rEntry.nMax - aTabCols.GetLeft(),
1925 !aTabCols.IsHidden(i) );
1926 aColItem.Append(aColDesc);
1927 nStart = nEnd;
1928 }
1929 SvxColumnDescription aColDesc(nStart, aTabCols.GetRight() - aTabCols.GetLeft(),
1930 0, 0, true);
1931 aColItem.Append(aColDesc);
1932 }
1933 aColItem.SetWhich(nWhich);
1934 rSet.Put(aColItem);
1935 }
1936 else if ( bFrameSelection || nFrameType & ( FrameTypeFlags::COLUMN | FrameTypeFlags::COLSECT ) )
1937 {
1938 // Out of frame or page?
1939 sal_uInt16 nNum = 0;
1940 if(bFrameSelection)
1941 {
1942 const SwFrameFormat* pFormat = rSh.GetFlyFrameFormat();
1943 if(pFormat)
1944 nNum = pFormat->GetCol().GetNumCols();
1945 }
1946 else
1947 nNum = rSh.GetCurColNum();
1948
1949 if(
1950 // For that matter FrameTypeFlags::COLSECT should not be included
1951 // if the border is selected!
1952 !bFrameSelection &&
1953 nFrameType & FrameTypeFlags::COLSECT )
1954 {
1955 const SwSection *pSect = rSh.GetAnySection(false, pPt);
1956 OSL_ENSURE( pSect, "Which section?");
1957 if( pSect )
1958 {
1959 SwSectionFormat const *pFormat = pSect->GetFormat();
1960 const SwFormatCol& rCol = pFormat->GetCol();
1961 if (rSh.IsColRightToLeft())
1962 nNum = rCol.GetColumns().size() - nNum;
1963 else
1964 --nNum;
1965 SvxColumnItem aColItem(nNum);
1967 const SwRect aTmpRect = rSh.GetAnyCurRect(CurRectType::Section, pPt);
1968
1969 ::lcl_FillSvxColumn(rCol, bVerticalWriting ? aRect.Height() : aRect.Width(), aColItem, 0);
1970
1971 if(bVerticalWriting)
1972 {
1973 aRect.Pos() += Point(aTmpRect.Left(), aTmpRect.Top());
1974 aRect.Pos().AdjustY( -(rPageRect.Top()) );
1975 aColItem.SetLeft(aRect.Top());
1976 aColItem.SetRight(nPageHeight - aRect.Bottom());
1977 }
1978 else
1979 {
1980 aRect.Pos() += aTmpRect.Pos();
1981
1982 // make relative to page position:
1983 aColItem.SetLeft (o3tl::narrowing<sal_uInt16>( aRect.Left() - rPageRect.Left() ));
1984 aColItem.SetRight(o3tl::narrowing<sal_uInt16>( rPageRect.Right() - aRect.Right()));
1985 }
1986 aColItem.SetOrtho(aColItem.CalcOrtho());
1987
1988 aColItem.SetWhich(nWhich);
1989 rSet.Put(aColItem);
1990 }
1991 }
1992 else if( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY )
1993 {
1994 // Columns in frame
1995 if ( nNum )
1996 {
1997 const SwFrameFormat* pFormat = rSh.GetFlyFrameFormat() ;
1998
1999 const SwFormatCol& rCol = pFormat->GetCol();
2000 if (rSh.IsColRightToLeft())
2001 nNum = rCol.GetColumns().size() - nNum;
2002 else
2003 nNum--;
2004 SvxColumnItem aColItem(nNum);
2005 const SwRect &rSizeRect = rSh.GetAnyCurRect(CurRectType::FlyEmbeddedPrt, pPt);
2006
2007 bool bUseVertical = bFrameHasVerticalColumns || (!bFrameSelection && bVerticalWriting);
2008 const tools::Long lWidth = bUseVertical ? rSizeRect.Height() : rSizeRect.Width();
2009 const SwRect &rRect = rSh.GetAnyCurRect(CurRectType::FlyEmbedded, pPt);
2010 tools::Long nDist2 = ((bUseVertical ? rRect.Height() : rRect.Width()) - lWidth) /2;
2011 ::lcl_FillSvxColumn(rCol, lWidth, aColItem, nDist2);
2012
2013 if(bUseVertical)
2014 {
2015 aColItem.SetLeft(rRect.Top()- rPageRect.Top());
2016 aColItem.SetRight(nPageHeight + rPageRect.Top() - rRect.Bottom());
2017 }
2018 else
2019 {
2020 aColItem.SetLeft(rRect.Left() - rPageRect.Left());
2021 aColItem.SetRight(rPageRect.Right() - rRect.Right());
2022 }
2023
2024 aColItem.SetOrtho(aColItem.CalcOrtho());
2025
2026 aColItem.SetWhich(nWhich);
2027 rSet.Put(aColItem);
2028 }
2029 else
2030 rSet.DisableItem(nWhich);
2031 }
2032 else
2033 { // Columns on the page
2034 const SwFrameFormat& rMaster = rDesc.GetMaster();
2035 SwFormatCol aCol(rMaster.GetCol());
2036 if(rFrameDir.GetValue() == SvxFrameDirection::Horizontal_RL_TB)
2037 nNum = aCol.GetColumns().size() - nNum;
2038 else
2039 nNum--;
2040
2041 SvxColumnItem aColItem(nNum);
2042 const SwRect aPrtRect = rSh.GetAnyCurRect(CurRectType::PagePrt, pPt);
2043 const SvxBoxItem& rBox = rMaster.GetFormatAttr(RES_BOX);
2044 tools::Long nDist = rBox.GetSmallestDistance();
2045
2047 aCol,
2048 bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width(),
2049 aColItem, nDist);
2050
2051 if(bBrowse)
2052 {
2053 if (bVerticalWriting)
2054 {
2055 aColItem.SetLeft(o3tl::narrowing<sal_uInt16>(rPagePrtRect.Top()));
2056 aColItem.SetRight(sal_uInt16(nPageHeight - rPagePrtRect.Bottom()));
2057 }
2058 else
2059 {
2060 aColItem.SetLeft(o3tl::narrowing<sal_uInt16>(rPagePrtRect.Left()));
2061 aColItem.SetRight(sal_uInt16(nPageWidth - rPagePrtRect.Right()));
2062 }
2063 }
2064 else
2065 {
2066 if (bVerticalWriting)
2067 {
2068 SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
2069 aColItem.SetLeft (aUL.GetUpper());
2070 aColItem.SetRight(aUL.GetLower());
2071 }
2072 else
2073 {
2074 aColItem.SetLeft (aPageLRSpace.GetLeft());
2075 aColItem.SetRight(aPageLRSpace.GetRight());
2076 }
2077 }
2078 aColItem.SetOrtho(aColItem.CalcOrtho());
2079
2080 aColItem.SetWhich(nWhich);
2081 rSet.Put(aColItem);
2082 }
2083 }
2084 else
2085 rSet.DisableItem(nWhich);
2086 break;
2087 }
2088
2089 case SID_RULER_ROWS :
2090 case SID_RULER_ROWS_VERTICAL:
2091 {
2092 bool bFrameHasVerticalColumns(false);
2093 {
2094 bool bFrameRTL;
2095 bool bFrameVertL2R;
2096 bFrameHasVerticalColumns = rSh.IsFrameVertical(false, bFrameRTL, bFrameVertL2R) &&
2097 bFrameSelection;
2098 }
2099
2100 if(((SID_RULER_ROWS == nWhich) &&
2101 ((!bVerticalWriting && !bFrameSelection) || (bFrameSelection && !bFrameHasVerticalColumns))) ||
2102 ((SID_RULER_ROWS_VERTICAL == nWhich) &&
2103 ((bVerticalWriting && !bFrameSelection) || bFrameHasVerticalColumns)))
2104 rSet.DisableItem(nWhich);
2105 else if ( IsTabRowFromDoc() ||
2106 ( rSh.GetTableFormat() && !bFrameSelection &&
2107 !(nFrameType & FrameTypeFlags::COLSECT ) ) )
2108 {
2109 SwTabCols aTabCols;
2111 if ( m_bSetTabRowFromDoc )
2112 {
2113 rSh.GetMouseTabRows( aTabCols, m_aTabColFromDocPos );
2114 }
2115 else
2116 {
2117 rSh.GetTabRows( aTabCols );
2118 }
2119
2120 const int nLft = aTabCols.GetLeftMin();
2121 const int nRgt = (bVerticalWriting ? nPageWidth : nPageHeight) -
2122 (aTabCols.GetLeftMin() + aTabCols.GetRight());
2123
2124 const sal_uInt16 nL = static_cast< sal_uInt16 >(std::max(nLft, 0));
2125 const sal_uInt16 nR = static_cast< sal_uInt16 >(std::max(nRgt, 0));
2126
2127 SvxColumnItem aColItem(0, nL, nR);
2128
2129 tools::Long nStart = 0;
2130 tools::Long nEnd = 0;
2131
2132 for ( size_t i = 0; i < aTabCols.Count(); ++i )
2133 {
2134 const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
2135 if(bVerticalWriting)
2136 {
2137 nEnd = aTabCols.GetRight() - rEntry.nPos;
2138 SvxColumnDescription aColDesc( nStart, nEnd,
2139 std::max(tools::Long(0), aTabCols.GetRight() - rEntry.nMax),
2140 std::max(tools::Long(0), aTabCols.GetRight() - rEntry.nMin),
2141 !aTabCols.IsHidden(i) );
2142 aColItem.Append(aColDesc);
2143 }
2144 else
2145 {
2146 nEnd = rEntry.nPos - aTabCols.GetLeft();
2147 SvxColumnDescription aColDesc( nStart, nEnd,
2148 rEntry.nMin - aTabCols.GetLeft(),
2149 rEntry.nMax - aTabCols.GetLeft(),
2150 !aTabCols.IsHidden(i) );
2151 aColItem.Append(aColDesc);
2152 }
2153 nStart = nEnd;
2154 }
2155 if(bVerticalWriting)
2156 nEnd = aTabCols.GetRight();
2157 else
2158 nEnd = aTabCols.GetLeft();
2159
2160 SvxColumnDescription aColDesc( nStart, nEnd,
2161 aTabCols.GetRight(),
2162 aTabCols.GetRight(),
2163 false );
2164 aColItem.Append(aColDesc);
2165
2166 aColItem.SetWhich(nWhich);
2167 rSet.Put(aColItem);
2168 }
2169 else
2170 rSet.DisableItem(nWhich);
2171 }
2172 break;
2173
2174 case SID_RULER_PAGE_POS:
2175 {
2176 SvxPagePosSizeItem aPagePosSize(
2177 Point( rPageRect.Left(), rPageRect.Top()) , nPageWidth, nPageHeight);
2178
2179 rSet.Put(aPagePosSize);
2180 break;
2181 }
2182
2183 case SID_RULER_LR_MIN_MAX:
2184 {
2185 tools::Rectangle aRectangle;
2186 if( ( nFrameType & FrameTypeFlags::COLSECT ) && !IsTabColFromDoc() &&
2187 ( nFrameType & ( FrameTypeFlags::TABLE|FrameTypeFlags::COLUMN ) ) )
2188 {
2189 if( nFrameType & FrameTypeFlags::TABLE )
2190 {
2191 const size_t nNum = rSh.GetCurTabColNum();
2192 SwTabCols aTabCols;
2193 rSh.GetTabCols( aTabCols );
2194
2195 const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
2196 const int nRgt = nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight());
2197
2198 const sal_uInt16 nL = static_cast< sal_uInt16 >(std::max(nLft, 0));
2199 const sal_uInt16 nR = static_cast< sal_uInt16 >(std::max(nRgt, 0));
2200
2201 aRectangle.SetLeft( nL );
2202 if(nNum > 1)
2203 aRectangle.AdjustLeft(aTabCols[nNum - 2] );
2204 if(nNum)
2205 aRectangle.AdjustLeft(MINLAY );
2206 if(aTabCols.Count() <= nNum + 1 )
2207 aRectangle.SetRight( nR );
2208 else
2209 aRectangle.SetRight( nPageWidth - (nL + aTabCols[nNum + 1]) );
2210
2211 if(nNum < aTabCols.Count())
2212 aRectangle.AdjustRight(MINLAY );
2213 }
2214 else
2215 {
2216 const SwFrameFormat* pFormat = rSh.GetFlyFrameFormat();
2217 const SwFormatCol* pCols = pFormat ? &pFormat->GetCol():
2218 &rDesc.GetMaster().GetCol();
2219 const SwColumns& rCols = pCols->GetColumns();
2220 sal_uInt16 nNum = rSh.GetCurOutColNum();
2221 const sal_uInt16 nCount = std::min(sal_uInt16(nNum + 1), sal_uInt16(rCols.size()));
2222 const SwRect aRect( rSh.GetAnyCurRect( pFormat
2224 : CurRectType::PagePrt, pPt ));
2225 const SwRect aAbsRect( rSh.GetAnyCurRect( pFormat
2227 : CurRectType::Page, pPt ));
2228
2229 // The width of the frame or within the page margins.
2230 const sal_uInt16 nTotalWidth = o3tl::narrowing<sal_uInt16>(aRect.Width());
2231 // The entire frame width - The difference is twice the distance to the edge.
2232 const sal_uInt16 nOuterWidth = o3tl::narrowing<sal_uInt16>(aAbsRect.Width());
2233 int nWidth = 0,
2234 nEnd = 0;
2235 aRectangle.SetLeft( 0 );
2236 for ( sal_uInt16 i = 0; i < nCount; ++i )
2237 {
2238 const SwColumn* pCol = &rCols[i];
2239 const int nStart = pCol->GetLeft() + nWidth;
2240 if(i == nNum - 2)
2241 aRectangle.SetLeft( nStart );
2242 nWidth += pCols->CalcColWidth( i, nTotalWidth );
2243 nEnd = nWidth - pCol->GetRight();
2244 }
2245 aRectangle.SetRight( rPageRect.Right() - nEnd );
2246 aRectangle.AdjustLeft( -(rPageRect.Left()) );
2247
2248 if(nNum > 1)
2249 {
2250 aRectangle.AdjustLeft(MINLAY );
2251 aRectangle.AdjustLeft(aRect.Left() );
2252 }
2253 if(pFormat) // Range in frame - here you may up to the edge
2254 {
2255 aRectangle.SetLeft(0);
2256 aRectangle.SetRight(0);
2257 }
2258 else
2259 {
2260 // Move the rectangle to the correct absolute position.
2261 aRectangle.AdjustLeft(aAbsRect.Left() );
2262 aRectangle.AdjustRight( -(aAbsRect.Left()) );
2263 // Include distance to the border.
2264 aRectangle.AdjustRight( -((nOuterWidth - nTotalWidth) / 2) );
2265 }
2266
2267 if(nNum < rCols.size())
2268 {
2269 aRectangle.AdjustRight(MINLAY );
2270 }
2271 else
2272 // Right is only the margin now.
2273 aRectangle.SetRight( 0 );
2274
2275 }
2276 }
2277 else if ( ((nFrameType & FrameTypeFlags::TABLE) || IsTabColFromDoc()) &&
2278 !bFrameSelection )
2279 {
2280 bool bColumn;
2281 if ( IsTabColFromDoc() )
2282 bColumn = rSh.GetCurMouseColNum( m_aTabColFromDocPos ) != 0;
2283 else
2285
2286 if ( !bColumn )
2287 {
2288 if( nFrameType & FrameTypeFlags::FLY_ANY && IsTabColFromDoc() )
2289 {
2290 SwRect aRect( rSh.GetAnyCurRect(
2293 pPt ).Pos();
2294
2295 aRectangle.SetLeft( aRect.Left() - rPageRect.Left() );
2296 aRectangle.SetRight( rPageRect.Right() - aRect.Right() );
2297 }
2298 else if( bBrowse )
2299 {
2300 aRectangle.SetLeft( rPagePrtRect.Left() );
2301 aRectangle.SetRight( nPageWidth - rPagePrtRect.Right() );
2302 }
2303 else
2304 {
2305 aRectangle.SetLeft( aPageLRSpace.GetLeft() );
2306 aRectangle.SetRight( aPageLRSpace.GetRight() );
2307 }
2308 }
2309 else
2310 { // Here only for table in multi-column pages and borders.
2311 bool bSectOutTable = bool(nFrameType & FrameTypeFlags::TABLE);
2312 bool bFrame = bool(nFrameType & FrameTypeFlags::FLY_ANY);
2313 bool bColSct = bool(nFrameType & ( bSectOutTable
2316 );
2317 //So you can also drag with the mouse, without being in the table.
2319 size_t nNum = IsTabColFromDoc() ?
2321 rSh.GetCurOutColNum();
2322 const SwFrameFormat* pFormat = nullptr;
2323 if( bColSct )
2324 {
2325 eRecType = bSectOutTable ? CurRectType::SectionOutsideTable
2327 const SwSection *pSect = rSh.GetAnySection( bSectOutTable, pPt );
2328 OSL_ENSURE( pSect, "Which section?");
2329 pFormat = pSect->GetFormat();
2330 }
2331 else if( bFrame )
2332 {
2333 pFormat = rSh.GetFlyFrameFormat();
2334 eRecType = CurRectType::FlyEmbeddedPrt;
2335 }
2336
2337 const SwFormatCol* pCols = pFormat ? &pFormat->GetCol():
2338 &rDesc.GetMaster().GetCol();
2339 const SwColumns& rCols = pCols->GetColumns();
2340 const sal_uInt16 nBorder = pFormat
2341 ? pFormat->GetBox().GetSmallestDistance()
2342 : rDesc.GetMaster().GetBox().GetSmallestDistance();
2343
2344 // RECT_FLY_PRT_EMBEDDED returns the relative position to RECT_FLY_EMBEDDED
2345 // the absolute position must be added here
2346
2347 SwRect aRect( rSh.GetAnyCurRect( eRecType, pPt ) );
2348 if(CurRectType::FlyEmbeddedPrt == eRecType)
2350 pPt ).Pos();
2351
2352 const sal_uInt16 nTotalWidth = o3tl::narrowing<sal_uInt16>(aRect.Width());
2353 // Initialize nStart and nEnd for nNum == 0
2354 int nWidth = 0,
2355 nStart = 0,
2356 nEnd = nTotalWidth;
2357
2358 if( nNum > rCols.size() )
2359 {
2360 OSL_ENSURE( false, "wrong FormatCol is being edited!" );
2361 nNum = rCols.size();
2362 }
2363
2364 for( size_t i = 0; i < nNum; ++i )
2365 {
2366 const SwColumn* pCol = &rCols[i];
2367 nStart = pCol->GetLeft() + nWidth;
2368 nWidth += pCols->CalcColWidth( o3tl::narrowing<sal_uInt16>(i), nTotalWidth );
2369 nEnd = nWidth - pCol->GetRight();
2370 }
2371 if( bFrame || bColSct )
2372 {
2373 aRectangle.SetLeft( aRect.Left() - rPageRect.Left() + nStart );
2374 aRectangle.SetRight( nPageWidth - aRectangle.Left() - nEnd + nStart );
2375 }
2376 else if(!bBrowse)
2377 {
2378 aRectangle.SetLeft( aPageLRSpace.GetLeft() + nStart );
2379 aRectangle.SetRight( nPageWidth - nEnd - aPageLRSpace.GetLeft() );
2380 }
2381 else
2382 {
2383 tools::Long nLeft = rPagePrtRect.Left();
2384 aRectangle.SetLeft( nStart + nLeft );
2385 aRectangle.SetRight( nPageWidth - nEnd - nLeft );
2386 }
2387 if(!bFrame)
2388 {
2389 aRectangle.AdjustLeft(nBorder );
2390 aRectangle.AdjustRight( -nBorder );
2391 }
2392 }
2393 }
2394 else if ( nFrameType & ( FrameTypeFlags::HEADER | FrameTypeFlags::FOOTER ))
2395 {
2396 aRectangle.SetLeft( aPageLRSpace.GetLeft() );
2397 aRectangle.SetRight( aPageLRSpace.GetRight() );
2398 }
2399 else
2400 {
2401 aRectangle.SetLeft(0);
2402 aRectangle.SetRight(0);
2403 }
2404
2405 SfxRectangleItem aLR( SID_RULER_LR_MIN_MAX , aRectangle);
2406 rSet.Put(aLR);
2407 }
2408 break;
2409
2410 case SID_RULER_PROTECT:
2411 {
2412 if(bFrameSelection)
2413 {
2415
2416 SvxProtectItem aProt(SID_RULER_PROTECT);
2417 aProt.SetContentProtect(bool(nProtect & FlyProtectFlags::Content));
2418 aProt.SetSizeProtect (bool(nProtect & FlyProtectFlags::Size));
2419 aProt.SetPosProtect (bool(nProtect & FlyProtectFlags::Pos));
2420 rSet.Put(aProt);
2421 }
2422 else
2423 {
2424 SvxProtectItem aProtect(SID_RULER_PROTECT);
2425 if(bBrowse && !(nFrameType & (FrameTypeFlags::DRAWOBJ|FrameTypeFlags::COLUMN)) && !rSh.GetTableFormat())
2426 {
2427 aProtect.SetSizeProtect(true);
2428 aProtect.SetPosProtect(true);
2429 }
2430 rSet.Put(aProtect);
2431 }
2432 }
2433 break;
2434
2439 {
2440 const SwFormatHeader& rHeader = rDesc.GetMaster().GetHeader();
2441 bool bHeaderOn = rHeader.IsActive();
2442 rSet.Put( SfxBoolItem(SID_ATTR_PAGE_HEADER, bHeaderOn ) );
2443 if(bHeaderOn)
2444 {
2445 const SvxLRSpaceItem* pLR = rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_LRSPACE);
2446 const SvxULSpaceItem* pUL = rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_ULSPACE);
2447 if (pLR && pUL)
2448 {
2450 rSet.Put(aLR);
2452 rSet.Put(aUL);
2453 }
2454
2455 bool bShared = !rDesc.IsHeaderShared();
2456 bool bFirst = !rDesc.IsFirstShared(); // FIXME control changes for both header footer - tdf#100287
2457 sal_uInt16 nLayout = (static_cast<int>(bShared)<<1) + static_cast<int>(bFirst);
2458 SfxInt16Item aLayoutItem(SID_ATTR_PAGE_HEADER_LAYOUT, nLayout);
2459 rSet.Put(aLayoutItem);
2460 }
2461 }
2462 break;
2467 {
2468 const SwFormatFooter& rFooter = rDesc.GetMaster().GetFooter();
2469 bool bFooterOn = rFooter.IsActive();
2470 rSet.Put( SfxBoolItem(SID_ATTR_PAGE_FOOTER, bFooterOn ) );
2471 if (bFooterOn)
2472 {
2473 if (const SvxLRSpaceItem* rLR = rFooter.GetFooterFormat()->GetAttrSet().GetItem<SvxLRSpaceItem>(SID_ATTR_LRSPACE))
2474 {
2475 SvxLongLRSpaceItem aLR(rLR->GetLeft(), rLR->GetRight(), SID_ATTR_PAGE_FOOTER_LRMARGIN);
2476 rSet.Put(aLR);
2477 }
2478 if (const SvxULSpaceItem* rUL = rFooter.GetFooterFormat()->GetAttrSet().GetItem<SvxULSpaceItem>(SID_ATTR_ULSPACE))
2479 {
2480 SvxLongULSpaceItem aUL( rUL->GetUpper(), rUL->GetLower(), SID_ATTR_PAGE_FOOTER_SPACING);
2481 rSet.Put(aUL);
2482 }
2483 bool bShared = !rDesc.IsFooterShared();
2484 bool bFirst = !rDesc.IsFirstShared(); // FIXME control changes for both header footer - tdf#100287
2485 sal_uInt16 nLayout = (static_cast<int>(bShared)<<1) + static_cast<int>(bFirst);
2486 SfxInt16Item aLayoutItem(SID_ATTR_PAGE_FOOTER_LAYOUT, nLayout);
2487 rSet.Put(aLayoutItem);
2488 }
2489 }
2490 break;
2491
2492 case SID_ATTR_PAGE_COLOR:
2493 case SID_ATTR_PAGE_FILLSTYLE:
2494 case SID_ATTR_PAGE_GRADIENT:
2495 case SID_ATTR_PAGE_HATCH:
2496 case SID_ATTR_PAGE_BITMAP:
2497 {
2498 SfxItemSet aSet = rDesc.GetMaster().GetAttrSet();
2499 if (const auto pFillStyleItem = aSet.GetItem(XATTR_FILLSTYLE))
2500 {
2501 drawing::FillStyle eXFS = pFillStyleItem->GetValue();
2502 XFillStyleItem aFillStyleItem( eXFS );
2503 aFillStyleItem.SetWhich( SID_ATTR_PAGE_FILLSTYLE );
2504 rSet.Put(aFillStyleItem);
2505
2506 switch(eXFS)
2507 {
2508 case drawing::FillStyle_SOLID:
2509 {
2510 if (const auto pItem = aSet.GetItem<XFillColorItem>(XATTR_FILLCOLOR, false))
2511 {
2512 Color aColor = pItem->GetColorValue();
2513 XFillColorItem aFillColorItem( OUString(), aColor );
2514 aFillColorItem.SetWhich( SID_ATTR_PAGE_COLOR );
2515 rSet.Put( aFillColorItem );
2516 }
2517 break;
2518 }
2519
2520 case drawing::FillStyle_GRADIENT:
2521 {
2522 const basegfx::BGradient& aBGradient = aSet.GetItem<XFillGradientItem>( XATTR_FILLGRADIENT )->GetGradientValue();
2523 XFillGradientItem aFillGradientItem( OUString(), aBGradient, SID_ATTR_PAGE_GRADIENT );
2524 rSet.Put( aFillGradientItem );
2525 }
2526 break;
2527
2528 case drawing::FillStyle_HATCH:
2529 {
2530 const XFillHatchItem *pFillHatchItem( aSet.GetItem<XFillHatchItem>( XATTR_FILLHATCH ) );
2531 XFillHatchItem aFillHatchItem( pFillHatchItem->GetName(), pFillHatchItem->GetHatchValue());
2532 aFillHatchItem.SetWhich( SID_ATTR_PAGE_HATCH );
2533 rSet.Put( aFillHatchItem );
2534 }
2535 break;
2536
2537 case drawing::FillStyle_BITMAP:
2538 {
2539 const XFillBitmapItem *pFillBitmapItem = aSet.GetItem<XFillBitmapItem>( XATTR_FILLBITMAP );
2540 XFillBitmapItem aFillBitmapItem( pFillBitmapItem->GetName(), pFillBitmapItem->GetGraphicObject() );
2541 aFillBitmapItem.SetWhich( SID_ATTR_PAGE_BITMAP );
2542 rSet.Put( aFillBitmapItem );
2543 }
2544 break;
2545 case drawing::FillStyle_NONE:
2546 {
2547 }
2548 break;
2549
2550 default:
2551 break;
2552 }
2553 }
2554 break;
2555 }
2556
2557 }
2558 nWhich = aIter.NextWhich();
2559 }
2560}
2561
2562/* 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()
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
SfxViewFrame & GetViewFrame() const
static SAL_WARN_UNUSED_RESULT SfxViewShell * Get(const css::uno::Reference< css::frame::XController > &i_rController)
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:2550
void StartAction()
Definition: crsrsh.cxx:226
bool IsInVerticalText(const Point *pPt=nullptr) const
Definition: crsrsh.cxx:3763
void GetPageNum(sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, bool bAtCursorPos=true, const bool bCalcFrame=true)
Definition: crsrsh.cxx:1509
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
bool IsInRightToLeftText() const
Definition: crsrsh.cxx:3770
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:797
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:848
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:1133
void SetMouseTabRows(const SwTabCols &rNew, bool bCurColOnly, const Point &rPt)
Definition: fetab.cxx:873
void GetTabCols(SwTabCols &rToFill) const
Info about columns and margins.
Definition: fetab.cxx:815
bool IsColRightToLeft() const
Definition: fews.cxx:585
bool IsTableVertical() const
Definition: fetab.cxx:2497
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:2218
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:832
bool IsMouseTableRightToLeft(const Point &rPt) const
Definition: fetab.cxx:2489
void GetMouseTabCols(SwTabCols &rToFill, const Point &rPt) const
Definition: fetab.cxx:2211
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:953
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1061
sal_uInt16 GetCurMouseColNum(const Point &rPt) const
Definition: fetab.cxx:2231
size_t IsObjSelected() const
Definition: feshview.cxx:1125
size_t GetCurMouseTabColNum(const Point &rPt) const
Definition: fetab.cxx:2236
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:1499
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:126
void GetMouseTabRows(SwTabCols &rToFill, const Point &rPt) const
Definition: fetab.cxx:866
bool IsDirectlyInSection() const
Definition: fews.cxx:231
bool IsTableRightToLeft() const
Definition: fetab.cxx:2480
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:72
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:341
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:3277
bool GetFirstLineOfsWithNum(short &rFirstOffset) const
Returns the combined first line indent of this text node and its numbering.
Definition: ndtxt.cxx:3334
bool getBrowseMode() const
Definition: viewopt.hxx:636
bool IsViewLocked() const
Definition: viewsh.hxx:490
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2817
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:470
void LockView(bool b)
Definition: viewsh.hxx:491
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:648
bool m_bSetTabRowFromDoc
Definition: view.hxx:246
sal_uInt16 m_nRightBorderDistance
Definition: view.hxx:233
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
void SetNumRuleNodeFromDoc(SwTextNode *pNumRuleNode)
Definition: view.hxx:459
bool IsTabColFromDoc() const
Definition: view.hxx:455
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:457
void StateTabWin(SfxItemSet &)
Definition: viewtab.cxx:1365
SwTextNode * m_pNumRuleNodeFromDoc
Definition: view.hxx:188
SvxRuler & GetHRuler()
Definition: view.hxx:505
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:1908
void LeaveSelFrameMode()
Definition: select.cxx:729
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1723
void UnSelectFrame()
Definition: select.cxx:332
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2047
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:897
#define SID_ATTR_PAGE_HEADER_LRMARGIN
Definition: cmdid.h:898
#define SID_ATTR_PAGE_COLUMN
Definition: cmdid.h:896
#define SID_ATTR_PAGE_FOOTER_SPACING
Definition: cmdid.h:903
#define SID_ATTR_PAGE_HEADER_SPACING
Definition: cmdid.h:899
#define SID_ATTR_PAGE_FOOTER_LAYOUT
Definition: cmdid.h:904
#define SID_ATTR_PAGE_FOOTER
Definition: cmdid.h:901
#define SID_ATTR_PAGE_HEADER_LAYOUT
Definition: cmdid.h:900
#define SID_ATTR_PAGE_FOOTER_LRMARGIN
Definition: cmdid.h:902
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:38
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:650
SW_DLLPUBLIC void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem &rTabs)
Definition: uitool.cxx:638
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)