To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=80762
User knipes changed the following: What |Old value |New value ================================================================================ Status|RESOLVED |UNCONFIRMED -------------------------------------------------------------------------------- Resolution|WORKSFORME | -------------------------------------------------------------------------------- ------- Additional comments from [EMAIL PROTECTED] Tue Jul 1 05:02:55 +0000 2008 ------- whoops. i didn't trace it properly. the code as a whole is what does it. sorry. subToggleCharacterStyles("i-code", array("CharFontCharSet","CharFontFamily","CharFontName","CharFontPitch")) ... Sub subToggleCharacterStyles(sStyle, mResetProps) oCurSelection = thisComponent.getCurrentSelection() If oCurSelection.supportsService("com.sun.star.text.TextRanges") Then nCount = oCurSelection.Count If nCount = 1 Then 'If nothing selected then select current word oVC = thisComponent.CurrentController.ViewCursor oTextCursor = oVC.Text.createTextCursorByRange(oVC) If oVC.isCollapsed() Then oTextCursor.gotoStartOfWord (False) oTextCursor.gotoEndOfWord (True) End If 'oTextRange = oCurSelection.getByIndex(0) subProcessTextRange(oTextCursor, sStyle, mResetProps) Else For i = 1 To nCount - 1 oTextRange = oCurSelection.getByIndex(i) subProcessTextRange(oTextRange, sStyle, mResetProps) Next End If End If End Sub Sub subProcessTextRange(oTextRange, sStyle, mResetProps) oTextElementEnum = oTextRange.createEnumeration While oTextElementEnum.hasMoreElements() oTextElement = oTextElementEnum.nextElement() If oTextElement.supportsService("com.sun.star.text.Paragraph") Then subProcessParagraph(oTextElement, sStyle, mResetProps) Else 'if oTextElement.supportsService("com.sun.star.text.TextTable") then subProcessTable(oTextElement, sStyle, mResetProps) End If Wend End Sub Sub subProcessTable(oTextElement, sStyle, mResetProps) mCells = oTextElement.getCellNames() For i = 0 To UBound(mCells) oCell = oTextElement.getCellByName(mCells(i)) subProcessTextRange(oCell.text, sStyle, mResetProps) Next End Sub Sub subProcessParagraph(oTextElement, sStyle, mResetProps) oCharStyles = thisComponent.styleFamilies.getByName("CharacterStyles") If Not oCharStyles.hasByName(sStyle) Then subCreateMissingStyle (sStyle) End If oPortionEnum = oTextElement.createEnumeration While oPortionEnum.hasMoreElements() oPortion = oPortionEnum.nextElement() subResetProperties(oPortion, mResetProps) mCharStyleNames = oPortion.getPropertyValue("CharStyleNames") sCharStyleNames = "" If IsEmpty(mCharStyleNames) Then sCharStyleNames = sStyle ElseIf UBound(mCharStyleNames) < 0 Then sCharStyleNames = sStyle Else sCharStyleNames = Join(mCharStyleNames, ",") & "," nLoc = InStr(sCharStyleNames, sStyle & ",") If nLoc > 0 Then sCharStyleNames = Left(sCharStyleNames, nLoc - 1) & Right(sCharStyleNames, Len(sCharStyleNames) - (nLoc + Len(sStyle))) If Right(sCharStyleNames, 1) = "," Then sCharStyleNames = Left(sCharStyleNames, Len(sCharStyleNames) - 1) Else sCharStyleNames = sCharStyleNames & sStyle End If End If mCharStyleNames = Split(sCharStyleNames, ",") If IsEmpty(mCharStyleNames) Then oPortion.setPropertyToDefault ("CharStyleNames") ElseIf UBound(mCharStyleNames) < 0 Then oPortion.setPropertyToDefault ("CharStyleNames") Else oPortion.setPropertyToDefault ("CharStyleNames") oPortion.setPropertyValue("CharStyleNames", mCharStyleNames) End If Wend End Sub Sub subResetProperties(oPortion, mResetProps) For i = 0 To UBound(mResetProps) oPortion.setPropertyToDefault (mResetProps(i)) Next End Sub --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]