find.cpp revision 8d8dbe5c107a022acda514982d3b7e235cf9f65b
250N/A#ifdef HAVE_CONFIG_H
250N/A#include "message-stack.h"
250N/A#include "inkscape.h"
250N/A#include "document.h"
250N/A#include "document-undo.h"
250N/A#include "selection.h"
250N/A#include "desktop-handles.h"
250N/A#include "dialogs/dialog-events.h"
250N/A#include "interface.h"
250N/A#include "preferences.h"
250N/A#include "sp-flowtext.h"
250N/A#include "text-editing.h"
250N/A#include "sp-tspan.h"
250N/A#include "selection-chemistry.h"
250N/A#include "sp-ellipse.h"
250N/A#include "sp-spiral.h"
250N/A#include "sp-polyline.h"
250N/A#include "sp-item-group.h"
250N/A#include "sp-image.h"
250N/A#include "sp-offset.h"
250N/A#include "xml/node-iterators.h"
250N/A#include "xml/attribute-record.h"
250N/A entry_find(_("F_ind:"), _("Find objects by their content or properties (exact or partial match)")),
250N/A check_searchin_property(_("_Properties"), _("Search in object properties, styles, attributes and IDs")),
250N/A vbox_searchin(0, false),
250N/A _action_replace(false),
250N/A expander_options.property_expanded().signal_changed().connect(sigc::mem_fun(*this, &Find::onExpander));
250N/A check_searchin_property.signal_clicked().connect(sigc::mem_fun(*this, &Find::onSearchinProperty));
250N/A desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &Find::setTargetDesktop) );
250N/A selectChangedConn = desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(*this, &Find::onSelectionChange)));
250N/AGlib::ustring Find::find_replace(const gchar *str, const gchar *find, const gchar *replace, bool exact, bool casematch, bool replaceall)
250N/A if (!replaceall) {
250N/A // Start the next search after the last replace character to avoid infinite loops (replace "a" with "aaa" etc)
250N/Agsize Find::find_strcmp_pos(const gchar *str, const gchar *find, bool exact, bool casematch, gsize start/*=0*/)
250N/AFind::item_text_match (SPItem *item, const gchar *find, bool exact, bool casematch, bool replace/*=false*/)
250N/A n = find_strcmp_pos(item_text, ufind.c_str(), exact, casematch, n + strlen(replace_text) + 1);
250N/AFind::item_id_match (SPItem *item, const gchar *id, bool exact, bool casematch, bool replace/*=false*/)
250N/A Glib::ustring new_item_style = find_replace(item_id, id, replace_text , exact, casematch, true);
250N/AFind::item_style_match (SPItem *item, const gchar *text, bool exact, bool casematch, bool replace/*=false*/)
250N/A Glib::ustring new_item_style = find_replace(item_style, text, replace_text , exact, casematch, true);
250N/Abool Find::item_attr_match(SPItem *item, const gchar *text, bool exact, bool /*casematch*/, bool replace/*=false*/)
2759N/Abool Find::item_attrvalue_match(SPItem *item, const gchar *text, bool exact, bool casematch, bool replace/*=false*/)
2759N/A Inkscape::Util::List<Inkscape::XML::AttributeRecord const> iter = item->getRepr()->attributeList();
2759N/A Glib::ustring new_item_style = find_replace(attr_value, text, replace_text , exact, casematch, true);
2759N/Abool Find::item_font_match(SPItem *item, const gchar *text, bool exact, bool casematch, bool /*replace*/ /*=false*/)
if (found) {
ret = true;
if (_action_replace) {
// Exact match fails since the "font-family:" is in the token, since the find was exact it still works with false below
Glib::ustring new_item_style = find_replace(orig_str, text, replace_text , false /*exact*/, casematch, true);
return ret;
GSList *
if (_action_replace) {
if (ids) {
if (_action_replace) {
if (style) {
if (_action_replace) {
if (attrname) {
if (_action_replace) {
if (attrvalue) {
if (_action_replace) {
if (font) {
if (_action_replace) {
return out;
} else if (SP_IS_GENERICELLIPSE(item) || SP_IS_ELLIPSE(item) || SP_IS_ARC(item) || SP_IS_CIRCLE(item)) {
GSList *
GSList *
l = filter_types (l);
GSList *
if (SP_IS_DEFS(r)) {
GSList *
Find::all_selection_items (Inkscape::Selection *s, GSList *l, SPObject *ancestor, bool hidden, bool locked)
if (SP_IS_ITEM (i->data) && !reinterpret_cast<SPItem *>(i->data)->cloned && !desktop->isLayer(SP_ITEM(i->data))) {
_action_replace = false;
onAction();
_action_replace = true;
onAction();
blocked = true;
if (n != NULL) {
count),
if (_action_replace){
status.set_text(Glib::ustring::compose(ngettext("%1 match replaced","%1 matches replaced",count), count));
status.set_text(Glib::ustring::compose(ngettext("%1 object found","%1 objects found",count), count));
if (_action_replace) {
blocked = false;
bool objectok = false;
objectok = true;
objectok = true;
if (!objectok) {
bool propertyok = false;
propertyok = true;
propertyok = true;
if (!propertyok) {
searchinToggle(false);
searchinToggle(true);