Avoid potential negative array index access to cached text.
[LibreOffice.git] / winaccessibility / source / UAccCOM / AccComponent.h
blob9a620a5231b85a5eb3e13e88ef29d88113ec1a16
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #pragma once
22 #include "Resource.h" // main symbols
24 #include <com/sun/star/accessibility/XAccessible.hpp>
25 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
26 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
27 #include "UNOXWrapper.h"
28 #include "AccComponentBase.h"
31 /**
32 * CAccComponent implements IAccessibleComponent interface.
34 class ATL_NO_VTABLE CAccComponent :
35 public CComObjectRoot,
36 public CComCoClass<CAccComponent,&CLSID_AccComponent>,
37 public IAccessibleComponent,
38 public CAccComponentBase
40 public:
41 CAccComponent()
45 BEGIN_COM_MAP(CAccComponent)
46 COM_INTERFACE_ENTRY(IAccessibleComponent)
47 COM_INTERFACE_ENTRY(IUNOXWrapper)
48 COM_INTERFACE_ENTRY_FUNC_BLIND(0,SmartQI_)
49 #if defined __clang__
50 #pragma clang diagnostic push
51 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
52 #endif
53 END_COM_MAP()
54 #if defined __clang__
55 #pragma clang diagnostic pop
56 #endif
58 static HRESULT WINAPI SmartQI_(void* pv,
59 REFIID iid, void** ppvObject, DWORD_PTR)
61 return static_cast<CAccComponent*>(pv)->SmartQI(iid,ppvObject);
64 HRESULT SmartQI(REFIID iid, void** ppvObject)
66 if( m_pOuterUnknown )
67 return OuterQueryInterface(iid,ppvObject);
68 return E_FAIL;
71 DECLARE_NO_REGISTRY()
73 public:
74 // IAccessibleComponent
76 // Returns the location of the upper left corner of the object's bounding
77 // box relative to the parent.
78 STDMETHOD(get_locationInParent)(long *x, long *y) override;
80 // Returns the foreground color of this object.
81 STDMETHOD(get_foreground)(IA2Color * foreground) override;
83 // Returns the background color of this object.
84 STDMETHOD(get_background)(IA2Color * background) override;
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */