void KPrFindReplace::highlightPortion(KoTextParag * parag, int index, int length, KoTextDocument *_textdoc, KDialogBase* dialog) { bool repaint = isReplace() ? options() & KReplaceDialog::PromptOnReplace : true; KPrTextDocument *textdoc = static_cast<KPrTextDocument *>(_textdoc); KPrTextObject* textobj = textdoc->textObject(); textobj->highlightPortion( parag, index, length, m_canvas, repaint, dialog ); }
void FindDialog::accept() { TextEditor *current = m_parent->m_activeEditor; QTextDocument *doc = current->getTextDocument(); QTextCursor start = current->textCursor(); QTextCursor result; int startPos = -1, endPos = -1; // see if we're supposed to search within a selection if (start.hasSelection() && searchSelection()) { startPos = start.selectionStart(); endPos = start.selectionEnd(); // get rid of selection if (findBackwards()) start.setPosition(endPos); else start.setPosition(startPos); } else if (!fromCursor() && !m_searching) start.movePosition(QTextCursor::Start); if (isFind()) { result = find(start, doc); // test if result was outside of selection if (!result.isNull() && ((endPos > 0 && result.selectionEnd() > endPos) || (startPos > 0 && result.selectionStart() < startPos))) result = QTextCursor(); // null cursor } else result = replace(start, doc, endPos); if (result.isNull()) { STATUS_BAR->showMessage(QString("%1 '%2' not found with the Options given").arg((regularExpression() ? QString("RegExp") : QString("String")), getSearchString())); m_searching = false; updateReplace(isReplace()); } else { current->changeTextCursor(result); STATUS_BAR->clearMessage(); m_searching = true; updateReplace(isReplace()); } }
Standard_Boolean ShHealOper_RemoveFace::removeFaces(const TopoDS_Shell& theShell, TopoDS_Shape& theNewShape) { Standard_Boolean aIsRemove = Standard_False; //TopoDS_Shape aShape = myReShape->Apply(theShape); //removing faces from shell. TopoDS_Iterator aIterFaces(theShell,Standard_False); for(; aIterFaces.More() && myMapFaces.Extent(); aIterFaces.Next()) { if(!myMapFaces.Contains(aIterFaces.Value())) continue; TopoDS_Face aFace = TopoDS::Face( aIterFaces.Value()); removePCurve(aFace); aIsRemove = Standard_True; myContext->Remove(aFace); myMapFaces.Remove(aFace); } if(aIsRemove) { TopoDS_Shape aNewShape = myContext->Apply(theShell); //avoiding empty shell and shell containing one face. TopoDS_Shape aresShape = getResultShell(aNewShape); if(aresShape.IsNull()) { myContext->Remove(aNewShape); theNewShape.Nullify(); } else if(aresShape.ShapeType() == TopAbs_FACE) { myContext->Replace(aNewShape,aresShape); theNewShape = aresShape; } else if(aresShape.ShapeType() == TopAbs_SHELL) { //obtaining correct shell or compound with help class ShapeFix_Shell. Standard_Boolean isManifShell = isManifold(theShell); Handle(ShapeFix_Shell) aFixShell = new ShapeFix_Shell; aFixShell->FixFaceOrientation(TopoDS::Shell(aresShape),Standard_True,!isManifShell); TopoDS_Shape aFixShape = aFixShell->Shape(); TopoDS_Shape areplShape; isReplace(aFixShape,areplShape); myContext->Replace(aNewShape,areplShape); theNewShape = areplShape; } } else theNewShape = theShell; return aIsRemove; }
QString SearchOptions::serializeSettings() const { QStringList list; if (isMatchEntireString()) list << "MatchEntireString"; if (isContains()) list << "Contains"; if (isStartsWith()) list << "StartsWith"; if (isEndsWith()) list << "EndsWith"; if (isMatchAsString()) list << "AsString"; if (isRegularExpression()) list << "RegExp"; if (isWildCard()) list << "Wildcard"; list << (isCaseSensitive() ? "CaseSensitive" : "CaseInSensitive"); list << (isWrap() ? "Wrap" : "NoWrap"); list << (isBackwards() ? "Backward" : "Forward"); list << (isAllColumns() ? "AllColumns" : "OneColumn"); if (isReplace()) list << "Replace"; if (isReplaceAll()) list << "ReplaceAll"; return list.join(","); }
Standard_Boolean ShHealOper_RemoveFace::Perform() { myDone = Standard_False; myErrorStatus = ShHealOper_NotError; if(myInitShape.IsNull()) { myErrorStatus = ShHealOper_InvalidParameters; return myDone; } TopExp_Explorer aExp(myInitShape,TopAbs_FACE); for( ; aExp.More(); aExp.Next()) { removePCurve(TopoDS::Face(aExp.Current())); myContext->Remove(aExp.Current()); myDone = Standard_True; } if(myDone) { TopoDS_Shape aNewShape = myContext->Apply(myInitShape); isReplace(aNewShape,myResultShape); myContext->Replace(aNewShape,myResultShape); } return myDone; }
bool FindDialog::isFind() const { return !isReplace(); }