| 2992 | // next: Dw_page_find_word |
| 2993 | |
| 2994 | void Textblock::changeLinkColor (int link, int newColor) |
| 2995 | { |
| 2996 | for (int lineIndex = 0; lineIndex < lines->size(); lineIndex++) { |
| 2997 | bool changed = false; |
| 2998 | Line *line = lines->getRef (lineIndex); |
| 2999 | int wordIdx; |
| 3000 | |
| 3001 | for (wordIdx = line->firstWord; wordIdx <= line->lastWord; wordIdx++){ |
| 3002 | Word *word = words->getRef(wordIdx); |
| 3003 | |
| 3004 | if (word->style->x_link == link) { |
| 3005 | core::style::StyleAttrs styleAttrs; |
| 3006 | |
| 3007 | switch (word->content.type) { |
| 3008 | case core::Content::TEXT: |
| 3009 | { core::style::Style *old_style = word->style; |
| 3010 | styleAttrs = *old_style; |
| 3011 | styleAttrs.color = core::style::Color::create (layout, |
| 3012 | newColor); |
| 3013 | word->style = core::style::Style::create (&styleAttrs); |
| 3014 | old_style->unref(); |
| 3015 | old_style = word->spaceStyle; |
| 3016 | styleAttrs = *old_style; |
| 3017 | styleAttrs.color = core::style::Color::create (layout, |
| 3018 | newColor); |
| 3019 | word->spaceStyle = core::style::Style::create(&styleAttrs); |
| 3020 | old_style->unref(); |
| 3021 | break; |
| 3022 | } |
| 3023 | case core::Content::WIDGET_IN_FLOW: |
| 3024 | { core::Widget *widget = word->content.widget; |
| 3025 | styleAttrs = *widget->getStyle(); |
| 3026 | styleAttrs.color = core::style::Color::create (layout, |
| 3027 | newColor); |
| 3028 | styleAttrs.setBorderColor( |
| 3029 | core::style::Color::create (layout, newColor)); |
| 3030 | widget->setStyle(core::style::Style::create (&styleAttrs)); |
| 3031 | break; |
| 3032 | } |
| 3033 | default: |
| 3034 | break; |
| 3035 | } |
| 3036 | changed = true; |
| 3037 | } |
| 3038 | } |
| 3039 | if (changed) |
| 3040 | queueDrawArea (0, lineYOffsetWidget(line), allocation.width, |
| 3041 | line->borderAscent + line->borderDescent); |
| 3042 | } |
| 3043 | } |
| 3044 | |
| 3045 | void Textblock::changeWordStyle (int from, int to, core::style::Style *style, |
| 3046 | bool includeFirstSpace, bool includeLastSpace) |