56 #include <section.hxx>
60 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
61 #include <boost/property_tree/json_parser.hpp>
62 #include <osl/diagnose.h>
76 bool bOrtho = rCol.
IsOrtho() && !rCols.empty();
80 nInnerWidth = nTotalWidth;
81 for (
const auto &
i : rCols)
83 nInnerWidth -=
i.GetLeft() +
i.GetRight();
88 nInnerWidth /= rCols.size();
92 for (
size_t i = 0;
i < rCols.size(); ++
i )
99 nWidth += rCol.
CalcColWidth(
i, static_cast< sal_uInt16 >(nTotalWidth));
103 rColItem.
Append(aColDesc);
112 OSL_ENSURE( rCols.
GetNumCols() == rColItem.
Count(),
"Column count mismatch" );
118 sal_uInt16 nLeft = 0;
124 for( sal_uInt16
i=0;
i < rColItem.
Count()-1; ++
i )
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);
130 const tools::Long nWidth = rColItem[
i].nEnd - rColItem[
i].nStart + nLeft + nRight;
140 rArr[rColItem.
Count()-1].SetLeft( nLeft );
144 rArr[rColItem.
Count()-1].SetWishWidth( rCols.
GetWishWidth() - o3tl::narrowing<sal_uInt16>(nSumAll) );
153 for ( sal_uInt16
i = 0;
i < rTabStops.
Count(); )
156 if ( SvxTabAdjust::Default == rTabStops[
i].GetAdjustment() ||
157 rTabStops[
i].GetTabPos() == 0 )
169 sal_uInt16 nPhyPage, nVirPage;
195 tools::Long nWishDiff = (nWishSum * 100/nOldWidth * nNewWidth) / 100 - nWishSum;
197 if(nNewWishWidth > 0xffffl)
201 tools::Long nScale = (0xffffl << 8)/ nNewWishWidth;
210 pCol->
SetLeft(o3tl::narrowing<sal_uInt16>(nVal));
213 pCol->
SetRight(o3tl::narrowing<sal_uInt16>(nVal));
218 rCol.
SetWishWidth( o3tl::narrowing<sal_uInt16>(nNewWishWidth) );
220 if( nLeftDelta >= 2 || nLeftDelta <= -2)
221 rArr.front().SetWishWidth(rArr.front().GetWishWidth() + o3tl::narrowing<sal_uInt16>(nWishDiff));
223 rArr.back().SetWishWidth(rArr.back().GetWishWidth() + o3tl::narrowing<sal_uInt16>(nWishDiff));
238 const sal_uInt16 nSlot = rReq.
GetSlot();
256 bool bUnlockView =
false;
262 case SID_ATTR_LONG_LRSPACE:
272 bool bVerticalFrame(
false);
276 bVerticalFrame = ( bFrameSelection &&
278 ( !bFrameSelection && bVerticalWriting);
281 rRect.
Right() - rPageRect.
Right() + aLongLR.GetRight() :
282 rPageRect.
Left() + aLongLR.GetLeft() - rRect.
Left();
292 aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaX );
293 aSet.Put( aVertOrient );
299 aHoriOrient.SetPos( aHoriOrient.GetPos() + nDeltaX );
300 aSet.Put( aHoriOrient );
306 if(aSize.GetWidthPercent())
311 aSize.SetWidthPercent(
sal_uInt8((nPageWidth - aLongLR.GetLeft() - aLongLR.GetRight()) * 100 /nPrtWidth));
314 aSize.SetWidth( nPageWidth -
315 (aLongLR.GetLeft() + aLongLR.GetRight()));
343 aLongLR.SetLeft( nOld > aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld );
346 aLongLR.SetRight( nOld > aLongLR.GetRight() ? 0 : aLongLR.GetRight() - nOld );
347 aLR.SetLeft(aLongLR.GetLeft());
348 aLR.SetRight(aLongLR.GetRight());
358 aRect.
Left( aLongLR.GetLeft() + rPageRect.
Left() );
359 aRect.Right( rPageRect.
Right() - aLongLR.GetRight());
368 aSectRect.
Pos() += aTmpRect.
Pos();
392 aLR.SetLeft(aLongLR.GetLeft());
393 aLR.SetRight(aLongLR.GetRight());
403 case SID_ATTR_PAGE_LRSPACE:
411 aLR.
SetLeft(aLongLR.GetLeft());
414 aDesc.GetMaster().SetFormatAttr( aLR );
420 case SID_ATTR_LONG_ULSPACE:
429 const tools::Long nDeltaY = rPageRect.
Top() + aLongULSpace.GetUpper() - rRect.
Top();
430 const tools::Long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower());
437 if ( ( bFrameSelection &&
439 ( !bFrameSelection && bVerticalWriting ) )
443 aHoriOrient.SetPos(aHoriOrient.GetPos() + nDeltaY );
444 aSet.Put( aHoriOrient );
450 aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaY );
451 aSet.Put( aVertOrient );
454 if(aSize.GetHeightPercent())
459 aSize.SetHeightPercent(
sal_uInt8(nHeight * 100 /nPrtHeight));
462 aSize.SetHeight(nHeight );
470 aRect.
Top( aLongULSpace.GetUpper() + rPageRect.
Top() );
471 aRect.Bottom( rPageRect.
Bottom() - aLongULSpace.GetLower() );
480 aSectRect.
Pos() += aTmpRect.
Pos();
511 aUL.
SetUpper( o3tl::narrowing<sal_uInt16>(aLongULSpace.GetUpper()) );
513 aUL.SetLower( o3tl::narrowing<sal_uInt16>(aLongULSpace.GetLower()) );
516 if( (bHead && pHeaderFormat) || (!bHead && pFooterFormat) )
521 aSz.SetHeight(nPageHeight - aLongULSpace.GetLower() -
522 aLongULSpace.GetUpper() );
532 aUL.
SetUpper(o3tl::narrowing<sal_uInt16>(aLongULSpace.GetUpper()));
533 aUL.
SetLower(o3tl::narrowing<sal_uInt16>(aLongULSpace.GetLower()));
543 case SID_ATTR_PAGE_ULSPACE:
551 aUL.
SetUpper(o3tl::narrowing<sal_uInt16>(aLongULSpace.GetUpper()));
552 aUL.
SetLower(o3tl::narrowing<sal_uInt16>(aLongULSpace.GetLower()));
553 aDesc.GetMaster().SetFormatAttr(aUL);
562 const SfxInt16Item aColumnItem( static_cast<const SfxInt16Item&>(pReqArgs->
Get(nSlot)) );
563 const sal_uInt16 nPageColumnType = aColumnItem.
GetValue();
573 if ( nPageColumnType == 1 )
577 else if ( nPageColumnType == 3 )
582 const sal_uInt16 nGutterWidth = 0;
587 const tools::Long nWidth = nPageWidth - nLeft - nRight;
590 aCols.
Init( nCount, nGutterWidth, nWidth );
591 aCols.SetWishWidth( nWidth );
592 aCols.SetGutterWidth( nGutterWidth, nWidth );
593 aCols.SetOrtho(
false, nGutterWidth, nWidth );
597 if ( nPageColumnType == 4 )
600 nColumnLeft = nWidth - nColumnRight;
601 aCols.GetColumns()[0].SetWishWidth( nColumnLeft );
602 aCols.GetColumns()[1].SetWishWidth( nColumnRight );
604 else if ( nPageColumnType == 5 )
607 nColumnRight = nWidth - nColumnLeft;
608 aCols.GetColumns()[0].SetWishWidth( nColumnLeft );
609 aCols.GetColumns()[1].SetWishWidth( nColumnRight );
618 case SID_ATTR_TABSTOP_VERTICAL:
619 case SID_ATTR_TABSTOP:
623 SvxTabStopItem aTabStops( static_cast<const SvxTabStopItem&>(pReqArgs->
635 SvxTabStop aSwTabStop( 0, SvxTabAdjust::Default );
636 aTabStops.
Insert( aSwTabStop );
653 case SID_TABSTOP_ADD_OR_CHANGE:
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();
670 if (nIndex < aTabStopItem.Count())
674 SvxTabStop aSwTabStop(0, SvxTabAdjust::Default);
675 aTabStopItem.Insert(aSwTabStop);
681 aTabStopItem.Insert(aTabStop);
685 SvxTabStop aTabStop = aTabStopItem.At(nIndex);
686 aTabStopItem.Remove(nIndex);
690 aTabStopItem.Insert(aTabStop);
692 SvxTabStop aSwTabStop(0, SvxTabAdjust::Default);
693 aTabStopItem.Insert(aSwTabStop);
702 case SID_PARAGRAPH_CHANGE_STATE:
712 const OUString ratio = fLineIndent->GetValue();
717 const OUString ratio = pLeftIndent->GetValue();
718 aParaMargin.SetLeft(nPageWidth * ratio.toFloat());
722 const OUString ratio = pRightIndent->GetValue();
723 aParaMargin.SetRight(nPageWidth * ratio.toFloat());
729 case SID_HANGING_INDENT:
736 aNewMargin.SetTextLeft( aParaMargin.GetTextLeft() + aParaMargin.GetTextFirstLineOffset() );
737 aNewMargin.SetRight( aParaMargin.GetRight() );
738 aNewMargin.SetTextFirstLineOffset( (aParaMargin.GetTextFirstLineOffset()) * -1 );
744 case SID_ATTR_PARA_LRSPACE_VERTICAL:
745 case SID_ATTR_PARA_LRSPACE:
748 SvxLRSpaceItem aParaMargin(static_cast<const SvxLRSpaceItem&>(pReqArgs->
Get(nSlot)));
769 aParaMargin.SetWhich( nSlot );
775 aSet.
Put(aParaMargin);
791 for ( i = 0; i < rTabStops.
Count(); ++i )
792 if ( rTabStops[i].GetTabPos() == 0 )
795 if ( i >= rTabStops.
Count() )
798 std::unique_ptr<SvxTabStopItem> aTabStops(rTabStops.
Clone());
802 SvxTabStop aSwTabStop( 0, SvxTabAdjust::Default );
803 aTabStops->Insert(aSwTabStop);
811 aSetTmp.
Put(*aTabStops);
821 case SID_ATTR_PARA_ULSPACE:
824 SvxULSpaceItem aParaMargin(static_cast<const SvxULSpaceItem&>(pReqArgs->
Get(nSlot)));
834 aSet.
Put(aParaMargin);
841 case SID_PARASPACE_INCREASE:
842 case SID_PARASPACE_DECREASE:
847 sal_uInt16 nUpper = aULSpace.
GetUpper();
848 sal_uInt16 nLower = aULSpace.GetLower();
850 if ( nSlot == SID_PARASPACE_INCREASE )
852 nUpper = std::min< sal_uInt16 >( nUpper + 57, 5670 );
853 nLower = std::min< sal_uInt16 >( nLower + 57, 5670 );
857 nUpper = std::max< sal_Int16 >( nUpper - 57, 0 );
858 nLower = std::max< sal_Int16 >( nLower - 57, 0 );
861 aULSpace.SetUpper( nUpper );
862 aULSpace.SetLower( nLower );
867 aULSpaceSet.
Put( aULSpace );
875 case SID_RULER_CHANGE_STATE:
880 const OUString ratio = pMargin1->GetValue();
885 const OUString ratio = pMargin2->GetValue();
890 case SID_RULER_BORDERS_VERTICAL:
891 case SID_RULER_BORDERS:
894 SvxColumnItem aColItem(static_cast<const SvxColumnItem&>(pReqArgs->
Get(nSlot)));
898 OSL_ENSURE(aColItem.
Count(),
"ColDesc is empty!!");
900 const bool bSingleLine = rReq.
901 GetArgs()->Get(SID_RULER_ACT_LINE_ONLY).GetValue();
913 nBorder = (bVerticalWriting ? nPageHeight : nPageWidth) - aTabCols.
GetLeftMin() - aColItem.
GetRight();
925 const size_t nColCount = aColItem.
Count() - 1;
928 for (
size_t i = 0;
i < nColCount &&
i < aTabCols.
Count(); ++
i )
937 for (
size_t i = 0;
i < nColCount &&
i < aTabCols.
Count(); ++
i )
968 OSL_ENSURE( pSect,
"Which section?");
980 const tools::Long lWidth = bVerticalWriting ? aCurRect.
Height() : aCurRect.Width();
1005 bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width(),
1008 aDesc.GetMaster().SetFormatAttr( aCols );
1015 case SID_RULER_ROWS :
1016 case SID_RULER_ROWS_VERTICAL:
1019 SvxColumnItem aColItem(static_cast<const SvxColumnItem&>(pReqArgs->
Get(nSlot)));
1023 OSL_ENSURE(aColItem.
Count(),
"ColDesc is empty!!");
1031 if ( bVerticalWriting )
1033 aTabCols.SetRight(nPageWidth - aColItem.
GetRight() - aColItem.
GetLeft());
1034 aTabCols.SetLeftMin(aColItem.
GetLeft());
1039 aTabCols.SetRight( nBorder );
1042 const size_t nColItems = aColItem.
Count() - 1;
1043 if(bVerticalWriting)
1045 for (
size_t i = nColItems;
i; --
i )
1049 aTabCols[
i - 1] = nColumnPos;
1050 aTabCols.SetHidden(
i - 1, !rCol.
bVisible );
1055 for (
size_t i = 0;
i < nColItems; ++
i )
1058 aTabCols[
i] = rCol.
nEnd + aTabCols.GetLeft();
1059 aTabCols.SetHidden(
i, !rCol.
bVisible );
1062 bool bSingleLine =
false;
1064 bSingleLine = pSingleLine->GetValue();
1079 case SID_TABLE_CHANGE_CURRENT_BORDER_POSITION:
1088 if (pBorderType && pIndex && pOffset)
1092 const sal_Int32 nOffset = pOffset->
GetValue();
1094 if (sType.startsWith(
"column"))
1099 if (sType ==
"column-left")
1102 if(aTabCols.
Count() > 0)
1104 auto & rEntry = aTabCols.
GetEntry(0);
1105 nNewPosition =
std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
1107 aTabCols.
SetLeft(nNewPosition);
1109 else if (sType ==
"column-right")
1112 if(aTabCols.
Count() > 0)
1115 nNewPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
1119 else if (sType ==
"column-middle" && nIndex < aTabCols.
Count())
1121 auto & rEntry = aTabCols.
GetEntry(nIndex);
1123 nNewPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
1124 rEntry.nPos = nNewPosition;
1129 else if (sType.startsWith(
"row"))
1134 if (sType ==
"row-left")
1136 auto & rEntry = aTabRows.
GetEntry(0);
1138 nNewPosition =
std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
1139 aTabRows.
SetLeft(nNewPosition);
1141 else if (sType ==
"row-right")
1144 if(aTabRows.
Count() > 0)
1147 nNewPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
1151 else if (sType ==
"row-middle" && nIndex < aTabRows.
Count())
1153 auto & rEntry = aTabRows.
GetEntry(nIndex);
1155 nNewPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
1156 rEntry.nPos = nNewPosition;
1210 sal_uInt16 nLayout = aLayoutItem.
GetValue();
1263 sal_uInt16 nLayout = aLayoutItem.
GetValue();
1272 case SID_ATTR_PAGE_COLOR:
1273 case SID_ATTR_PAGE_FILLSTYLE:
1274 case SID_ATTR_PAGE_GRADIENT:
1275 case SID_ATTR_PAGE_HATCH:
1276 case SID_ATTR_PAGE_BITMAP:
1284 case SID_ATTR_PAGE_FILLSTYLE:
1287 drawing::FillStyle eXFS = aFSItem.GetValue();
1289 if ( eXFS == drawing::FillStyle_NONE )
1294 case SID_ATTR_PAGE_COLOR:
1302 case SID_ATTR_PAGE_GRADIENT:
1310 case SID_ATTR_PAGE_HATCH:
1318 case SID_ATTR_PAGE_BITMAP:
1335 OSL_ENSURE(
false,
"wrong SlotId");
1403 sal_uInt16 nColumnType = 0;
1412 else if ( nCols == 2 )
1414 const sal_uInt16 nColLeft = aCol.CalcPrtColWidth(0, aCol.GetWishWidth());
1415 const sal_uInt16 nColRight = aCol.CalcPrtColWidth(1, aCol.GetWishWidth());
1417 if (
abs(nColLeft - nColRight) <= 10 )
1421 else if(
abs(nColLeft - nColRight*2) < 20 )
1425 else if(
abs(nColLeft*2 - nColRight) < 20 )
1430 else if( nCols == 3 )
1435 nColumnType = nCols;
1441 case SID_ATTR_LONG_LRSPACE:
1444 aPageLRSpace.GetRight(),
1445 SID_ATTR_LONG_LRSPACE);
1449 aLongLR.SetRight(nPageWidth - rPagePrtRect.
Right());
1463 aLongLR.SetRight( nPageWidth - aRect.Right() + aLR.
GetRight() );
1473 aRect.
Pos() += aTmpRect.
Pos();
1484 aLongLR.SetLeft(aRect.
Left() - rPageRect.
Left());
1485 aLongLR.SetRight(rPageRect.
Right() - aRect.
Right());
1488 rSet.
Put( aLongLR );
1493 case SID_ATTR_PAGE_LRSPACE:
1497 aTmpPageLRSpace.GetLeft(),
1498 aTmpPageLRSpace.GetRight(),
1499 SID_ATTR_PAGE_LRSPACE );
1500 rSet.
Put( aLongLR );
1504 case SID_ATTR_LONG_ULSPACE:
1509 static_cast<tools::Long>(aUL.GetLower()),
1510 SID_ATTR_LONG_ULSPACE);
1516 aLongUL.SetUpper(rRect.
Top() - rPageRect.
Top());
1523 aLongUL.SetUpper( aRect.Top() );
1524 aLongUL.SetLower( nPageHeight - aRect.Bottom() );
1529 aLongUL.SetUpper(rRect.
Top() - rPageRect.
Top());
1534 aLongUL.SetUpper(rPagePrtRect.
Top());
1535 aLongUL.SetLower(nPageHeight - rPagePrtRect.
Bottom());
1537 rSet.
Put( aLongUL );
1542 case SID_ATTR_PAGE_ULSPACE:
1546 static_cast<tools::Long>(aUL.GetUpper()),
1547 static_cast<tools::Long>(aUL.GetLower()),
1548 SID_ATTR_PAGE_ULSPACE );
1550 rSet.
Put( aLongUL );
1554 case SID_ATTR_TABSTOP_VERTICAL :
1555 case RES_PARATR_TABSTOP:
1557 if ( dynamic_cast< const SwWebView *>(
this ) !=
nullptr ||
1563 ( SfxItemState::DEFAULT > aCoreSet.GetItemState(RES_LR_SPACE) ) ||
1564 (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich) ) ||
1565 ( bVerticalWriting && (RES_PARATR_TABSTOP == nWhich))
1574 OSL_ENSURE(
m_pHRuler,
"why is there no ruler?");
1579 aTabStops.SetWhich(nWhich);
1580 rSet.
Put(aTabStops);
1584 boost::property_tree::ptree aRootTree;
1585 boost::property_tree::ptree
aEntries;
1587 for (sal_uInt16
i = 0;
i < aTabStops.Count(); ++
i)
1590 boost::property_tree::ptree aEntry;
1593 aEntry.put(
"decimal", OUString(rTabStop.
GetDecimal()));
1594 aEntry.put(
"fill", OUString(rTabStop.
GetFill()));
1595 aEntries.push_back(std::make_pair(
"", aEntry));
1597 aRootTree.push_back(std::make_pair(
"tabstops", aEntries));
1599 std::stringstream aStream;
1600 boost::property_tree::write_json(aStream, aRootTree);
1607 case SID_HANGING_INDENT:
1610 if( e == SfxItemState::DISABLED )
1615 case SID_ATTR_PARA_LRSPACE_VERTICAL:
1616 case SID_ATTR_PARA_LRSPACE:
1617 case SID_ATTR_PARA_LEFTSPACE:
1618 case SID_ATTR_PARA_RIGHTSPACE:
1619 case SID_ATTR_PARA_FIRSTLINESPACE:
1625 (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich)) ||
1626 ( bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich))
1633 std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE));
1636 aLR.reset(aCoreSet.Get(RES_LR_SPACE).Clone());
1641 short nOffset =
static_cast< short >(aLR->GetTextLeft() +
1649 aLR->SetLeft( nOffset + nFLOffset );
1652 aLR->SetWhich(nWhich);
1658 case SID_ATTR_PARA_ULSPACE:
1659 case SID_ATTR_PARA_ABOVESPACE:
1660 case SID_ATTR_PARA_BELOWSPACE:
1661 case SID_PARASPACE_INCREASE:
1662 case SID_PARASPACE_DECREASE:
1666 if( e >= SfxItemState::DEFAULT )
1672 if ( nWhich == SID_ATTR_PARA_ULSPACE
1673 || nWhich == SID_ATTR_PARA_ABOVESPACE
1674 || nWhich == SID_ATTR_PARA_BELOWSPACE
1677 aUL.SetWhich( nWhich );
1692 case SID_RULER_BORDER_DISTANCE:
1697 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aCoreSet2(
GetPool());
1718 aCoreSet2.Put(aBoxInfo);
1720 const SvxBoxItem& rBox = aCoreSet2.Get(RES_BOX);
1742 aCoreSet2.Put(aBoxInfo);
1744 const SvxBoxItem& rBox = aCoreSet2.Get(RES_BOX);
1773 pBox = & pHeaderFormat->
GetBox();
1780 pBox = & pFooterFormat->
GetBox();
1791 const SvxBoxItem& rParaBox = aCoreSet2.Get(RES_BOX);
1801 case SID_RULER_TEXT_RIGHT_TO_LEFT:
1816 case SID_RULER_BORDERS_VERTICAL:
1817 case SID_RULER_BORDERS:
1819 bool bFrameHasVerticalColumns(
false);
1823 bFrameHasVerticalColumns = rSh.
IsFrameVertical(
false, bFrameRTL, bFrameVertL2R) &&
1832 if(((SID_RULER_BORDERS_VERTICAL == nWhich) &&
1833 ((bHasTable && !bTableVertical) ||
1834 (!bVerticalWriting && !bFrameSelection && !bHasTable ) ||
1835 ( bFrameSelection && !bFrameHasVerticalColumns))) ||
1836 ((SID_RULER_BORDERS == nWhich) &&
1837 ((bHasTable && bTableVertical) ||
1838 (bVerticalWriting && !bFrameSelection&& !bHasTable) || bFrameHasVerticalColumns)))
1840 else if ( bHasTable )
1855 nNum = aTabCols.
Count() - nNum;
1858 OSL_ENSURE(nNum <= aTabCols.
Count(),
"TabCol not found");
1860 const int nRgt = (bTableVertical ? nPageHeight : nPageWidth) -
1863 const sal_uInt16 nL =
static_cast< sal_uInt16
>(std::max(nLft, 0));
1864 const sal_uInt16 nR =
static_cast< sal_uInt16
>(std::max(nRgt, 0));
1878 for (
size_t i = aTabCols.
Count();
i; --
i )
1886 aColItem.
Append(aColDesc);
1891 aColItem.
Append(aColDesc);
1895 for (
size_t i = 0;
i < aTabCols.
Count(); ++
i )
1902 aColItem.
Append(aColDesc);
1907 aColItem.
Append(aColDesc);
1909 aColItem.SetWhich(nWhich);
1915 sal_uInt16 nNum = 0;
1932 OSL_ENSURE( pSect,
"Which section?");
1947 if(bVerticalWriting)
1950 aRect.
Pos().AdjustY( -(rPageRect.
Top()) );
1956 aRect.
Pos() += aTmpRect.
Pos();
1959 aColItem.
SetLeft (o3tl::narrowing<sal_uInt16>( aRect.
Left() - rPageRect.
Left() ));
1964 aColItem.SetWhich(nWhich);
1983 bool bUseVertical = bFrameHasVerticalColumns || (!bFrameSelection && bVerticalWriting);
2002 aColItem.SetWhich(nWhich);
2012 if(rFrameDir.GetValue() == SvxFrameDirection::Horizontal_RL_TB)
2024 bVerticalWriting ? aPrtRect.
Height() : aPrtRect.
Width(),
2029 if (bVerticalWriting)
2031 aColItem.
SetLeft(o3tl::narrowing<sal_uInt16>(rPagePrtRect.
Top()));
2032 aColItem.
SetRight(sal_uInt16(nPageHeight - rPagePrtRect.
Bottom()));
2036 aColItem.
SetLeft(o3tl::narrowing<sal_uInt16>(rPagePrtRect.
Left()));
2037 aColItem.
SetRight(sal_uInt16(nPageWidth - rPagePrtRect.
Right()));
2042 if (bVerticalWriting)
2045 aColItem.
SetLeft (aUL.GetUpper());
2050 aColItem.
SetLeft (aPageLRSpace.GetLeft());
2051 aColItem.
SetRight(aPageLRSpace.GetRight());
2056 aColItem.SetWhich(nWhich);
2065 case SID_RULER_ROWS :
2066 case SID_RULER_ROWS_VERTICAL:
2068 bool bFrameHasVerticalColumns(
false);
2072 bFrameHasVerticalColumns = rSh.
IsFrameVertical(
false, bFrameRTL, bFrameVertL2R) &&
2076 if(((SID_RULER_ROWS == nWhich) &&
2077 ((!bVerticalWriting && !bFrameSelection) || (bFrameSelection && !bFrameHasVerticalColumns))) ||
2078 ((SID_RULER_ROWS_VERTICAL == nWhich) &&
2079 ((bVerticalWriting && !bFrameSelection) || bFrameHasVerticalColumns)))
2097 const int nRgt = (bVerticalWriting ? nPageWidth : nPageHeight) -
2100 const sal_uInt16 nL =
static_cast< sal_uInt16
>(std::max(nLft, 0));
2101 const sal_uInt16 nR =
static_cast< sal_uInt16
>(std::max(nRgt, 0));
2108 for (
size_t i = 0;
i < aTabCols.
Count(); ++
i )
2111 if(bVerticalWriting)
2118 aColItem.
Append(aColDesc);
2127 aColItem.
Append(aColDesc);
2131 if(bVerticalWriting)
2140 aColItem.
Append(aColDesc);
2142 aColItem.SetWhich(nWhich);
2150 case SID_RULER_PAGE_POS:
2153 Point( rPageRect.
Left(), rPageRect.
Top()) , nPageWidth, nPageHeight);
2155 rSet.
Put(aPagePosSize);
2159 case SID_RULER_LR_MIN_MAX:
2174 const sal_uInt16 nL =
static_cast< sal_uInt16
>(std::max(nLft, 0));
2175 const sal_uInt16 nR =
static_cast< sal_uInt16
>(std::max(nRgt, 0));
2182 if(aTabCols.
Count() <= nNum + 1 )
2185 aRectangle.
SetRight( nPageWidth - (nL + aTabCols[nNum + 1]) );
2187 if(nNum < aTabCols.
Count())
2197 const sal_uInt16
nCount =
std::min(sal_uInt16(nNum + 1), sal_uInt16(rCols.size()));
2206 const sal_uInt16 nTotalWidth = o3tl::narrowing<sal_uInt16>(aRect.Width());
2208 const sal_uInt16 nOuterWidth = o3tl::narrowing<sal_uInt16>(aAbsRect.Width());
2212 for ( sal_uInt16
i = 0;
i < nCount; ++
i )
2215 const int nStart = pCol->
GetLeft() + nWidth;
2240 aRectangle.
AdjustRight( -((nOuterWidth - nTotalWidth) / 2) );
2243 if(nNum < rCols.size())
2271 aRectangle.
SetLeft( aRect.Left() - rPageRect.
Left() );
2281 aRectangle.
SetLeft( aPageLRSpace.GetLeft() );
2282 aRectangle.
SetRight( aPageLRSpace.GetRight() );
2287 bool bSectOutTable = bool(nFrameType & FrameTypeFlags::TABLE);
2289 bool bColSct = bool(nFrameType & ( bSectOutTable
2291 : FrameTypeFlags::COLSECT )
2304 OSL_ENSURE( pSect,
"Which section?");
2316 const sal_uInt16
nBorder = pFormat
2328 const sal_uInt16 nTotalWidth = o3tl::narrowing<sal_uInt16>(aRect.Width());
2334 if( nNum > rCols.size() )
2336 OSL_ENSURE(
false,
"wrong FormatCol is being edited!" );
2337 nNum = rCols.size();
2340 for(
size_t i = 0;
i < nNum; ++
i )
2343 nStart = pCol->
GetLeft() + nWidth;
2344 nWidth += pCols->
CalcColWidth( o3tl::narrowing<sal_uInt16>(
i), nTotalWidth );
2347 if( bFrame || bColSct )
2349 aRectangle.
SetLeft( aRect.Left() - rPageRect.
Left() + nStart );
2350 aRectangle.
SetRight( nPageWidth - aRectangle.
Left() - nEnd + nStart );
2354 aRectangle.
SetLeft( aPageLRSpace.GetLeft() + nStart );
2355 aRectangle.
SetRight( nPageWidth - nEnd - aPageLRSpace.GetLeft() );
2360 aRectangle.
SetLeft( nStart + nLeft );
2361 aRectangle.
SetRight( nPageWidth - nEnd - nLeft );
2372 aRectangle.
SetLeft( aPageLRSpace.GetLeft() );
2373 aRectangle.
SetRight( aPageLRSpace.GetRight() );
2386 case SID_RULER_PROTECT:
2417 bool bHeaderOn = rHeader.
IsActive();
2435 sal_uInt16 nLayout = (
static_cast<int>(bShared)<<1) +
static_cast<int>(bFirst);
2437 rSet.
Put(aLayoutItem);
2447 bool bFooterOn = rFooter.
IsActive();
2460 sal_uInt16 nLayout = (
static_cast<int>(bShared)<<1) +
static_cast<int>(bFirst);
2462 rSet.
Put(aLayoutItem);
2467 case SID_ATTR_PAGE_COLOR:
2468 case SID_ATTR_PAGE_FILLSTYLE:
2469 case SID_ATTR_PAGE_GRADIENT:
2470 case SID_ATTR_PAGE_HATCH:
2471 case SID_ATTR_PAGE_BITMAP:
2476 drawing::FillStyle eXFS = pFillStyleItem->GetValue();
2478 aFillStyleItem.SetWhich( SID_ATTR_PAGE_FILLSTYLE );
2479 rSet.
Put(aFillStyleItem);
2483 case drawing::FillStyle_SOLID:
2487 Color aColor = pItem->GetColorValue();
2489 aFillColorItem.SetWhich( SID_ATTR_PAGE_COLOR );
2490 rSet.
Put( aFillColorItem );
2495 case drawing::FillStyle_GRADIENT:
2498 XFillGradientItem aFillGradientItem( OUString(), xGradient, SID_ATTR_PAGE_GRADIENT );
2499 rSet.
Put( aFillGradientItem );
2503 case drawing::FillStyle_HATCH:
2507 aFillHatchItem.SetWhich( SID_ATTR_PAGE_HATCH );
2508 rSet.
Put( aFillHatchItem );
2512 case drawing::FillStyle_BITMAP:
2516 aFillBitmapItem.SetWhich( SID_ATTR_PAGE_BITMAP );
2517 rSet.
Put( aFillBitmapItem );
2520 case drawing::FillStyle_NONE:
SfxViewFrame * GetViewFrame() const
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
void SetMouseTabCols(const SwTabCols &rNew, bool bCurRowOnly, const Point &rPt)
sal_uInt16 m_nRightBorderDistance
sal_Int32 GetValue() const
tools::Long GetWidth() const
bool Insert(const SvxTabStop &rTab)
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
void Right(const tools::Long nRight)
#define SID_ATTR_PAGE_HEADER_LRMARGIN
bool IsTabRowFromDoc() const
size_t GetSectionFormatPos(const SwSectionFormat &) const
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
Represents the style of a paragraph.
bool IsInVerticalText(const Point *pPt=nullptr) const
Rect of current FlyFrame.
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Marks a position in the document model.
#define SID_ATTR_PAGE_HEADER
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
std::vector< SwColumn > SwColumns
void SetLeft(tools::Long nNew)
sal_uInt16 GetLower() const
constexpr WinBits WB_EXTRAFIELD
static void lcl_ConvertToCols(const SvxColumnItem &rColItem, tools::Long nTotalWidth, SwFormatCol &rCols)
#define SID_ATTR_PAGE_HEADER_LAYOUT
#define SID_ATTR_PAGE_COLUMN
void SetState(const SfxItemSet &rSet)
void ChgHeaderShare(bool bNew)
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
std::unique_ptr< SwWrtShell > m_pWrtShell
void SetLeft(sal_uInt16 nNew)
void Append(const SvxColumnDescription &rDesc)
void Left(const tools::Long nLeft)
void SetRight(tools::Long nNew)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
void SetDefTabDist(tools::Long)
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
VclPtr< SvxRuler > m_pHRuler
bool GetFirstLineOfsWithNum(short &rFirstOffset) const
Returns the combined first line indent of this text node and its numbering.
tools::Long GetRight() const
sal_uInt16 GetCurColNum(SwGetCurColNumPara *pPara=nullptr) const
The ruler needs some information too.
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
void SetRight(sal_uInt16 nNew)
tools::Long GetLeft() const
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
void GetTabRows(SwTabCols &rToFill) const
sal_uInt16 GetValue() const
void InvalidateItem(sal_uInt16 nWhich)
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
void GetPageNum(sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, bool bAtCursorPos=true, const bool bCalcFrame=true)
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
SwSectionFormat * GetFormat()
tools::Long GetRight() const
void StateTabWin(SfxItemSet &)
void Pos(const Point &rNew)
Of course Writer needs its own rectangles.
SfxViewShell * GetSfxViewShell() const
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
void AutoUpdatePara(SwTextFormatColl *pColl, const SfxItemSet &rStyleSet, SwPaM *pPaM=nullptr)
const SfxItemSet * GetArgs() const
SwNodeOffset abs(const SwNodeOffset &a)
bool IsDirectlyInSection() const
void GetMouseTabCols(SwTabCols &rToFill, const Point &rPt) const
tools::Long GetUpper() const
UseOnPage GetUseOn() const
size_t GetMousePageDesc(const Point &rPt) const
tools::Long GetRight() const
const SwTabColsEntry & GetEntry(size_t nPos) const
sal_uInt16 GetCurMouseColNum(const Point &rPt) const
SwWrtShell & GetWrtShell() const
const SwSection * GetCurrSection() const
constexpr auto convertTwipToMm100(N n)
void UpdateSection(size_t const nSect, SwSectionData &, SfxItemSet const *const =nullptr)
#define SID_ATTR_PAGE_FOOTER_SPACING
#define SID_ATTR_PAGE_FOOTER_LAYOUT
Used by the UI to modify the document model.
bool IsTableVertical() const
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
tools::Long GetLeft() const
Rect of current PrtArea of section.
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
void Remove(const sal_uInt16 nPos, const sal_uInt16 nLen=1)
static void lcl_EraseDefTabs(SvxTabStopItem &rTabStops)
bool getBrowseMode() const
bool IsTableRightToLeft() const
tools::Long GetLeftMin() const
static void lcl_Scale(tools::Long &nVal, tools::Long nScale)
virtual void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
void Width(tools::Long nNew)
sal_Unicode & GetDecimal()
SwTextNode * m_pNumRuleNodeFromDoc
bool IsHidden(size_t nPos) const
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
SfxItemPool & GetPool() const
const GraphicObject & GetGraphicObject() const
const XHatch & GetHatchValue() const
SvxTabAdjust & GetAdjustment()
constexpr OUStringLiteral aData
bool GetFlyFrameAttr(SfxItemSet &rSet) const
SwSection * GetAnySection(bool bOutOfTab=false, const Point *pPt=nullptr)
Deliver the responsible area of the columns.
bool IsHeaderShared() const
const SfxItemPool & GetAttrPool() const
sal_uInt16 m_nLeftBorderDistance
tools::Long GetTextLeft() const
virtual SvxTabStopItem * Clone(SfxItemPool *pPool=nullptr) const override
void SetTabCols(const SwTabCols &rNew, bool bCurRowOnly)
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Query default attribute of document.
#define SID_ATTR_PAGE_FOOTER
bool IsInRightToLeftText() const
Rect of current PrtArea of page.
sal_Int16 GetValue() const
size_t GetCurMouseTabColNum(const Point &rPt) const
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
Rect of current section but outside of table.
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
void Push()
store a copy of the current cursor on the cursor stack
void SetTabRows(const SwTabCols &rNew, bool bCurColOnly)
void ChgFirstShare(bool bNew)
void SetTabsRelativeToIndent(bool bRel)
void ChgFooterShare(bool bNew)
SfxBindings & GetBindings()
static void lcl_FillSvxColumn(const SwFormatCol &rCol, tools::Long nTotalWidth, SvxColumnItem &rColItem, tools::Long nDistance)
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
const OUString & GetValue() const
const SwPageDesc & GetPageDesc(size_t i) const
bool SetFlyFrameAttr(SfxItemSet &rSet)
FrameTypeFlags
values can be combined via logical or
tools::Long GetLeft() const
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
#define SID_ATTR_PAGE_FOOTER_LRMARGIN
FlyProtectFlags
values can be combined via logical or
SAL_DLLPRIVATE void SwapPageMargin(const SwPageDesc &, SvxLRSpaceItem &rLR)
short GetTextFirstLineOffset() const
void GetMouseTabRows(SwTabCols &rToFill, const Point &rPt) const
bool IsFooterShared() const
tools::Long GetLeftMarginWithNum(bool bTextLeft=false) const
Returns the additional indents of this text node and its numbering.
void GetTabCols(SwTabCols &rToFill) const
Info about columns and margins.
void SetObjRect(const SwRect &rRect)
Set size of draw objects.
tools::Long GetHeight() const
VclPtr< SvxRuler > m_pVRuler
Frame cannot be moved in Var-direction.
SwFrameFormat * GetTableFormat()
void CalcBoundRect(SwRect &_orRect, const RndStdIds _nAnchorId, const sal_Int16 _eHoriRelOrient=css::text::RelOrientation::FRAME, const sal_Int16 _eVertRelOrient=css::text::RelOrientation::FRAME, const SwPosition *_pToCharContentPos=nullptr, const bool _bFollowTextFlow=false, bool _bMirror=false, Point *_opRef=nullptr, Size *_opPercent=nullptr, const SwFormatFrameSize *pFormatFrameSize=nullptr) const
i#17567 - adjustments to allow negative vertical positions for fly frames anchored to paragraph or to...
tools::Long const nBorder
void SetRight(tools::Long aRight)
bool IsColRightToLeft() const
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
SwFrameFormat & GetMaster()
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void Bottom(const tools::Long nBottom)
sal_uInt16 GetSlot() const
void SetSizeProtect(bool bNew)
sal_uInt16 GetWishWidth() const
void SetWishWidth(sal_uInt16 nNew)
void DisableItem(sal_uInt16 nWhich)
bool IsFrameVertical(const bool bEnvironment, bool &bRightToLeft, bool &bVertL2R) const
Determines whether a frame or its environment is vertically formatted and right-to-left.
void SetPosProtect(bool bNew)
tools::Long GetLeft() const
sal_uInt16 GetRight() const
void SetLeft(tools::Long aLeft)
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
static void ResizeFrameCols(SwFormatCol &rCol, tools::Long nOldWidth, tools::Long nNewWidth, tools::Long nLeftDelta)
bool IsTabColFromDoc() const
void SetHidden(size_t nPos, bool bValue)
const SwViewOption * GetViewOptions() const
sal_uInt16 GetCurOutColNum() const
Current outer column.
static SfxViewShell * Get(const css::uno::Reference< css::frame::XController > &i_rController)
SwRect GetObjRect() const
For adjustment of PosAttr when anchor changes.
void ChgPageDesc(size_t i, const SwPageDesc &)
Point m_aTabColFromDocPos
bool IsMouseTableRightToLeft(const Point &rPt) const
void Top(const tools::Long nTop)
size_t IsObjSelected() const
tools::Long GetLower() const
Rect of current header/footer.
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
void GetTabBorders(SfxItemSet &rSet) const
sal_uInt16 GetLeft() const
ScXMLEditAttributeMap::Entry const aEntries[]
const SwFrameFormat * GetFlyFrameFormat() const
Get FlyFrameFormat; for UI macro linkage at Flys.
OUString const & GetName() const
void SetContentProtect(bool bNew)
void SetSectionAttr(const SfxItemSet &rSet, SwSectionFormat *pSectFormat=nullptr)
Set attributes.
bool IsFirstShared() const
void ExecTabWin(SfxRequest const &)
void SetNumRuleNodeFromDoc(SwTextNode *pNumRuleNode)
void SetIndent(short nIndent, const SwPosition &rPos)
void SetMouseTabRows(const SwTabCols &rNew, bool bCurColOnly, const Point &rPt)
void SetValues(RulerChangeType type, tools::Long value)
void SetLeft(tools::Long lArgLeft)
SelectionType GetSelectionType() const
sal_uInt16 GetSmallestDistance() const
void StartAllAction()
For all views of this document.
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
size_t GetCurPageDesc(const bool bCalcFrame=true) const
void Height(tools::Long nNew)
#define SID_ATTR_PAGE_HEADER_SPACING
tools::Long GetRight() const
size_t GetCurTabColNum() const
Rect of PrtArea of FlyFrame.
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
bool IsFrameSelected() const
bool IsViewLocked() const
sal_uInt16 GetUpper() const
void EndAction(const bool bIdleEnd=false)
bool m_bDetectedRangeSegmentation false