21#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
22#include <com/sun/star/container/XNamed.hpp>
23#include <com/sun/star/container/XNameAccess.hpp>
24#include <com/sun/star/container/XIndexAccess.hpp>
28#include <com/sun/star/style/XStyle.hpp>
29#include <com/sun/star/beans/XPropertySet.hpp>
43#include <tablemodel.hxx>
49#include <svx/strings.hrc>
53#include <libxml/xmlwriter.h>
56#include <boost/property_tree/ptree.hpp>
60using ::com::sun::star::uno::Any;
61using ::com::sun::star::uno::Reference;
62using ::com::sun::star::uno::UNO_QUERY;
63using ::com::sun::star::uno::UNO_QUERY_THROW;
64using ::com::sun::star::uno::Exception;
65using ::com::sun::star::container::XIndexAccess;
66using ::com::sun::star::style::XStyle;
67using ::com::sun::star::table::XTableRows;
68using ::com::sun::star::table::XTableColumns;
69using ::com::sun::star::table::XTable;
71using ::com::sun::star::util::XModifyBroadcaster;
91 explicit TableProperties(
SdrObject& rObj );
94 TableProperties(
const TableProperties& rProps,
SdrObject& rObj );
97 std::unique_ptr<BaseProperties>
Clone(
SdrObject& rObj)
const override;
99 virtual void ItemChange(
const sal_uInt16 nWhich,
const SfxPoolItem* pNewItem =
nullptr)
override;
104TableProperties::TableProperties(
SdrObject& rObj)
109TableProperties::TableProperties(
const TableProperties& rProps,
SdrObject& rObj)
114std::unique_ptr<BaseProperties> TableProperties::Clone(
SdrObject& rObj)
const
116 return std::unique_ptr<BaseProperties>(
new TableProperties(*
this, rObj));
119void TableProperties::ItemChange(
const sal_uInt16 nWhich,
const SfxPoolItem* pNewItem)
122 AttributeProperties::ItemChange( nWhich, pNewItem );
124 TextProperties::ItemChange( nWhich, pNewItem );
141 EE_ITEMS_START, EE_ITEMS_END>);
154TableStyleSettings::TableStyleSettings()
157, mbUseFirstColumn(false)
158, mbUseLastColumn(false)
159, mbUseRowBanding(true)
160, mbUseColumnBanding(false)
204: mpTableObj( nullptr )
205, mbSkipChangeLayout(false)
224 const sal_Int32 nColumns(rEnd.
mnCol - rStart.
mnCol + 1);
225 const sal_Int32 nRows(rEnd.
mnRow - rStart.
mnRow + 1);
247 mxTable->init(nColumns, nRows);
250 for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
252 for( sal_Int32 nCol = 0; nCol < nColumns; ++nCol )
try
254 CellRef xTargetCell(
dynamic_cast< Cell*
>(
mxTable->getCellByPosition( nCol, nRow ).get() ) );
255 if( xTargetCell.is() )
256 xTargetCell->cloneFrom(
dynamic_cast< Cell*
>( xOldTable->getCellByPosition( rStart.
mnCol + nCol, rStart.
mnRow + nRow ).get() ) );
265 Reference< XTableRows > xNewRows(
mxTable->getRows(), css::uno::UNO_SET_THROW );
266 static constexpr OUStringLiteral sHeight(
u"Height" );
267 for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
269 Reference< XPropertySet > xNewSet( xNewRows->getByIndex( nRow ), UNO_QUERY_THROW );
270 xNewSet->setPropertyValue( sHeight,
Any(
mpLayouter->getRowHeight( rStart.
mnRow + nRow ) ) );
274 Reference< XTableColumns > xNewColumns(
mxTable->getColumns(), css::uno::UNO_SET_THROW );
275 static constexpr OUStringLiteral sWidth(
u"Width" );
276 for( sal_Int32 nCol = 0; nCol < nColumns; ++nCol )
278 Reference< XPropertySet > xNewSet( xNewColumns->getByIndex( nCol ), UNO_QUERY_THROW );
279 xNewSet->setPropertyValue( sWidth,
Any(
mpLayouter->getColumnWidth( rStart.
mnCol + nCol ) ) );
287 Reference< XModifyListener > xListener(
static_cast< css::util::XModifyListener*
>(
this) );
288 xOldTable->removeModifyListener( xListener );
289 xOldTable->dispose();
297 Reference< XModifyListener > xListener(
static_cast< css::util::XModifyListener*
>(
this) );
298 mxTable->addModifyListener( xListener );
313 mxTable->init( nColumns, nRows );
314 Reference< XModifyListener > xListener(
static_cast< css::util::XModifyListener*
>(
this) );
315 mxTable->addModifyListener( xListener );
346 Reference< XModifyListener > xListener(
static_cast< css::util::XModifyListener*
>(
this) );
347 mxTable->removeModifyListener( xListener );
365 Reference< XModifyListener > xListener(
static_cast< css::util::XModifyListener*
>(
this) );
366 mxTable->addModifyListener( xListener );
369 Reference< XIndexAccess > xNewTableStyle;
373 if(rSource.
mxTableStyle.is() && &rSourceSdrModel == &rTargetSdrModel)
379 if(!xNewTableStyle.is() && rSource.
mxTableStyle.is())
try
382 const OUString sStyleName( Reference< XNamed >( rSource.
mxTableStyle, UNO_QUERY_THROW )->getName() );
383 Reference< XStyleFamiliesSupplier > xSFS(rTargetSdrModel.
getUnoModel(), UNO_QUERY_THROW );
384 Reference< XNameAccess > xFamilyNameAccess( xSFS->getStyleFamilies(), css::uno::UNO_SET_THROW );
385 Reference< XNameAccess > xTableFamilyAccess( xFamilyNameAccess->getByName(
"table" ), UNO_QUERY_THROW );
387 if( xTableFamilyAccess->hasByName( sStyleName ) )
390 xTableFamilyAccess->getByName( sStyleName ) >>= xNewTableStyle;
395 Reference< XIndexAccess > xIndexAccess( xTableFamilyAccess, UNO_QUERY_THROW );
396 xIndexAccess->getByIndex( 0 ) >>= xNewTableStyle;
442 Reference< XStyle > xStyle;
469 if( (aPos.
mnRow & 1) == 0 )
481 if( (aPos.
mnCol & 1) == 0 )
505 if( xCell.is() && ( xCell->GetStyleSheet() != pStyle ) )
507 xCell->SetStyleSheet( pStyle,
true );
525 Reference< XModifyListener > xListener(
static_cast< css::util::XModifyListener*
>(
this) );
526 mxTable->removeModifyListener( xListener );
535 if( !((nEdge >= 0) &&
mxTable.is()))
540 static constexpr OUStringLiteral sSize(
u"Size" );
545 sal_Int32 nHeight =
mpLayouter->getRowHeight( (!nEdge)?nEdge:(nEdge-1) );
550 Reference< XIndexAccess > xRows(
mxTable->getRows(), UNO_QUERY_THROW );
551 Reference< XPropertySet > xRowSet( xRows->getByIndex( (!nEdge)?nEdge:(nEdge-1) ), UNO_QUERY_THROW );
552 xRowSet->setPropertyValue( sSize,
Any( nHeight ) );
576 nWidth =
mpLayouter->getColumnWidth( (!nEdge)?nEdge:(nEdge-1) );
578 Reference< XIndexAccess > xCols(
mxTable->getColumns(), UNO_QUERY_THROW );
582 Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge ), UNO_QUERY_THROW );
583 xColSet->setPropertyValue( sSize,
Any( nWidth ) );
585 else if(!bRTL && nEdge>0)
587 Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge-1 ), UNO_QUERY_THROW );
588 xColSet->setPropertyValue( sSize,
Any( nWidth ) );
597 nWidth = std::max(
static_cast<sal_Int32
>(nWidth - nOffset), sal_Int32(0));
599 Reference<XPropertySet> xColSet(xCols->getByIndex(nEdge), UNO_QUERY_THROW);
600 xColSet->setPropertyValue(sSize,
Any(nWidth));
658 Reference< XModifyBroadcaster > xBroadcaster(
mxTableStyle, UNO_QUERY );
659 if( xBroadcaster.is() )
661 Reference< XModifyListener > xListener(
static_cast< css::util::XModifyListener*
>(
this) );
662 xBroadcaster->addModifyListener( xListener );
672 Reference< XModifyBroadcaster > xBroadcaster(
mxTableStyle, UNO_QUERY );
673 if( xBroadcaster.is() )
675 Reference< XModifyListener > xListener(
static_cast< css::util::XModifyListener*
>(
this) );
676 xBroadcaster->removeModifyListener( xListener );
689 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SdrTableObjImpl"));
693 (void)xmlTextWriterEndElement(pWriter);
705 Reference<XIndexAccess> xDefaultStyle;
709 Reference<XNameAccess> xTableFamily(xSupplier->getStyleFamilies()->getByName(
"table"), UNO_QUERY_THROW);
710 xDefaultStyle.set(xTableFamily->getByName(
"default"), UNO_QUERY_THROW);
743 std::vector<sal_Int32> aRet;
746 aRet =
mxTable->getColumnWidths();
765 bool bInteractiveMightGrowBecauseTextChanged =
768 if( bInteractiveMightGrowBecauseTextChanged
788 mpLayouter->LayoutTable( rArea, bFitWidth, bFitHeight );
815 return std::make_unique<TableProperties>(*
this);
824 return std::make_unique<sdr::contact::ViewContactOfTableObj>(*
this);
863 const ::tools::Rectangle& rNewRect,
877 init( nColumns, nRows );
888 mpImpl->init(
this, nColumns, nRows );
895 mpImpl->LayoutTable(aRectangle,
false,
false);
931 if(
mpImpl->mxTable.is() )
945 case WritingMode_LR_TB:
947 case WritingMode_RL_TB:
949 case WritingMode_TB_RL:
960 case WritingMode_LR_TB:
962 case WritingMode_RL_TB:
964 case WritingMode_TB_RL:
975 case WritingMode_LR_TB:
976 case WritingMode_RL_TB:
978 case WritingMode_TB_RL:
989 case WritingMode_LR_TB:
990 case WritingMode_RL_TB:
992 case WritingMode_TB_RL:
1004 if( xCell.is() && xCell->isMerged() )
1006 sal_Int32 nTemp = 0;
1010 if( aPos.
mnCol > 0 )
1015 else if( bEdgeTravel && (aPos.
mnRow > 0) )
1033 if( xCell->isMerged() )
1037 xCell =
mpImpl->getCell(aPos);
1041 aPos.
mnCol += xCell->getColumnSpan();
1047 aPos.
mnCol += xCell->getColumnSpan();
1050 if( aPos.
mnCol <
mpImpl->mxTable->getColumnCount() )
1053 if( bEdgeTravel && ((aPos.
mnRow + 1) <
mpImpl->getRowCount()) )
1073 if( xCell.is() && xCell->isMerged() )
1075 sal_Int32 nTemp = 0;
1079 if( aPos.
mnRow > 0 )
1083 else if( bEdgeTravel && (aPos.
mnCol > 0) )
1102 if( xCell->isMerged() )
1105 xCell =
mpImpl->getCell(aPos);
1110 aPos.
mnRow += xCell->getRowSpan();
1115 if( bEdgeTravel && (aPos.
mnCol + 1) <
mpImpl->mxTable->getColumnCount() )
1120 while( aPos.
mnCol <
mpImpl->mxTable->getColumnCount() )
1122 xCell =
mpImpl->getCell( aPos );
1123 if( xCell.is() && !xCell->isMerged() )
1140 return mpImpl->maTableStyle;
1154 mpImpl->maTableStyle = rStyle;
1168 const sal_Int32 nColCount =
mpImpl->getColumnCount();
1169 const sal_Int32 nRowCount =
mpImpl->getRowCount();
1179 bool bVrtHit =
false;
1182 while( rnX <= nColCount )
1184 if( nX - aTol <= 0 )
1190 if( rnX == nColCount )
1193 nX -=
mpImpl->mpLayouter->getColumnWidth( rnX );
1204 if( nX - aTol <= 0 )
1214 nX -=
mpImpl->mpLayouter->getColumnWidth( rnX );
1223 bool bHrzHit =
false;
1224 while( rnY <= nRowCount )
1226 if( nY - aTol <= 0 )
1232 if( rnY == nRowCount )
1235 nY -=
mpImpl->mpLayouter->getRowHeight(rnY);
1243 if( bVrtHit &&
mpImpl->mpLayouter->isEdgeVisible( rnX, rnY,
false ) )
1246 if( bHrzHit &&
mpImpl->mpLayouter->isEdgeVisible( rnX, rnY,
true ) )
1250 if( xCell.is() && xCell->isMerged() )
1255 nX +=
mpImpl->mpLayouter->getColumnWidth( rnX );
1258 while(xCell.is() && xCell->isMerged())
1260 nX +=
mpImpl->mpLayouter->getColumnWidth( rnX+
i );
1262 if(rnX+
i < nColCount)
1282 if(
mpImpl.is() && (
mpImpl->mxTableStyle != xTableStyle) )
1284 mpImpl->disconnectTableStyle();
1285 mpImpl->mxTableStyle = xTableStyle;
1286 mpImpl->connectTableStyle();
1296 return mpImpl->mxTableStyle;
1300 static Reference< XIndexAccess > aTmp;
1319 if(
mpImpl->mxTable.is() )
1321 const sal_Int32 nColCount =
mpImpl->getColumnCount();
1337 if(
mpImpl->mxTable.is() )
1339 const sal_Int32 nColCount =
mpImpl->getColumnCount();
1340 const sal_Int32 nRowCount =
mpImpl->getRowCount();
1342 return nColCount * nRowCount;
1356 const sal_Int32 nColCount =
mpImpl->mxTable->getColumnCount();
1390 assert(
mpImpl.is() &&
mpImpl->mpLayouter &&
"getTableLayouter() error: no mpImpl or mpLayouter (!)");
1391 return *(
mpImpl->mpLayouter);
1422 mpImpl->LayoutTable(aRectangle,
false,
false);
1482 nStat0 |= EEControlBits::AUTOPAGESIZE;
1502 if (xCell->GetOutlinerParaObject())
1503 pPara = *xCell->GetOutlinerParaObject();
1512 if( !pTestObj || !bHitTest || (pTestObj !=
this) || (pTestObj->GetOutlinerParaObject() != xCell->GetOutlinerParaObject()) )
1535 aTextPos.AdjustY(nFreeHgt/2 );
1537 aTextPos.AdjustY(nFreeHgt );
1541 *pAnchorRect=aAnkRect;
1550 if( !
mpImpl->mxActiveCell.is() )
1555 return mpImpl->mxActiveCell;
1578 mpImpl->DragEdge(bHorizontal, nEdge, nOffset);
1589 if(
mpImpl->mxActiveCell.is() &&
mpImpl->mxActiveCell->isMerged() )
1593 mpImpl->mxActiveCell.set(
dynamic_cast< Cell*
>(
mpImpl->mxTable->getCellByPosition( aOrigin.
mnCol, aOrigin.
mnRow ).get() ) );
1594 mpImpl->maEditPos = aOrigin;
1598 mpImpl->maEditPos = rPos;
1610 rPos =
mpImpl->maEditPos;
1620 rCellRect = xCell->getCellRect();
1640 xCell->TakeTextAnchorRect( aAnkRect );
1644 rAnchorRect=aAnkRect;
1657 Size aPaperMin,aPaperMax;
1676 if (pViewMin!=
nullptr)
1678 *pViewMin=aViewInit;
1702 if (pPaperMin!=
nullptr) *pPaperMin=aPaperMin;
1703 if (pPaperMax!=
nullptr) *pPaperMax=aPaperMax;
1704 if (pViewInit!=
nullptr) *pViewInit=aViewInit;
1719 eRet=EEAnchorMode::TopLeft;
1723 eRet=EEAnchorMode::BottomLeft;
1727 eRet=EEAnchorMode::VCenterLeft;
1740 if (!
aName.isEmpty())
1749 return SvxResId(STR_ObjNamePluralTable);
1791 rOutl.
Init( OutlinerMode::TextObject );
1807 nStat |= EEControlBits::AUTOPAGESIZE;
1828 for (std::unique_ptr<SdrUndoAction>& pAction :
mpImpl->maUndos)
1866 return xCell->GetOutlinerParaObject();
1886 xCell->SetOutlinerParaObject( std::move(pTextObject) );
1899 if (
mpImpl->mbSkipChangeLayout)
1961 mpImpl->LayoutTable( aRectangle, !bWidth, !bHeight );
1963 if( aRectangle != rR )
1984 return rModeItem.
GetValue() == css::text::WritingMode_TB_RL;
2002 return WritingMode_LR_TB;
2008 eWritingMode = pItem->GetValue();
2011 ( eWritingMode != WritingMode_TB_RL ) &&
2014 if ( pItem->GetValue() == SvxFrameDirection::Horizontal_LR_TB )
2015 eWritingMode = WritingMode_LR_TB;
2017 eWritingMode = WritingMode_RL_TB;
2020 return eWritingMode;
2025 mpImpl->maUndos.push_back(std::unique_ptr<SdrUndoAction>(pUndo));
2030 mpImpl->mbSkipChangeLayout = bSkipChangeLayout;
2046 const sal_Int32 nRowCount =
mpImpl->getRowCount();
2047 const sal_Int32 nColCount =
mpImpl->getColumnCount();
2049 if( nRowCount && nColCount )
2050 nCount += nRowCount + nColCount + 2 + 1;
2057 const sal_Int32 nRowCount =
mpImpl->getRowCount();
2058 const sal_Int32 nColCount =
mpImpl->getColumnCount();
2061 std::vector<TableEdgeHdl*> aRowEdges(nRowCount + 1);
2062 for (
auto const & rEdge :
mpImpl->mpLayouter->getHorizontalEdges())
2065 aPoint.
AdjustY(rEdge.nPosition);
2067 std::unique_ptr<TableEdgeHdl> pHdl(
new TableEdgeHdl(aPoint,
true, rEdge.nMin, rEdge.nMax, nColCount + 1));
2068 pHdl->SetPointNum(rEdge.nIndex);
2069 aRowEdges[rEdge.nIndex] = pHdl.get();
2070 rHdlList.
AddHdl(std::move(pHdl));
2074 std::vector<TableEdgeHdl*> aColEdges(nColCount + 1);
2075 for (
auto const & rEdge :
mpImpl->mpLayouter->getVerticalEdges())
2078 aPoint.
AdjustX(rEdge.nPosition);
2080 std::unique_ptr<TableEdgeHdl> pHdl(
new TableEdgeHdl(aPoint,
false, rEdge.nMin, rEdge.nMax, nRowCount + 1));
2081 pHdl->SetPointNum(rEdge.nIndex);
2082 aColEdges[rEdge.nIndex] = pHdl.get();
2083 rHdlList.
AddHdl(std::move(pHdl));
2093 for( sal_Int32 nRow = 0; nRow <= nRowCount; ++nRow )
2095 const sal_Int32 nRowHeight = (nRow == nRowCount) ? 0 : rLayouter.
getRowHeight(nRow);
2098 for( sal_Int32 nCol = 0; nCol <= nColCount; ++nCol )
2100 const sal_Int32 nColWidth = (nCol == nColCount) ? 0 : rLayouter.
getColumnWidth(nCol);
2102 if( nRowHeight > 0 )
2133 for(
size_t nHdl = 0; nHdl < tempList.
GetHdlCount(); ++nHdl )
2135 tempList.
MoveTo(rHdlList);
2138 for(
size_t nHdl = 0; nHdl < nHdlCount; ++nHdl )
2327 return PointerStyle::Cross;
2333 xNewCell = Cell::create( *
this );
2339 return std::make_unique<TableObjectGeoData>();
2345 DBG_ASSERT(
dynamic_cast< TableObjectGeoData*
>( &rGeo ),
"svx::SdrTableObj::SaveGeoData(), illegal geo data!" );
2354 DBG_ASSERT(
dynamic_cast< const TableObjectGeoData*
>( &rGeo ),
"svx::SdrTableObj::RestoreGeoData(), illegal geo data!" );
2363 mpImpl->LayoutTable(aRectangle,
false,
false);
2376 mpImpl->CropTableModelToSelection(rStart, rEnd);
2383 mpImpl->mpLayouter->LayoutTableHeight(rArea,
false);
2393 mpImpl->mpLayouter->DistributeColumns(aRectangle, nFirstColumn, nLastColumn, bOptimize, bMinimize);
2405 mpImpl->mpLayouter->DistributeRows(aRectangle, nFirstRow, nLastRow, bOptimize, bMinimize);
2416 mpImpl->LayoutTable(aRectangle,
false,
false);
2427 mpImpl->mxTable->lockBroadcasts();
2434 mpImpl->mxTable->unlockBroadcasts();
2439 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SdrTableObj"));
2440 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
2444 mpImpl->dumpAsXml(pWriter);
2446 (void)xmlTextWriterEndElement(pWriter);
2455 boost::property_tree::ptree aTableColumns;
2459 boost::property_tree::ptree
aEntries;
2460 auto const & aEdges =
mpImpl->mpLayouter->getVerticalEdges();
2461 for (
auto & rEdge : aEdges)
2463 if (rEdge.nIndex == 0)
2467 else if (rEdge.nIndex == sal_Int32(aEdges.size() - 1))
2473 boost::property_tree::ptree aEntry;
2477 aEntry.put(
"hidden",
false);
2478 aEntries.push_back(std::make_pair(
"", aEntry));
2481 aTableColumns.push_back(std::make_pair(
"entries",
aEntries));
2483 rJsonRoot.add_child(
"columns", aTableColumns);
2485 boost::property_tree::ptree aTableRows;
2489 boost::property_tree::ptree
aEntries;
2490 auto const & aEdges =
mpImpl->mpLayouter->getHorizontalEdges();
2491 for (
auto & rEdge : aEdges)
2493 if (rEdge.nIndex == 0)
2497 else if (rEdge.nIndex == sal_Int32(aEdges.size() - 1))
2503 boost::property_tree::ptree aEntry;
2507 aEntry.put(
"hidden",
false);
2508 aEntries.push_back(std::make_pair(
"", aEntry));
2511 aTableRows.push_back(std::make_pair(
"entries",
aEntries));
2513 rJsonRoot.add_child(
"rows", aTableRows);
EditStatusFlags GetStatusWord() const
void SetMaxAutoPaperSize(const Size &rSz)
void SetText(const OutlinerParaObject &)
const Size & GetPaperSize() const
Paragraph * GetParagraph(sal_Int32 nAbsPos) const
void SetMinAutoPaperSize(const Size &rSz)
std::optional< OutlinerParaObject > CreateParaObject(sal_Int32 nStartPara=0, sal_Int32 nParaCount=EE_PARA_ALL) const
void SetPaperSize(const Size &rSize)
bool SetUpdateLayout(bool bUpdate)
EEControlBits GetControlWord() const
void SetControlWord(EEControlBits nWord)
void SetRefDevice(OutputDevice *pRefDev)
void Init(OutlinerMode nMode)
sal_Int32 GetParagraphCount() const
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
void SetActionRect(const tools::Rectangle &rR)
sal_Int32 GetPointCount() const
void TakeCreateRect(tools::Rectangle &rRect) const
tools::Long GetDY() const
void SetOrtho4Possible(bool bOn=true)
const Point & GetStart() const
const SdrHdl * GetHdl() const
const Point & GetNow() const
void SetNoSnap(bool bOn=true)
void SetEndDragChangesAttributes(bool bOn)
tools::Long GetDX() const
void SetEndDragChangesLayout(bool bOn)
void MoveTo(SdrHdlList &rOther)
size_t GetHdlCount() const
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
SdrHdl * GetHdl(size_t nNum) const
SdrHdlKind GetKind() const
void SetMoveOutside(bool bMoveOutside)
void SetObj(SdrObject *pNewObj)
sal_uInt32 GetPointNum() const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
css::uno::Reference< css::uno::XInterface > const & getUnoModel()
SdrOutliner & GetHitTestOutliner() const
All geometrical data of an arbitrary object for use in undo/redo.
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
void ActionChanged() const
void SetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject)
virtual sdr::properties::BaseProperties & GetProperties() const
void BroadcastObjectChange() const
void SetObjectItem(const SfxPoolItem &rItem)
const SfxPoolItem & GetObjectItem(const sal_uInt16 nWhich) const
virtual const tools::Rectangle & GetCurrentBoundRect() const
SdrModel & getSdrModelFromSdrObject() const
SdrObjUserCall * m_pUserCall
virtual void SetLogicRect(const tools::Rectangle &rRect)
SfxStyleSheet * GetStyleSheet() const
virtual const OUString & GetName() const
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
virtual void SetChanged()
virtual const tools::Rectangle & GetLastBoundRect() const
virtual void SetBoundRectDirty()
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
void SetTextObj(const SdrTextObj *pObj)
const SdrTextObj * GetTextObj() const
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
tools::Rectangle const & getRectangle() const
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
SdrOutliner * mpEditingOutliner
virtual OutlinerParaObject * GetOutlinerParaObject() const override
tools::Long GetTextLeftDistance() const
Left inner spacing to borders
tools::Rectangle maRectangle
virtual bool NbcAdjustTextFrameWidthAndHeight(bool bHgt=true, bool bWdt=true)
static void ImpJustifyRect(tools::Rectangle &rRect)
bool mbDisableAutoWidthOnDragging
tools::Rectangle ImpDragCalcRect(const SdrDragStat &rDrag) const
void setRectangle(tools::Rectangle const &rRectangle)
Abstract base class (ABC) for all UndoActions of DrawingEngine.
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
virtual SfxItemSet & GetItemSet()
static SfxUnoStyleSheet * getUnoStyleSheet(const css::uno::Reference< css::style::XStyle > &xStyle)
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
css::text::WritingMode GetValue() const
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
oslInterlockedCount m_refCount
CellRef getCell(const CellPos &rPos) const
SdrTableObjImpl & operator=(const SdrTableObjImpl &rSource)
static sal_Int32 lastColCount
TableStyleSettings maTableStyle
std::unique_ptr< TableLayouter > mpLayouter
void dumpAsXml(xmlTextWriterPtr pWriter) const
static tools::Rectangle lastLayoutResultRectangle
static bool lastLayoutFitWidth
void UpdateCells(tools::Rectangle const &rArea)
sal_Int32 getRowCount() const
static css::text::WritingMode lastLayoutMode
void CropTableModelToSelection(const CellPos &rStart, const CellPos &rEnd)
static sal_Int32 lastRowCount
std::vector< sal_Int32 > getColumnWidths() const
Get widths of the columns in the table.
static SdrTableObjImpl * lastLayoutTable
static bool lastLayoutFitHeight
void LayoutTable(tools::Rectangle &rArea, bool bFitWidth, bool bFitHeight)
void DragEdge(bool mbHorizontal, int nEdge, sal_Int32 nOffset)
static tools::Rectangle lastLayoutInputRectangle
virtual ~SdrTableObjImpl() override
void disconnectTableStyle()
static bool rowSizeChanged
sal_Int32 getColumnCount() const
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
css::uno::Reference< css::container::XIndexAccess > mxTableStyle
static std::vector< sal_Int32 > lastColWidths
void init(SdrTableObj *pTable, sal_Int32 nColumns, sal_Int32 nRows)
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
CellPos getLastCell() const
bool IsTextEditActive() const
const TableLayouter & getTableLayouter() const
virtual SdrObjKind GetObjIdentifier() const override
void TakeTextRect(const sdr::table::CellPos &rPos, SdrOutliner &rOutliner, ::tools::Rectangle &rTextRect, bool bNoEditText, ::tools::Rectangle *pAnchorRect) const
At the same time, we set the text in the outliner (if applicable the EditOutliners') as well as the P...
virtual void AdjustToMaxRect(const tools::Rectangle &rMaxRect, bool bShrinkOnly=false) override
void setTableStyleSettings(const sdr::table::TableStyleSettings &rStyle)
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
void LayoutTableHeight(tools::Rectangle &rArea)
virtual bool BckCreate(SdrDragStat &rStat) override
virtual OutlinerParaObject * GetOutlinerParaObject() const override
CellPos getRightCell(const CellPos &rPos, bool bEdgeTravel) const
virtual SdrText * getActiveText() const override
Returns the currently active text.
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
void changeEdge(bool bHorizontal, int nEdge, sal_Int32 nOffset)
SdrTableObj(SdrModel &rSdrModel)
CellPos getDownCell(const CellPos &rPos, bool bEdgeTravel) const
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
const css::uno::Reference< css::container::XIndexAccess > & getTableStyle() const
sal_Int32 getColumnCount() const
CellPos getPreviousCell(const CellPos &rPos, bool bEdgeTravel) const
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
CellPos getLeftCell(const CellPos &rPos, bool bEdgeTravel) const
void AddUndo(SdrUndoAction *pUndo)
Add an undo action that should be on the undo stack after ending text edit.
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
void TakeTextAnchorRect(const sdr::table::CellPos &rPos, ::tools::Rectangle &rAnchorRect) const
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
virtual bool MovCreate(SdrDragStat &rStat) override
const sdr::table::TableStyleSettings & getTableStyleSettings() const
static CellPos getFirstCell()
virtual const tools::Rectangle & GetLogicRect() const override
virtual bool IsFontwork() const override
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
sal_Int32 getRowCount() const
virtual bool BegTextEdit(SdrOutliner &rOutl) override
virtual void SetVerticalWriting(bool bVertical) override
CellPos getUpCell(const CellPos &rPos, bool bEdgeTravel) const
virtual ~SdrTableObj() override
css::text::WritingMode GetWritingMode() const
virtual OUString TakeObjNameSingul() const override
void getActiveCellPos(sdr::table::CellPos &rPos) const
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
const SfxItemSet & GetActiveCellItemSet() const
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
virtual bool IsAutoGrowHeight() const override
bool createTableEdgesJson(boost::property_tree::ptree &rJsonRoot)
virtual std::unique_ptr< SdrObjGeoData > NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
virtual void onEditOutlinerStatusEvent(EditStatus *pEditStatus) override
called from the SdrObjEditView during text edit when the status of the edit outliner changes
void DistributeColumns(sal_Int32 nFirstColumn, sal_Int32 nLastColumn, const bool bOptimize, const bool bMinimize)
CellPos getPreviousRow(const CellPos &rPos, bool bEdgeTravel) const
void CropTableModelToSelection(const CellPos &rStart, const CellPos &rEnd)
virtual void NbcReformatText() override
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat &rDrag) const override
virtual void NbcSetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject) override
void createCell(sdr::table::CellRef &xCell)
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
virtual bool IsVerticalWriting() const override
void init(sal_Int32 nColumns, sal_Int32 nRows)
virtual bool IsReallyEdited() const override
Returns true only if we are in edit mode and the user actually changed anything.
void SetSkipChangeLayout(bool bSkipChangeLayout)
Next time layouting would be done, skip it (to layout at the end of multiple actions).
friend class SdrTableObjImpl
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
virtual bool HasText() const override
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
void setTableStyle(const css::uno::Reference< css::container::XIndexAccess > &xAutoFormatStyle)
void getCellBounds(const sdr::table::CellPos &rPos, ::tools::Rectangle &rCellRect)
virtual EEAnchorMode GetOutlinerViewAnchorMode() const override
virtual void TakeTextEditArea(Size *pPaperMin, Size *pPaperMax, tools::Rectangle *pViewInit, tools::Rectangle *pViewMin) const override
css::uno::Reference< css::table::XTable > getTable() const
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
void setActiveCell(const sdr::table::CellPos &rPos)
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
virtual void setActiveText(sal_Int32 nIndex) override
Changes the current active text.
virtual void SetChanged() override
tools::Rectangle maLogicRect
void DistributeRows(sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize, const bool bMinimize)
virtual const tools::Rectangle & GetSnapRect() const override
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
SdrOutliner * GetCellTextEditOutliner(const sdr::table::Cell &rCell) const
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
bool isValid(const sdr::table::CellPos &rPos) const
virtual void BrkCreate(SdrDragStat &rStat) override
rtl::Reference< SdrTableObjImpl > mpImpl
virtual OUString TakeObjNamePlural() const override
virtual sal_Int32 getTextCount() const override
Returns the number of texts available for this object.
virtual bool AdjustTextFrameWidthAndHeight() override
virtual SdrText * getText(sal_Int32 nIndex) const override
Returns the nth available text.
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
TableHitKind CheckTableHit(const Point &rPos, sal_Int32 &rnX, sal_Int32 &rnY, const sal_uInt16 aTol=0) const
virtual void EndTextEdit(SdrOutliner &rOutl) override
virtual sal_Int32 CheckTextHit(const Point &rPnt) const override
Returns the index of the text that contains the given point or -1.
virtual bool IsAutoGrowWidth() const override
const sdr::table::CellRef & getActiveCell() const
The active table has the focus or is currently edited.
CellPos getNextCell(const CellPos &rPos, bool bEdgeTravel) const
CellPos getNextRow(const CellPos &rPos, bool bEdgeTravel) const
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
bool IsHorizontalEdge() const
sal_Int32 GetValidDragOffset(const SdrDragStat &rDrag) const
basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat &rDrag) const
bool isEdgeVisible(sal_Int32 nEdgeX, sal_Int32 nEdgeY, bool bHorizontal) const
checks if the given edge is visible.
sal_Int32 getColumnWidth(sal_Int32 nColumn) const
editeng::SvxBorderLine * getBorderLine(sal_Int32 nEdgeX, sal_Int32 nEdgeY, bool bHorizontal) const
returns the requested borderline in rpBorderLine or a null pointer if there is no border at this edge
sal_Int32 getRowHeight(sal_Int32 nRow) const
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
OUString SvxResId(TranslateId aId)
ScXMLEditAttributeMap::Entry const aEntries[]
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
struct _xmlTextWriter * xmlTextWriterPtr
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
class SAL_NO_VTABLE XPropertySet
constexpr auto toTwips(N number, Length from)
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
bool findMergeOrigin(const TableModelRef &xTable, sal_Int32 nMergedX, sal_Int32 nMergedY, sal_Int32 &rOriginX, sal_Int32 &rOriginY)
returns true if the cell(nMergedX,nMergedY) is merged with other cells.
TableHitKind
SdrTableHitKind.
const sal_Int32 last_column_style
rtl::Reference< Cell > CellRef
const sal_Int32 first_column_style
const sal_Int32 odd_columns_style
const sal_Int32 body_style
const sal_Int32 even_rows_style
const sal_Int32 first_row_style
const sal_Int32 last_row_style
const sal_Int32 even_columns_style
const sal_Int32 odd_rows_style
static constexpr auto Items
@ SDRTEXTVERTADJUST_BOTTOM
@ SDRTEXTVERTADJUST_CENTER
TableStyleSettings & operator=(const TableStyleSettings &rStyle)
bool operator==(const TableStyleSettings &r) const
constexpr sal_uInt16 SDRATTR_TABLE_FIRST(SDRATTR_CUSTOMSHAPE_LAST+1)
constexpr sal_uInt16 SDRATTR_START(XATTR_START)
constexpr sal_uInt16 SDRATTR_MISC_LAST(SDRATTR_TEXT_CLIPVERTOVERFLOW)
constexpr sal_uInt16 SDRATTR_MISC_FIRST(SDRATTR_CAPTION_LAST+1)
constexpr sal_uInt16 SDRATTR_TABLE_LAST(SDRATTR_TABLE_CELL_GRABBAG)
constexpr sal_uInt16 SDRATTR_SHADOW_LAST(SDRATTR_SHADOWALIGNMENT)
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
tools::Rectangle maLogicRect
void ResizeRect(tools::Rectangle &rRect, const Point &rRef, const Fraction &rxFact, const Fraction &ryFact)