trichview.support
Remove HTML link |
Author |
Message |
Posted: 08/12/2004 8:12:45 Hi After doing following tasks i get a Red highlight. 1) select a few wrods. 2) create a link 3) remove the link (dont get the highlight here) 4) save to RVF 5) load the RVF (i get the red highlight here) The red highlight is on where i selected for removing the link. Please help me out. I have set my RichViewEdit as follow. //---------------------------------------------- AcceptDragDropFormats >> rvddBitmap >> rvddFiles; RTFReadProperties->UnicodeMode = rvruOnlyUnicode; EditorOptions << rvoHideReadOnlyCaret << rvoDoNotWantShiftReturns; EditorOptions >> rvoClearTagOnStyleApp >> rvoCtrlJumps; Options << rvoTagsArePChars; RVFOptions << rvfoSaveBinary << rvfoSaveTextStyles << rvfoSaveParaStyles; //---------------------------------------------- //---------------------------------------------- // Make link //---------------------------------------------- // Set TextStyle l_RE->ApplyStyleConversion(3); // Get selection details int l_SelStart, l_SelEnd; int l_SelStartOffset, l_SelEndOffset; l_RE->GetSelectionBounds(l_SelStart, l_SelStartOffset, l_SelEnd, l_SelEndOffset, false); if (l_SelStart == l_SelEnd) { l_RE->SetItemTag(l_SelStart, int(StrNew(l_String.c_str()))); } else if (l_SelStart < l_SelEnd) { for (int i=l_SelStart+1; i<=l_SelEnd; i++) { l_RE->SetItemTag(i, int(StrNew(l_String.c_str()))); } } else if (l_SelStart > l_SelEnd) { for (int i=l_SelEnd+1; i<=l_SelStart; i++) { l_RE->SetItemTag(i, int(StrNew(l_String.c_str()))); } } //---------------------------------------------- // Remove link // // If a user selects a portion of the link, i want to // remove the link on that portion only, not the whole link. //---------------------------------------------- // Remove TextStyle l_RE->ApplyStyleConversion(4); // Get selection, then reset the Tags int l_SelStart, l_SelEnd, l_SelStartOffs, l_SelEndOffs; l_RE->GetSelectionBounds(l_SelStart, l_SelStartOffs, l_SelEnd, l_SelEndOffs, false); if (l_SelStart <= l_SelEnd) { while (l_SelStart <= l_SelEnd) { if (l_RE->GetItemTag(l_SelStart) != 0) { l_RE->SetItemTag(l_SelStart,0); } // Incrememnt to next item l_SelStart++; } } else { while (l_SelEnd <= l_SelStart) { if (l_RE->GetItemTag(l_SelEnd) != 0) { l_RE->SetItemTag(l_SelEnd,0); } // Incrememnt to next item l_SelEnd++; } } //---------------------------------------------- // OnStyleConversion //---------------------------------------------- // Get font info TFontInfo *FontInfo = new TFontInfo(NULL); FontInfo->Assign(RVStyleText->TextStyles->Items[StyleNo]); switch(UserData) { case 0: // Clear Bold and Italic styles FontInfo->Style >> fsBold >> fsItalic; break; case 1: // Add Bold style FontInfo->Style << fsBold; break; case 2: // Add Italic style FontInfo->Style << fsItalic; break; case 3: // Add Link style FontInfo->Style << fsUnderline; FontInfo->Jump = true; FontInfo->Color = clBlue; break; case 4: // Remove Link style FontInfo->Style >> fsUnderline; FontInfo->Jump = false; FontInfo->Color = clBlack; break; } // Update the style NewStyleNo = RVStyleText->TextStyles->FindSuchStyle(StyleNo, FontInfo, RVAllFontInfoProperties); if (NewStyleNo == -1) { RVStyleText->TextStyles->Add(); NewStyleNo = RVStyleText->TextStyles->Count-1; RVStyleText->TextStyles->Items[NewStyleNo]->Assign(FontInfo); RVStyleText->TextStyles->Items[NewStyleNo]->Standard = false; } delete FontInfo; } -- Programer - SplashMedia http://splashmedia.co.nz |
Powered by ABC Amber Outlook Express Converter