solenv/clang-format/excludelist | 4 winaccessibility/source/UAccCOM/AccHyperLink.cxx | 212 +++++++++++---------- winaccessibility/source/UAccCOM/AccHyperLink.h | 62 ++---- winaccessibility/source/UAccCOM/AccHypertext.cxx | 228 +++++++++++------------ winaccessibility/source/UAccCOM/AccHypertext.h | 79 ++++--- 5 files changed, 304 insertions(+), 281 deletions(-)
New commits: commit 2244cf03057f57df8a724177c8ed1f48e83c56e0 Author: Michael Weghorn <[email protected]> AuthorDate: Mon Aug 12 16:14:15 2024 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Aug 13 07:18:27 2024 +0200 wina11y: clang-format CAccHypertext This in particular ensures that try and catch blocks are indented by an additional indentation level as expected, increasing readability. Change-Id: I82af846dfe9707895d146406b6ed79b5a1f8a467 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171798 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index b19bc15fa145..983c48ece4a0 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -15101,8 +15101,6 @@ winaccessibility/source/UAccCOM/AccActionBase.cxx winaccessibility/source/UAccCOM/AccComponent.h winaccessibility/source/UAccCOM/AccEditableText.cxx winaccessibility/source/UAccCOM/AccEditableText.h -winaccessibility/source/UAccCOM/AccHypertext.cxx -winaccessibility/source/UAccCOM/AccHypertext.h winaccessibility/source/UAccCOM/AccImage.h winaccessibility/source/UAccCOM/AccRelation.cxx winaccessibility/source/UAccCOM/AccRelation.h diff --git a/winaccessibility/source/UAccCOM/AccHypertext.cxx b/winaccessibility/source/UAccCOM/AccHypertext.cxx index c1f81c88849c..039a57667df4 100644 --- a/winaccessibility/source/UAccCOM/AccHypertext.cxx +++ b/winaccessibility/source/UAccCOM/AccHypertext.cxx @@ -18,18 +18,16 @@ */ #include "stdafx.h" -#include <UAccCOM.h> +#include <UAccCOM.h> #include "AccHypertext.h" #include "AccHyperLink.h" #include "acccommon.h" #include <vcl/svapp.hxx> - using namespace com::sun::star::accessibility; using namespace com::sun::star::uno; - /** * Get special selection. * @param startOffset Start selection offset. @@ -39,11 +37,9 @@ using namespace com::sun::star::uno; */ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::addSelection(long startOffset, long endOffset) { - return CAccTextBase::get_addSelection(startOffset, endOffset); } - /** * Get special attributes. * @param offset Offset. @@ -52,9 +48,10 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::addSelection(long startOffset, * @param textAttributes Variant to accept attributes. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_attributes(long offset, long * startOffset, long * endOffset, BSTR * textAttributes) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_attributes(long offset, long* startOffset, + long* endOffset, + BSTR* textAttributes) { - return CAccTextBase::get_attributes(offset, startOffset, endOffset, textAttributes); } @@ -63,9 +60,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_attributes(long offset, lon * @param offset Variant to accept caret offset. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_caretOffset(long * offset) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_caretOffset(long* offset) { - return CAccTextBase::get_caretOffset(offset); } @@ -78,9 +74,11 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_caretOffset(long * offset) * @param Height Variant to accept height. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_characterExtents(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_characterExtents(long offset, + IA2CoordinateType coordType, + long* x, long* y, long* width, + long* height) { - return CAccTextBase::get_characterExtents(offset, coordType, x, y, width, height); } @@ -89,9 +87,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_characterExtents(long offse * @param nSelections Variant to accept selections count. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_nSelections(long * nSelections) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_nSelections(long* nSelections) { - return CAccTextBase::get_nSelections(nSelections); } @@ -103,7 +100,9 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_nSelections(long * nSelecti * @param offset Variant to accept offset. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_offsetAtPoint(long x, long y, IA2CoordinateType coordType, long * offset) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_offsetAtPoint(long x, long y, + IA2CoordinateType coordType, + long* offset) { return CAccTextBase::get_offsetAtPoint(x, y, coordType, offset); } @@ -115,9 +114,9 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_offsetAtPoint(long x, long * @param endOffset Variant to accept the end offset of special selection. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_selection(long selection, long * startOffset, long * endOffset) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_selection(long selection, long* startOffset, + long* endOffset) { - return CAccTextBase::get_selection(selection, startOffset, endOffset); } @@ -128,9 +127,9 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_selection(long selection, l * @param text Variant to accept the text of special range. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_text(long startOffset, long endOffset, BSTR * text) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_text(long startOffset, long endOffset, + BSTR* text) { - return CAccTextBase::get_text(startOffset, endOffset, text); } @@ -143,11 +142,10 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_text(long startOffset, long * @param text Variant to accept the special text. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textBeforeOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textBeforeOffset( + long offset, IA2TextBoundaryType boundaryType, long* startOffset, long* endOffset, BSTR* text) { - - return CAccTextBase::get_textBeforeOffset(offset, boundaryType, - startOffset, endOffset, text); + return CAccTextBase::get_textBeforeOffset(offset, boundaryType, startOffset, endOffset, text); } /** @@ -159,11 +157,10 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textBeforeOffset(long offse * @param text Variant to accept the special text. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textAfterOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textAfterOffset( + long offset, IA2TextBoundaryType boundaryType, long* startOffset, long* endOffset, BSTR* text) { - - return CAccTextBase::get_textAfterOffset(offset, boundaryType, - startOffset, endOffset, text); + return CAccTextBase::get_textAfterOffset(offset, boundaryType, startOffset, endOffset, text); } /** @@ -175,11 +172,12 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textAfterOffset(long offset * @param text Variant to accept the special text. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textAtOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textAtOffset(long offset, + IA2TextBoundaryType boundaryType, + long* startOffset, + long* endOffset, BSTR* text) { - - return CAccTextBase::get_textAtOffset(offset, boundaryType, - startOffset, endOffset, text); + return CAccTextBase::get_textAtOffset(offset, boundaryType, startOffset, endOffset, text); } /** @@ -190,7 +188,6 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textAtOffset(long offset, I */ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::removeSelection(long selectionIndex) { - return CAccTextBase::removeSelection(selectionIndex); } @@ -202,7 +199,6 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::removeSelection(long selectionI */ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::setCaretOffset(long offset) { - return CAccTextBase::setCaretOffset(offset); } @@ -214,11 +210,10 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::setCaretOffset(long offset) * @param success Variant to accept the method called result. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::setSelection(long selectionIndex, long startOffset, long endOffset) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::setSelection(long selectionIndex, long startOffset, + long endOffset) { - - return CAccTextBase::setSelection(selectionIndex, startOffset, - endOffset); + return CAccTextBase::setSelection(selectionIndex, startOffset, endOffset); } /** @@ -226,18 +221,17 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::setSelection(long selectionInde * @param nCharacters Variant to accept the characters count. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_nCharacters(long * nCharacters) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_nCharacters(long* nCharacters) { - return CAccTextBase::get_nCharacters(nCharacters); } -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_newText( IA2TextSegment *newText) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_newText(IA2TextSegment* newText) { return CAccTextBase::get_newText(newText); } -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_oldText( IA2TextSegment *oldText) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_oldText(IA2TextSegment* oldText) { return CAccTextBase::get_oldText(oldText); } @@ -248,15 +242,15 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_oldText( IA2TextSegment *ol * @param endIndex End index of sub string. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::scrollSubstringToPoint(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y ) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::scrollSubstringToPoint( + long startIndex, long endIndex, enum IA2CoordinateType coordinateType, long x, long y) { - return CAccTextBase::scrollSubstringToPoint(startIndex, endIndex, coordinateType, x, y); } -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::scrollSubstringTo(long startIndex, long endIndex,enum IA2ScrollType scrollType) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::scrollSubstringTo(long startIndex, long endIndex, + enum IA2ScrollType scrollType) { - - return CAccTextBase::scrollSubstringTo(startIndex, endIndex,scrollType); + return CAccTextBase::scrollSubstringTo(startIndex, endIndex, scrollType); } /** @@ -264,24 +258,27 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::scrollSubstringTo(long startInd * @param hyperlinkCount Variant to accept hyperlink count. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_nHyperlinks(long *hyperlinkCount) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_nHyperlinks(long* hyperlinkCount) { SolarMutexGuard g; - try { + try + { + if (hyperlinkCount == nullptr) + return E_INVALIDARG; - if(hyperlinkCount == nullptr) - return E_INVALIDARG; + if (!pHyperText.is()) + { + return E_FAIL; + } - if(!pHyperText.is()) + *hyperlinkCount = pHyperText->getHyperLinkCount(); + return S_OK; + } + catch (...) { return E_FAIL; } - - *hyperlinkCount = pHyperText->getHyperLinkCount(); - return S_OK; - - } catch(...) { return E_FAIL; } } /** @@ -290,45 +287,49 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_nHyperlinks(long *hyperlink * @param hyperlink Variant to accept special hyperlink via index. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_hyperlink(long index,IAccessibleHyperlink **hyperlink) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_hyperlink(long index, + IAccessibleHyperlink** hyperlink) { SolarMutexGuard g; - try { - - if(hyperlink == nullptr) - return E_INVALIDARG; - - if(!pHyperText.is()) + try { - return E_FAIL; - } + if (hyperlink == nullptr) + return E_INVALIDARG; - Reference<XAccessibleHyperlink> pRLink = pHyperText->getHyperLink(index); - if(!pRLink.is()) - { - *hyperlink = nullptr; - return E_FAIL; - } + if (!pHyperText.is()) + { + return E_FAIL; + } - IAccessibleHyperlink* plink = nullptr; - HRESULT hr = createInstance<CAccHyperLink>(IID_IAccessibleHyperlink, &plink); - if( SUCCEEDED(hr) ) - { - IUNOXWrapper* wrapper = nullptr; - plink->QueryInterface(IID_IUNOXWrapper, reinterpret_cast<void**>(&wrapper)); - if(wrapper) + Reference<XAccessibleHyperlink> pRLink = pHyperText->getHyperLink(index); + if (!pRLink.is()) { - wrapper->put_XSubInterface(reinterpret_cast<hyper>(pRLink.get())); - wrapper->Release(); + *hyperlink = nullptr; + return E_FAIL; } - *hyperlink = plink; - return S_OK; - } - return E_FAIL; + IAccessibleHyperlink* plink = nullptr; + HRESULT hr = createInstance<CAccHyperLink>(IID_IAccessibleHyperlink, &plink); + if (SUCCEEDED(hr)) + { + IUNOXWrapper* wrapper = nullptr; + plink->QueryInterface(IID_IUNOXWrapper, reinterpret_cast<void**>(&wrapper)); + if (wrapper) + { + wrapper->put_XSubInterface(reinterpret_cast<hyper>(pRLink.get())); + wrapper->Release(); + } + *hyperlink = plink; + return S_OK; + } - } catch(...) { return E_FAIL; } + return E_FAIL; + } + catch (...) + { + return E_FAIL; + } } /** @@ -337,24 +338,28 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_hyperlink(long index,IAcces * @param hyperlinkIndex Variant to accept special hyperlink index. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_hyperlinkIndex(long charIndex, long *hyperlinkIndex) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_hyperlinkIndex(long charIndex, + long* hyperlinkIndex) { SolarMutexGuard g; - try { + try + { + if (hyperlinkIndex == nullptr) + return E_INVALIDARG; - if(hyperlinkIndex == nullptr) - return E_INVALIDARG; + if (!pHyperText.is()) + { + return E_FAIL; + } - if(!pHyperText.is()) + *hyperlinkIndex = pHyperText->getHyperLinkIndex(charIndex); + return S_OK; + } + catch (...) { return E_FAIL; } - - *hyperlinkIndex = pHyperText->getHyperLinkIndex(charIndex); - return S_OK; - - } catch(...) { return E_FAIL; } } /** @@ -366,25 +371,28 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::put_XInterface(hyper pXInterfac { // internal IUNOXWrapper - no mutex meeded - try { - - CAccTextBase::put_XInterface(pXInterface); - //special query. - if(pUNOInterface == nullptr) - return E_FAIL; - Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); - if( !pRContext.is() ) + try + { + CAccTextBase::put_XInterface(pXInterface); + //special query. + if (pUNOInterface == nullptr) + return E_FAIL; + Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); + if (!pRContext.is()) + { + return E_FAIL; + } + Reference<XAccessibleHypertext> pRXI(pRContext, UNO_QUERY); + if (!pRXI.is()) + pHyperText = nullptr; + else + pHyperText = pRXI.get(); + return S_OK; + } + catch (...) { return E_FAIL; } - Reference<XAccessibleHypertext> pRXI(pRContext,UNO_QUERY); - if( !pRXI.is() ) - pHyperText = nullptr; - else - pHyperText = pRXI.get(); - return S_OK; - - } catch(...) { return E_FAIL; } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/source/UAccCOM/AccHypertext.h b/winaccessibility/source/UAccCOM/AccHypertext.h index 3a6dccfb12a1..b7ba97ce76b7 100644 --- a/winaccessibility/source/UAccCOM/AccHypertext.h +++ b/winaccessibility/source/UAccCOM/AccHypertext.h @@ -19,7 +19,7 @@ #pragma once -#include "Resource.h" // main symbols +#include "Resource.h" // main symbols #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleHypertext.hpp> @@ -28,22 +28,19 @@ /** * CAccHypertext implements IAccessibleHypertext interface. */ -class ATL_NO_VTABLE CAccHypertext : - public CComObjectRoot, - public CComCoClass<CAccHypertext,&CLSID_AccHypertext>, - public IAccessibleHypertext, - public CAccTextBase +class ATL_NO_VTABLE CAccHypertext : public CComObjectRoot, + public CComCoClass<CAccHypertext, &CLSID_AccHypertext>, + public IAccessibleHypertext, + public CAccTextBase { public: - CAccHypertext() - { - } + CAccHypertext() {} BEGIN_COM_MAP(CAccHypertext) COM_INTERFACE_ENTRY(IAccessibleText) COM_INTERFACE_ENTRY(IAccessibleHypertext) COM_INTERFACE_ENTRY(IUNOXWrapper) - COM_INTERFACE_ENTRY_FUNC_BLIND(0,SmartQI_) + COM_INTERFACE_ENTRY_FUNC_BLIND(0, SmartQI_) #if defined __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winconsistent-missing-override" @@ -53,16 +50,15 @@ public: #pragma clang diagnostic pop #endif - static HRESULT WINAPI SmartQI_(void* pv, - REFIID iid, void** ppvObject, DWORD_PTR) + static HRESULT WINAPI SmartQI_(void* pv, REFIID iid, void** ppvObject, DWORD_PTR) { - return static_cast<CAccHypertext*>(pv)->SmartQI(iid,ppvObject); + return static_cast<CAccHypertext*>(pv)->SmartQI(iid, ppvObject); } HRESULT SmartQI(REFIID iid, void** ppvObject) { - if( m_pOuterUnknown ) - return OuterQueryInterface(iid,ppvObject); + if (m_pOuterUnknown) + return OuterQueryInterface(iid, ppvObject); return E_FAIL; } @@ -72,39 +68,49 @@ public: // IAccessibleText // Adds a text selection. - STDMETHOD(addSelection)(long startOffset, long endOffset) override;//, unsigned char * success) + STDMETHOD(addSelection)(long startOffset, long endOffset) override; //, unsigned char * success) // Gets text attributes. - STDMETHOD(get_attributes)(long offset, long * startOffset, long * endOffset, BSTR * textAttributes) override; + STDMETHOD(get_attributes) + (long offset, long* startOffset, long* endOffset, BSTR* textAttributes) override; // Gets caret offset. - STDMETHOD(get_caretOffset)(long * offset) override; + STDMETHOD(get_caretOffset)(long* offset) override; // Gets bounding rect containing the glyph(s) representing the character // at the specified text offset - STDMETHOD(get_characterExtents)(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height) override; + STDMETHOD(get_characterExtents) + (long offset, IA2CoordinateType coordType, long* x, long* y, long* width, + long* height) override; // Gets number of active non-contiguous selections. - STDMETHOD(get_nSelections)(long * nSelections) override; + STDMETHOD(get_nSelections)(long* nSelections) override; // Gets bounding rect for the glyph at a certain point. - STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long * offset) override; + STDMETHOD(get_offsetAtPoint) + (long x, long y, IA2CoordinateType coordType, long* offset) override; // Gets character offsets of N-th active text selection. - STDMETHOD(get_selection)(long selection, long * startOffset, long * endOffset) override; + STDMETHOD(get_selection)(long selection, long* startOffset, long* endOffset) override; // Gets a range of text by offset NOTE: returned string may be longer // than endOffset-startOffset bytes if text contains multi-byte characters. - STDMETHOD(get_text)(long startOffset, long endOffset, BSTR * text) override; + STDMETHOD(get_text)(long startOffset, long endOffset, BSTR* text) override; // Gets a specified amount of text that ends before a specified offset. - STDMETHOD(get_textBeforeOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text) override; + STDMETHOD(get_textBeforeOffset) + (long offset, IA2TextBoundaryType boundaryType, long* startOffset, long* endOffset, + BSTR* text) override; // Gets a specified amount of text that spans the specified offset. - STDMETHOD(get_textAfterOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text) override; + STDMETHOD(get_textAfterOffset) + (long offset, IA2TextBoundaryType boundaryType, long* startOffset, long* endOffset, + BSTR* text) override; // Gets a specified amount of text that starts after a specified offset. - STDMETHOD(get_textAtOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text) override; + STDMETHOD(get_textAtOffset) + (long offset, IA2TextBoundaryType boundaryType, long* startOffset, long* endOffset, + BSTR* text) override; // Unselects a range of text. STDMETHOD(removeSelection)(long selectionIndex) override; @@ -118,36 +124,37 @@ public: // Gets total number of characters. // NOTE: this may be different than the total number of bytes required // to store the text, if the text contains multi-byte characters. - STDMETHOD(get_nCharacters)(long * nCharacters) override; + STDMETHOD(get_nCharacters)(long* nCharacters) override; // Makes specific part of string visible on screen. - STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex,enum IA2ScrollType scrollType) override; + STDMETHOD(scrollSubstringTo) + (long startIndex, long endIndex, enum IA2ScrollType scrollType) override; - STDMETHOD(scrollSubstringToPoint)(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y ) override; + STDMETHOD(scrollSubstringToPoint) + (long startIndex, long endIndex, enum IA2CoordinateType coordinateType, long x, + long y) override; - STDMETHOD(get_newText)( IA2TextSegment *newText) override; + STDMETHOD(get_newText)(IA2TextSegment* newText) override; - STDMETHOD(get_oldText)( IA2TextSegment *oldText) override; + STDMETHOD(get_oldText)(IA2TextSegment* oldText) override; //IAccessibleHypertext // Gets the number of hyperlink. - STDMETHOD(get_nHyperlinks)(long *hyperlinkCount) override; + STDMETHOD(get_nHyperlinks)(long* hyperlinkCount) override; // Gets the hyperlink object via specified index. - STDMETHOD(get_hyperlink)(long index,IAccessibleHyperlink **hyperlink) override; + STDMETHOD(get_hyperlink)(long index, IAccessibleHyperlink** hyperlink) override; // Returns the index of the hyperlink that is associated with this // character index. - STDMETHOD(get_hyperlinkIndex)(long charIndex, long *hyperlinkIndex) override; + STDMETHOD(get_hyperlinkIndex)(long charIndex, long* hyperlinkIndex) override; // Override of IUNOXWrapper. STDMETHOD(put_XInterface)(hyper pXInterface) override; private: - css::uno::Reference<css::accessibility::XAccessibleHypertext> pHyperText; - }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit c7060bf1b2cab506a81fdfc40296f3d3e1867898 Author: Michael Weghorn <[email protected]> AuthorDate: Mon Aug 12 16:07:26 2024 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Aug 13 07:18:21 2024 +0200 wina11y: clang-format CAccHyperLink This in particular ensures that try and catch blocks are indented by an additional indentation level as expected, increasing readability. Change-Id: I8cfe89e80b9d8713a69037f1f5bda9ee7eaf782a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171797 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 93c0b5f789d1..b19bc15fa145 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -15101,8 +15101,6 @@ winaccessibility/source/UAccCOM/AccActionBase.cxx winaccessibility/source/UAccCOM/AccComponent.h winaccessibility/source/UAccCOM/AccEditableText.cxx winaccessibility/source/UAccCOM/AccEditableText.h -winaccessibility/source/UAccCOM/AccHyperLink.cxx -winaccessibility/source/UAccCOM/AccHyperLink.h winaccessibility/source/UAccCOM/AccHypertext.cxx winaccessibility/source/UAccCOM/AccHypertext.h winaccessibility/source/UAccCOM/AccImage.h diff --git a/winaccessibility/source/UAccCOM/AccHyperLink.cxx b/winaccessibility/source/UAccCOM/AccHyperLink.cxx index 40a5280c2c02..dfd32ca8ef39 100644 --- a/winaccessibility/source/UAccCOM/AccHyperLink.cxx +++ b/winaccessibility/source/UAccCOM/AccHyperLink.cxx @@ -18,7 +18,7 @@ */ #include "stdafx.h" -#include <UAccCOM.h> +#include <UAccCOM.h> #include "AccHyperLink.h" #include <vcl/svapp.hxx> @@ -36,9 +36,8 @@ using namespace com::sun::star::awt; * * @param nActions the number of action. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::nActions(/*[out,retval]*/long* nActions) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::nActions(/*[out,retval]*/ long* nActions) { - return CAccActionBase::nActions(nActions); } @@ -49,7 +48,6 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::nActions(/*[out,retval]*/long* */ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::doAction(/* [in] */ long actionIndex) { - return CAccActionBase::doAction(actionIndex); } @@ -59,21 +57,20 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::doAction(/* [in] */ long action * @param actionIndex the index of action. * @param description the description string of the specified action. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_description(long actionIndex,BSTR __RPC_FAR *description) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_description(long actionIndex, + BSTR __RPC_FAR* description) { - return CAccActionBase::get_description(actionIndex, description); } -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_name( long actionIndex, BSTR __RPC_FAR *name) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_name(long actionIndex, BSTR __RPC_FAR* name) { - return CAccActionBase::get_name(actionIndex, name); } -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_localizedName( long actionIndex, BSTR __RPC_FAR *localizedName) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_localizedName(long actionIndex, + BSTR __RPC_FAR* localizedName) { - return CAccActionBase::get_name(actionIndex, localizedName); } @@ -90,10 +87,9 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_localizedName( long actionI COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_keyBinding( /* [in] */ long actionIndex, /* [in] */ long nMaxBinding, - /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding, - /* [retval][out] */ long __RPC_FAR *nBinding) + /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR* __RPC_FAR* keyBinding, + /* [retval][out] */ long __RPC_FAR* nBinding) { - return CAccActionBase::get_keyBinding(actionIndex, nMaxBinding, keyBinding, nBinding); } @@ -102,30 +98,34 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_keyBinding( * @param * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_anchor(/* [in] */ long index, - /* [retval][out] */ VARIANT __RPC_FAR *anchor) +COM_DECLSPEC_NOTHROW STDMETHODIMP +CAccHyperLink::get_anchor(/* [in] */ long index, + /* [retval][out] */ VARIANT __RPC_FAR* anchor) { SolarMutexGuard g; - try { - - if(anchor == nullptr) + try { - return E_INVALIDARG; - } + if (anchor == nullptr) + { + return E_INVALIDARG; + } + + if (!pRXLink.is()) + { + return E_FAIL; + } + // Get Any type value via pRXLink. + css::uno::Any anyVal = GetXInterface()->getAccessibleActionAnchor(index); + // Convert Any to VARIANT. + CMAccessible::ConvertAnyToVariant(anyVal, anchor); - if(!pRXLink.is()) + return S_OK; + } + catch (...) { return E_FAIL; } - // Get Any type value via pRXLink. - css::uno::Any anyVal = GetXInterface()->getAccessibleActionAnchor(index); - // Convert Any to VARIANT. - CMAccessible::ConvertAnyToVariant(anyVal, anchor); - - return S_OK; - - } catch(...) { return E_FAIL; } } /** @@ -133,53 +133,60 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_anchor(/* [in] */ long inde * @param * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_anchorTarget(/* [in] */ long index, - /* [retval][out] */ VARIANT __RPC_FAR *anchorTarget) +COM_DECLSPEC_NOTHROW STDMETHODIMP +CAccHyperLink::get_anchorTarget(/* [in] */ long index, + /* [retval][out] */ VARIANT __RPC_FAR* anchorTarget) { SolarMutexGuard g; - try { - - if(anchorTarget == nullptr) + try { - return E_INVALIDARG; - } + if (anchorTarget == nullptr) + { + return E_INVALIDARG; + } - if(!pRXLink.is()) + if (!pRXLink.is()) + { + return E_FAIL; + } + // Get Any type value via pRXLink. + css::uno::Any anyVal = GetXInterface()->getAccessibleActionObject(index); + // Convert Any to VARIANT. + CMAccessible::ConvertAnyToVariant(anyVal, anchorTarget); + + return S_OK; + } + catch (...) { return E_FAIL; } - // Get Any type value via pRXLink. - css::uno::Any anyVal = GetXInterface()->getAccessibleActionObject(index); - // Convert Any to VARIANT. - CMAccessible::ConvertAnyToVariant(anyVal, anchorTarget); - - return S_OK; - - } catch(...) { return E_FAIL; } } - /** * Get start index. * @param index Variant to get start index. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_startIndex(/* [retval][out] */ long __RPC_FAR *index) +COM_DECLSPEC_NOTHROW STDMETHODIMP +CAccHyperLink::get_startIndex(/* [retval][out] */ long __RPC_FAR* index) { SolarMutexGuard g; - try { + try + { + if (index == nullptr) + { + return E_INVALIDARG; + } + *index = GetXInterface()->getStartIndex(); - if(index == nullptr) + return S_OK; + } + catch (...) { - return E_INVALIDARG; + return E_FAIL; } - *index = GetXInterface()->getStartIndex(); - - return S_OK; - - } catch(...) { return E_FAIL; } } /** @@ -187,26 +194,30 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_startIndex(/* [retval][out] * @param index Variant to get end index. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_endIndex(/* [retval][out] */ long __RPC_FAR *index) +COM_DECLSPEC_NOTHROW STDMETHODIMP +CAccHyperLink::get_endIndex(/* [retval][out] */ long __RPC_FAR* index) { SolarMutexGuard g; - try { - - if(index == nullptr) + try { - return E_INVALIDARG; - } + if (index == nullptr) + { + return E_INVALIDARG; + } + + if (!pRXLink.is()) + { + return E_FAIL; + } + *index = GetXInterface()->getEndIndex(); - if(!pRXLink.is()) + return S_OK; + } + catch (...) { return E_FAIL; } - *index = GetXInterface()->getEndIndex(); - - return S_OK; - - } catch(...) { return E_FAIL; } } /** @@ -214,26 +225,30 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_endIndex(/* [retval][out] * * @param valid Variant to get validity. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_valid(/* [retval][out] */ boolean __RPC_FAR *valid) +COM_DECLSPEC_NOTHROW STDMETHODIMP +CAccHyperLink::get_valid(/* [retval][out] */ boolean __RPC_FAR* valid) { SolarMutexGuard g; - try { - - if(valid == nullptr) + try { - return E_INVALIDARG; - } + if (valid == nullptr) + { + return E_INVALIDARG; + } + + if (!pRXLink.is()) + { + return E_FAIL; + } + *valid = GetXInterface()->isValid(); - if(!pRXLink.is()) + return S_OK; + } + catch (...) { return E_FAIL; } - *valid = GetXInterface()->isValid(); - - return S_OK; - - } catch(...) { return E_FAIL; } } /** @@ -245,28 +260,31 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::put_XInterface(hyper pXInterfac { // internal IUNOXWrapper - no mutex meeded - try { - - CAccActionBase::put_XInterface(pXInterface); - //special query. - if(pUNOInterface != nullptr) + try { - Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); - if( !pRContext.is() ) + CAccActionBase::put_XInterface(pXInterface); + //special query. + if (pUNOInterface != nullptr) { - return E_FAIL; + Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); + if (!pRContext.is()) + { + return E_FAIL; + } + Reference<XAccessibleHyperlink> pRXI(pRContext, UNO_QUERY); + if (!pRXI.is()) + { + pRXLink = nullptr; + } + else + pRXLink = pRXI.get(); } - Reference<XAccessibleHyperlink> pRXI(pRContext,UNO_QUERY); - if( !pRXI.is() ) - { - pRXLink = nullptr; - } - else - pRXLink = pRXI.get(); + return S_OK; + } + catch (...) + { + return E_FAIL; } - return S_OK; - - } catch(...) { return E_FAIL; } } /** diff --git a/winaccessibility/source/UAccCOM/AccHyperLink.h b/winaccessibility/source/UAccCOM/AccHyperLink.h index 42d65a833577..aa425be0fd62 100644 --- a/winaccessibility/source/UAccCOM/AccHyperLink.h +++ b/winaccessibility/source/UAccCOM/AccHyperLink.h @@ -19,7 +19,7 @@ #pragma once -#include "Resource.h" // main symbols +#include "Resource.h" // main symbols #include <com/sun/star/accessibility/XAccessibleHyperlink.hpp> #include "AccActionBase.h" @@ -28,16 +28,13 @@ /** * CAccHyperLink implements IAccessibleHyperlink interface. */ -class ATL_NO_VTABLE CAccHyperLink : - public CComObjectRoot, - public CComCoClass<CAccHyperLink,&CLSID_AccHyperLink>, - public IAccessibleHyperlink, - public CAccActionBase +class ATL_NO_VTABLE CAccHyperLink : public CComObjectRoot, + public CComCoClass<CAccHyperLink, &CLSID_AccHyperLink>, + public IAccessibleHyperlink, + public CAccActionBase { public: - CAccHyperLink() - { - } + CAccHyperLink() {} BEGIN_COM_MAP(CAccHyperLink) COM_INTERFACE_ENTRY(IAccessibleAction) @@ -54,16 +51,15 @@ public: DECLARE_NO_REGISTRY() - static HRESULT WINAPI SmartQI_(void* pv, - REFIID iid, void** ppvObject, DWORD_PTR) + static HRESULT WINAPI SmartQI_(void* pv, REFIID iid, void** ppvObject, DWORD_PTR) { - return static_cast<CAccHyperLink*>(pv)->SmartQI(iid,ppvObject); + return static_cast<CAccHyperLink*>(pv)->SmartQI(iid, ppvObject); } HRESULT SmartQI(REFIID iid, void** ppvObject) { - if( m_pOuterUnknown ) - return OuterQueryInterface(iid,ppvObject); + if (m_pOuterUnknown) + return OuterQueryInterface(iid, ppvObject); return E_FAIL; } @@ -72,49 +68,52 @@ public: // IAccessibleAction // Returns the number of action. - STDMETHOD(nActions)(/*[out,retval]*/long* nActions) override; + STDMETHOD(nActions)(/*[out,retval]*/ long* nActions) override; // Performs specified action on the object. STDMETHOD(doAction)(/* [in] */ long actionIndex) override; // get the action name - STDMETHOD(get_name)( long actionIndex, BSTR __RPC_FAR *name) override; + STDMETHOD(get_name)(long actionIndex, BSTR __RPC_FAR* name) override; // get the localized action name - STDMETHOD(get_localizedName)( long actionIndex, BSTR __RPC_FAR *localizedName) override; + STDMETHOD(get_localizedName)(long actionIndex, BSTR __RPC_FAR* localizedName) override; // Gets description of specified action. - STDMETHOD(get_description)(long actionIndex,BSTR __RPC_FAR *description) override; + STDMETHOD(get_description)(long actionIndex, BSTR __RPC_FAR* description) override; // Returns key binding object (if any) associated with specified action // key binding is string. // e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut). - STDMETHOD(get_keyBinding)( + STDMETHOD(get_keyBinding) + ( /* [in] */ long actionIndex, /* [in] */ long nMaxBinding, - /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding, - /* [retval][out] */ long __RPC_FAR *nBinding) override; + /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR* __RPC_FAR* keyBinding, + /* [retval][out] */ long __RPC_FAR* nBinding) override; // IAccessibleHyperlink // get an object, e.g. BSTR or image object, that is overloaded with link behavior - STDMETHOD(get_anchor)(/* [in] */ long index, - /* [retval][out] */ VARIANT __RPC_FAR *anchor) override; + STDMETHOD(get_anchor) + (/* [in] */ long index, + /* [retval][out] */ VARIANT __RPC_FAR* anchor) override; // get an object representing the target of the link, usually a BSTR of the URI - STDMETHOD(get_anchorTarget)(/* [in] */ long index, - /* [retval][out] */ VARIANT __RPC_FAR *anchorTarget) override; + STDMETHOD(get_anchorTarget) + (/* [in] */ long index, + /* [retval][out] */ VARIANT __RPC_FAR* anchorTarget) override; // Returns the index at which the textual representation of the // hyperlink (group) starts. - STDMETHOD(get_startIndex)(/* [retval][out] */ long __RPC_FAR *index) override; + STDMETHOD(get_startIndex)(/* [retval][out] */ long __RPC_FAR* index) override; // Returns the index at which the textual representation of the // hyperlink (group) ends. - STDMETHOD(get_endIndex)(/* [retval][out] */ long __RPC_FAR *index) override; + STDMETHOD(get_endIndex)(/* [retval][out] */ long __RPC_FAR* index) override; // Returns whether the document referenced by this links is still valid. - STDMETHOD(get_valid)(/* [retval][out] */ boolean __RPC_FAR *valid) override; + STDMETHOD(get_valid)(/* [retval][out] */ boolean __RPC_FAR* valid) override; // Override of IUNOXWrapper. STDMETHOD(put_XInterface)(hyper pXInterface) override; @@ -123,14 +122,9 @@ public: STDMETHOD(put_XSubInterface)(hyper pXSubInterface) override; private: - css::uno::Reference<css::accessibility::XAccessibleHyperlink> pRXLink; - css::accessibility::XAccessibleHyperlink* GetXInterface() - { - return pRXLink.get(); - } - + css::accessibility::XAccessibleHyperlink* GetXInterface() { return pRXLink.get(); } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
