23#include <tablemodel.hxx>
25#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
26#include <com/sun/star/container/XIndexAccess.hpp>
28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/table/XMergeableCellRange.hpp>
30#include <com/sun/star/table/XMergeableCell.hpp>
47#include <svx/svxids.hrc>
60#include <svx/strings.hrc>
67#include <LibreOfficeKit/LibreOfficeKitEnums.h>
78using ::editeng::SvxBorderLine;
114class SvxTableControllerModifyListener :
public ::cppu::WeakImplHelper< css::util::XModifyListener >
121 virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent )
override;
124 virtual void SAL_CALL disposing(
const css::lang::EventObject& Source )
override;
134void SAL_CALL SvxTableControllerModifyListener::modified(
const css::lang::EventObject& )
144void SAL_CALL SvxTableControllerModifyListener::disposing(
const css::lang::EventObject& )
166 if( xRefController.is() )
170 if(pController && (pController->
mxTableObj.get() == &rObj) && (&pController->
mrView == &rView))
172 return xRefController;
183: mbCellSelectionMode(false)
184 ,mbHasJustMerged(false)
185 ,mbLeftButtonDown(false)
188 ,mnUpdateEvent( nullptr )
193 Reference< XTable > xTable(
mxTableObj.get()->getTable() );
212 Reference< XTable > xTable(
mxTableObj.get()->getTable() );
237 case awt::Key::RIGHT:
245 case awt::Key::ESCAPE:
279 pWindow = pOutputDevice->GetOwnerWindow();
327 bool bEmptyOutliner =
false;
330 if (pOutliner->GetParagraphCount() == 1)
332 if (
Paragraph* pParagraph = pOutliner->GetParagraph(0))
333 bEmptyOutliner = pOutliner->GetText(pParagraph).isEmpty();
395 bool bSelected =
false;
398 if( pTableObj && pTableObj->IsTextEditActive() )
423 if ( pTableObj && !pTableObj->IsTextEditActive())
437 std::optional<SfxItemSet> oSet;
438 bool bVertDone(
false);
447 case SID_TABLE_VERT_BOTTOM:
448 case SID_TABLE_VERT_CENTER:
449 case SID_TABLE_VERT_NONE:
471 case SID_TABLE_DELETE_ROW:
475 case SID_TABLE_DELETE_COL:
479 case SID_TABLE_DELETE_TABLE:
483 case SID_TABLE_MERGE_CELLS:
487 case SID_TABLE_SPLIT_CELLS:
492 case SID_TABLE_OPTIMAL_ROW_HEIGHT:
493 case SID_TABLE_DISTRIBUTE_COLUMNS:
494 case SID_TABLE_DISTRIBUTE_ROWS:
496 bool bDistributeColumns =
false;
497 bool bDistributeRows =
false;
503 bDistributeColumns = aStart.
mnCol != aEnd.
mnCol;
506 if( !bDistributeColumns )
508 if( !bDistributeRows )
531 bool bInsertAfter =
true;
542 bInsertAfter = pItem2->GetValue();
566 static constexpr OUStringLiteral sSize(
u"Size" );
571 case SID_TABLE_INSERT_COL:
581 Reference< XTableColumns > xCols(
mxTable->getColumns() );
583 const sal_Int32 nNewStartColumn = aEnd.
mnCol + (bInsertAfter ? 1 : 0);
584 xCols->insertByIndex( nNewStartColumn, nNewColumns );
586 for( sal_Int32 nOffset = 0; nOffset < nNewColumns; nOffset++ )
593 Reference< XPropertySet >(xCols->getByIndex(nNewStartColumn+nOffset), UNO_QUERY_THROW )->
595 Reference< XPropertySet >(xCols->getByIndex( bInsertAfter?nNewStartColumn-1:nNewStartColumn+nNewColumns ), UNO_QUERY_THROW )->
600 sal_Int32 nPropSrcCol = (bInsertAfter ? aEnd.
mnCol : aStart.
mnCol + nNewColumns);
601 sal_Int32 nRowSpan = 0;
602 bool bNewSpan =
false;
604 for( sal_Int32 nRow = 0; nRow <
mxTable->getRowCount(); ++nRow )
606 CellRef xSourceCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nPropSrcCol, nRow ).get() ) );
609 if (xSourceCell.is() && nRowSpan == 0)
612 sal_Int32 nColSpan = sal_Int32();
613 sal_Int32 nSpanInfoCol = sal_Int32();
615 if( xSourceCell->getRowSpan() > 1 )
619 nRowSpan = xSourceCell->getRowSpan();
620 nColSpan = xSourceCell->getColumnSpan();
621 nSpanInfoCol = nPropSrcCol;
623 else if( xSourceCell->isMerged() )
627 for( nSpanInfoCol = nPropSrcCol - 1; nSpanInfoCol >= 0; --nSpanInfoCol )
629 CellRef xMergeInfoCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nSpanInfoCol, nRow ).get() ) );
630 if (xMergeInfoCell.is() && !xMergeInfoCell->isMerged())
632 nRowSpan = xMergeInfoCell->getRowSpan();
633 nColSpan = xMergeInfoCell->getColumnSpan();
642 if( nRowSpan > 0 && ( nNewStartColumn < nSpanInfoCol || nSpanInfoCol + nColSpan <= nNewStartColumn ) )
647 for( sal_Int32 nOffset = 0; nOffset < nNewColumns; nOffset++ )
649 CellRef xTargetCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nNewStartColumn + nOffset, nRow ).get() ) );
650 if( xTargetCell.is() )
655 xTargetCell->merge( 1, nRowSpan );
657 xTargetCell->setMerged();
659 xTargetCell->copyFormatFrom( xSourceCell );
673 aStart.
mnCol = nNewStartColumn;
680 case SID_TABLE_INSERT_ROW:
690 Reference< XTableRows > xRows(
mxTable->getRows() );
692 const sal_Int32 nNewRowStart = aEnd.
mnRow + (bInsertAfter ? 1 : 0);
693 xRows->insertByIndex( nNewRowStart, nNewRows );
695 for( sal_Int32 nOffset = 0; nOffset < nNewRows; nOffset++ )
697 Reference< XPropertySet >( xRows->getByIndex( aEnd.
mnRow + nOffset + 1 ), UNO_QUERY_THROW )->
699 Reference< XPropertySet >( xRows->getByIndex( aStart.
mnRow + nOffset ), UNO_QUERY_THROW )->
704 sal_Int32 nPropSrcRow = (bInsertAfter ? aEnd.
mnRow : aStart.
mnRow + nNewRows);
705 sal_Int32 nColSpan = 0;
706 bool bNewSpan =
false;
708 for( sal_Int32 nCol = 0; nCol <
mxTable->getColumnCount(); ++nCol )
710 CellRef xSourceCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nPropSrcRow ).get() ) );
712 if (!xSourceCell.is())
719 sal_Int32 nRowSpan = sal_Int32();
720 sal_Int32 nSpanInfoRow = sal_Int32();
722 if( xSourceCell->getColumnSpan() > 1 )
726 nColSpan = xSourceCell->getColumnSpan();
727 nRowSpan = xSourceCell->getRowSpan();
728 nSpanInfoRow = nPropSrcRow;
730 else if( xSourceCell->isMerged() )
734 for( nSpanInfoRow = nPropSrcRow - 1; nSpanInfoRow >= 0; --nSpanInfoRow )
736 CellRef xMergeInfoCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nSpanInfoRow ).get() ) );
737 if (xMergeInfoCell.is() && !xMergeInfoCell->isMerged())
739 nColSpan = xMergeInfoCell->getColumnSpan();
740 nRowSpan = xMergeInfoCell->getRowSpan();
749 if( nColSpan > 0 && ( nNewRowStart < nSpanInfoRow || nSpanInfoRow + nRowSpan <= nNewRowStart ) )
754 for( sal_Int32 nOffset = 0; nOffset < nNewRows; ++nOffset )
756 CellRef xTargetCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nNewRowStart + nOffset ).get() ) );
757 if( xTargetCell.is() )
762 xTargetCell->merge( nColSpan, 1 );
764 xTargetCell->setMerged();
766 xTargetCell->copyFormatFrom( xSourceCell );
781 aStart.
mnRow = nNewRowStart;
796 if( !pTableObj || !
mxTable.is() )
799 if( nSId == SID_TABLE_DELETE_TABLE )
801 if( pTableObj->IsTextEditActive() )
811 if( pTableObj->IsTextEditActive() )
816 bool bDeleteTable =
false;
819 case SID_TABLE_DELETE_COL:
821 const sal_Int32 nRemovedColumns = aEnd.
mnCol - aStart.
mnCol + 1;
822 if( nRemovedColumns ==
mxTable->getColumnCount() )
828 Reference< XTableColumns > xCols(
mxTable->getColumns() );
829 xCols->removeByIndex( aStart.
mnCol, nRemovedColumns );
835 case SID_TABLE_DELETE_ROW:
837 const sal_Int32 nRemovedRows = aEnd.
mnRow - aStart.
mnRow + 1;
838 if( nRemovedRows ==
mxTable->getRowCount() )
844 Reference< XTableRows > xRows(
mxTable->getRows() );
845 xRows->removeByIndex( aStart.
mnRow, nRemovedRows );
865 const sal_Int32 nRowCount =
mxTable->getRowCount();
866 const sal_Int32 nColCount =
mxTable->getColumnCount();
867 if( !(nRowCount && nColCount) )
875 case SID_TABLE_SELECT_ALL:
877 aStart.
mnCol = nColCount - 1; aStart.
mnRow = nRowCount - 1;
879 case SID_TABLE_SELECT_COL:
880 aEnd.
mnRow = nRowCount - 1;
883 case SID_TABLE_SELECT_ROW:
884 aEnd.
mnCol = nColCount - 1;
913 if( pNewItem->
GetDistance( SvxBoxItemLine::RIGHT ) != pOriginalItem.
GetDistance( SvxBoxItemLine::RIGHT ) )
919 if( pNewItem->
GetDistance( SvxBoxItemLine::BOTTOM ) != pOriginalItem.
GetDistance( SvxBoxItemLine::BOTTOM ) )
943 aNewAttr.
Put(*xBoxItem);
944 aNewAttr.
Put(*xBoxInfoItem);
950 if (rTableItemSet.
GetItemState(nWhich,
false) != SfxItemState::SET)
955 aNewAttr.
Put(rTableItemSet.
Get(nWhich));
965 xDlg->StartExecuteAsync([xDlg,
this, xBoxItem, xBoxInfoItem](
int nResult){
968 SfxItemSet aNewSet(*(xDlg->GetOutputItemSet()));
977 aNewSet.
Put(*xBoxItem);
981 aNewSet.
Put(*xBoxInfoItem);
1008 xDlg->disposeOnce();
1014 const sal_uInt16 nSId = rReq.
GetSlot();
1017 case SID_TABLE_INSERT_ROW:
1018 case SID_TABLE_INSERT_COL:
1021 case SID_TABLE_DELETE_ROW:
1022 case SID_TABLE_DELETE_COL:
1023 case SID_TABLE_DELETE_TABLE:
1026 case SID_TABLE_SELECT_ALL:
1027 case SID_TABLE_SELECT_COL:
1028 case SID_TABLE_SELECT_ROW:
1031 case SID_FORMAT_TABLE_DLG:
1035 case SID_FRAME_LINESTYLE:
1036 case SID_FRAME_LINECOLOR:
1037 case SID_ATTR_BORDER:
1045 case SID_ATTR_FILL_STYLE:
1053 case SID_TABLE_MERGE_CELLS:
1057 case SID_TABLE_SPLIT_CELLS:
1061 case SID_TABLE_MINIMAL_COLUMN_WIDTH:
1065 case SID_TABLE_OPTIMAL_COLUMN_WIDTH:
1069 case SID_TABLE_DISTRIBUTE_COLUMNS:
1073 case SID_TABLE_MINIMAL_ROW_HEIGHT:
1077 case SID_TABLE_OPTIMAL_ROW_HEIGHT:
1081 case SID_TABLE_DISTRIBUTE_ROWS:
1085 case SID_TABLE_VERT_BOTTOM:
1086 case SID_TABLE_VERT_CENTER:
1087 case SID_TABLE_VERT_NONE:
1091 case SID_AUTOFORMAT:
1092 case SID_TABLE_SORT_DIALOG:
1093 case SID_TABLE_AUTOSUM:
1097 case SID_TABLE_STYLE:
1101 case SID_TABLE_STYLE_SETTINGS:
1104 case SID_TABLE_CHANGE_CURRENT_BORDER_POSITION:
1118 if(!pArgs || (SfxItemState::SET != pArgs->
GetItemState(SID_TABLE_STYLE,
false)))
1127 Reference< XStyleFamiliesSupplier > xSFS( rModel.
getUnoModel(), UNO_QUERY_THROW );
1128 Reference< XNameAccess > xFamilyNameAccess( xSFS->getStyleFamilies(), UNO_SET_THROW );
1129 Reference< XNameAccess > xTableFamilyAccess( xFamilyNameAccess->getByName(
"table" ), UNO_QUERY_THROW );
1131 if( xTableFamilyAccess->hasByName( pArg->
GetValue() ) )
1134 Reference< XIndexAccess > xNewTableStyle( xTableFamilyAccess->getByName( pArg->
GetValue() ), UNO_QUERY_THROW );
1141 rModel.
AddUndo(std::make_unique<TableStyleUndo>(rTableObj));
1146 const sal_Int32 nRowCount =
mxTable->getRowCount();
1147 const sal_Int32 nColCount =
mxTable->getColumnCount();
1148 for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
1150 for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ )
try
1152 CellRef xCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
1156 bool bChanges =
false;
1158 SAL_WARN_IF(!pStyleSheet,
"svx",
"no stylesheet for table cell?");
1165 if( (rStyleAttribs.
GetItemState( nWhich ) == SfxItemState::SET) && (aSet.
GetItemState( nWhich ) == SfxItemState::SET) )
1178 xCell->SetMergedItemSetAndBroadcast( aSet,
true );
1209 if( (pPoolItem = pArgs->
GetItemIfSet(ID_VAL_USEFIRSTROWSTYLE,
false)) )
1212 if( (pPoolItem = pArgs->
GetItemIfSet(ID_VAL_USELASTROWSTYLE,
false)) )
1215 if( (pPoolItem = pArgs->
GetItemIfSet(ID_VAL_USEBANDINGROWSTYLE,
false)) )
1218 if( (pPoolItem = pArgs->
GetItemIfSet(ID_VAL_USEFIRSTCOLUMNSTYLE,
false)) )
1221 if( (pPoolItem = pArgs->
GetItemIfSet(ID_VAL_USELASTCOLUMNSTYLE,
false)) )
1224 if( (pPoolItem = pArgs->
GetItemIfSet(ID_VAL_USEBANDINGCOLUMNSTYLE,
false)) )
1235 rModel.
AddUndo(std::make_unique<TableStyleUndo>(rTableObj));
1268 case SID_TABLE_VERT_BOTTOM:
1271 case SID_TABLE_VERT_CENTER:
1281 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
1283 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
1285 CellRef xCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
1292 xCell->SetMergedItemSetAndBroadcast(aSet,
false);
1310 if( pTableObj->IsTextEditActive() )
1326 xDlg->StartExecuteAsync([xDlg,
this](
int) {
1327 const sal_Int32
nCount = xDlg->GetCount() - 1;
1334 Reference< XMergeableCellRange > xRange(
mxTable->createCursorByRange(
mxTable->getCellRangeByPosition( aStart.
mnCol, aStart.
mnRow, aEnd.
mnCol, aEnd.
mnRow ) ), UNO_QUERY_THROW );
1335 const sal_Int32 nRowCount =
mxTable->getRowCount();
1336 const sal_Int32 nColCount =
mxTable->getColumnCount();
1352 if( xDlg->IsHorizontal() )
1354 xRange->split( 0,
nCount );
1358 xRange->split(
nCount, 0 );
1369 xDlg->disposeOnce();
1432 bool bDeleteTable =
false;
1439 const sal_Int32 nRemovedColumns = aEnd.
mnCol - aStart.
mnCol + 1;
1440 const sal_Int32 nRemovedRows = aEnd.
mnRow - aStart.
mnRow + 1;
1441 if( nRemovedColumns ==
mxTable->getColumnCount() && nRemovedRows ==
mxTable->getRowCount())
1443 bDeleteTable =
true;
1447 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
1449 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
1451 CellRef xCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
1452 if (xCell.is() && xCell->hasText())
1456 xCell->SetOutlinerParaObject(std::nullopt);
1477 rpStyleSheet =
nullptr;
1487 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
1489 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
1491 CellRef xCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
1499 else if(pRet != pSS)
1507 rpStyleSheet = pRet;
1523 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
1525 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
1527 CellRef xCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
1529 xCell->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
1549 if (!(pType && pIndex && pOffset))
1552 const OUString
sType = pType->GetValue();
1558 sal_Int32 nEdgeIndex = -1;
1559 bool bHorizontal =
sType.startsWith(
"row");
1561 if (
sType ==
"column-left" ||
sType ==
"row-left")
1565 else if (
sType ==
"column-right")
1570 else if (
sType ==
"row-right")
1575 else if (
sType ==
"column-middle" ||
sType ==
"row-middle")
1589 rModel.
BegUndo(pUndoObject->GetComment());
1591 auto* pGeoUndo =
static_cast<SdrUndoGeoObj*
>(pUndoObject.get());
1595 rModel.
AddUndo(std::move(pUndoObject));
1600 rTableObj.
changeEdge(bHorizontal, nEdgeIndex, nOffset);
1632 case awt::Key::ESCAPE:
1646 case awt::Key::RETURN:
1648 if( !bMod1 && !bMod2 && !bTextEdit )
1658 if( bMod1 || bMod2 )
1661 else if( bTextEdit )
1679 case awt::Key::HOME:
1680 case awt::Key::NUM7:
1684 if( bMod1 && !bMod2 )
1689 else if( !bMod1 && bMod2 )
1698 case awt::Key::NUM1:
1702 if( bMod1 && !bMod2 )
1707 else if( !bMod1 && bMod2 )
1724 case awt::Key::NUM8:
1725 case awt::Key::DOWN:
1726 case awt::Key::NUM2:
1727 case awt::Key::LEFT:
1728 case awt::Key::NUM4:
1729 case awt::Key::RIGHT:
1730 case awt::Key::NUM6:
1733 if( !bMod1 && bMod2 )
1737 if( (nCode == awt::Key::UP) || (nCode == awt::Key::NUM8) )
1742 else if( (nCode == awt::Key::DOWN) || (nCode == awt::Key::NUM2) )
1750 bool bTextMove =
false;
1770 case awt::Key::LEFT:
1771 case awt::Key::NUM4:
1774 case awt::Key::RIGHT:
1775 case awt::Key::NUM6:
1778 case awt::Key::DOWN:
1779 case awt::Key::NUM2:
1783 case awt::Key::NUM8:
1790 case awt::Key::PAGEUP:
1795 case awt::Key::PAGEDOWN:
1831 gotoCell( pTableObj->getLastCell(), bSelect, pWindow, nAction );
1838 gotoCell( aPos, bSelect, pWindow, nAction );
1845 gotoCell( aPos, bSelect, pWindow, nAction );
1852 gotoCell( aPos, bSelect, pWindow, nAction );
1871 gotoCell( aPos, bSelect, pWindow, nAction );
1894 CellPos aNextCell( pTableObj->getNextCell( aSelectionEnd,
true ) );
1895 if( aSelectionEnd == aNextCell )
1898 aNextCell = pTableObj->getNextCell( aSelectionEnd,
true );
1900 gotoCell( aNextCell,
false, pWindow, nAction );
1915 if( pTable && pTable->IsTextEditActive() )
1922 pTable->setActiveCell( rPos );
1936 EditCell( rPos, pWindow, nAction );
1968 Reference< XMergeableCellRange > xRange(
mxTable->createCursorByRange(
mxTable->getCellRangeByPosition( nFirstCol, nFirstRow,nLastCol, nLastRow ) ), UNO_QUERY_THROW );
1970 if( xRange->isMergeable() )
2024 Reference< XMergeableCell > xCell(
mxTable->getCellByPosition( rPos.
mnCol, rPos.
mnRow ), UNO_QUERY_THROW );
2025 if( xCell->isMerged() )
2049 bool bEmptyOutliner =
false;
2057 if(nParaCnt==1 && p1stPara)
2060 if (pOutl->
GetText(p1stPara).isEmpty())
2062 bEmptyOutliner =
true;
2080 std::unique_ptr<SdrOutliner> pOutl(
SdrMakeOutliner(OutlinerMode::OutlineObject, rModel));
2083 pOutl->SetVertical(
true );
2138 for( sal_Int32 nRow = rFirst.
mnRow; nRow <= rLast.
mnRow && !bExt; nRow++ )
2140 for( sal_Int32 nCol = rFirst.
mnCol; nCol <= rLast.
mnCol && !bExt; nCol++ )
2142 Reference< XMergeableCell > xCell(
mxTable->getCellByPosition( nCol, nRow ), UNO_QUERY );
2146 if( xCell->isMerged() )
2159 if( ((nCol + xCell->getColumnSpan() - 1) > rLast.
mnCol) || (nRow + xCell->getRowSpan() - 1 ) > rLast.
mnRow )
2161 rLast.
mnCol = std::max( rLast.
mnCol, nCol + xCell->getColumnSpan() - 1 );
2162 rLast.
mnRow = std::max( rLast.
mnRow, nRow + xCell->getRowSpan() - 1 );
2179 Reference< XMergeableCell > xCell(
mxTable->getCellByPosition( rLast.
mnCol, rLast.
mnRow ), UNO_QUERY );
2182 rLast.
mnCol += xCell->getColumnSpan() - 1;
2183 rLast.
mnRow += xCell->getRowSpan() - 1;
2248 for (sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++)
2250 for (sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++)
2261 xCell->SetMergedItemSetAndBroadcast(aCellSet,
false);
2291 if( (aPos2.
mnCol >= 0) && (aPos2.
mnRow >= 0) )
2337 pTableObj->getCellBounds( aStart, aStartRect );
2343 pTableObj->getCellBounds( aEnd, aEndRect );
2346 aRanges.push_back( a2DRange );
2360 if( xOverlayManager.is() )
2364 xOverlayManager->add(*pOverlay);
2382 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, aSelection.
toString());
2383 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.
toString());
2400 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA,
"EMPTY");
2401 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START,
"EMPTY");
2402 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END,
"EMPTY");
2403 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION,
"EMPTY");
2417 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
2419 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
2421 CellRef xCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
2422 if( xCell.is() && !xCell->isMerged() )
2432 if(SfxItemState::DONTCARE ==
nState)
2437 else if(SfxItemState::SET ==
nState)
2455 const SvxBorderLine* pOld = rNewFrame.
GetLine(nLine);
2458 SvxBorderLine aNewLine( *pNew );
2459 aNewLine.SetColor( pOld->GetColor() );
2460 rNewFrame.
SetLine( &aNewLine, nLine );
2464 rNewFrame.
SetLine( pNew, nLine );
2470 if (nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After|CellPosFlag::Upper|CellPosFlag::Lower))
2474 if (!(nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After)))
2476 if (nCellPosFlags & CellPosFlag::Upper)
2478 if( pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::TOP) )
2479 rNewFrame.
SetLine(
nullptr, SvxBoxItemLine::BOTTOM );
2481 else if (nCellPosFlags & CellPosFlag::Lower)
2483 if( pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::BOTTOM) )
2484 rNewFrame.
SetLine(
nullptr, SvxBoxItemLine::TOP );
2487 else if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Lower)))
2489 if (nCellPosFlags & CellPosFlag::Before)
2491 if( pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::LEFT) )
2492 rNewFrame.
SetLine(
nullptr, SvxBoxItemLine::RIGHT );
2494 else if (nCellPosFlags & CellPosFlag::After)
2496 if( pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::RIGHT) )
2497 rNewFrame.
SetLine(
nullptr, SvxBoxItemLine::LEFT );
2505 if ((nCellPosFlags & CellPosFlag::Left) ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::LEFT)
2506 : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::VERT))
2507 rNewFrame.
SetLine( (nCellPosFlags & CellPosFlag::Left) ? pBoxItem->
GetLeft() : pBoxInfoItem->
GetVert(), SvxBoxItemLine::LEFT );
2509 if( (nCellPosFlags & CellPosFlag::Right) ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::RIGHT) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::VERT) )
2510 rNewFrame.
SetLine( (nCellPosFlags & CellPosFlag::Right) ? pBoxItem->
GetRight() : pBoxInfoItem->
GetVert(), SvxBoxItemLine::RIGHT );
2512 if( (nCellPosFlags & CellPosFlag::Top) ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::TOP) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::HORI) )
2513 rNewFrame.
SetLine( (nCellPosFlags & CellPosFlag::Top) ? pBoxItem->
GetTop() : pBoxInfoItem->
GetHori(), SvxBoxItemLine::TOP );
2515 if( (nCellPosFlags & CellPosFlag::Bottom) ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::BOTTOM) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::HORI) )
2516 rNewFrame.
SetLine( (nCellPosFlags & CellPosFlag::Bottom) ? pBoxItem->
GetBottom() : pBoxInfoItem->
GetHori(), SvxBoxItemLine::BOTTOM );
2519 if( pBoxInfoItem->
IsValid( SvxBoxInfoItemValidFlags::DISTANCE ) )
2528 const SvxBorderLine* pSourceLine = rNewFrame.
GetLine( nLine );
2531 SvxBorderLine aLine( *pSourceLine );
2532 aLine.SetColor( rColor );
2533 rNewFrame.
SetLine( &aLine, nLine );
2542 if (!(nCellPosFlags & (CellPosFlag::Lower|CellPosFlag::Before|CellPosFlag::After)))
2545 if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Before|CellPosFlag::After)))
2548 if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Lower|CellPosFlag::After)))
2551 if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Lower|CellPosFlag::Before)))
2558 if (nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After|CellPosFlag::Upper|CellPosFlag::Lower))
2560 if (!(nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After)))
2562 if (nCellPosFlags & CellPosFlag::Upper)
2567 else if (nCellPosFlags & CellPosFlag::Lower)
2573 else if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Lower)))
2575 if (nCellPosFlags & CellPosFlag::Before)
2580 else if (nCellPosFlags & CellPosFlag::After)
2606 const sal_Int32 nRowCount =
mxTable->getRowCount();
2607 const sal_Int32 nColCount =
mxTable->getColumnCount();
2608 if( !(nRowCount && nColCount) )
2620 if(SfxItemState::SET == rAttr.
GetItemState(SID_FRAME_LINECOLOR,
false) )
2621 pLineColorItem = &rAttr.
Get( SID_FRAME_LINECOLOR );
2623 const SvxBorderLine* pBorderLineItem =
nullptr;
2624 if(SfxItemState::SET == rAttr.
GetItemState(SID_FRAME_LINESTYLE,
false) )
2625 pBorderLineItem = rAttr.
Get( SID_FRAME_LINESTYLE ).GetLine();
2627 if( pBoxInfoItem && !pBoxItem )
2630 pBoxItem = &gaEmptyBoxItem;
2632 else if( pBoxItem && !pBoxInfoItem )
2635 pBoxInfoItem = &gaEmptyBoxInfoItem;
2641 const sal_Int32 nLastRow = std::min( aEnd.
mnRow + 2, nRowCount );
2642 const sal_Int32 nLastCol = std::min( aEnd.
mnCol + 2, nColCount );
2644 for( sal_Int32 nRow = std::max( aStart.
mnRow - 1, sal_Int32(0) ); nRow < nLastRow; nRow++ )
2646 CellPosFlag nRowFlags = CellPosFlag::NONE;
2647 nRowFlags |= (nRow == aStart.
mnRow) ? CellPosFlag::Top : CellPosFlag::NONE;
2648 nRowFlags |= (nRow == aEnd.
mnRow) ? CellPosFlag::Bottom : CellPosFlag::NONE;
2649 nRowFlags |= (nRow < aStart.
mnRow) ? CellPosFlag::Upper : CellPosFlag::NONE;
2650 nRowFlags |= (nRow > aEnd.
mnRow) ? CellPosFlag::Lower : CellPosFlag::NONE;
2652 for( sal_Int32 nCol = std::max( aStart.
mnCol - 1, sal_Int32(0) ); nCol < nLastCol; nCol++ )
2654 CellRef xCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
2663 CellPosFlag nCellPosFlags = nRowFlags;
2664 nCellPosFlags |= (nCol == aStart.
mnCol) ? CellPosFlag::Left : CellPosFlag::NONE;
2665 nCellPosFlags |= (nCol == aEnd.
mnCol) ? CellPosFlag::Right : CellPosFlag::NONE;
2666 nCellPosFlags |= (nCol < aStart.
mnCol) ? CellPosFlag::Before : CellPosFlag::NONE;
2667 nCellPosFlags |= (nCol > aEnd.
mnCol) ? CellPosFlag::After : CellPosFlag::NONE;
2669 if( pBoxItem && pBoxInfoItem )
2672 if( pLineColorItem )
2675 if( pBorderLineItem )
2678 if (aNewFrame != *pOldOuter)
2681 aAttr.
Put(aNewFrame);
2682 xCell->SetMergedItemSetAndBroadcast( aAttr,
false );
2694 pTableObj->ActionChanged();
2695 pTableObj->BroadcastObjectChange();
2727 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
2729 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
2731 CellRef xCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
2736 xCell->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
2781 if(pTextEditOutlinerView)
2812 if(
nullptr == pCurrentSdrTableObj)
2829 if(aStart != aFullStart || aEnd != aFullEnd)
2835 pRetval->CropTableModelToSelection(aStart, aEnd);
2846 if( pPastePage && pPastePage->
GetObjCount() == 1 )
2849 if( pPasteTableObj )
2862 if( !pPasteTableObj )
2865 Reference< XTable > xPasteTable( pPasteTableObj->
getTable() );
2866 if( !xPasteTable.is() )
2872 sal_Int32 nPasteColumns = xPasteTable->getColumnCount();
2873 sal_Int32 nPasteRows = xPasteTable->getRowCount();
2881 sal_Int32 nColumns =
mxTable->getColumnCount();
2882 sal_Int32 nRows =
mxTable->getRowCount();
2884 const sal_Int32 nMissing = nPasteRows - ( nRows - aStart.
mnRow );
2887 Reference< XTableRows > xRows(
mxTable->getRows() );
2888 xRows->insertByIndex( nRows, nMissing );
2889 nRows =
mxTable->getRowCount();
2892 nPasteRows = std::min( nPasteRows, nRows - aStart.
mnRow );
2893 nPasteColumns = std::min( nPasteColumns, nColumns - aStart.
mnCol );
2896 for( sal_Int32 nRow = 0; nRow < nPasteRows; ++nRow )
2898 for( sal_Int32 nCol = 0, nTargetCol = aStart.
mnCol; nCol < nPasteColumns; ++nCol )
2900 CellRef xTargetCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nTargetCol, aStart.
mnRow + nRow ).get() ) );
2901 if( xTargetCell.is() && !xTargetCell->isMerged() )
2903 CellRef xSourceCell(
dynamic_cast<Cell*
>(xPasteTable->getCellByPosition(nCol, nRow).get()));
2904 if (xSourceCell.is())
2906 xTargetCell->AddUndo();
2908 if (nColumns < nTargetCol + xSourceCell->getColumnSpan())
2909 xTargetCell->replaceContentAndFormatting(xSourceCell);
2911 xTargetCell->cloneFrom(xSourceCell);
2913 nCol += xSourceCell->getColumnSpan() - 1;
2914 nTargetCol += xTargetCell->getColumnSpan();
2946 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
2948 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
2950 CellRef xCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
2977 mnUpdateEvent =
nullptr;
2979 if( mbCellSelectionMode )
2981 CellPos aStart( maCursorFirstPos );
2982 CellPos aEnd( maCursorLastPos );
2985 if( aStart != maCursorFirstPos || aEnd != maCursorLastPos )
2987 setSelectedCells( aStart, aEnd );
2991 updateSelectionOverlay();
2992 mbHasJustMerged =
false;
3029 const SvxBorderLine* getLine()
const;
3030 void setLine(
const SvxBorderLine* pLine);
3040BoxItemWrapper::BoxItemWrapper(
3051const SvxBorderLine* BoxItemWrapper::getLine()
const
3059void BoxItemWrapper::setLine(
const SvxBorderLine* pLine)
3067void lcl_MergeBorderLine(
3068 LinesState& rLinesState,
const SvxBorderLine*
const pLine,
const SvxBoxItemLine nLine,
3071 const SvxBoxInfoItemLine nInnerLine(bBorder ? SvxBoxInfoItemLine::HORI : ((nValidFlag & SvxBoxInfoItemValidFlags::HORI) ? SvxBoxInfoItemLine::HORI : SvxBoxInfoItemLine::VERT));
3072 BoxItemWrapper aBoxItem(rLinesState.rBoxItem, rLinesState.rBoxInfoItem, nLine, nInnerLine, bBorder);
3073 bool& rbSet(bBorder ? rLinesState.aBorderSet[nLine] : rLinesState.aInnerLineSet[nInnerLine]);
3077 bool& rbIndeterminate(bBorder ? rLinesState.aBorderIndeterminate[nLine] : rLinesState.aInnerLineIndeterminate[nInnerLine]);
3078 if (!rbIndeterminate)
3080 const SvxBorderLine*
const pMergedLine(aBoxItem.getLine());
3081 if ((pLine && !pMergedLine) || (!pLine && pMergedLine) || (pLine && (*pLine != *pMergedLine)))
3083 aBoxItem.setLine(
nullptr);
3084 rbIndeterminate =
true;
3090 aBoxItem.setLine(pLine);
3095void lcl_MergeBorderOrInnerLine(
3096 LinesState& rLinesState,
const SvxBorderLine*
const pLine,
const SvxBoxItemLine nLine,
3100 lcl_MergeBorderLine(rLinesState, pLine, nLine, nValidFlag);
3103 const bool bVertical = (nLine == SvxBoxItemLine::LEFT) || (nLine == SvxBoxItemLine::RIGHT);
3104 lcl_MergeBorderLine(rLinesState, pLine, nLine, bVertical ? SvxBoxInfoItemValidFlags::VERT : SvxBoxInfoItemValidFlags::HORI,
false);
3108void lcl_MergeDistance(
3109 LinesState& rLinesState,
const SvxBoxItemLine nIndex,
const sal_uInt16 nDistance)
3111 if (rLinesState.aDistanceSet[nIndex])
3113 if (!rLinesState.bDistanceIndeterminate)
3114 rLinesState.bDistanceIndeterminate = nDistance != rLinesState.aDistance[
nIndex];
3118 rLinesState.aDistance[
nIndex] = nDistance;
3119 rLinesState.aDistanceSet[
nIndex] =
true;
3123void lcl_MergeCommonBorderAttr(LinesState& rLinesState,
const SvxBoxItem& rCellBoxItem,
const CellPosFlag nCellPosFlags)
3125 if (nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After|CellPosFlag::Upper|CellPosFlag::Lower))
3129 if (!(nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After)))
3131 if (nCellPosFlags & CellPosFlag::Upper)
3132 lcl_MergeBorderLine(rLinesState, rCellBoxItem.
GetBottom(), SvxBoxItemLine::TOP, SvxBoxInfoItemValidFlags::TOP);
3133 else if (nCellPosFlags & CellPosFlag::Lower)
3134 lcl_MergeBorderLine(rLinesState, rCellBoxItem.
GetTop(), SvxBoxItemLine::BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM);
3136 else if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Lower)))
3138 if (nCellPosFlags & CellPosFlag::Before)
3139 lcl_MergeBorderLine(rLinesState, rCellBoxItem.
GetRight(), SvxBoxItemLine::LEFT, SvxBoxInfoItemValidFlags::LEFT);
3140 else if (nCellPosFlags & CellPosFlag::After)
3141 lcl_MergeBorderLine(rLinesState, rCellBoxItem.
GetLeft(), SvxBoxItemLine::RIGHT, SvxBoxInfoItemValidFlags::RIGHT);
3151 lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.
GetTop(), SvxBoxItemLine::TOP, SvxBoxInfoItemValidFlags::TOP,
static_cast<bool>(nCellPosFlags & CellPosFlag::Top));
3152 lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.
GetBottom(), SvxBoxItemLine::BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM,
static_cast<bool>(nCellPosFlags & CellPosFlag::Bottom));
3153 lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.
GetLeft(), SvxBoxItemLine::LEFT, SvxBoxInfoItemValidFlags::LEFT,
static_cast<bool>(nCellPosFlags & CellPosFlag::Left));
3154 lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.
GetRight(), SvxBoxItemLine::RIGHT, SvxBoxInfoItemValidFlags::RIGHT,
static_cast<bool>(nCellPosFlags & CellPosFlag::Right));
3156 lcl_MergeDistance(rLinesState, SvxBoxItemLine::TOP, rCellBoxItem.
GetDistance(SvxBoxItemLine::TOP));
3157 lcl_MergeDistance(rLinesState, SvxBoxItemLine::BOTTOM, rCellBoxItem.
GetDistance(SvxBoxItemLine::BOTTOM));
3158 lcl_MergeDistance(rLinesState, SvxBoxItemLine::LEFT, rCellBoxItem.
GetDistance(SvxBoxItemLine::LEFT));
3159 lcl_MergeDistance(rLinesState, SvxBoxItemLine::RIGHT, rCellBoxItem.
GetDistance(SvxBoxItemLine::RIGHT));
3170 const sal_Int32 nRowCount =
mxTable->getRowCount();
3171 const sal_Int32 nColCount =
mxTable->getColumnCount();
3172 if( !(nRowCount && nColCount) )
3180 const sal_Int32 nLastRow = std::min( aEnd.
mnRow + 2, nRowCount );
3181 const sal_Int32 nLastCol = std::min( aEnd.
mnCol + 2, nColCount );
3195 for( sal_Int32 nRow = std::max( aStart.
mnRow - 1, sal_Int32(0) ); nRow < nLastRow; nRow++ )
3197 CellPosFlag nRowFlags = CellPosFlag::NONE;
3198 nRowFlags |= (nRow == aStart.
mnRow) ? CellPosFlag::Top : CellPosFlag::NONE;
3199 nRowFlags |= (nRow == aEnd.
mnRow) ? CellPosFlag::Bottom : CellPosFlag::NONE;
3200 nRowFlags |= (nRow < aStart.
mnRow) ? CellPosFlag::Upper : CellPosFlag::NONE;
3201 nRowFlags |= (nRow > aEnd.
mnRow) ? CellPosFlag::Lower : CellPosFlag::NONE;
3203 for( sal_Int32 nCol = std::max( aStart.
mnCol - 1, sal_Int32(0) ); nCol < nLastCol; nCol++ )
3205 CellRef xCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
3209 CellPosFlag nCellPosFlags = nRowFlags;
3210 nCellPosFlags |= (nCol == aStart.
mnCol) ? CellPosFlag::Left : CellPosFlag::NONE;
3211 nCellPosFlags |= (nCol == aEnd.
mnCol) ? CellPosFlag::Right : CellPosFlag::NONE;
3212 nCellPosFlags |= (nCol < aStart.
mnCol) ? CellPosFlag::Before : CellPosFlag::NONE;
3213 nCellPosFlags |= (nCol > aEnd.
mnCol) ? CellPosFlag::After : CellPosFlag::NONE;
3217 lcl_MergeCommonBorderAttr( aLinesState, aCellBoxItem, nCellPosFlags );
3221 if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::TOP])
3222 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::TOP);
3223 if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::BOTTOM])
3224 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::BOTTOM);
3225 if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::LEFT])
3226 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::LEFT);
3227 if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::RIGHT])
3228 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::RIGHT);
3229 if (!aLinesState.aInnerLineIndeterminate[SvxBoxInfoItemLine::HORI])
3230 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::HORI);
3231 if (!aLinesState.aInnerLineIndeterminate[SvxBoxInfoItemLine::VERT])
3232 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::VERT);
3234 if (!aLinesState.bDistanceIndeterminate)
3236 if (aLinesState.aDistanceSet[SvxBoxItemLine::TOP])
3237 aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::TOP], SvxBoxItemLine::TOP);
3238 if (aLinesState.aDistanceSet[SvxBoxItemLine::BOTTOM])
3239 aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::BOTTOM], SvxBoxItemLine::BOTTOM);
3240 if (aLinesState.aDistanceSet[SvxBoxItemLine::LEFT])
3241 aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::LEFT], SvxBoxItemLine::LEFT);
3242 if (aLinesState.aDistanceSet[SvxBoxItemLine::RIGHT])
3243 aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::RIGHT], SvxBoxItemLine::RIGHT);
3244 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::DISTANCE);
3252 CellPos aStart( 0, row ), aEnd(
mxTable->getColumnCount() - 1, row );
3262 CellPos aStart( column, 0 ), aEnd( column,
mxTable->getRowCount() - 1 );
3272 CellPos aStart( 0, row ), aEnd(
mxTable->getColumnCount() - 1, row );
3274 gotoCell( aStart,
false,
nullptr );
3282 CellPos aStart( column, 0 ), aEnd( column,
mxTable->getRowCount() - 1 );
3284 gotoCell( aStart,
false,
nullptr );
3294 if( (aFirstPos.
mnCol == 0) && (nRow >= aFirstPos.
mnRow && nRow <= aLastPos.
mnRow) && (
mxTable->getColumnCount() - 1 == aLastPos.
mnCol) )
3306 if( (aFirstPos.
mnRow == 0) && (nColumn >= aFirstPos.
mnCol && nColumn <= aLastPos.
mnCol) && (
mxTable->getRowCount() - 1 == aLastPos.
mnRow) )
constexpr auto convertTwipToMm100(N n)
const StyleSettings & GetStyleSettings() const
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
sal_uInt16 GetValue() const
const OUString & GetValue() const
void ChangeFontSize(bool bGrow, const FontList *pList)
const vcl::KeyCode & GetKeyCode() const
MapUnit GetMapUnit() const
sal_uInt16 GetClicks() const
const Point & GetPosPixel() const
void SetSelection(const ESelection &)
ESelection GetSelection() const
bool PostKeyEvent(const KeyEvent &rKEvt, vcl::Window const *pFrameWin=nullptr)
OUString GetText(Paragraph const *pPara, sal_Int32 nParaCount=1) const
Paragraph * GetParagraph(sal_Int32 nAbsPos) const
sal_Int32 GetParagraphCount() const
const MapMode & GetMapMode() const
const AllSettings & GetSettings() const
void SetEditMode(SdrViewEditMode eMode)
void SetCurrentObj(SdrObjKind nIdent, SdrInventor nInvent=SdrInventor::Default)
void SetAttrToMarked(const SfxItemSet &rAttr, bool bReplaceAll)
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
SdrHdl * PickHandle(const Point &rPnt) const
const SdrMarkList & GetMarkedObjectList() const
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
SdrObject * GetMarkedSdrObj() const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
virtual bool IsReadOnly() const
const SfxItemPool & GetItemPool() const
SdrUndoFactory & GetSdrUndoFactory() const
returns the models undo factory.
css::uno::Reference< css::uno::XInterface > const & getUnoModel()
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
const SdrPage * GetPage(sal_uInt16 nPgNum) const
sal_uInt16 GetPageCount() const
SdrTextObj * GetTextEditObject() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
const OutlinerView * GetTextEditOutlinerView() const
static void ApplyFormatPaintBrushToText(SfxItemSet const &rFormatSet, SdrTextObj &rTextObj, SdrText *pText, bool bNoCharacterFormats, bool bNoParagraphFormats)
helper function for selections with multiple SdrText for one SdrTextObj (f.e.
virtual bool IsTextEdit() const final override
virtual void MarkListHasChanged() override
virtual bool SdrBeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, SdrOutliner *pGivenOutliner=nullptr, OutlinerView *pGivenOutlinerView=nullptr, bool bDontDeleteOutliner=false, bool bOnlyOneView=false, bool bGrabFocus=true)
const SdrOutliner * GetTextEditOutliner() const
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
SdrObjUserCall * GetUserCall() const
static rtl::Reference< T > Clone(T const &rObj, SdrModel &rTargetModel)
SdrModel & getSdrModelFromSdrObject() const
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
virtual const tools::Rectangle & GetLastBoundRect() const
SdrPage * getSdrPageFromSdrObject() const
const SfxItemSet & GetMergedItemSet() const
SdrPage * GetPage() const
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
OutputDevice * GetFirstOutputDevice() const
sal_uInt32 PaintWindowCount() const
SdrPageView * GetSdrPageView() const
rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const
virtual std::unique_ptr< SdrUndoAction > CreateUndoAttrObject(SdrObject &rObject, bool bStyleSheet1=false, bool bSaveText=false)
virtual std::unique_ptr< SdrUndoAction > CreateUndoGeoObject(SdrObject &rObject)
Changing the geometry of an object.
void SetSkipChangeLayout(bool bOn)
SdrHitKind PickAnything(const MouseEvent &rMEvt, SdrMouseEventKind nMouseDownOrMoveOrUp, SdrViewEvent &rVEvt) const
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
void MergeValue(const SfxPoolItem &rItem, bool bOverwriteDefaults=false)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) 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
const T * GetArg(sal_uInt16 nSlotId) const
weld::Window * GetFrameWeld() const
SfxStyleFamily GetFamily() const
virtual SfxItemSet & GetItemSet()
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
SfxItemState GetItemState(bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const Color & GetHighlightColor() const
virtual VclPtr< SvxAbstractSplitTableDialog > CreateSvxSplitTableDialog(weld::Window *pParent, bool bIsTableVertical, tools::Long nMaxVertical)=0
virtual VclPtr< SfxAbstractTabDialog > CreateSvxFormatCellsDialog(weld::Window *pParent, const SfxItemSet &rAttr, const SdrModel &rModel, bool bStyle)=0
static SvxAbstractDialogFactory * Create()
bool IsValid(SvxBoxInfoItemValidFlags nValid) const
const editeng::SvxBorderLine * GetHori() const
const editeng::SvxBorderLine * GetVert() const
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
const editeng::SvxBorderLine * GetTop() const
const editeng::SvxBorderLine * GetLine(SvxBoxItemLine nLine) const
const editeng::SvxBorderLine * GetRight() const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
const editeng::SvxBorderLine * GetLeft() const
sal_Int16 GetDistance(SvxBoxItemLine nLine, bool bAllowNegative=false) const
void SetDistance(sal_Int16 nNew, SvxBoxItemLine nLine)
const editeng::SvxBorderLine * GetBottom() const
const Color & GetValue() const
void expand(const Tuple2D< TYPE > &rTuple)
::std::vector< basegfx::B2DRange > RangeVector
bool IsTextEditActive() const
void setTableStyleSettings(const sdr::table::TableStyleSettings &rStyle)
virtual OutlinerParaObject * GetOutlinerParaObject() const override
void changeEdge(bool bHorizontal, int nEdge, sal_Int32 nOffset)
sal_Int32 getColumnCount() const
const sdr::table::TableStyleSettings & getTableStyleSettings() const
static CellPos getFirstCell()
sal_Int32 getRowCount() const
css::text::WritingMode GetWritingMode() const
void getActiveCellPos(sdr::table::CellPos &rPos) const
void DistributeColumns(sal_Int32 nFirstColumn, sal_Int32 nLastColumn, const bool bOptimize, const bool bMinimize)
virtual bool IsVerticalWriting() const override
void setTableStyle(const css::uno::Reference< css::container::XIndexAccess > &xAutoFormatStyle)
css::uno::Reference< css::table::XTable > getTable() const
void setActiveCell(const sdr::table::CellPos &rPos)
virtual void SetChanged() override
void DistributeRows(sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize, const bool bMinimize)
virtual bool ChangeFontSize(bool bGrow, const FontList *pFontList) override
Changes the font (grow/shrink) according to the input parameters.
SVX_DLLPRIVATE void DistributeColumns(const bool bOptimize, const bool bMinimize)
virtual SVX_DLLPRIVATE ~SvxTableController() override
SVX_DLLPRIVATE void SetTableStyleSettings(const SfxItemSet *pArgs)
bool deselectColumn(sal_Int32 column)
virtual SVX_DLLPRIVATE bool PasteObjModel(const SdrModel &rModel) override
SVX_DLLPRIVATE void destroySelectionOverlay()
void SetAttrToSelectedShape(const SfxItemSet &rAttr)
SVX_DLLPRIVATE void FillCommonBorderAttrFromSelectedCells(SvxBoxItem &rBox, SvxBoxInfoItem &rBoxInfo) const
Fill the values that are common for all selected cells.
virtual SVX_DLLPRIVATE bool ApplyFormatPaintBrush(SfxItemSet &rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats) override
applies a format paint brush set from the current selection.
SVX_DLLPRIVATE void onFormatTable(const SfxRequest &rReq)
SVX_DLLPRIVATE void SetTableStyle(const SfxItemSet *pArgs)
virtual SVX_DLLPRIVATE void onSelectAll() override
virtual SVX_DLLPRIVATE rtl::Reference< SdrObject > GetMarkedSdrObjClone(SdrModel &rTargetModel) override
SVX_DLLPRIVATE TblAction getKeyboardAction(const KeyEvent &rKEvt)
SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet &rAttr, bool bReplaceAll)
SVX_DLLPRIVATE void findMergeOrigin(CellPos &rPos)
SVX_DLLPRIVATE void UpdateSelection(const CellPos &rPos)
SVX_DLLPRIVATE void changeTableEdge(const SfxRequest &rReq)
virtual SVX_DLLPRIVATE bool DeleteMarked() override
SVX_DLLPRIVATE void StopTextEdit()
SVX_DLLPRIVATE void MergeRange(sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow)
static SVX_DLLPRIVATE rtl::Reference< sdr::SelectionController > create(SdrView &rView, const SdrTableObj &rObj, const rtl::Reference< sdr::SelectionController > &xRefController)
SVX_DLLPRIVATE void EditCell(const CellPos &rPos, vcl::Window *pWindow, TblAction nAction)
void getSelectedCells(CellPos &rFirstPos, CellPos &rLastPos) override
bool isColumnSelected(sal_Int32 nColumn)
SVX_DLLPRIVATE void onDelete(sal_uInt16 nSId)
sdr::table::SdrTableObj * GetTableObj()
virtual SVX_DLLPRIVATE bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll) override
SVX_DLLPRIVATE const CellPos & getSelectionStart()
virtual SVX_DLLPRIVATE bool onMouseButtonDown(const MouseEvent &rMEvt, vcl::Window *pWin) override
static SvxBoxItem TextDistancesToSvxBoxItem(const SfxItemSet &rAttrSet)
SVX_DLLPRIVATE void UpdateTableShape()
SVX_DLLPRIVATE void gotoCell(const CellPos &rCell, bool bSelect, vcl::Window *pWindow, TblAction nAction=TblAction::NONE)
std::optional< sdr::overlay::OverlayObjectList > mpSelectionOverlay
SVX_DLLPRIVATE void StartSelection(const CellPos &rPos)
bool deselectRow(sal_Int32 row)
ImplSVEvent * mnUpdateEvent
static void SvxBoxItemToTextDistances(const SvxBoxItem &pOriginalItem, SfxItemSet &rAttrSet)
virtual SVX_DLLPRIVATE void onSelectionHasChanged() override
virtual SVX_DLLPRIVATE bool setCursorLogicPosition(const Point &rPosition, bool bPoint) override
css::uno::Reference< css::util::XModifyListener > mxModifyListener
SVX_DLLPRIVATE void setSelectionStart(const CellPos &rPos)
virtual SVX_DLLPRIVATE bool onMouseMove(const MouseEvent &rMEvt, vcl::Window *pWin) override
SVX_DLLPRIVATE void ApplyBorderAttr(const SfxItemSet &rAttr)
SVX_DLLPRIVATE void onSelect(sal_uInt16 nSId)
rtl::Reference< TableModel > mxTable
SVX_DLLPRIVATE void checkCell(CellPos &rPos) const
virtual SVX_DLLPRIVATE bool GetStyleSheet(SfxStyleSheet *&rpStyleSheet) const override
unotools::WeakReference< SdrTableObj > mxTableObj
SVX_DLLPRIVATE void updateSelectionOverlay()
SVX_DLLPRIVATE void SplitMarkedCells(const SfxRequest &rReq)
virtual SVX_DLLPRIVATE bool onMouseButtonUp(const MouseEvent &rMEvt, vcl::Window *pWin) override
virtual SVX_DLLPRIVATE bool onKeyInput(const KeyEvent &rKEvt, vcl::Window *pWin) override
bool selectColumn(sal_Int32 column)
SVX_DLLPRIVATE SvxTableController(SdrView &rView, const SdrTableObj &rObj)
SVX_DLLPRIVATE bool executeAction(TblAction nAction, bool bSelect, vcl::Window *pWindow)
SVX_DLLPRIVATE bool checkTableObject()
SVX_DLLPRIVATE bool HasMarked() const
SVX_DLLPRIVATE bool PasteObject(SdrTableObj const *pPasteTableObj)
SVX_DLLPRIVATE void MergeMarkedCells()
SVX_DLLPRIVATE void DistributeRows(const bool bOptimize, const bool bMinimize)
virtual SVX_DLLPRIVATE bool hasSelectedCells() const override
This is a table object, and one or more of its cells are selected.
SVX_DLLPRIVATE void onInsert(sal_uInt16 nSId, const SfxItemSet *pArgs=nullptr)
void setSelectedCells(const CellPos &rFirstPos, const CellPos &rLastPos)
SVX_DLLPRIVATE void RemoveSelection()
virtual void Execute(SfxRequest &rReq) override
SVX_DLLPRIVATE void onTableModified()
SVX_DLLPRIVATE const CellPos & getSelectionEnd()
SVX_DLLPRIVATE void SetVertical(sal_uInt16 nSId)
bool isRowSelected(sal_Int32 nRow)
bool selectRow(sal_Int32 row)
SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet &rAttr, bool bOnlyHardAttr) const
virtual SVX_DLLPRIVATE void GetState(SfxItemSet &rSet) override
virtual SVX_DLLPRIVATE bool SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr) override
virtual SVX_DLLPRIVATE bool GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr) const override
sal_uInt16 GetCode() const
Point PixelToLogic(const Point &rDevicePt) const
constexpr ::Color COL_BLUE(0x00, 0x00, 0x80)
#define TOOLS_WARN_EXCEPTION(area, stream)
OUString SvxResId(TranslateId aId)
ESelection aNewSelection(GetSelection())
#define EE_PARA_NOT_FOUND
#define EE_INDEX_NOT_FOUND
#define LINK(Instance, Class, Member)
#define SAL_WARN_IF(condition, area, stream)
constexpr auto toTwips(N number, Length from)
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
IMPL_LINK_NOARG(SvxTableController, UpdateHdl, void *, void)
TableHitKind
SdrTableHitKind.
static void ImplApplyBorderLineItem(CellPosFlag nCellPosFlags, const SvxBorderLine *pBorderLineItem, SvxBoxItem &rNewFrame)
static void ImplSetLinePreserveColor(SvxBoxItem &rNewFrame, const SvxBorderLine *pNew, SvxBoxItemLine nLine)
static void ImplApplyBoxItem(CellPosFlag nCellPosFlags, const SvxBoxItem *pBoxItem, const SvxBoxInfoItem *pBoxInfoItem, SvxBoxItem &rNewFrame)
static void ImplApplyLineColorItem(CellPosFlag nCellPosFlags, const SvxColorItem *pLineColorItem, SvxBoxItem &rNewFrame)
rtl::Reference< sdr::SelectionController > CreateTableController(SdrView &rView, const SdrTableObj &rObj, const rtl::Reference< sdr::SelectionController > &xRefController)
static void ImplSetLineColor(SvxBoxItem &rNewFrame, SvxBoxItemLine nLine, const Color &rColor)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
@ SDRTEXTVERTADJUST_BOTTOM
@ SDRTEXTVERTADJUST_BLOCK
@ SDRTEXTVERTADJUST_CENTER
SdrMetricItem makeSdrTextUpperDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextRightDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextLowerDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextLeftDistItem(tools::Long mnHeight)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LEFTDIST(SDRATTR_MISC_FIRST+4)
constexpr sal_uInt16 SDRATTR_START(XATTR_START)
constexpr TypedWhichId< SvxBoxInfoItem > SDRATTR_TABLE_BORDER_INNER(SDRATTR_TABLE_FIRST+1)
constexpr sal_uInt16 SDRATTR_SHADOW_FIRST(XATTR_END+1)
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
constexpr sal_uInt16 SDRATTR_TABLE_LAST(SDRATTR_TABLE_CELL_GRABBAG)
constexpr TypedWhichId< SvxBoxItem > SDRATTR_TABLE_BORDER(SDRATTR_TABLE_FIRST+0)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_RIGHTDIST(SDRATTR_MISC_FIRST+5)
constexpr sal_uInt16 SDRATTR_SHADOW_LAST(SDRATTR_SHADOWALIGNMENT)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LOWERDIST(SDRATTR_MISC_FIRST+7)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_UPPERDIST(SDRATTR_MISC_FIRST+6)
std::unique_ptr< SdrOutliner > SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel &rModel)
Create an Outliner with the engine-global default settings on the heap.
SvxBoxInfoItem & m_rBoxInfoItem
o3tl::enumarray< SvxBoxInfoItemLine, bool > aInnerLineSet
const SvxBoxItemLine m_nBorderLine
const SvxBoxInfoItemLine m_nInnerLine
SvxBoxInfoItem & rBoxInfoItem
o3tl::enumarray< SvxBoxItemLine, bool > aBorderSet
o3tl::enumarray< SvxBoxInfoItemLine, bool > aInnerLineIndeterminate
o3tl::enumarray< SvxBoxItemLine, sal_uInt16 > aDistance
SvxTableController * mpController
o3tl::enumarray< SvxBoxItemLine, bool > aBorderIndeterminate
bool bDistanceIndeterminate
o3tl::enumarray< SvxBoxItemLine, bool > aDistanceSet