1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 // AccTextBase.cpp: implementation of the CAccTextBase class.
25 #include "AccTextBase.h"
27 #include <rtl/ustrbuf.hxx>
28 #include <vcl/svapp.hxx>
29 #include <o3tl/char16_t2wchar_t.hxx>
31 #include <com/sun/star/accessibility/AccessibleTextType.hpp>
32 #include <com/sun/star/accessibility/XAccessible.hpp>
33 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
34 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
35 #include <com/sun/star/accessibility/XAccessibleTextSelection.hpp>
36 #include "MAccessible.h"
38 using namespace css::accessibility
;
39 using namespace css::uno
;
42 // Construction/Destruction
45 static OUString
ReplaceFourChar(OUString
const & oldOUString
);
47 CAccTextBase::CAccTextBase()
50 CAccTextBase::~CAccTextBase()
55 * Get special selection.
56 * @param startOffset Start selection offset.
57 * @param endOffset End selection offset.
58 * @param success Variant to accept the result of if the method call is successful.
61 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_addSelection(long startOffset
, long endOffset
)
68 if(pUNOInterface
== nullptr)
71 Reference
<XAccessibleContext
> pRContext
= pUNOInterface
->getAccessibleContext();
73 Reference
< XAccessibleTextSelection
> pRExtension(pRContext
,UNO_QUERY
);
75 if( pRExtension
.is() )
77 pRExtension
->addSelection(0, startOffset
, endOffset
);
82 GetXInterface()->setSelection(startOffset
, endOffset
);
90 * Get special attributes.
91 * @param offset Offset.
92 * @param startOffset Variant to accept start offset.
93 * @param endOffset Variant to accept end offset.
94 * @param textAttributes Variant to accept attributes.
97 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_attributes(long offset
, long * startOffset
, long * endOffset
, BSTR
* textAttributes
)
101 ENTER_PROTECTED_BLOCK
103 if (startOffset
== nullptr || endOffset
== nullptr || textAttributes
== nullptr)
105 // #CHECK XInterface#
111 if( offset
< 0 || offset
> GetXInterface()->getCharacterCount() )
114 OUStringBuffer
strAttrs("Version:1;");
116 Sequence
< css::beans::PropertyValue
> pValues
= GetXInterface()->getCharacterAttributes(offset
, Sequence
< OUString
>());
117 int nCount
= pValues
.getLength();
119 sal_Int16 numberingLevel
= 0;
120 OUString numberingPrefix
;
122 bool bHaveNumberingPrefixAttr
= false;
123 bool bHaveNumberingLevel
= false;
124 bool bHaveNumberingRules
= false;
125 for(int i
=0; i
<nCount
; i
++)
128 css::beans::PropertyValue
&pValue
= pValues
[i
];
129 if(pValue
.Name
== "NumberingLevel")
131 if (pValue
.Value
!= Any())
132 pValue
.Value
>>= numberingLevel
;
135 bHaveNumberingLevel
= true;
138 if(pValue
.Name
== "NumberingPrefix")
140 pValue
.Value
>>=numberingPrefix
;
141 bHaveNumberingPrefixAttr
= true;
144 if(pValue
.Name
== "NumberingRules")
146 bHaveNumberingRules
= true;
147 anyNumRule
= pValue
.Value
;
150 if (bHaveNumberingLevel
&& bHaveNumberingRules
&& bHaveNumberingPrefixAttr
)
152 strAttrs
.append(';');
153 numberingPrefix
= ReplaceFourChar(numberingPrefix
);
154 strAttrs
.append(CMAccessible::get_String4Numbering(anyNumRule
,numberingLevel
,numberingPrefix
));
155 bHaveNumberingLevel
= false;
156 bHaveNumberingRules
= false;
158 if( (bHaveNumberingPrefixAttr
&& i
> 1 ) ||
159 (!bHaveNumberingPrefixAttr
&& i
> 0 ) ) //element 0 is NumberingPrefix, not write alone
161 strAttrs
.append(';');
163 strAttrs
.append(pValue
.Name
);
164 strAttrs
.append(':');
166 if (pValue
.Name
== "CharBackColor" ||
167 pValue
.Name
== "CharColor" ||
168 pValue
.Name
== "CharUnderlineColor" )
170 unsigned long nColor
;
171 pValue
.Value
>>= nColor
;
172 strAttrs
.append('#');
173 OUString
const hex
= OUString::number(nColor
, 16).toAsciiUpperCase();
174 for (sal_Int32 j
= hex
.getLength(); j
< 8; ++j
) {
175 strAttrs
.append('0');
177 strAttrs
.append(hex
);
181 strAttrs
.append(CMAccessible::get_StringFromAny(pValue
.Value
));
184 strAttrs
.append(';');
187 SysFreeString(*textAttributes
);
188 *textAttributes
= SysAllocString(o3tl::toW(strAttrs
.makeStringAndClear().getStr()));
190 if( offset
< GetXInterface()->getCharacterCount() )
192 TextSegment textSeg
= GetXInterface()->getTextAtIndex(offset
, AccessibleTextType::ATTRIBUTE_RUN
);
193 *startOffset
= textSeg
.SegmentStart
;
194 *endOffset
= textSeg
.SegmentEnd
;
198 *startOffset
= offset
;
204 LEAVE_PROTECTED_BLOCK
208 * Get caret position.
209 * @param offset Variant to accept caret offset.
212 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_caretOffset(long * offset
)
216 ENTER_PROTECTED_BLOCK
218 if (offset
== nullptr)
220 // #CHECK XInterface#
227 *offset
= GetXInterface()->getCaretPosition();
230 LEAVE_PROTECTED_BLOCK
234 * Get character count.
235 * @param nCharacters Variant to accept character count.
238 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_characterCount(long * nCharacters
)
242 ENTER_PROTECTED_BLOCK
244 if (nCharacters
== nullptr)
246 // #CHECK XInterface#
253 *nCharacters
= GetXInterface()->getCharacterCount();
256 LEAVE_PROTECTED_BLOCK
260 * Get character extents.
261 * @param offset Offset.
262 * @param x Variant to accept x position.
263 * @param y Variant to accept y position.
264 * @param width Variant to accept width.
265 * @param Height Variant to accept height.
268 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_characterExtents(long offset
, IA2CoordinateType coordType
, long * x
, long * y
, long * width
, long * height
)
272 ENTER_PROTECTED_BLOCK
274 if (x
== nullptr || height
== nullptr || y
== nullptr || width
== nullptr)
276 // #CHECK XInterface#
280 if(offset
< 0 || offset
> GetXInterface()->getCharacterCount() )
283 css::awt::Rectangle rectangle
;
284 rectangle
= GetXInterface()->getCharacterBounds(offset
);
287 css::awt::Point aPoint
;
289 Reference
<XAccessibleContext
> pRContext
= pUNOInterface
->getAccessibleContext();
290 if( !pRContext
.is() )
294 Reference
<XAccessibleComponent
> pRComp(pRContext
,UNO_QUERY
);
297 if(coordType
== IA2_COORDTYPE_SCREEN_RELATIVE
)
299 css::awt::Point pt
= pRComp
->getLocationOnScreen();
303 else if(coordType
== IA2_COORDTYPE_PARENT_RELATIVE
)
305 css::awt::Point pt
= pRComp
->getLocation();
310 rectangle
.X
= rectangle
.X
+ aPoint
.X
;
311 rectangle
.Y
= rectangle
.Y
+ aPoint
.Y
;
316 // GetXInterface()->getCharacterBounds() have different implement in different acc component
317 // But we need return the width/height == 1 for every component when offset == text length.
318 // So we ignore the return result of GetXInterface()->getCharacterBounds() when offset == text length.
319 if( offset
== GetXInterface()->getCharacterCount() )
326 *width
= rectangle
.Width
;
327 *height
= rectangle
.Height
;
332 LEAVE_PROTECTED_BLOCK
336 * Get selections count.
337 * @param nSelections Variant to accept selections count.
340 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_nSelections(long * nSelections
)
344 ENTER_PROTECTED_BLOCK
346 if (nSelections
== nullptr)
348 // #CHECK XInterface#
349 if(pUNOInterface
== nullptr)
355 Reference
<XAccessibleContext
> pRContext
= pUNOInterface
->getAccessibleContext();
357 Reference
< XAccessibleTextSelection
> pRExtension(pRContext
,UNO_QUERY
);
359 if( pRExtension
.is() )
361 *nSelections
= pRExtension
->getSelectedPortionCount();
365 long iLength
= GetXInterface()->getSelectedText().getLength();
375 LEAVE_PROTECTED_BLOCK
379 * Get offset of some special point.
380 * @param x X position of one point.
381 * @param x Y position of one point.
382 * @param coordType Type.
383 * @param offset Variant to accept offset.
386 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_offsetAtPoint(long x
, long y
, IA2CoordinateType
, long * offset
)
390 ENTER_PROTECTED_BLOCK
392 if (offset
== nullptr)
394 // #CHECK XInterface#
398 css::awt::Point point
;
401 *offset
= GetXInterface()->getIndexAtPoint(point
);
404 LEAVE_PROTECTED_BLOCK
408 * Get selection range.
409 * @param selection selection count.
410 * @param startOffset Variant to accept the start offset of special selection.
411 * @param endOffset Variant to accept the end offset of special selection.
415 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_selection(long selectionIndex
, long * startOffset
, long * endOffset
)
419 ENTER_PROTECTED_BLOCK
421 if (startOffset
== nullptr || endOffset
== nullptr )
423 // #CHECK XInterface#
424 if(pUNOInterface
== nullptr )
428 get_nSelections(&nSelection
);
430 if(selectionIndex
>= nSelection
|| selectionIndex
< 0 )
433 Reference
<XAccessibleContext
> pRContext
= pUNOInterface
->getAccessibleContext();
435 Reference
< XAccessibleTextSelection
> pRExtension(pRContext
,UNO_QUERY
);
437 if( pRExtension
.is() )
439 *startOffset
= pRExtension
->getSeletedPositionStart(selectionIndex
);
440 *endOffset
= pRExtension
->getSeletedPositionEnd(selectionIndex
);
443 else if(GetXInterface()->getSelectionEnd() > -1)
445 *startOffset
= GetXInterface()->getSelectionStart();
446 *endOffset
= GetXInterface()->getSelectionEnd();
454 LEAVE_PROTECTED_BLOCK
459 * @param startOffset Start position of special range.
460 * @param endOffset End position of special range.
461 * @param text Variant to accept the text of special range.
464 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_text(long startOffset
, long endOffset
, BSTR
* text
)
468 ENTER_PROTECTED_BLOCK
472 // #CHECK XInterface#
476 if (endOffset
< -1 || endOffset
< startOffset
)
482 if (endOffset
== -1 )
485 if(SUCCEEDED(get_characterCount(&nLen
)))
487 ouStr
= GetXInterface()->getTextRange( 0, nLen
);
492 ouStr
= GetXInterface()->getTextRange( startOffset
, endOffset
);
495 SysFreeString(*text
);
496 *text
= SysAllocString(o3tl::toW(ouStr
.getStr()));
499 LEAVE_PROTECTED_BLOCK
503 * Get special text before some position.
504 * @param offset Special position.
505 * @param boundaryType Boundary type.
506 * @param startOffset Variant to accept the start offset.
507 * @param endOffset Variant to accept the end offset.
508 * @param text Variant to accept the special text.
511 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_textBeforeOffset(long offset
, IA2TextBoundaryType boundaryType
, long * startOffset
, long * endOffset
, BSTR
* text
)
515 ENTER_PROTECTED_BLOCK
518 if (startOffset
== nullptr || endOffset
== nullptr || text
== nullptr)
520 // #CHECK XInterface#
524 // In New UNO IAccessibleText.idl these constant values are defined as follows:
526 // const long TEXT_BOUNDARY_CHAR = -1;
527 // const long TEXT_BOUNDARY_TO_CURSOR_POS = -2;
528 // const long TEXT_BOUNDARY_START_OF_WORD = -3;
529 // const long TEXT_BOUNDARY_END_OF_WORD = -4;
530 // const long TEXT_BOUNDARY_START_OF_SENTENCE = -5;
531 // const long TEXT_BOUNDARY_END_OF_SENTENCE = -6;
532 // const long TEXT_BOUNDARY_START_OF_LINE = -7;
533 // const long TEXT_BOUNDARY_END_OF_LINE = -8;
535 // In UNO, the corresponding values are as follows:
537 // const short CHARACTER = 1;
538 // const short WORD = 2;
539 // const short SENTENCE = 3;
540 // const short PARAGRAPH = 4;
541 // const short LINE = 5;
542 // const short GLYPH = 6;
543 // const short ATTRIBUTE_RUN = 7;
546 long lUnoBoundaryType
;
550 case IA2_TEXT_BOUNDARY_CHAR
:
551 lUnoBoundaryType
= 1; // CHARACTER;
553 case IA2_TEXT_BOUNDARY_WORD
:
554 lUnoBoundaryType
= 2; // WORD;
556 case IA2_TEXT_BOUNDARY_SENTENCE
:
557 lUnoBoundaryType
= 3; // SENTENCE;
559 case IA2_TEXT_BOUNDARY_LINE
:
560 lUnoBoundaryType
= 5; // LINE;
562 case IA2_TEXT_BOUNDARY_PARAGRAPH
:
563 lUnoBoundaryType
= 4;
565 case IA2_TEXT_BOUNDARY_ALL
:
568 get_nCharacters( &nChar
);
571 return get_text(0, nChar
, text
);
578 TextSegment segment
= GetXInterface()->getTextBeforeIndex( offset
, sal_Int16(lUnoBoundaryType
));
579 OUString ouStr
= segment
.SegmentText
;
580 SysFreeString(*text
);
581 *text
= SysAllocString(o3tl::toW(ouStr
.getStr()));
582 *startOffset
= segment
.SegmentStart
;
583 *endOffset
= segment
.SegmentEnd
;
587 LEAVE_PROTECTED_BLOCK
591 * Get special text after some position.
592 * @param offset Special position.
593 * @param boundaryType Boundary type.
594 * @param startOffset Variant to accept the start offset.
595 * @param endOffset Variant to accept the end offset.
596 * @param text Variant to accept the special text.
599 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_textAfterOffset(long offset
, IA2TextBoundaryType boundaryType
, long * startOffset
, long * endOffset
, BSTR
* text
)
603 ENTER_PROTECTED_BLOCK
605 if (startOffset
== nullptr || endOffset
== nullptr || text
== nullptr)
607 // #CHECK XInterface#
611 // In New UNO IAccessibleText.idl these constant values are defined as follows:
613 // const long TEXT_BOUNDARY_CHAR = -1;
614 // const long TEXT_BOUNDARY_TO_CURSOR_POS = -2;
615 // const long TEXT_BOUNDARY_START_OF_WORD = -3;
616 // const long TEXT_BOUNDARY_END_OF_WORD = -4;
617 // const long TEXT_BOUNDARY_START_OF_SENTENCE = -5;
618 // const long TEXT_BOUNDARY_END_OF_SENTENCE = -6;
619 // const long TEXT_BOUNDARY_START_OF_LINE = -7;
620 // const long TEXT_BOUNDARY_END_OF_LINE = -8;
622 // In UNO, the corresponding values are as follows:
624 // const short CHARACTER = 1;
625 // const short WORD = 2;
626 // const short SENTENCE = 3;
627 // const short PARAGRAPH = 4;
628 // const short LINE = 5;
629 // const short GLYPH = 6;
630 // const short ATTRIBUTE_RUN = 7;
633 long lUnoBoundaryType
;
636 case IA2_TEXT_BOUNDARY_CHAR
:
637 lUnoBoundaryType
= 1; // CHARACTER;
639 case IA2_TEXT_BOUNDARY_WORD
:
640 lUnoBoundaryType
= 2; // WORD;
642 case IA2_TEXT_BOUNDARY_SENTENCE
:
643 lUnoBoundaryType
= 3; // SENTENCE;
645 case IA2_TEXT_BOUNDARY_LINE
:
646 lUnoBoundaryType
= 5; // LINE;
648 case IA2_TEXT_BOUNDARY_PARAGRAPH
:
649 lUnoBoundaryType
= 4;
651 case IA2_TEXT_BOUNDARY_ALL
:
654 get_nCharacters( &nChar
);
657 return get_text(0, nChar
, text
);
664 TextSegment segment
= GetXInterface()->getTextBehindIndex( offset
, sal_Int16(lUnoBoundaryType
));
665 OUString ouStr
= segment
.SegmentText
;
666 SysFreeString(*text
);
667 *text
= SysAllocString(o3tl::toW(ouStr
.getStr()));
668 *startOffset
= segment
.SegmentStart
;
669 *endOffset
= segment
.SegmentEnd
;
673 LEAVE_PROTECTED_BLOCK
677 * Get special text at some position.
678 * @param offset Special position.
679 * @param boundaryType Boundary type.
680 * @param startOffset Variant to accept the start offset.
681 * @param endOffset Variant to accept the end offset.
682 * @param text Variant to accept the special text.
685 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_textAtOffset(long offset
, IA2TextBoundaryType boundaryType
, long * startOffset
, long * endOffset
, BSTR
* text
)
689 ENTER_PROTECTED_BLOCK
691 if (startOffset
== nullptr || text
== nullptr ||endOffset
== nullptr)
693 // #CHECK XInterface#
697 // In New UNO IAccessibleText.idl these constant values are defined as follows:
699 // const long TEXT_BOUNDARY_CHAR = -1;
700 // const long TEXT_BOUNDARY_TO_CURSOR_POS = -2;
701 // const long TEXT_BOUNDARY_START_OF_WORD = -3;
702 // const long TEXT_BOUNDARY_END_OF_WORD = -4;
703 // const long TEXT_BOUNDARY_START_OF_SENTENCE = -5;
704 // const long TEXT_BOUNDARY_END_OF_SENTENCE = -6;
705 // const long TEXT_BOUNDARY_START_OF_LINE = -7;
706 // const long TEXT_BOUNDARY_END_OF_LINE = -8;
708 // In UNO, the corresponding values are as follows:
710 // const short CHARACTER = 1;
711 // const short WORD = 2;
712 // const short SENTENCE = 3;
713 // const short PARAGRAPH = 4;
714 // const short LINE = 5;
715 // const short GLYPH = 6;
716 // const short ATTRIBUTE_RUN = 7;
719 long lUnoBoundaryType
;
723 case IA2_TEXT_BOUNDARY_CHAR
:
724 lUnoBoundaryType
= 1; // CHARACTER;
726 case IA2_TEXT_BOUNDARY_WORD
:
727 lUnoBoundaryType
= 2; // WORD;
729 case IA2_TEXT_BOUNDARY_SENTENCE
:
730 lUnoBoundaryType
= 3; // SENTENCE;
732 case IA2_TEXT_BOUNDARY_LINE
:
733 lUnoBoundaryType
= 5; // LINE;
735 case IA2_TEXT_BOUNDARY_PARAGRAPH
:
736 lUnoBoundaryType
= 4;
738 case IA2_TEXT_BOUNDARY_ALL
:
741 get_nCharacters( &nChar
);
744 return get_text(0, nChar
, text
);
751 TextSegment segment
= GetXInterface()->getTextAtIndex( offset
, sal_Int16(lUnoBoundaryType
));
752 OUString ouStr
= segment
.SegmentText
;
753 SysFreeString(*text
);
754 *text
= SysAllocString(o3tl::toW(ouStr
.getStr()));
755 *startOffset
= segment
.SegmentStart
;
756 *endOffset
= segment
.SegmentEnd
;
760 LEAVE_PROTECTED_BLOCK
765 * @param selectionIndex Special selection index
766 * @param success Variant to accept the memthod called result.
769 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::removeSelection(long selectionIndex
)
773 ENTER_PROTECTED_BLOCK
775 // #CHECK XInterface#
776 if(pUNOInterface
== nullptr)
781 Reference
<XAccessibleContext
> pRContext
= pUNOInterface
->getAccessibleContext();
783 Reference
< XAccessibleTextSelection
> pRExtension(pRContext
,UNO_QUERY
);
785 if( pRExtension
.is() )
787 pRExtension
->removeSelection(selectionIndex
);
792 GetXInterface()->setSelection(0, 0);
796 LEAVE_PROTECTED_BLOCK
800 * Set caret position.
801 * @param offset Special position.
802 * @param success Variant to accept the memthod called result.
805 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::setCaretOffset(long offset
)
809 ENTER_PROTECTED_BLOCK
811 // #CHECK XInterface#
815 GetXInterface()->setCaretPosition( offset
);
819 LEAVE_PROTECTED_BLOCK
823 * Set special selection.
824 * @param selectionIndex Special selection index.
825 * @param startOffset start position.
826 * @param endOffset end position.
827 * @param success Variant to accept the memthod called result.
830 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::setSelection(long, long startOffset
, long endOffset
)
834 ENTER_PROTECTED_BLOCK
836 // #CHECK XInterface#
842 GetXInterface()->setSelection( startOffset
, endOffset
);
846 LEAVE_PROTECTED_BLOCK
850 * Get characters count.
851 * @param nCharacters Variant to accept the characters count.
854 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_nCharacters(long * nCharacters
)
858 ENTER_PROTECTED_BLOCK
860 if (nCharacters
== nullptr)
862 // #CHECK XInterface#
869 *nCharacters
= GetXInterface()->getCharacterCount();
873 LEAVE_PROTECTED_BLOCK
876 // added by qiuhd, 2006/07/03, for direver 07/11
877 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_newText( IA2TextSegment
*)
882 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::get_oldText( IA2TextSegment
*)
888 * Scroll to special sub-string .
889 * @param startIndex Start index of sub string.
890 * @param endIndex End index of sub string.
893 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::scrollSubstringToPoint(long, long, IA2CoordinateType
, long, long )
898 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::scrollSubstringTo(long, long, IA2ScrollType
)
905 * @param pXInterface UNO interface.
908 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccTextBase::put_XInterface(hyper pXInterface
)
910 // internal IUNOXWrapper - no mutex meeded
912 ENTER_PROTECTED_BLOCK
914 CUNOXWrapper::put_XInterface(pXInterface
);
916 if(pUNOInterface
== nullptr)
918 Reference
<XAccessibleContext
> pRContext
= pUNOInterface
->getAccessibleContext();
919 if( !pRContext
.is() )
923 Reference
<XAccessibleText
> pRXI(pRContext
,UNO_QUERY
);
930 LEAVE_PROTECTED_BLOCK
933 static OUString
ReplaceOneChar(OUString
const & oldOUString
, OUString
const & replacedChar
, OUString
const & replaceStr
)
935 auto s
= oldOUString
;
936 int iReplace
= s
.lastIndexOf(replacedChar
);
941 s
= s
.replaceAt(iReplace
,1, replaceStr
);
942 iReplace
=s
.lastIndexOf(replacedChar
,iReplace
);
948 static OUString
ReplaceFourChar(OUString
const & oldOUString
)
950 auto s
= oldOUString
;
951 s
= ReplaceOneChar(s
, "\\", "\\\\");
952 s
= ReplaceOneChar(s
, ";", "\\;");
953 s
= ReplaceOneChar(s
, "=", "\\=");
954 s
= ReplaceOneChar(s
, ",", "\\,");
955 s
= ReplaceOneChar(s
, ":", "\\:");
959 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */