tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / chart2 / source / controller / accessibility / AccessibleTextHelper.cxx
bloba117186f4521bebaf3b72fd186a76e7f99604362
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 #include <sal/config.h>
22 #include <memory>
24 #include <AccessibleTextHelper.hxx>
25 #include <DrawViewWrapper.hxx>
27 #include <vcl/svapp.hxx>
29 #include <svx/AccessibleTextHelper.hxx>
30 #include <svx/unoshtxt.hxx>
31 #include <toolkit/helper/vclunohelper.hxx>
32 #include <vcl/window.hxx>
34 #include <com/sun/star/awt/XWindow.hpp>
35 #include <com/sun/star/accessibility/AccessibleRole.hpp>
36 #include <osl/diagnose.h>
38 using namespace ::com::sun::star;
39 using namespace ::com::sun::star::accessibility;
41 using ::com::sun::star::uno::Reference;
43 namespace chart
46 AccessibleTextHelper::AccessibleTextHelper(
47 DrawViewWrapper * pDrawViewWrapper ) :
48 m_pDrawViewWrapper( pDrawViewWrapper )
51 AccessibleTextHelper::~AccessibleTextHelper()
55 void AccessibleTextHelper::initialize( const OUString& aCID,
56 const Reference< XAccessible >& xEventSource,
57 const Reference< awt::XWindow >& xWindow )
59 OSL_ENSURE( !aCID.isEmpty(), "Empty CID" );
60 OSL_ENSURE( xEventSource.is(), "Empty Event Source" );
61 OSL_ENSURE( xWindow.is(), "Empty Window" );
62 if( !xEventSource.is() || aCID.isEmpty() )
63 return;
65 SolarMutexGuard aSolarGuard;
67 m_oTextHelper.reset();
69 VclPtr<vcl::Window> pWindow( VCLUnoHelper::GetWindow( xWindow ));
70 if( pWindow )
72 SdrView * pView = m_pDrawViewWrapper;
73 if( pView )
75 SdrObject * pTextObj = m_pDrawViewWrapper->getNamedSdrObject( aCID );
76 if( pTextObj )
78 m_oTextHelper.emplace( std::make_unique<SvxTextEditSource>(*pTextObj, nullptr, *pView, *pWindow->GetOutDev()) );
79 m_oTextHelper->SetEventSource( xEventSource );
84 OSL_ENSURE( m_oTextHelper, "Couldn't create text helper" );
87 // ____ XAccessibleContext ____
88 sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleChildCount()
90 if( m_oTextHelper )
92 SolarMutexGuard aSolarGuard;
93 return m_oTextHelper->GetChildCount();
95 return 0;
98 Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleChild( sal_Int64 i )
100 if( m_oTextHelper )
102 SolarMutexGuard aSolarGuard;
103 return m_oTextHelper->GetChild( i );
105 return Reference< XAccessible >();
108 Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleParent()
110 OSL_FAIL( "Not implemented in this helper" );
111 return Reference< XAccessible >();
114 sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleIndexInParent()
116 OSL_FAIL( "Not implemented in this helper" );
117 return -1;
120 ::sal_Int16 SAL_CALL AccessibleTextHelper::getAccessibleRole()
122 OSL_FAIL( "Not implemented in this helper" );
123 return AccessibleRole::UNKNOWN;
126 OUString SAL_CALL AccessibleTextHelper::getAccessibleDescription()
128 OSL_FAIL( "Not implemented in this helper" );
129 return OUString();
132 OUString SAL_CALL AccessibleTextHelper::getAccessibleName()
134 OSL_FAIL( "Not implemented in this helper" );
135 return OUString();
138 Reference< XAccessibleRelationSet > SAL_CALL AccessibleTextHelper::getAccessibleRelationSet()
140 OSL_FAIL( "Not implemented in this helper" );
141 return Reference< XAccessibleRelationSet >();
144 sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleStateSet()
146 OSL_FAIL( "Not implemented in this helper" );
147 return 0;
150 lang::Locale SAL_CALL AccessibleTextHelper::getLocale()
152 OSL_FAIL( "Not implemented in this helper" );
153 return lang::Locale();
156 } // namespace chart
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */