35 #include <osl/diagnose.h>
65 pTableBoxStartNode = pTableBox->
GetSttNd();
73 if( !aCellStt.GetNode().IsStartNode() )
75 if( pCursor->
HasMark() || !bAppendLine )
83 StartOfSectionIndex() );
85 OSL_ENSURE( pTableBox,
"Box is not in this table" );
148 if( bCheckProtected )
159 pEnd = aBoxes.
back();
166 pTable->
CreateSelection( *pCursor, aBoxes, eSearchType, bCheckProtected );
171 pEnd = aBoxes.
back();
178 const SwFrame* pStartFrame = pFrame;
180 std::pair<Point, bool>
const tmp(pCursor->
GetMkPos(),
true);
181 const SwFrame* pEndFrame = pCNd
191 if ( !pStartFrame || !pEndFrame )
201 const bool bSelectUp = ( bVert && !bRow ) ||
204 GetTableSel( static_cast<const SwCellFrame*>(pStartFrame),
205 static_cast<const SwCellFrame*>(pEndFrame),
206 aBoxes, bSelectUp ?
nullptr : &aCells, eType );
208 if( aBoxes.
empty() || ( !bSelectUp && 4 != aCells.size() ) )
214 pEnd = aBoxes.
back();
219 pStt = aCells[bVert ? 0 : (bRow ? 2 : 1)]->GetTabBox();
221 pEnd = aCells[bVert ? 3 : (bRow ? 1 : 2)]->GetTabBox();
295 #if OSL_DEBUG_LEVEL > 0
300 OSL_ENSURE( !pFrame->
IsInTab() == !(pStartNode !=
nullptr),
301 "Schroedinger's table: We're in a box, and also we aren't." );
303 if( pStartNode ==
nullptr )
356 OSL_FAIL(
"lcl_FindNextCell not celled with table start node!" );
367 pCNd = rNds.
GoNext( &aTmp );
375 if (
nullptr == pFrame || pCNd->
FindTableNode() != pTableNd ||
397 if(
nullptr == pCNd )
398 pCNd = rNds.
GoNext( &aTmp );
407 if (
nullptr != pFrame && pCNd->
FindTableNode() == pTableNd &&
433 OSL_FAIL(
"lcl_FindPrevCell not celled with table start node!" );
447 if(
nullptr == pFrame || pCNd->
FindTableNode() != pTableNd ||
460 if(
nullptr == pCNd )
468 if(
nullptr != pFrame && pCNd->
FindTableNode() == pTableNd &&
499 if( pInnerTableNd == pTableNd )
500 aIdx.
Assign( *pTableNd, - 1 );
506 while( aIdx.GetIndex() &&
507 nullptr == ( pTableNd = aIdx.GetNode().StartOfSectionNode()->GetTableNode()) )
510 if ( aIdx == aOldIdx )
517 if ( !aIdx.GetIndex() )
527 aIdx = *aIdx.GetNode().StartOfSectionNode();
531 aIdx.Assign( *pTableNd, -1 );
541 aIdx.Assign( *pTableNd, -1 );
570 aIdx.Assign( *pTableNd->EndOfSectionNode(), 1 );
575 while( aIdx.GetIndex() < nLastNd &&
576 nullptr == ( pTableNd = aIdx.GetNode().GetTableNode()) )
579 if ( aIdx == aOldIdx )
586 if ( aIdx.GetIndex() == nLastNd )
600 aIdx.Assign( *pTableNd->EndOfSectionNode(), + 1 );
606 aIdx = *aIdx.GetNode().EndOfSectionNode();
611 aIdx.Assign( *pTableNd->EndOfSectionNode(), + 1 );
672 if( pTableCursor || !
HasMark() )
690 sal_Int32 nPtCnt = 0;
709 bRet = pCursor->
MoveTable( fnWhichTable, fnPosTable );
763 OSL_ENSURE( pFrame,
"no frame for this box" );
768 sNm =
static_cast<SwCellFrame*
>(pFrame)->GetTabBox()->GetName() +
":";
789 sNm +=
static_cast<SwCellFrame*
>(pFrame)->GetTabBox()->GetName();
836 if( !pPos && !pChkBox )
840 if( pChkBox && !pPos &&
850 pSttNd->
GetIndex() + 1 ]->GetTextNode();
867 return nullptr != pChkBox;
880 bool bCheckBox =
false;
921 if(
auto pCursorShell = dynamic_cast<SwCursorShell *>(&rSh) )
922 bRet |= pCursorShell->CheckTableBoxContent(
923 pCursorShell->m_pCurrentCursor->GetPoint() );
SwStartNode * FindSttNodeByType(SwStartNodeType eTyp)
const SwEndNode * EndOfSectionNode() const
Starts a section of nodes in the document model.
Base class of the Writer layout elements.
SwTableBox * m_pBoxPtr
table row
void CreateSelection(const SwPaM &rPam, SwSelBoxes &rBoxes, const SearchType eSearchType, bool bProtect) const
void SwTable::CreateSelection(..) fills the selection structure with table cells for a given SwPaM...
sal_uLong GetIndex() const
SAL_DLLPRIVATE void UpdateCursor(sal_uInt16 eFlags=SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE, bool bIdleEnd=false)
SwNode & GetNode(bool bPoint=true) const
const Value & back() const
SwShellCursor * m_pCurrentCursor
current cursor
bool GoInContent(SwPaM &rPam, SwMoveFnCollection const &fnMove)
bool GotoTable(const OUString &rName)
bool IsAutoUpdateCells() const
Marks a position in the document model.
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
void SaveTableBoxContent(const SwPosition *pPos=nullptr)
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
bool GoPrevCell(sal_uInt16 nCnt=1)
const OUString & GetText() const
virtual const SwRootFrame * GetCurrentLayout() const =0
static ShellResource * GetShellRes()
bool GotoPrevTable(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosTable, bool bInReadOnly)
void ClearTableBoxContent()
const SwTable * GetTable() const
virtual sal_Int32 Len() const override
const SwPosition * GetMark() const
SwTabFrame is one table in the document layout, containing rows (which contain cells).
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
virtual bool IsSelOvr(SwCursorSelOverFlags eFlags=SwCursorSelOverFlags::CheckNodeSection|SwCursorSelOverFlags::Toggle|SwCursorSelOverFlags::ChangePos)
tools::Long GetCursorRowSpanOffset() const
bool IsTableComplexForChart(const OUString &rSel) const
static SwContentNode * GoPrevious(SwNodeIndex *)
bool GoNextCell(bool bAppendLine=true)
set cursor into next/previous cell
bool GotoCurrTable(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosTable, bool bInReadOnly)
sal_Int32 getRowSpan() const
SwContentNode * GetContentNode(bool bPoint=true) const
std::deque< SwCellFrame * > SwCellFrames
static bool lcl_FindNextCell(SwNodeIndex &rIdx, bool bInReadOnly)
get the next non-protected cell inside a table
SwTableNode * GetTableNode()
static const SwFrame * lcl_FindMostUpperCellFrame(const SwFrame *pFrame)
rtl::Reference< SwDoc > mxDoc
The document; never 0.
const SwRect & getFrameArea() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_uLong GetIndex() const
const SwTable & GetTable() const
SwShellTableCursor * m_pTableCursor
table Cursor; only in tables when the selection lays over 2 columns
virtual bool GotoTable(const OUString &rName)
bool GoNextCell(sal_uInt16 nCnt=1)
SwShellCursor * GetCursor_()
PaM is Point and Mark: a selection of the document model.
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
bool(* SwWhichTable)(SwPaM &, SwMoveFnCollection const &, bool bInReadOnly)
SwTabFrame * ImplFindTabFrame()
const SwTableNode * IsCursorInTable() const
A helper class to save cursor state (position).
SwTabFrame * FindMaster(bool bFirstMaster=false) const
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
void GetTableSel(const SwCursorShell &rShell, SwSelBoxes &rBoxes, const SwTableSearchType eSearchType)
const SwStartNode * StartOfSectionNode() const
const SwPosition * GetPoint() const
static SwSelBoxes & SelLineFromBox(const SwTableBox *pBox, SwSelBoxes &rBoxes, bool bToTop=true)
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
bool EndAllTableBoxEdit()
SwIndex & Assign(SwIndexReg *, sal_Int32)
SwContentNode * GetContentNode()
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
SwLayoutFrame * GetUpper()
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
const Point & GetMkPos() const
Marks a node in the document model.
SwFrameFormat * GetFrameFormat()
SwNodes & GetNodes()
Node is in which nodes-array/doc?
bool IsSelTableCells() const
ring_container GetRingContainer()
SwStartNodeType GetStartNodeType() const
SwStartNode * GetStartNode()
static void SetSearchLabel(const SearchLabel &rSL)
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
SwTable is one table in the document model, containing rows (which contain cells).
const SwPosition * Start() const
OUString GetBoxNms() const
virtual bool IsReadOnlyAvailable() const
sal_uLong EndOfSectionIndex() const
SwTextNode is a paragraph in the document model.
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(149)
bool IsReadOnlyAvailable() const
const SwStartNode * GetSttNd() const
SwNodeIndex * m_pBoxIdx
for recognizing of the changed
SwContentFrame * GetCurrFrame(const bool bCalcFrame=true) const
Get current frame in which the cursor is positioned.
bool MoveTable(SwWhichTable, SwMoveFnCollection const &)
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
SwShellCursor * GetNext()
sal_Int32 GetIndex() const
const SwPosition * End() const
SwTableBox & FindEndOfRowSpan(const SwTable &, sal_uInt16 nMaxStep)
SwTableBox::FindEndOfRowSpan(..) returns the last overlapped cell if there is any.
SwTableBox is one table cell in the document model.
const Point & GetPtPos() const
bool CheckTableBoxContent(const SwPosition *pPos=nullptr)
bool SelTableRowOrCol(bool bRow, bool bRowSimple=false)
const SwStartNode * FindTableBoxStartNode() const
SwMoveFnCollection const & fnMoveBackward
SwTableNode * FindTableNode()
Search table node, in which it is.
bool MoveTable(SwWhichTable, SwMoveFnCollection const &)
bool IsTableComplexForChart()
bool GotoNextTable(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosTable, bool bInReadOnly)
make visible in spite of Readonly
static bool lcl_FindPrevCell(SwNodeIndex &rIdx, bool bInReadOnly)
see lcl_FindNextCell()
SwRootFrame * GetLayout() const
SwTable::SearchType m_eEnhancedTableSel
SwContentNode * GoNext(SwNodeIndex *) const
SwCellFrame is one table cell in the document layout.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
void ChkBoxNumFormat(SwTableBox &rCurrentBox, bool bCallUpdate)
SwNodeIndex & Assign(SwNodes const &rNds, sal_uLong)
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
SwTabFrame * FindTabFrame()
SwTableNode * GetTableNode() const
Base class of the Writer document model elements.