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>
46 #include <svx/svxids.hrc>
60 #include <svx/strings.hrc>
67 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
78 using ::editeng::SvxBorderLine;
114 class 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;
134 void SAL_CALL SvxTableControllerModifyListener::modified(
const css::lang::EventObject& )
144 void 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->getTable() );
199 mxTable.set( dynamic_cast< TableModel* >( xTable.get() ) );
212 Reference< XTable > xTable(
mxTableObj->getTable() );
230 if( rModel.IsReadOnly())
237 case awt::Key::RIGHT:
245 case awt::Key::ESCAPE:
279 pWindow = static_cast<vcl::Window*>(pOutputDevice);
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;
436 std::unique_ptr<SfxItemSet> xSet;
437 bool bVertDone(
false);
446 case SID_TABLE_VERT_BOTTOM:
447 case SID_TABLE_VERT_CENTER:
448 case SID_TABLE_VERT_NONE:
454 xSet.reset(
new SfxItemSet(rModel.GetItemPool()));
470 case SID_TABLE_DELETE_ROW:
474 case SID_TABLE_DELETE_COL:
478 case SID_TABLE_DELETE_TABLE:
482 case SID_TABLE_MERGE_CELLS:
486 case SID_TABLE_SPLIT_CELLS:
491 case SID_TABLE_OPTIMAL_ROW_HEIGHT:
492 case SID_TABLE_DISTRIBUTE_COLUMNS:
493 case SID_TABLE_DISTRIBUTE_ROWS:
495 bool bDistributeColumns =
false;
496 bool bDistributeRows =
false;
502 bDistributeColumns = aStart.
mnCol != aEnd.
mnCol;
505 if( !bDistributeColumns )
507 if( !bDistributeRows )
530 bool bInsertAfter =
true;
540 if(SfxItemState::SET == pArgs->
GetItemState(SID_TABLE_PARAM_INSERT_AFTER,
true, &pItem))
541 bInsertAfter = static_cast<const SfxBoolItem*>(pItem)->GetValue();
565 const OUString sSize(
"Size" );
566 const bool bUndo(rModel.IsUndoEnabled());
570 case SID_TABLE_INSERT_COL:
576 rModel.BegUndo(
SvxResId(STR_TABLE_INSCOL) );
577 rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoGeoObject(rTableObj));
580 Reference< XTableColumns > xCols(
mxTable->getColumns() );
581 const sal_Int32 nNewColumns = (nCount == 0) ? (aEnd.
mnCol - aStart.
mnCol + 1) : nCount;
582 const sal_Int32 nNewStartColumn = aEnd.
mnCol + (bInsertAfter ? 1 : 0);
583 xCols->insertByIndex( nNewStartColumn, nNewColumns );
585 for( sal_Int32 nOffset = 0; nOffset < nNewColumns; nOffset++ )
594 Reference< XPropertySet >(xCols->getByIndex( bInsertAfter?nNewStartColumn-1:nNewStartColumn+nNewColumns ), UNO_QUERY_THROW )->
599 sal_Int32 nPropSrcCol = (bInsertAfter ? aEnd.
mnCol : aStart.
mnCol + nNewColumns);
600 sal_Int32 nRowSpan = 0;
601 bool bNewSpan =
false;
603 for( sal_Int32 nRow = 0; nRow <
mxTable->getRowCount(); ++nRow )
605 CellRef xSourceCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nPropSrcCol, nRow ).get() ) );
608 if (xSourceCell.is() && nRowSpan == 0)
611 sal_Int32 nColSpan = sal_Int32();
612 sal_Int32 nSpanInfoCol = sal_Int32();
614 if( xSourceCell->getRowSpan() > 1 )
618 nRowSpan = xSourceCell->getRowSpan();
619 nColSpan = xSourceCell->getColumnSpan();
620 nSpanInfoCol = nPropSrcCol;
622 else if( xSourceCell->isMerged() )
626 for( nSpanInfoCol = nPropSrcCol - 1; nSpanInfoCol >= 0; --nSpanInfoCol )
628 CellRef xMergeInfoCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nSpanInfoCol, nRow ).get() ) );
629 if (xMergeInfoCell.is() && !xMergeInfoCell->isMerged())
631 nRowSpan = xMergeInfoCell->getRowSpan();
632 nColSpan = xMergeInfoCell->getColumnSpan();
641 if( nRowSpan > 0 && ( nNewStartColumn < nSpanInfoCol || nSpanInfoCol + nColSpan <= nNewStartColumn ) )
646 for( sal_Int32 nOffset = 0; nOffset < nNewColumns; nOffset++ )
648 CellRef xTargetCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nNewStartColumn + nOffset, nRow ).get() ) );
649 if( xTargetCell.is() )
654 xTargetCell->merge( 1, nRowSpan );
656 xTargetCell->setMerged();
658 xTargetCell->copyFormatFrom( xSourceCell );
672 aStart.
mnCol = nNewStartColumn;
679 case SID_TABLE_INSERT_ROW:
685 rModel.BegUndo(
SvxResId(STR_TABLE_INSROW ) );
686 rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoGeoObject(rTableObj));
689 Reference< XTableRows > xRows(
mxTable->getRows() );
690 const sal_Int32 nNewRows = (nCount == 0) ? (aEnd.
mnRow - aStart.
mnRow + 1) : nCount;
691 const sal_Int32 nNewRowStart = aEnd.
mnRow + (bInsertAfter ? 1 : 0);
692 xRows->insertByIndex( nNewRowStart, nNewRows );
694 for( sal_Int32 nOffset = 0; nOffset < nNewRows; nOffset++ )
703 sal_Int32 nPropSrcRow = (bInsertAfter ? aEnd.
mnRow : aStart.
mnRow + nNewRows);
704 sal_Int32 nColSpan = 0;
705 bool bNewSpan =
false;
707 for( sal_Int32 nCol = 0; nCol <
mxTable->getColumnCount(); ++nCol )
709 CellRef xSourceCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nPropSrcRow ).get() ) );
711 if (!xSourceCell.is())
718 sal_Int32 nRowSpan = sal_Int32();
719 sal_Int32 nSpanInfoRow = sal_Int32();
721 if( xSourceCell->getColumnSpan() > 1 )
725 nColSpan = xSourceCell->getColumnSpan();
726 nRowSpan = xSourceCell->getRowSpan();
727 nSpanInfoRow = nPropSrcRow;
729 else if( xSourceCell->isMerged() )
733 for( nSpanInfoRow = nPropSrcRow - 1; nSpanInfoRow >= 0; --nSpanInfoRow )
735 CellRef xMergeInfoCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nSpanInfoRow ).get() ) );
736 if (xMergeInfoCell.is() && !xMergeInfoCell->isMerged())
738 nColSpan = xMergeInfoCell->getColumnSpan();
739 nRowSpan = xMergeInfoCell->getRowSpan();
748 if( nColSpan > 0 && ( nNewRowStart < nSpanInfoRow || nSpanInfoRow + nRowSpan <= nNewRowStart ) )
753 for( sal_Int32 nOffset = 0; nOffset < nNewRows; ++nOffset )
755 CellRef xTargetCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nNewRowStart + nOffset ).get() ) );
756 if( xTargetCell.is() )
761 xTargetCell->merge( nColSpan, 1 );
763 xTargetCell->setMerged();
765 xTargetCell->copyFormatFrom( xSourceCell );
780 aStart.
mnRow = nNewRowStart;
795 if( !pTableObj || !
mxTable.is() )
798 if( nSId == SID_TABLE_DELETE_TABLE )
815 bool bDeleteTable =
false;
818 case SID_TABLE_DELETE_COL:
820 const sal_Int32 nRemovedColumns = aEnd.
mnCol - aStart.
mnCol + 1;
821 if( nRemovedColumns ==
mxTable->getColumnCount() )
827 Reference< XTableColumns > xCols(
mxTable->getColumns() );
828 xCols->removeByIndex( aStart.
mnCol, nRemovedColumns );
833 case SID_TABLE_DELETE_ROW:
835 const sal_Int32 nRemovedRows = aEnd.
mnRow - aStart.
mnRow + 1;
836 if( nRemovedRows ==
mxTable->getRowCount() )
842 Reference< XTableRows > xRows(
mxTable->getRows() );
843 xRows->removeByIndex( aStart.
mnRow, nRemovedRows );
862 const sal_Int32 nRowCount =
mxTable->getRowCount();
863 const sal_Int32 nColCount =
mxTable->getColumnCount();
864 if( !(nRowCount && nColCount) )
872 case SID_TABLE_SELECT_ALL:
874 aStart.
mnCol = nColCount - 1; aStart.
mnRow = nRowCount - 1;
876 case SID_TABLE_SELECT_COL:
877 aEnd.
mnRow = nRowCount - 1;
880 case SID_TABLE_SELECT_ROW:
881 aEnd.
mnCol = nColCount - 1;
897 aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( rAttrSet.
Get(
SDRATTR_TEXT_RIGHTDIST).GetValue()), SvxBoxItemLine::RIGHT );
898 aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( rAttrSet.
Get(
SDRATTR_TEXT_UPPERDIST).GetValue()), SvxBoxItemLine::TOP );
899 aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( rAttrSet.
Get(
SDRATTR_TEXT_LOWERDIST).GetValue()), SvxBoxItemLine::BOTTOM );
919 SvxBoxItem aBoxItem(mergeDrawinglayerTextDistancesAndSvxBoxItem(aNewAttr));
925 aNewAttr.Put( aBoxItem );
926 aNewAttr.Put( aBoxInfoItem );
932 if (rTableItemSet.
GetItemState(nWhich,
false) != SfxItemState::SET)
937 aNewAttr.
Put(rTableItemSet.
Get(nWhich));
947 xDlg->StartExecuteAsync([xDlg,
this, aBoxItem, aBoxInfoItem](
int nResult){
959 aNewSet.
Put(aBoxItem);
963 aNewSet.
Put(aBoxInfoItem);
968 if( aNewBoxItem.GetDistance( SvxBoxItemLine::LEFT ) != aBoxItem.GetDistance( SvxBoxItemLine::LEFT ) )
971 if( aNewBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) != aBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) )
974 if( aNewBoxItem.GetDistance( SvxBoxItemLine::TOP ) != aBoxItem.GetDistance( SvxBoxItemLine::TOP ) )
977 if( aNewBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) != aBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) )
988 rSdrModel.BegUndo(
SvxResId(STR_TABLE_NUMFORMAT));
1002 xDlg->disposeOnce();
1008 const sal_uInt16 nSId = rReq.
GetSlot();
1011 case SID_TABLE_INSERT_ROW:
1012 case SID_TABLE_INSERT_COL:
1015 case SID_TABLE_DELETE_ROW:
1016 case SID_TABLE_DELETE_COL:
1017 case SID_TABLE_DELETE_TABLE:
1020 case SID_TABLE_SELECT_ALL:
1021 case SID_TABLE_SELECT_COL:
1022 case SID_TABLE_SELECT_ROW:
1025 case SID_FORMAT_TABLE_DLG:
1029 case SID_FRAME_LINESTYLE:
1030 case SID_FRAME_LINECOLOR:
1031 case SID_ATTR_BORDER:
1039 case SID_ATTR_FILL_STYLE:
1047 case SID_TABLE_MERGE_CELLS:
1051 case SID_TABLE_SPLIT_CELLS:
1055 case SID_TABLE_MINIMAL_COLUMN_WIDTH:
1059 case SID_TABLE_OPTIMAL_COLUMN_WIDTH:
1063 case SID_TABLE_DISTRIBUTE_COLUMNS:
1067 case SID_TABLE_MINIMAL_ROW_HEIGHT:
1071 case SID_TABLE_OPTIMAL_ROW_HEIGHT:
1075 case SID_TABLE_DISTRIBUTE_ROWS:
1079 case SID_TABLE_VERT_BOTTOM:
1080 case SID_TABLE_VERT_CENTER:
1081 case SID_TABLE_VERT_NONE:
1085 case SID_AUTOFORMAT:
1086 case SID_TABLE_SORT_DIALOG:
1087 case SID_TABLE_AUTOSUM:
1091 case SID_TABLE_STYLE:
1095 case SID_TABLE_STYLE_SETTINGS:
1098 case SID_TABLE_CHANGE_CURRENT_BORDER_POSITION:
1112 if(!pArgs || (SfxItemState::SET != pArgs->
GetItemState(SID_TABLE_STYLE,
false)))
1121 Reference< XStyleFamiliesSupplier > xSFS( rModel.getUnoModel(), UNO_QUERY_THROW );
1125 if( xTableFamilyAccess->hasByName( pArg->
GetValue() ) )
1128 Reference< XIndexAccess > xNewTableStyle( xTableFamilyAccess->getByName( pArg->
GetValue() ), UNO_QUERY_THROW );
1130 const bool bUndo = rModel.IsUndoEnabled();
1134 rModel.BegUndo(
SvxResId(STR_TABLE_STYLE));
1135 rModel.AddUndo(std::make_unique<TableStyleUndo>(rTableObj));
1140 const sal_Int32 nRowCount =
mxTable->getRowCount();
1141 const sal_Int32 nColCount =
mxTable->getColumnCount();
1142 for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
1144 for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ )
try
1146 CellRef xCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
1150 bool bChanges =
false;
1152 SAL_WARN_IF(!pStyleSheet,
"svx",
"no stylesheet for table cell?");
1159 if( (rStyleAttribs.
GetItemState( nWhich ) == SfxItemState::SET) && (aSet.GetItemState( nWhich ) == SfxItemState::SET) )
1172 xCell->SetMergedItemSetAndBroadcast( aSet,
true );
1203 if( SfxItemState::SET == pArgs->
GetItemState(ID_VAL_USEFIRSTROWSTYLE,
false,&pPoolItem) )
1204 aSettings.mbUseFirstRow = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
1206 if( SfxItemState::SET == pArgs->
GetItemState(ID_VAL_USELASTROWSTYLE,
false,&pPoolItem) )
1207 aSettings.mbUseLastRow = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
1209 if( SfxItemState::SET == pArgs->
GetItemState(ID_VAL_USEBANDINGROWSTYLE,
false,&pPoolItem) )
1210 aSettings.mbUseRowBanding = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
1212 if( SfxItemState::SET == pArgs->
GetItemState(ID_VAL_USEFIRSTCOLUMNSTYLE,
false,&pPoolItem) )
1213 aSettings.mbUseFirstColumn = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
1215 if( SfxItemState::SET == pArgs->
GetItemState(ID_VAL_USELASTCOLUMNSTYLE,
false,&pPoolItem) )
1216 aSettings.mbUseLastColumn = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
1218 if( SfxItemState::SET == pArgs->
GetItemState(ID_VAL_USEBANDINGCOLUMNSTYLE,
false,&pPoolItem) )
1219 aSettings.mbUseColumnBanding = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
1224 const bool bUndo(rModel.IsUndoEnabled());
1228 rModel.BegUndo(
SvxResId(STR_TABLE_STYLE_SETTINGS) );
1229 rModel.AddUndo(std::make_unique<TableStyleUndo>(rTableObj));
1247 const bool bUndo(rModel.IsUndoEnabled());
1251 rModel.BegUndo(
SvxResId(STR_TABLE_NUMFORMAT));
1252 rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoAttrObject(rTableObj));
1262 case SID_TABLE_VERT_BOTTOM:
1265 case SID_TABLE_VERT_CENTER:
1275 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
1277 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
1279 CellRef xCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
1286 xCell->SetMergedItemSetAndBroadcast(aSet,
false);
1328 Reference< XMergeableCellRange > xRange(
mxTable->createCursorByRange(
mxTable->getCellRangeByPosition( aStart.
mnCol, aStart.
mnRow, aEnd.
mnCol, aEnd.
mnRow ) ), UNO_QUERY_THROW );
1329 const sal_Int32 nRowCount =
mxTable->getRowCount();
1330 const sal_Int32 nColCount =
mxTable->getColumnCount();
1338 const bool bUndo(rModel.IsUndoEnabled());
1343 rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoGeoObject(rTableObj));
1348 xRange->split( 0, nCount );
1352 xRange->split( nCount, 0 );
1374 const bool bUndo(rModel.IsUndoEnabled());
1379 rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoGeoObject(rTableObj));
1397 const bool bUndo(rModel.IsUndoEnabled());
1402 rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoGeoObject(rTableObj));
1425 const bool bUndo(rModel.IsUndoEnabled());
1432 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
1434 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
1436 CellRef xCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
1437 if (xCell.is() && xCell->hasText())
1441 xCell->SetOutlinerParaObject(
nullptr);
1457 rpStyleSheet =
nullptr;
1467 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
1469 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
1471 CellRef xCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
1479 else if(pRet != pSS)
1487 rpStyleSheet = pRet;
1503 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
1505 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
1507 CellRef xCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
1509 xCell->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
1529 if (!(pType && pIndex && pOffset))
1532 const OUString
sType = pType->GetValue();
1538 sal_Int32 nEdgeIndex = -1;
1539 bool bHorizontal = sType.startsWith(
"row");
1541 if (sType ==
"column-left" || sType ==
"row-left")
1545 else if (sType ==
"column-right")
1548 nEdgeIndex = rTableObj.getColumnCount();
1550 else if (sType ==
"row-right")
1553 nEdgeIndex = rTableObj.getRowCount();
1555 else if (sType ==
"column-middle" || sType ==
"row-middle")
1557 nEdgeIndex = nIndex + 1;
1564 SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
1565 const bool bUndo(rModel.IsUndoEnabled());
1569 rModel.BegUndo(pUndoObject->GetComment());
1571 auto* pGeoUndo =
static_cast<SdrUndoGeoObj*
>(pUndoObject.get());
1575 rModel.AddUndo(std::move(pUndoObject));
1578 if (rTableObj.GetUserCall())
1579 aBoundRect = rTableObj.GetLastBoundRect();
1580 rTableObj.changeEdge(bHorizontal, nEdgeIndex, nOffset);
1581 rTableObj.SetChanged();
1612 case awt::Key::ESCAPE:
1626 case awt::Key::RETURN:
1628 if( !bMod1 && !bMod2 && !bTextEdit )
1638 if( bMod1 || bMod2 )
1641 else if( bTextEdit )
1659 case awt::Key::HOME:
1660 case awt::Key::NUM7:
1664 if( bMod1 && !bMod2 )
1669 else if( !bMod1 && bMod2 )
1678 case awt::Key::NUM1:
1682 if( bMod1 && !bMod2 )
1687 else if( !bMod1 && bMod2 )
1704 case awt::Key::NUM8:
1705 case awt::Key::DOWN:
1706 case awt::Key::NUM2:
1707 case awt::Key::LEFT:
1708 case awt::Key::NUM4:
1709 case awt::Key::RIGHT:
1710 case awt::Key::NUM6:
1713 if( !bMod1 && bMod2 )
1717 if( (nCode == awt::Key::UP) || (nCode == awt::Key::NUM8) )
1722 else if( (nCode == awt::Key::DOWN) || (nCode == awt::Key::NUM2) )
1730 bool bTextMove =
false;
1750 case awt::Key::LEFT:
1751 case awt::Key::NUM4:
1754 case awt::Key::RIGHT:
1755 case awt::Key::NUM6:
1758 case awt::Key::DOWN:
1759 case awt::Key::NUM2:
1763 case awt::Key::NUM8:
1770 case awt::Key::PAGEUP:
1775 case awt::Key::PAGEDOWN:
1818 gotoCell( aPos, bSelect, pWindow, nAction );
1825 gotoCell( aPos, bSelect, pWindow, nAction );
1832 gotoCell( aPos, bSelect, pWindow, nAction );
1851 gotoCell( aPos, bSelect, pWindow, nAction );
1875 if( aSelectionEnd == aNextCell )
1878 aNextCell = pTableObj->
getNextCell( aSelectionEnd,
true );
1880 gotoCell( aNextCell,
false, pWindow, nAction );
1915 EditCell( rPos, pWindow, nAction );
1947 Reference< XMergeableCellRange > xRange(
mxTable->createCursorByRange(
mxTable->getCellRangeByPosition( nFirstCol, nFirstRow,nLastCol, nLastRow ) ), UNO_QUERY_THROW );
1949 if( xRange->isMergeable() )
1953 const bool bUndo(rModel.IsUndoEnabled());
1958 rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoGeoObject(rTableObj));
2003 Reference< XMergeableCell > xCell(
mxTable->getCellByPosition( rPos.
mnCol, rPos.
mnRow ), UNO_QUERY_THROW );
2004 if( xCell->isMerged() )
2028 bool bEmptyOutliner =
false;
2036 if(nParaCnt==1 && p1stPara)
2039 if (pOutl->
GetText(p1stPara).isEmpty())
2041 bEmptyOutliner =
true;
2059 std::unique_ptr<SdrOutliner> pOutl(
SdrMakeOutliner(OutlinerMode::OutlineObject, rModel));
2062 pOutl->SetVertical(
true );
2114 for( sal_Int32 nRow = rFirst.
mnRow; nRow <= rLast.
mnRow && !bExt; nRow++ )
2116 for( sal_Int32 nCol = rFirst.
mnCol; nCol <= rLast.
mnCol && !bExt; nCol++ )
2118 Reference< XMergeableCell > xCell(
mxTable->getCellByPosition( nCol, nRow ), UNO_QUERY );
2122 if( xCell->isMerged() )
2135 if( ((nCol + xCell->getColumnSpan() - 1) > rLast.
mnCol) || (nRow + xCell->getRowSpan() - 1 ) > rLast.
mnRow )
2137 rLast.
mnCol = std::max( rLast.
mnCol, nCol + xCell->getColumnSpan() - 1 );
2138 rLast.
mnRow = std::max( rLast.
mnRow, nRow + xCell->getRowSpan() - 1 );
2155 Reference< XMergeableCell > xCell(
mxTable->getCellByPosition( rLast.
mnCol, rLast.
mnRow ), UNO_QUERY );
2158 rLast.
mnCol += xCell->getColumnSpan() - 1;
2159 rLast.
mnRow += xCell->getRowSpan() - 1;
2224 for (sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++)
2226 for (sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++)
2228 CellRef xCell(dynamic_cast< Cell* >(
mxTable->getCellByPosition(nCol, nRow).get()));
2231 if (rModel.IsUndoEnabled())
2237 xCell->SetMergedItemSetAndBroadcast(aCellSet,
false);
2267 if( (aPos2.mnCol >= 0) && (aPos2.mnRow >= 0) )
2322 aRanges.push_back( a2DRange );
2336 if( xOverlayManager.is() )
2340 xOverlayManager->add(*pOverlay);
2358 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, aSelection.toString().getStr());
2359 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.toString().getStr());
2376 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA,
"EMPTY");
2377 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START,
"EMPTY");
2378 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END,
"EMPTY");
2379 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION,
"EMPTY");
2393 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
2395 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
2397 CellRef xCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
2398 if( xCell.is() && !xCell->isMerged() )
2400 const SfxItemSet& rSet = xCell->GetItemSet();
2407 if(SfxItemState::DONTCARE == rSet.
GetItemState(nWhich,
false))
2412 else if(SfxItemState::SET == rSet.
GetItemState(nWhich,
false))
2430 const SvxBorderLine* pOld = rNewFrame.
GetLine(nLine);
2433 SvxBorderLine aNewLine( *pNew );
2434 aNewLine.SetColor( pOld->GetColor() );
2435 rNewFrame.
SetLine( &aNewLine, nLine );
2439 rNewFrame.
SetLine( pNew, nLine );
2445 if (nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After|CellPosFlag::Upper|CellPosFlag::Lower))
2449 if (!(nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After)))
2451 if (nCellPosFlags & CellPosFlag::Upper)
2453 if( pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::TOP) )
2454 rNewFrame.
SetLine(
nullptr, SvxBoxItemLine::BOTTOM );
2456 else if (nCellPosFlags & CellPosFlag::Lower)
2458 if( pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::BOTTOM) )
2459 rNewFrame.
SetLine(
nullptr, SvxBoxItemLine::TOP );
2462 else if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Lower)))
2464 if (nCellPosFlags & CellPosFlag::Before)
2466 if( pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::LEFT) )
2467 rNewFrame.
SetLine(
nullptr, SvxBoxItemLine::RIGHT );
2469 else if (nCellPosFlags & CellPosFlag::After)
2471 if( pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::RIGHT) )
2472 rNewFrame.
SetLine(
nullptr, SvxBoxItemLine::LEFT );
2480 if ((nCellPosFlags & CellPosFlag::Left) ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::LEFT)
2481 : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::VERT))
2482 rNewFrame.
SetLine( (nCellPosFlags & CellPosFlag::Left) ? pBoxItem->
GetLeft() : pBoxInfoItem->
GetVert(), SvxBoxItemLine::LEFT );
2484 if( (nCellPosFlags & CellPosFlag::Right) ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::RIGHT) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::VERT) )
2485 rNewFrame.
SetLine( (nCellPosFlags & CellPosFlag::Right) ? pBoxItem->
GetRight() : pBoxInfoItem->
GetVert(), SvxBoxItemLine::RIGHT );
2487 if( (nCellPosFlags & CellPosFlag::Top) ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::TOP) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::HORI) )
2488 rNewFrame.
SetLine( (nCellPosFlags & CellPosFlag::Top) ? pBoxItem->
GetTop() : pBoxInfoItem->
GetHori(), SvxBoxItemLine::TOP );
2490 if( (nCellPosFlags & CellPosFlag::Bottom) ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::BOTTOM) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::HORI) )
2491 rNewFrame.
SetLine( (nCellPosFlags & CellPosFlag::Bottom) ? pBoxItem->
GetBottom() : pBoxInfoItem->
GetHori(), SvxBoxItemLine::BOTTOM );
2494 if( pBoxInfoItem->
IsValid( SvxBoxInfoItemValidFlags::DISTANCE ) )
2503 const SvxBorderLine* pSourceLine = rNewFrame.
GetLine( nLine );
2506 SvxBorderLine aLine( *pSourceLine );
2507 aLine.SetColor( rColor );
2508 rNewFrame.
SetLine( &aLine, nLine );
2517 if (!(nCellPosFlags & (CellPosFlag::Lower|CellPosFlag::Before|CellPosFlag::After)))
2520 if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Before|CellPosFlag::After)))
2523 if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Lower|CellPosFlag::After)))
2526 if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Lower|CellPosFlag::Before)))
2533 if (nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After|CellPosFlag::Upper|CellPosFlag::Lower))
2535 if (!(nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After)))
2537 if (nCellPosFlags & CellPosFlag::Upper)
2542 else if (nCellPosFlags & CellPosFlag::Lower)
2548 else if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Lower)))
2550 if (nCellPosFlags & CellPosFlag::Before)
2555 else if (nCellPosFlags & CellPosFlag::After)
2581 const sal_Int32 nRowCount =
mxTable->getRowCount();
2582 const sal_Int32 nColCount =
mxTable->getColumnCount();
2583 if( !(nRowCount && nColCount) )
2595 if(SfxItemState::SET == rAttr.
GetItemState(SID_FRAME_LINECOLOR,
false) )
2596 pLineColorItem = &rAttr.
Get( SID_FRAME_LINECOLOR );
2598 const SvxBorderLine* pBorderLineItem =
nullptr;
2599 if(SfxItemState::SET == rAttr.
GetItemState(SID_FRAME_LINESTYLE,
false) )
2600 pBorderLineItem = rAttr.
Get( SID_FRAME_LINESTYLE ).GetLine();
2602 if( pBoxInfoItem && !pBoxItem )
2605 pBoxItem = &gaEmptyBoxItem;
2607 else if( pBoxItem && !pBoxInfoItem )
2610 pBoxInfoItem = &gaEmptyBoxInfoItem;
2616 const sal_Int32 nLastRow = std::min( aEnd.
mnRow + 2, nRowCount );
2617 const sal_Int32 nLastCol = std::min( aEnd.
mnCol + 2, nColCount );
2619 for( sal_Int32 nRow = std::max( aStart.
mnRow - 1, sal_Int32(0) ); nRow < nLastRow; nRow++ )
2627 for( sal_Int32 nCol = std::max( aStart.
mnCol - 1, sal_Int32(0) ); nCol < nLastCol; nCol++ )
2629 CellRef xCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
2633 const SfxItemSet& rSet = xCell->GetItemSet();
2644 if( pBoxItem && pBoxInfoItem )
2647 if( pLineColorItem )
2650 if( pBorderLineItem )
2653 if (aNewFrame != *pOldOuter)
2656 aAttr.Put(aNewFrame);
2657 xCell->SetMergedItemSetAndBroadcast( aAttr,
false );
2683 const bool bUndo(rModel.IsUndoEnabled());
2702 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
2704 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
2706 CellRef xCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
2711 xCell->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
2749 if(pTextEditOutlinerView)
2780 if(
nullptr == pCurrentSdrTableObj)
2797 if(aStart != aFullStart || aEnd != aFullEnd)
2814 if( pPastePage && pPastePage->
GetObjCount() == 1 )
2817 if( pPasteTableObj )
2830 if( !pPasteTableObj )
2833 Reference< XTable > xPasteTable( pPasteTableObj->
getTable() );
2834 if( !xPasteTable.is() )
2840 sal_Int32 nPasteColumns = xPasteTable->getColumnCount();
2841 sal_Int32 nPasteRows = xPasteTable->getRowCount();
2849 sal_Int32 nColumns =
mxTable->getColumnCount();
2850 sal_Int32 nRows =
mxTable->getRowCount();
2852 const sal_Int32 nMissing = nPasteRows - ( nRows - aStart.
mnRow );
2855 Reference< XTableRows > xRows(
mxTable->getRows() );
2856 xRows->insertByIndex( nRows, nMissing );
2857 nRows =
mxTable->getRowCount();
2860 nPasteRows = std::min( nPasteRows, nRows - aStart.
mnRow );
2861 nPasteColumns = std::min( nPasteColumns, nColumns - aStart.
mnCol );
2864 for( sal_Int32 nRow = 0; nRow < nPasteRows; ++nRow )
2866 for( sal_Int32 nCol = 0, nTargetCol = aStart.
mnCol; nCol < nPasteColumns; ++nCol )
2868 CellRef xTargetCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nTargetCol, aStart.
mnRow + nRow ).get() ) );
2869 if( xTargetCell.is() && !xTargetCell->isMerged() )
2871 CellRef xSourceCell(dynamic_cast<Cell*>(xPasteTable->getCellByPosition(nCol, nRow).get()));
2872 if (xSourceCell.is())
2874 xTargetCell->AddUndo();
2876 if (nColumns < nTargetCol + xSourceCell->getColumnSpan())
2877 xTargetCell->replaceContentAndFormatting(xSourceCell);
2879 xTargetCell->cloneFrom(xSourceCell);
2881 nCol += xSourceCell->getColumnSpan() - 1;
2882 nTargetCol += xTargetCell->getColumnSpan();
2905 const bool bUndo(rModel.IsUndoEnabled());
2914 for( sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++ )
2916 for( sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++ )
2918 CellRef xCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
2945 mnUpdateEvent =
nullptr;
2947 if( mbCellSelectionMode )
2949 CellPos aStart( maCursorFirstPos );
2950 CellPos aEnd( maCursorLastPos );
2953 if( aStart != maCursorFirstPos || aEnd != maCursorLastPos )
2955 setSelectedCells( aStart, aEnd );
2959 updateSelectionOverlay();
2960 mbHasJustMerged =
false;
2992 class BoxItemWrapper
2997 const SvxBorderLine* getLine()
const;
2998 void setLine(
const SvxBorderLine* pLine);
3008 BoxItemWrapper::BoxItemWrapper(
3019 const SvxBorderLine* BoxItemWrapper::getLine()
const
3027 void BoxItemWrapper::setLine(
const SvxBorderLine* pLine)
3035 void lcl_MergeBorderLine(
3036 LinesState& rLinesState,
const SvxBorderLine*
const pLine,
const SvxBoxItemLine nLine,
3039 const SvxBoxInfoItemLine nInnerLine(bBorder ? SvxBoxInfoItemLine::HORI : ((nValidFlag & SvxBoxInfoItemValidFlags::HORI) ? SvxBoxInfoItemLine::HORI : SvxBoxInfoItemLine::VERT));
3040 BoxItemWrapper aBoxItem(rLinesState.rBoxItem, rLinesState.rBoxInfoItem, nLine, nInnerLine, bBorder);
3041 bool& rbSet(bBorder ? rLinesState.aBorderSet[nLine] : rLinesState.aInnerLineSet[nInnerLine]);
3045 bool& rbIndeterminate(bBorder ? rLinesState.aBorderIndeterminate[nLine] : rLinesState.aInnerLineIndeterminate[nInnerLine]);
3046 if (!rbIndeterminate)
3048 const SvxBorderLine*
const pMergedLine(aBoxItem.getLine());
3049 if ((pLine && !pMergedLine) || (!pLine && pMergedLine) || (pLine && (*pLine != *pMergedLine)))
3051 aBoxItem.setLine(
nullptr);
3052 rbIndeterminate =
true;
3058 aBoxItem.setLine(pLine);
3063 void lcl_MergeBorderOrInnerLine(
3064 LinesState& rLinesState,
const SvxBorderLine*
const pLine,
const SvxBoxItemLine nLine,
3068 lcl_MergeBorderLine(rLinesState, pLine, nLine, nValidFlag);
3071 const bool bVertical = (nLine == SvxBoxItemLine::LEFT) || (nLine == SvxBoxItemLine::RIGHT);
3072 lcl_MergeBorderLine(rLinesState, pLine, nLine, bVertical ? SvxBoxInfoItemValidFlags::VERT : SvxBoxInfoItemValidFlags::HORI,
false);
3076 void lcl_MergeDistance(
3077 LinesState& rLinesState,
const SvxBoxItemLine nIndex,
const sal_uInt16 nDistance)
3079 if (rLinesState.aDistanceSet[nIndex])
3081 if (!rLinesState.bDistanceIndeterminate)
3082 rLinesState.bDistanceIndeterminate = nDistance != rLinesState.aDistance[nIndex];
3086 rLinesState.aDistance[nIndex] = nDistance;
3087 rLinesState.aDistanceSet[nIndex] =
true;
3091 void lcl_MergeCommonBorderAttr(LinesState& rLinesState,
const SvxBoxItem& rCellBoxItem,
const CellPosFlag nCellPosFlags)
3093 if (nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After|CellPosFlag::Upper|CellPosFlag::Lower))
3097 if (!(nCellPosFlags & (CellPosFlag::Before|CellPosFlag::After)))
3099 if (nCellPosFlags & CellPosFlag::Upper)
3100 lcl_MergeBorderLine(rLinesState, rCellBoxItem.
GetBottom(), SvxBoxItemLine::TOP, SvxBoxInfoItemValidFlags::TOP);
3101 else if (nCellPosFlags & CellPosFlag::Lower)
3102 lcl_MergeBorderLine(rLinesState, rCellBoxItem.
GetTop(), SvxBoxItemLine::BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM);
3104 else if (!(nCellPosFlags & (CellPosFlag::Upper|CellPosFlag::Lower)))
3106 if (nCellPosFlags & CellPosFlag::Before)
3107 lcl_MergeBorderLine(rLinesState, rCellBoxItem.
GetRight(), SvxBoxItemLine::LEFT, SvxBoxInfoItemValidFlags::LEFT);
3108 else if (nCellPosFlags & CellPosFlag::After)
3109 lcl_MergeBorderLine(rLinesState, rCellBoxItem.
GetLeft(), SvxBoxItemLine::RIGHT, SvxBoxInfoItemValidFlags::RIGHT);
3119 lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.
GetTop(), SvxBoxItemLine::TOP, SvxBoxInfoItemValidFlags::TOP,
static_cast<bool>(nCellPosFlags & CellPosFlag::Top));
3120 lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.
GetBottom(), SvxBoxItemLine::BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM,
static_cast<bool>(nCellPosFlags & CellPosFlag::Bottom));
3121 lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.
GetLeft(), SvxBoxItemLine::LEFT, SvxBoxInfoItemValidFlags::LEFT,
static_cast<bool>(nCellPosFlags & CellPosFlag::Left));
3122 lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.
GetRight(), SvxBoxItemLine::RIGHT, SvxBoxInfoItemValidFlags::RIGHT,
static_cast<bool>(nCellPosFlags & CellPosFlag::Right));
3124 lcl_MergeDistance(rLinesState, SvxBoxItemLine::TOP, rCellBoxItem.
GetDistance(SvxBoxItemLine::TOP));
3125 lcl_MergeDistance(rLinesState, SvxBoxItemLine::BOTTOM, rCellBoxItem.
GetDistance(SvxBoxItemLine::BOTTOM));
3126 lcl_MergeDistance(rLinesState, SvxBoxItemLine::LEFT, rCellBoxItem.
GetDistance(SvxBoxItemLine::LEFT));
3127 lcl_MergeDistance(rLinesState, SvxBoxItemLine::RIGHT, rCellBoxItem.
GetDistance(SvxBoxItemLine::RIGHT));
3138 const sal_Int32 nRowCount =
mxTable->getRowCount();
3139 const sal_Int32 nColCount =
mxTable->getColumnCount();
3140 if( !(nRowCount && nColCount) )
3148 const sal_Int32 nLastRow = std::min( aEnd.
mnRow + 2, nRowCount );
3149 const sal_Int32 nLastCol = std::min( aEnd.
mnCol + 2, nColCount );
3151 rBoxInfoItem.
SetValid( SvxBoxInfoItemValidFlags::ALL,
false );
3152 LinesState aLinesState( rBoxItem, rBoxInfoItem );
3163 for( sal_Int32 nRow = std::max( aStart.
mnRow - 1, sal_Int32(0) ); nRow < nLastRow; nRow++ )
3171 for( sal_Int32 nCol = std::max( aStart.
mnCol - 1, sal_Int32(0) ); nCol < nLastCol; nCol++ )
3173 CellRef xCell( dynamic_cast< Cell* >(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
3183 const SfxItemSet& rSet = xCell->GetItemSet();
3184 SvxBoxItem aCellBoxItem(mergeDrawinglayerTextDistancesAndSvxBoxItem(rSet));
3185 lcl_MergeCommonBorderAttr( aLinesState, aCellBoxItem, nCellPosFlags );
3189 if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::TOP])
3190 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::TOP);
3191 if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::BOTTOM])
3192 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::BOTTOM);
3193 if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::LEFT])
3194 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::LEFT);
3195 if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::RIGHT])
3196 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::RIGHT);
3197 if (!aLinesState.aInnerLineIndeterminate[SvxBoxInfoItemLine::HORI])
3198 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::HORI);
3199 if (!aLinesState.aInnerLineIndeterminate[SvxBoxInfoItemLine::VERT])
3200 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::VERT);
3202 if (!aLinesState.bDistanceIndeterminate)
3204 if (aLinesState.aDistanceSet[SvxBoxItemLine::TOP])
3205 aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::TOP], SvxBoxItemLine::TOP);
3206 if (aLinesState.aDistanceSet[SvxBoxItemLine::BOTTOM])
3207 aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::BOTTOM], SvxBoxItemLine::BOTTOM);
3208 if (aLinesState.aDistanceSet[SvxBoxItemLine::LEFT])
3209 aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::LEFT], SvxBoxItemLine::LEFT);
3210 if (aLinesState.aDistanceSet[SvxBoxItemLine::RIGHT])
3211 aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::RIGHT], SvxBoxItemLine::RIGHT);
3212 aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::DISTANCE);
3220 CellPos aStart( 0, row ), aEnd(
mxTable->getColumnCount() - 1, row );
3230 CellPos aStart( column, 0 ), aEnd( column,
mxTable->getRowCount() - 1 );
3240 CellPos aStart( 0, row ), aEnd(
mxTable->getColumnCount() - 1, row );
3242 gotoCell( aStart,
false,
nullptr );
3250 CellPos aStart( column, 0 ), aEnd( column,
mxTable->getRowCount() - 1 );
3252 gotoCell( aStart,
false,
nullptr );
3262 if( (aFirstPos.
mnCol == 0) && (nRow >= aFirstPos.
mnRow && nRow <= aLastPos.
mnRow) && (
mxTable->getColumnCount() - 1 == aLastPos.
mnCol) )
3274 if( (aFirstPos.
mnRow == 0) && (nColumn >= aFirstPos.
mnCol && nColumn <= aLastPos.
mnCol) && (
mxTable->getRowCount() - 1 == aLastPos.
mnRow) )
#define LINK(Instance, Class, Member)
SdrMetricItem makeSdrTextUpperDistItem(tools::Long mnHeight)
IMPL_LINK_NOARG(SvxTableController, UpdateHdl, void *, void)
void expand(const B2DTuple &rTuple)
CellPos getRightCell(const CellPos &rPos, bool bEdgeTravel) const
virtual OutlinerParaObject * GetOutlinerParaObject() const override
virtual SVX_DLLPRIVATE ~SvxTableController() override
constexpr sal_uInt16 SDRATTR_SHADOW_FIRST(XATTR_END+1)
size_t GetMarkCount() const
o3tl::enumarray< SvxBoxInfoItemLine, bool > aInnerLineSet
SVX_DLLPRIVATE void destroySelectionOverlay()
css::uno::Reference< css::table::XTable > getTable() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
void setTableStyle(const css::uno::Reference< css::container::XIndexAccess > &xAutoFormatStyle)
CellPos getUpCell(const CellPos &rPos, bool bEdgeTravel) const
rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const
void SetSkipChangeLayout(bool bOn)
virtual const SfxItemSet * GetOutputItemSet() const =0
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
SVX_DLLPRIVATE void RemoveSelection()
static void ImplApplyLineColorItem(CellPosFlag nCellPosFlags, const SvxColorItem *pLineColorItem, SvxBoxItem &rNewFrame)
SVX_DLLPRIVATE void findMergeOrigin(CellPos &rPos)
SVX_DLLPRIVATE void onDelete(sal_uInt16 nSId)
SdrTextObj * GetTextEditObject() const
static SvxAbstractDialogFactory * Create()
SVX_DLLPRIVATE bool HasMarked() const
bool deselectRow(sal_Int32 row)
const StyleSettings & GetStyleSettings() const
void MergeValue(const SfxPoolItem &rItem, bool bOverwriteDefaults=false)
const editeng::SvxBorderLine * GetVert() const
css::uno::Reference< css::util::XModifyListener > mxModifyListener
#define EE_INDEX_NOT_FOUND
rtl::Reference< sdr::SelectionController > CreateTableController(SdrView &rView, const SdrTableObj &rObj, const rtl::Reference< sdr::SelectionController > &xRefController)
SvxTableController * mpController
SvxBoxInfoItem & rBoxInfoItem
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
sal_uInt16 GetValue() const
void InvalidateItem(sal_uInt16 nWhich)
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
void CropTableModelToSelection(const CellPos &rStart, const CellPos &rEnd)
virtual VclPtr< SfxAbstractTabDialog > CreateSvxFormatCellsDialog(weld::Window *pParent, const SfxItemSet *pAttr, const SdrModel &rModel)=0
SVX_DLLPRIVATE void StartSelection(const CellPos &rPos)
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
const MapMode & GetMapMode() const
sal_uInt16 GetCode() const
void SetAttrToSelectedShape(const SfxItemSet &rAttr)
Changing the geometry of an object.
SdrMark * GetMark(size_t nNum) const
sal_Int32 GetParagraphCount() const
void ChangeFontSize(bool bGrow, const FontList *pList)
virtual SVX_DLLPRIVATE bool hasSelectedCells() const override
This is a table object, and one or more of its cells are selected.
static void ImplApplyBorderLineItem(CellPosFlag nCellPosFlags, const SvxBorderLine *pBorderLineItem, SvxBoxItem &rNewFrame)
bool bDistanceIndeterminate
virtual SfxItemSet & GetItemSet()
SdrMetricItem makeSdrTextRightDistItem(tools::Long mnHeight)
SdrHitKind PickAnything(const MouseEvent &rMEvt, SdrMouseEventKind nMouseDownOrMoveOrUp, SdrViewEvent &rVEvt) const
SdrMetricItem makeSdrTextLowerDistItem(tools::Long mnHeight)
const SfxItemSet * GetArgs() const
virtual SVX_DLLPRIVATE bool GetStyleSheet(SfxStyleSheet *&rpStyleSheet) const override
const editeng::SvxBorderLine * GetRight() const
SfxStyleFamily GetFamily() const
o3tl::enumarray< SvxBoxInfoItemLine, bool > aInnerLineIndeterminate
SVX_DLLPRIVATE void changeTableEdge(const SfxRequest &rReq)
CellPos getLeftCell(const CellPos &rPos, bool bEdgeTravel) const
static void ImplSetLineColor(SvxBoxItem &rNewFrame, SvxBoxItemLine nLine, const Color &rColor)
virtual void MarkListHasChanged() override
bool deselectColumn(sal_Int32 column)
constexpr sal_uInt16 SDRATTR_START(XATTR_START)
const Color & GetHighlightColor() const
SVX_DLLPRIVATE void DistributeColumns(const bool bOptimize, const bool bMinimize)
ImplSVEvent * mnUpdateEvent
virtual bool IsHorizontal() const =0
constexpr auto convertTwipToMm100(N n)
tools::WeakReference< SdrTableObj > mxTableObj
#define EE_PARA_NOT_FOUND
::std::vector< basegfx::B2DRange > RangeVector
sal_uInt16 GetClicks() const
SVX_DLLPRIVATE bool PasteObject(SdrTableObj const *pPasteTableObj)
void SetAttrToMarked(const SfxItemSet &rAttr, bool bReplaceAll)
sdr::table::SdrTableObj * GetTableObj()
SVX_DLLPRIVATE void setSelectionStart(const CellPos &rPos)
ESelection aNewSelection(GetSelection())
SdrPage * getSdrPageFromSdrObject() const
virtual SVX_DLLPRIVATE bool onMouseMove(const MouseEvent &rMEvt, vcl::Window *pWin) override
OUString SvxResId(const char *pId)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
static void ImplSetLinePreserveColor(SvxBoxItem &rNewFrame, const SvxBorderLine *pNew, SvxBoxItemLine nLine)
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.
o3tl::enumarray< SvxBoxItemLine, bool > aBorderIndeterminate
static SfxViewShell * Current()
SVX_DLLPRIVATE void UpdateSelection(const CellPos &rPos)
void DistributeColumns(sal_Int32 nFirstColumn, sal_Int32 nLastColumn, const bool bOptimize, const bool bMinimize)
void SetEditMode(SdrViewEditMode eMode)
const sdr::table::TableStyleSettings & getTableStyleSettings() const
const editeng::SvxBorderLine * GetLine(SvxBoxItemLine nLine) const
CellPos getPreviousCell(const CellPos &rPos, bool bEdgeTravel) const
OutputDevice * GetFirstOutputDevice() const
void DistributeRows(sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize, const bool bMinimize)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LOWERDIST(SDRATTR_MISC_FIRST+7)
void getActiveCellPos(sdr::table::CellPos &rPos) const
bool selectColumn(sal_Int32 column)
sal_uInt32 PaintWindowCount() const
o3tl::enumarray< SvxBoxItemLine, bool > aDistanceSet
constexpr TypedWhichId< SvxBoxInfoItem > SDRATTR_TABLE_BORDER_INNER(SDRATTR_TABLE_FIRST+1)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
SdrObject * GetMarkedSdrObj() const
const editeng::SvxBorderLine * GetHori() const
const editeng::SvxBorderLine * GetTop() const
SVX_DLLPRIVATE TblAction getKeyboardAction(const KeyEvent &rKEvt)
const SvxBoxItemLine m_nBorderLine
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SdrOutliner * GetTextEditOutliner() const
#define TOOLS_WARN_EXCEPTION(area, stream)
const editeng::SvxBorderLine * GetLeft() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SVX_DLLPRIVATE void DistributeRows(const bool bOptimize, const bool bMinimize)
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
TableHitKind
SdrTableHitKind.
SVX_DLLPRIVATE void gotoCell(const CellPos &rCell, bool bSelect, vcl::Window *pWindow, TblAction nAction=TblAction::NONE)
SVX_DLLPRIVATE void onFormatTable(const SfxRequest &rReq)
virtual SVX_DLLPRIVATE bool PasteObjModel(const SdrModel &rModel) override
rtl::Reference< TableModel > mxTable
bool isRowSelected(sal_Int32 nRow)
std::unique_ptr< sdr::overlay::OverlayObjectList > mpSelectionOverlay
void setSelectedCells(const CellPos &rFirstPos, const CellPos &rLastPos)
void BroadcastObjectChange() const
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
const OUString & GetValue() const
const SdrMarkList & GetMarkedObjectList() const
CellPos getLastCell() const
const T * GetArg(sal_uInt16 nSlotId) const
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LEFTDIST(SDRATTR_MISC_FIRST+4)
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
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 SdrPage * GetPage(sal_uInt16 nPgNum) const
void ActionChanged() const
virtual SVX_DLLPRIVATE bool DeleteMarked() override
SdrHdl * PickHandle(const Point &rPnt) const
const SvxBoxInfoItemLine m_nInnerLine
SdrModel & getSdrModelFromSdrObject() const
void SetCurrentObj(SdrObjKind nIdent, SdrInventor nInvent=SdrInventor::Default)
SVX_DLLPRIVATE void SplitMarkedCells(const SfxRequest &rReq)
virtual bool ChangeFontSize(bool bGrow, const FontList *pFontList) override
Changes the font (grow/shrink) according to the input parameters.
SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet &rAttr, bool bReplaceAll)
const OutlinerView * GetTextEditOutlinerView() const
SVX_DLLPRIVATE void SetTableStyle(const SfxItemSet *pArgs)
SVX_DLLPRIVATE const CellPos & getSelectionEnd()
OUString GetText(Paragraph const *pPara, sal_Int32 nParaCount=1) const
const AllSettings & GetSettings() const
MapUnit GetMapUnit() const
void SetDistance(sal_uInt16 nNew, SvxBoxItemLine nLine)
bool setPropertyValue(uno::Sequence< beans::PropertyValue > &aProp, const OUString &aName, const uno::Any &aValue)
SvxBoxInfoItem & m_rBoxInfoItem
virtual void Execute(SfxRequest &rReq) override
SVX_DLLPRIVATE void onInsert(sal_uInt16 nSId, const SfxItemSet *pArgs=nullptr)
bool StartExecuteAsync(const std::function< void(sal_Int32)> &rEndDialogFn)
SfxItemPool * GetPool() const
TableHitKind CheckTableHit(const Point &rPos, sal_Int32 &rnX, sal_Int32 &rnY, const sal_uInt16 aTol=0) const
SdrUndoFactory & GetSdrUndoFactory() const
returns the models undo factory.
SVX_DLLPRIVATE void EditCell(const CellPos &rPos, vcl::Window *pWindow, TblAction nAction)
virtual SVX_DLLPRIVATE bool onKeyInput(const KeyEvent &rKEvt, vcl::Window *pWin) override
CellPos getDownCell(const CellPos &rPos, bool bEdgeTravel) const
SVX_DLLPRIVATE void StopTextEdit()
virtual SdrTableObj * CloneSdrObject(SdrModel &rTargetModel) const override
SdrMetricItem makeSdrTextLeftDistItem(tools::Long mnHeight)
css::text::WritingMode GetWritingMode() const
Paragraph * GetParagraph(sal_Int32 nAbsPos) const
void setTableStyleSettings(const sdr::table::TableStyleSettings &rStyle)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_UPPERDIST(SDRATTR_MISC_FIRST+6)
SVX_DLLPRIVATE void MergeMarkedCells()
virtual std::unique_ptr< SdrUndoAction > CreateUndoGeoObject(SdrObject &rObject)
bool IsValid(SvxBoxInfoItemValidFlags nValid) const
SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet &rAttr, bool bOnlyHardAttr) const
Point PixelToLogic(const Point &rDevicePt) const
ESelection GetSelection() const
weld::Window * GetFrameWeld() const
virtual SVX_DLLPRIVATE bool setCursorLogicPosition(const Point &rPosition, bool bPoint) override
bool selectRow(sal_Int32 row)
static SVX_DLLPRIVATE rtl::Reference< sdr::SelectionController > create(SdrView &rView, const SdrTableObj &rObj, const rtl::Reference< sdr::SelectionController > &xRefController)
constexpr TypedWhichId< SvxBoxItem > SDRATTR_TABLE_BORDER(SDRATTR_TABLE_FIRST+0)
static CellPos getFirstCell()
virtual tools::Long GetCount() const =0
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr sal_uInt16 SDRATTR_SHADOW_LAST(SDRATTR_SHADOWBLUR)
const vcl::KeyCode & GetKeyCode() const
sal_uInt16 GetSlot() const
constexpr sal_uInt16 SDRATTR_TABLE_LAST(SDRATTR_TABLE_TEXT_ROTATION)
void SetSelection(const ESelection &)
bool IsTextEditActive() const
o3tl::enumarray< SvxBoxItemLine, bool > aBorderSet
virtual bool IsTextEdit() const final override
void DisableItem(sal_uInt16 nWhich)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_RIGHTDIST(SDRATTR_MISC_FIRST+5)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SVX_DLLPRIVATE void SetVertical(sal_uInt16 nSId)
#define SAL_WARN_IF(condition, area, stream)
virtual bool IsVerticalWriting() const override
const SfxItemSet & GetMergedItemSet() const
CellPos getNextCell(const CellPos &rPos, bool bEdgeTravel) const
std::unique_ptr< SdrOutliner > SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel &rModel)
Create an Outliner with the engine-global default settings on the heap.
bool PostKeyEvent(const KeyEvent &rKEvt, vcl::Window const *pFrameWin=nullptr)
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
SVX_DLLPRIVATE void ApplyBorderAttr(const SfxItemSet &rAttr)
virtual SVX_DLLPRIVATE SdrObject * GetMarkedSdrObjClone(SdrModel &rTargetModel) override
const Point & GetPosPixel() const
void setActiveCell(const sdr::table::CellPos &rPos)
SVX_DLLPRIVATE void SetTableStyleSettings(const SfxItemSet *pArgs)
SdrPageView * GetSdrPageView() const
virtual SVX_DLLPRIVATE void onSelectionHasChanged() override
const sal_uInt16 * GetRanges() const
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
void getSelectedCells(CellPos &rFirstPos, CellPos &rLastPos) override
bool isColumnSelected(sal_Int32 nColumn)
SVX_DLLPRIVATE bool executeAction(TblAction nAction, bool bSelect, vcl::Window *pWindow)
constexpr::Color COL_BLUE(0x00, 0x00, 0x80)
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
SVX_DLLPRIVATE void FillCommonBorderAttrFromSelectedCells(SvxBoxItem &rBox, SvxBoxInfoItem &rBoxInfo) const
Fill the values that are common for all selected cells.
o3tl::enumarray< SvxBoxItemLine, sal_uInt16 > aDistance
static void ImplApplyBoxItem(CellPosFlag nCellPosFlags, const SvxBoxItem *pBoxItem, const SvxBoxInfoItem *pBoxInfoItem, SvxBoxItem &rNewFrame)
SVX_DLLPRIVATE void UpdateTableShape()
SVX_DLLPRIVATE void onTableModified()
SVX_DLLPRIVATE void updateSelectionOverlay()
SVX_DLLPRIVATE void onSelect(sal_uInt16 nSId)
virtual SVX_DLLPRIVATE bool GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr) const override
virtual SVX_DLLPRIVATE bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll) override
virtual SVX_DLLPRIVATE bool SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr) override
const editeng::SvxBorderLine * GetBottom() const
virtual VclPtr< SvxAbstractSplitTableDialog > CreateSvxSplitTableDialog(weld::Window *pParent, bool bIsTableVertical, tools::Long nMaxVertical)=0
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
SVX_DLLPRIVATE void MergeRange(sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow)
virtual SVX_DLLPRIVATE bool onMouseButtonDown(const MouseEvent &rMEvt, vcl::Window *pWin) override
virtual SVX_DLLPRIVATE bool onMouseButtonUp(const MouseEvent &rMEvt, vcl::Window *pWin) override
SVX_DLLPRIVATE bool checkTableObject()
virtual SVX_DLLPRIVATE bool ApplyFormatPaintBrush(SfxItemSet &rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats) override
applies a format paint brush set from the current selection.
SVX_DLLPRIVATE SvxTableController(SdrView &rView, const SdrTableObj &rObj)
SVX_DLLPRIVATE const CellPos & getSelectionStart()
sal_uInt16 GetPageCount() const
const Color & GetValue() const
virtual SVX_DLLPRIVATE void GetState(SfxItemSet &rSet) override
void getCellBounds(const sdr::table::CellPos &rPos,::tools::Rectangle &rCellRect)
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
SVX_DLLPRIVATE void checkCell(CellPos &rPos)