fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / ui / querydesign / JAccess.cxx
blobc76d2f8c933f9f4753d64a9c469f3923fdf08520
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 "JAccess.hxx"
21 #include "JoinTableView.hxx"
22 #include "TableWindow.hxx"
23 #include <com/sun/star/accessibility/AccessibleRole.hpp>
24 #include "JoinDesignView.hxx"
25 #include "JoinController.hxx"
26 #include "TableConnection.hxx"
28 namespace dbaui
30 using namespace ::com::sun::star::accessibility;
31 using namespace ::com::sun::star::uno;
32 using namespace ::com::sun::star::beans;
33 using namespace ::com::sun::star::lang;
35 OJoinDesignViewAccess::OJoinDesignViewAccess(OJoinTableView* _pTableView)
36 :VCLXAccessibleComponent(_pTableView->GetComponentInterface().is() ? _pTableView->GetWindowPeer() : NULL)
37 ,m_pTableView(_pTableView)
40 OUString SAL_CALL OJoinDesignViewAccess::getImplementationName() throw(RuntimeException, std::exception)
42 return getImplementationName_Static();
44 OUString OJoinDesignViewAccess::getImplementationName_Static() throw( RuntimeException )
46 return OUString("org.openoffice.comp.dbu.JoinViewAccessibility");
48 void OJoinDesignViewAccess::clearTableView()
50 ::osl::MutexGuard aGuard( m_aMutex );
51 m_pTableView = NULL;
53 // XAccessibleContext
54 sal_Int32 SAL_CALL OJoinDesignViewAccess::getAccessibleChildCount( ) throw (RuntimeException, std::exception)
56 // TODO may be this will change to only visible windows
57 // this is the same assumption mt implements
58 ::osl::MutexGuard aGuard( m_aMutex );
59 sal_Int32 nChildCount = 0;
60 if ( m_pTableView )
61 nChildCount = m_pTableView->GetTabWinCount() + m_pTableView->getTableConnections().size();
62 return nChildCount;
64 Reference< XAccessible > SAL_CALL OJoinDesignViewAccess::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException,RuntimeException, std::exception)
66 Reference< XAccessible > aRet;
67 ::osl::MutexGuard aGuard( m_aMutex );
68 if(i >= 0 && i < getAccessibleChildCount() && m_pTableView )
70 // check if we should return a table window or a connection
71 sal_Int32 nTableWindowCount = m_pTableView->GetTabWinCount();
72 if( i < nTableWindowCount )
74 OJoinTableView::OTableWindowMap::iterator aIter = m_pTableView->GetTabWinMap().begin();
75 for (sal_Int32 j=i; j; ++aIter,--j)
77 aRet = aIter->second->GetAccessible();
79 else if( size_t(i - nTableWindowCount) < m_pTableView->getTableConnections().size() )
80 aRet = m_pTableView->getTableConnections()[i - nTableWindowCount]->GetAccessible();
82 else
83 throw IndexOutOfBoundsException();
84 return aRet;
86 sal_Int16 SAL_CALL OJoinDesignViewAccess::getAccessibleRole( ) throw (RuntimeException, std::exception)
88 return AccessibleRole::VIEW_PORT;
90 Reference< XAccessibleContext > SAL_CALL OJoinDesignViewAccess::getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
92 return this;
94 // XInterface
95 IMPLEMENT_FORWARD_XINTERFACE2( OJoinDesignViewAccess, VCLXAccessibleComponent, OJoinDesignViewAccess_BASE )
96 // XTypeProvider
97 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OJoinDesignViewAccess, VCLXAccessibleComponent, OJoinDesignViewAccess_BASE )
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */