void FV_Selection::checkSelectAll(void) { fl_SectionLayout * pSL = m_pView->m_pLayout->getLastSection(); if(pSL == NULL) return; if(m_pView->m_pDoc->isPieceTableChanging()) { return; } if(m_pView->m_pLayout->isLayoutFilling()) { return; } PT_DocPosition posLow = m_iSelectAnchor; PT_DocPosition posHigh = m_pView->getPoint(); if(posHigh < posLow) { posHigh = m_iSelectAnchor; posLow = m_pView->getPoint(); } PT_DocPosition posBeg,posEnd=0; m_pView->getEditableBounds(false,posBeg); m_pView->getEditableBounds(true,posEnd); xxx_UT_DEBUGMSG(("posLow %d posBeg %d posHigh %d posEnd %d\n",posLow,posBeg,posHigh,posEnd)); bool bSelAll = ((posBeg >= posLow) && (posEnd == posHigh)); setSelectAll(bSelAll); }
void FV_Selection::setMode(FV_SelectionMode iSelMode) { if( (m_iSelectionMode != FV_SelectionMode_NONE) || (iSelMode != FV_SelectionMode_NONE)) { m_iPrevSelectionMode = m_iSelectionMode; } if((m_iSelectionMode == FV_SelectionMode_TOC) && (m_iSelectionMode != iSelMode)) { if(m_pSelectedTOC) { m_pSelectedTOC->setSelected(false); } m_pSelectedTOC = NULL; } m_iSelectionMode = iSelMode; if(m_iSelectionMode != FV_SelectionMode_NONE) { m_pTableOfSelectedColumn = NULL; UT_VECTOR_PURGEALL(PD_DocumentRange *,m_vecSelRanges); UT_VECTOR_PURGEALL(UT_ByteBuf *,m_vecSelRTFBuffers); UT_VECTOR_PURGEALL(FV_SelectionCellProps *,m_vecSelCellProps); m_vecSelRanges.clear(); m_vecSelRTFBuffers.clear(); m_vecSelCellProps.clear(); } setSelectAll(false); }
void FV_Selection::setTOCSelected(fl_TOCLayout * pTOCL) { UT_return_if_fail(pTOCL); setMode(FV_SelectionMode_TOC); m_pSelectedTOC = pTOCL; m_iSelectAnchor = pTOCL->getPosition(); pTOCL->setSelected(true); setSelectAll(false); }
void FV_Selection::setSelectionRightAnchor(PT_DocPosition pos) { if(pos == 0) return; m_iSelectRightAnchor = pos; PT_DocPosition posBeg,posEnd=0; m_pView->getEditableBounds(false,posBeg); m_pView->getEditableBounds(true,posEnd); bool bSelAll = ((posBeg >= m_iSelectLeftAnchor) && (posEnd <= m_iSelectRightAnchor)); xxx_UT_DEBUGMSG(("setRight posBeg %d left %d posEnd %d right %d\n",posBeg,m_iSelectLeftAnchor,posEnd,m_iSelectRightAnchor)); setSelectAll(bSelAll); }
/*! * Add a cell to the list of selected regions. */ void FV_Selection::addCellToSelection(fl_CellLayout * pCell) { UT_ASSERT((m_iSelectionMode == FV_SelectionMode_TableColumn) || ( m_iSelectionMode == FV_SelectionMode_TableRow)); PL_StruxDocHandle sdhEnd = NULL; PL_StruxDocHandle sdhStart = pCell->getStruxDocHandle(); PT_DocPosition posLow = getDoc()->getStruxPosition(sdhStart) +1; // First block bool bres; bres = getDoc()->getNextStruxOfType(sdhStart,PTX_EndCell,&sdhEnd); PT_DocPosition posHigh = getDoc()->getStruxPosition(sdhEnd) -1; UT_ASSERT(bres && sdhEnd); PD_DocumentRange * pDocRange = new PD_DocumentRange(getDoc(),posLow,posHigh); m_vecSelRanges.addItem(pDocRange); IE_Exp_RTF * pExpRtf = new IE_Exp_RTF(pDocRange->m_pDoc); UT_ByteBuf * pByteBuf = new UT_ByteBuf; if (pExpRtf) { if(posLow < posHigh) { pDocRange->m_pos1++; pDocRange->m_pos2++; } pExpRtf->copyToBuffer(pDocRange,pByteBuf); if(posLow < posHigh) { pDocRange->m_pos1--; pDocRange->m_pos2--; } DELETEP(pExpRtf); } m_vecSelRTFBuffers.addItem(pByteBuf); FV_SelectionCellProps * pCellProps = new FV_SelectionCellProps; UT_sint32 iLeft,iRight,iTop,iBot; m_pView->getCellParams(posLow,&iLeft,&iRight,&iTop,&iBot); UT_DEBUGMSG(("In Selection left %d right %d top %d bot %d \n",iLeft,iRight,iTop,iBot)); pCellProps->m_iLeft = iLeft; pCellProps->m_iRight = iRight; pCellProps->m_iTop = iTop; pCellProps->m_iBot = iBot; m_vecSelCellProps.addItem(pCellProps); setSelectAll(false); }
void FV_Selection::setSelectionAnchor(PT_DocPosition pos) { m_iSelectAnchor = pos; fl_SectionLayout * pSL = m_pView->m_pLayout->getLastSection(); if(pSL == NULL) return; PT_DocPosition posLow = m_iSelectAnchor; PT_DocPosition posHigh = m_pView->getPoint(); if(posHigh < posLow) { posHigh = m_iSelectAnchor; posLow = m_pView->getPoint(); } PT_DocPosition posBeg,posEnd=0; m_pView->getEditableBounds(false,posBeg); m_pView->getEditableBounds(true,posEnd); xxx_UT_DEBUGMSG(("posLow %d posBeg %d posHigh %d posEnd %d\n",posLow,posBeg,posHigh,posEnd)); bool bSelAll = ((posBeg >= posLow) && (posEnd <= posHigh)); setSelectAll(bSelAll); }
void AMGraphicsTextItem::changingText() { int initialPosition = textCursor().position(); QTextCursor newPosition = textCursor(); int anchorPositon = newPosition.anchor(); if(textCursor().atStart()) initialPosition = -2; emit textChanged(shapeIndex_); if(initialPosition == -1) { initialPosition++; } else if (initialPosition == -2) { newPosition.setPosition(0); } else newPosition.setPosition(initialPosition); newPosition.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor,newPosition.position() - anchorPositon); setTextCursor(newPosition); setSelectAll(false); }
void FV_Selection::clearSelection(void) { setMode(FV_SelectionMode_NONE); setSelectAll(false); }
void AMGraphicsTextItem::focusOutEvent(QFocusEvent *event) { QGraphicsTextItem::focusOutEvent(event); setSelectAll(false); clearSelection(); }