diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-04-04 14:57:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-04-04 16:12:11 +0000 |
commit | 9ac98e6e3488e434bf4864ecfb13a121784f640b (patch) | |
tree | b3c9cbf52126fee5864be12e9109f7413e7a0878 /winaccessibility | |
parent | 6f995da5a652d993ab253b3363188cd18e289728 (diff) |
Finally switch MSVC to sal_Unicode = char16_t, too
There is lots of (Windows-only) code that relied on sal_Unicode being the same
as wchar_t, and the best change may be different in each case (and doing the
changes may be somewhat error prone). So for now add SAL_U/SAL_W scaffolding
functions to sal/types.h, remove their uses one by one again, and finally drop
those functions again.
Change-Id: I2cc791bd941d089901abb5f6fc2f05fbc49e65ea
Reviewed-on: https://gerrit.libreoffice.org/36077
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'winaccessibility')
-rw-r--r-- | winaccessibility/source/UAccCOM/AccActionBase.cxx | 4 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/AccEditableText.cxx | 60 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/AccImage.cxx | 2 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/AccTable.cxx | 4 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/AccTextBase.cxx | 10 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/MAccessible.cxx | 18 | ||||
-rw-r--r-- | winaccessibility/source/service/AccObject.cxx | 24 |
7 files changed, 61 insertions, 61 deletions
diff --git a/winaccessibility/source/UAccCOM/AccActionBase.cxx b/winaccessibility/source/UAccCOM/AccActionBase.cxx index 485dc6b5da84..5610ba4f3627 100644 --- a/winaccessibility/source/UAccCOM/AccActionBase.cxx +++ b/winaccessibility/source/UAccCOM/AccActionBase.cxx @@ -117,7 +117,7 @@ STDMETHODIMP CAccActionBase::get_description(long actionIndex,BSTR __RPC_FAR *de // #CHECK# SAFE_SYSFREESTRING(*description); - *description = SysAllocString(ouStr.getStr()); + *description = SysAllocString(SAL_W(ouStr.getStr())); return S_OK; @@ -235,7 +235,7 @@ void CAccActionBase::GetkeyBindingStrByXkeyBinding( const Sequence< KeyStroke > KeyStroke stroke = keySet[iIndex]; OLECHAR wString[64] = {NULL}; wcscat(wString, OLESTR("\n")); - wcscat(wString, &stroke.KeyChar); + wcscat(wString, SAL_W(&stroke.KeyChar)); wcscat( pString, wString); } diff --git a/winaccessibility/source/UAccCOM/AccEditableText.cxx b/winaccessibility/source/UAccCOM/AccEditableText.cxx index bf1fc69f6d3b..d676493ef58d 100644 --- a/winaccessibility/source/UAccCOM/AccEditableText.cxx +++ b/winaccessibility/source/UAccCOM/AccEditableText.cxx @@ -119,7 +119,7 @@ STDMETHODIMP CAccEditableText::insertText(long offset, BSTR * text) if( !pRXEdtTxt.is() ) return E_FAIL; - ::rtl::OUString ouStr(*text); + ::rtl::OUString ouStr(SAL_U(*text)); if( GetXInterface()->insertText( ouStr, offset ) ) return S_OK; @@ -196,7 +196,7 @@ STDMETHODIMP CAccEditableText::replaceText(long startOffset, long endOffset, BST if( !pRXEdtTxt.is() ) return E_FAIL; - ::rtl::OUString ouStr(*text); + ::rtl::OUString ouStr(SAL_U(*text)); if( GetXInterface()->replaceText( startOffset,endOffset, ouStr) ) return S_OK; @@ -225,7 +225,7 @@ STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset, B if( !pRXEdtTxt.is() ) return E_FAIL; - ::rtl::OUString ouStr(*attributes); + ::rtl::OUString ouStr(SAL_U(*attributes)); sal_Int32 nIndex = 0; sal_Unicode cTok = ';'; @@ -268,55 +268,55 @@ STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset, B */ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const ::rtl::OUString &ouValue, Any &rAny) { - if(ouName.equals(L"CharBackColor") || - ouName.equals(L"CharColor") || - ouName.equals(L"ParaAdjust") || - ouName.equals(L"ParaFirstLineIndent") || - ouName.equals(L"ParaLeftMargin") || - ouName.equals(L"ParaRightMargin") || - ouName.equals(L"ParaTopMargin") || - ouName.equals(L"ParaBottomMargin") || - ouName.equals(L"CharFontPitch") ) + if(ouName.equals(u"CharBackColor") || + ouName.equals(u"CharColor") || + ouName.equals(u"ParaAdjust") || + ouName.equals(u"ParaFirstLineIndent") || + ouName.equals(u"ParaLeftMargin") || + ouName.equals(u"ParaRightMargin") || + ouName.equals(u"ParaTopMargin") || + ouName.equals(u"ParaBottomMargin") || + ouName.equals(u"CharFontPitch") ) { // Convert to int. // NOTE: CharFontPitch is not implemented in java file. sal_Int32 nValue = ouValue.toInt32(); rAny.setValue(&nValue, cppu::UnoType<sal_Int32>::get()); } - else if(ouName.equals(L"CharShadowed") || - ouName.equals(L"CharContoured") ) + else if(ouName.equals(u"CharShadowed") || + ouName.equals(u"CharContoured") ) { // Convert to boolean. rAny <<= ouValue.toBoolean(); } - else if(ouName.equals(L"CharEscapement") || - ouName.equals(L"CharStrikeout") || - ouName.equals(L"CharUnderline") || - ouName.equals(L"CharFontPitch") ) + else if(ouName.equals(u"CharEscapement") || + ouName.equals(u"CharStrikeout") || + ouName.equals(u"CharUnderline") || + ouName.equals(u"CharFontPitch") ) { // Convert to short. short nValue = (short)ouValue.toInt32(); rAny.setValue(&nValue, cppu::UnoType<short>::get()); } - else if(ouName.equals(L"CharHeight") || - ouName.equals(L"CharWeight") ) + else if(ouName.equals(u"CharHeight") || + ouName.equals(u"CharWeight") ) { // Convert to float. float fValue = ouValue.toFloat(); rAny.setValue(&fValue, cppu::UnoType<float>::get()); } - else if(ouName.equals(L"CharFontName") ) + else if(ouName.equals(u"CharFontName") ) { // Convert to string. rAny.setValue(&ouValue, cppu::UnoType<rtl::OUString>::get()); } - else if(ouName.equals(L"CharPosture") ) + else if(ouName.equals(u"CharPosture") ) { // Convert to FontSlant. css::awt::FontSlant fontSlant = (css::awt::FontSlant)ouValue.toInt32(); rAny.setValue(&fontSlant, cppu::UnoType<css::awt::FontSlant>::get()); } - else if(ouName.equals(L"ParaTabStops") ) + else if(ouName.equals(u"ParaTabStops") ) { // Convert to the Sequence with TabStop element. @@ -328,7 +328,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const : do { // Position. - pos = ouValue.indexOf(L"Position=", pos); + pos = ouValue.indexOf(u"Position=", pos); if(pos != -1) { posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "Position=". @@ -339,7 +339,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const : pos = posComma + 1; // TabAlign. - pos = ouValue.indexOf(L"TabAlign=", pos); + pos = ouValue.indexOf(u"TabAlign=", pos); if(pos != -1) { posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=". @@ -350,7 +350,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const : pos = posComma + 1; // DecimalChar. - pos = ouValue.indexOf(L"DecimalChar=", pos); + pos = ouValue.indexOf(u"DecimalChar=", pos); if(pos != -1) { posComma = ouValue.indexOf(',', pos + 11); // 11 = length of "TabAlign=". @@ -361,7 +361,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const : pos = posComma + 1; // FillChar. - pos = ouValue.indexOf(L"FillChar=", pos); + pos = ouValue.indexOf(u"FillChar=", pos); if(pos != -1) { posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=". @@ -425,14 +425,14 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const : // Assign to Any object. rAny.setValue(&seqTabStop, cppu::UnoType<Sequence< css::style::TabStop >>::get()); } - else if(ouName.equals(L"ParaLineSpacing") ) + else if(ouName.equals(u"ParaLineSpacing") ) { // Parse value string. css::style::LineSpacing lineSpacing; ::rtl::OUString ouSubValue; sal_Int32 pos = 0, posComma = 0; - pos = ouValue.indexOf(L"Mode=", pos); + pos = ouValue.indexOf(u"Mode=", pos); if(pos != -1) { posComma = ouValue.indexOf(',', pos + 5); // 5 = length of "Mode=". @@ -442,7 +442,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const : lineSpacing.Mode = (sal_Int16)ouSubValue.toInt32(); pos = posComma + 1; - pos = ouValue.indexOf(L"Height=", pos); + pos = ouValue.indexOf(u"Height=", pos); if(pos != -1) { ouSubValue = ouValue.copy(pos + 7, ouValue.getLength() - pos - 7); diff --git a/winaccessibility/source/UAccCOM/AccImage.cxx b/winaccessibility/source/UAccCOM/AccImage.cxx index b089dece8b14..5b0e88fd47d1 100644 --- a/winaccessibility/source/UAccCOM/AccImage.cxx +++ b/winaccessibility/source/UAccCOM/AccImage.cxx @@ -56,7 +56,7 @@ STDMETHODIMP CAccImage::get_description(BSTR * description) ::rtl::OUString ouStr = GetXInterface()->getAccessibleImageDescription(); SAFE_SYSFREESTRING(*description); - *description = SysAllocString(ouStr.getStr()); + *description = SysAllocString(SAL_W(ouStr.getStr())); return S_OK; diff --git a/winaccessibility/source/UAccCOM/AccTable.cxx b/winaccessibility/source/UAccCOM/AccTable.cxx index a1de13d69353..542a40ce9398 100644 --- a/winaccessibility/source/UAccCOM/AccTable.cxx +++ b/winaccessibility/source/UAccCOM/AccTable.cxx @@ -132,7 +132,7 @@ STDMETHODIMP CAccTable::get_columnDescription(long column, BSTR * description) // #CHECK# SAFE_SYSFREESTRING(*description);//?? - *description = SysAllocString(ouStr.getStr()); + *description = SysAllocString(SAL_W(ouStr.getStr())); if(description==nullptr) return E_FAIL; return S_OK; @@ -351,7 +351,7 @@ STDMETHODIMP CAccTable::get_rowDescription(long row, BSTR * description) // #CHECK# SAFE_SYSFREESTRING(*description); - *description = SysAllocString(ouStr.getStr()); + *description = SysAllocString(SAL_W(ouStr.getStr())); if(description==nullptr) return E_FAIL; diff --git a/winaccessibility/source/UAccCOM/AccTextBase.cxx b/winaccessibility/source/UAccCOM/AccTextBase.cxx index f67bb4aefbd6..6bed720c5389 100644 --- a/winaccessibility/source/UAccCOM/AccTextBase.cxx +++ b/winaccessibility/source/UAccCOM/AccTextBase.cxx @@ -163,7 +163,7 @@ STDMETHODIMP CAccTextBase::get_attributes(long offset, long * startOffset, long { strAttrs+=L";"; } - strAttrs += pValue.Name.getStr(); + strAttrs += SAL_W(pValue.Name.getStr()); strAttrs += L":"; OLECHAR pTemp[2048] = {0}; @@ -499,7 +499,7 @@ STDMETHODIMP CAccTextBase::get_text(long startOffset, long endOffset, BSTR * tex } SysFreeString(*text); - *text = SysAllocString(ouStr.getStr()); + *text = SysAllocString(SAL_W(ouStr.getStr())); return S_OK; LEAVE_PROTECTED_BLOCK @@ -584,7 +584,7 @@ STDMETHODIMP CAccTextBase::get_textBeforeOffset(long offset, IA2TextBoundaryType TextSegment segment = GetXInterface()->getTextBeforeIndex( offset, sal_Int16(lUnoBoundaryType)); ::rtl::OUString ouStr = segment.SegmentText; SysFreeString(*text); - *text = SysAllocString(ouStr.getStr()); + *text = SysAllocString(SAL_W(ouStr.getStr())); *startOffset = segment.SegmentStart; *endOffset = segment.SegmentEnd; @@ -670,7 +670,7 @@ STDMETHODIMP CAccTextBase::get_textAfterOffset(long offset, IA2TextBoundaryType TextSegment segment = GetXInterface()->getTextBehindIndex( offset, sal_Int16(lUnoBoundaryType)); ::rtl::OUString ouStr = segment.SegmentText; SysFreeString(*text); - *text = SysAllocString(ouStr.getStr()); + *text = SysAllocString(SAL_W(ouStr.getStr())); *startOffset = segment.SegmentStart; *endOffset = segment.SegmentEnd; @@ -757,7 +757,7 @@ STDMETHODIMP CAccTextBase::get_textAtOffset(long offset, IA2TextBoundaryType bou TextSegment segment = GetXInterface()->getTextAtIndex( offset, sal_Int16(lUnoBoundaryType)); ::rtl::OUString ouStr = segment.SegmentText; SysFreeString(*text); - *text = SysAllocString(ouStr.getStr()); + *text = SysAllocString(SAL_W(ouStr.getStr())); *startOffset = segment.SegmentStart; *endOffset = segment.SegmentEnd; diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index 3c34e30a766d..ec628099aab9 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.cxx +++ b/winaccessibility/source/UAccCOM/MAccessible.cxx @@ -2736,7 +2736,7 @@ void CMAccessible::get_OLECHARFromAny(Any& pAny, OLECHAR* pChar) { ::rtl::OUString val; pAny >>= val; - wcscpy(pChar, val.getStr()); + wcscpy(pChar, SAL_W(val.getStr())); break; } case TypeClass_SEQUENCE: @@ -2754,7 +2754,7 @@ void CMAccessible::get_OLECHARFromAny(Any& pAny, OLECHAR* pChar) { pString += val[iIndex]; } - wcscpy(pChar, pString.getStr()); + wcscpy(pChar, SAL_W(pString.getStr())); } else if (pAny.getValueType() == cppu::UnoType<Sequence< css::style::TabStop >>::get()) { @@ -2817,7 +2817,7 @@ void CMAccessible::get_OLECHARFromAny(Any& pAny, OLECHAR* pChar) css::accessibility::TextSegment val; pAny >>= val; ::rtl::OUString realVal(val.SegmentText); - wcscpy(pChar, realVal.getStr()); + wcscpy(pChar, SAL_W(realVal.getStr())); } break; } @@ -2966,7 +2966,7 @@ void CMAccessible::ConvertAnyToVariant(const css::uno::Any &rAnyVal, VARIANT *pv pvData->vt = VT_BSTR; ::rtl::OUString val; rAnyVal >>= val; - pvData->bstrVal = SysAllocString(val.getStr()); + pvData->bstrVal = SysAllocString(SAL_W(val.getStr())); break; } @@ -3019,7 +3019,7 @@ void CMAccessible::ConvertAnyToVariant(const css::uno::Any &rAnyVal, VARIANT *pv case TypeClass::TypeClass_MAKE_FIXED_SIZE: // Output the type string, if there is other uno value type. pvData->vt = VT_BSTR; - pvData->bstrVal = SysAllocString(rAnyVal.getValueTypeName().getStr()); + pvData->bstrVal = SysAllocString(SAL_W(rAnyVal.getValueTypeName().getStr())); break; default: @@ -3133,9 +3133,9 @@ STDMETHODIMP CMAccessible:: get_locale( IA2Locale __RPC_FAR *locale ) return E_FAIL; css::lang::Locale unoLoc = m_xContext.get()->getLocale(); - locale->language = SysAllocString(unoLoc.Language.getStr()); - locale->country = SysAllocString(unoLoc.Country.getStr()); - locale->variant = SysAllocString(unoLoc.Variant.getStr()); + locale->language = SysAllocString(SAL_W(unoLoc.Language.getStr())); + locale->country = SysAllocString(SAL_W(unoLoc.Country.getStr())); + locale->variant = SysAllocString(SAL_W(unoLoc.Variant.getStr())); return S_OK; @@ -3222,7 +3222,7 @@ STDMETHODIMP CMAccessible::get_attributes(/*[out]*/ BSTR *pAttr) if(*pAttr) SAFE_SYSFREESTRING(*pAttr); - *pAttr = SysAllocString(val.getStr()); + *pAttr = SysAllocString(SAL_W(val.getStr())); return S_OK; } diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx index b5134c57c653..a2b1b0c26f4e 100644 --- a/winaccessibility/source/service/AccObject.cxx +++ b/winaccessibility/source/service/AccObject.cxx @@ -272,16 +272,16 @@ void AccObject::UpdateName( ) } if( ( TEXT_FRAME == m_accRole ) && ( m_pParentObj !=nullptr )&& ( SCROLL_PANE == m_pParentObj -> m_accRole ) ) - m_pIMAcc->Put_XAccName( m_pParentObj->m_xAccContextRef->getAccessibleName().getStr() ); + m_pIMAcc->Put_XAccName( SAL_W(m_pParentObj->m_xAccContextRef->getAccessibleName().getStr()) ); //IAccessibility2 Implementation 2009----- if ( PARAGRAPH == m_accRole) { ::rtl::OUString emptyStr(""); - m_pIMAcc->Put_XAccName(emptyStr.getStr()); + m_pIMAcc->Put_XAccName(SAL_W(emptyStr.getStr())); } //-----IAccessibility2 Implementation 2009 else - m_pIMAcc->Put_XAccName(m_xAccContextRef->getAccessibleName().getStr()); + m_pIMAcc->Put_XAccName(SAL_W(m_xAccContextRef->getAccessibleName().getStr())); return ; } @@ -298,7 +298,7 @@ void AccObject::UpdateDescription() return; } - m_pIMAcc->Put_XAccDescription(m_xAccContextRef->getAccessibleDescription().getStr()); + m_pIMAcc->Put_XAccDescription(SAL_W(m_xAccContextRef->getAccessibleDescription().getStr())); return ; } @@ -367,7 +367,7 @@ void AccObject::UpdateDefaultAction( ) case CHECK_BOX: case TREE_ITEM: case BUTTON_DROPDOWN: - m_pIMAcc->Put_ActionDescription( m_xAccActionRef->getAccessibleActionDescription((sal_Int32)0).getStr() ); + m_pIMAcc->Put_ActionDescription( SAL_W(m_xAccActionRef->getAccessibleActionDescription((sal_Int32)0).getStr()) ); return; } } @@ -403,19 +403,19 @@ void AccObject::SetValue( Any pAny ) { val = pRText->getText(); } - m_pIMAcc->Put_XAccValue( val.getStr() ); + m_pIMAcc->Put_XAccValue( SAL_W(val.getStr()) ); break; case TREE_ITEM: //case CHECK_BOX: //Commented by Li Xing to disable the value for general checkbox case COMBO_BOX: case NOTE: case SCROLL_BAR: - m_pIMAcc->Put_XAccValue( GetMAccessibleValueFromAny(pAny).getStr() ); + m_pIMAcc->Put_XAccValue( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) ); break ; // Added by Li Xing, only the checkbox in tree should have the value. case CHECK_BOX: if( ( m_pParentObj !=nullptr ) && (TREE == m_pParentObj->m_accRole || TREE_ITEM == m_pParentObj->m_accRole )) - m_pIMAcc->Put_XAccValue( GetMAccessibleValueFromAny(pAny).getStr() ); + m_pIMAcc->Put_XAccValue( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) ); break; default: break; @@ -501,7 +501,7 @@ void AccObject::SetName( Any pAny) if( nullptr == m_pIMAcc ) return ; - m_pIMAcc->Put_XAccName( GetMAccessibleValueFromAny(pAny).getStr() ); + m_pIMAcc->Put_XAccName( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) ); } @@ -514,7 +514,7 @@ void AccObject::SetDescription( Any pAny ) { if( nullptr == m_pIMAcc ) return ; - m_pIMAcc->Put_XAccDescription( GetMAccessibleValueFromAny(pAny).getStr() ); + m_pIMAcc->Put_XAccDescription( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) ); } /** @@ -756,7 +756,7 @@ void AccObject::UpdateActionDesc() } ::rtl::OUString pXString = m_xAccContextRef->getAccessibleDescription(); - m_pIMAcc->Put_XAccDescription(pXString.getStr()); + m_pIMAcc->Put_XAccDescription(SAL_W(pXString.getStr())); long Role = m_accRole; if( Role == PUSH_BUTTON || Role == RADIO_BUTTON || Role == MENU_ITEM || @@ -778,7 +778,7 @@ void AccObject::UpdateActionDesc() pXString = m_xAccActionRef->getAccessibleActionDescription( 0 ); //Solution: if string length is more than zero, action is set. if( pXString.getLength() > 0) - m_pIMAcc->Put_ActionDescription( pXString.getStr() ); + m_pIMAcc->Put_ActionDescription( SAL_W(pXString.getStr()) ); } } } |