1*2e2212a7SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2e2212a7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2e2212a7SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2e2212a7SAndrew Rist * distributed with this work for additional information 6*2e2212a7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2e2212a7SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2e2212a7SAndrew Rist * "License"); you may not use this file except in compliance 9*2e2212a7SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*2e2212a7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*2e2212a7SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2e2212a7SAndrew Rist * software distributed under the License is distributed on an 15*2e2212a7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2e2212a7SAndrew Rist * KIND, either express or implied. See the License for the 17*2e2212a7SAndrew Rist * specific language governing permissions and limitations 18*2e2212a7SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*2e2212a7SAndrew Rist *************************************************************/ 21*2e2212a7SAndrew Rist 22*2e2212a7SAndrew Rist 23cdf0e10cSrcweir #ifndef DBAUI_QYDLGTAB_HXX 24cdf0e10cSrcweir #define DBAUI_QYDLGTAB_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #ifndef _DIALOG_HXX //autogen 27cdf0e10cSrcweir #include <vcl/dialog.hxx> 28cdf0e10cSrcweir #endif 29cdf0e10cSrcweir 30cdf0e10cSrcweir #ifndef _BUTTON_HXX //autogen 31cdf0e10cSrcweir #include <vcl/button.hxx> 32cdf0e10cSrcweir #endif 33cdf0e10cSrcweir 34cdf0e10cSrcweir #ifndef _FIXED_HXX //autogen 35cdf0e10cSrcweir #include <vcl/fixed.hxx> 36cdf0e10cSrcweir #endif 37cdf0e10cSrcweir 38cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ 39cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp> 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir 42cdf0e10cSrcweir #ifndef _LSTBOX_HXX //autogen 43cdf0e10cSrcweir #include <vcl/lstbox.hxx> 44cdf0e10cSrcweir #endif 45cdf0e10cSrcweir #ifndef _SV_DIALOG_HXX 46cdf0e10cSrcweir #include <vcl/dialog.hxx> 47cdf0e10cSrcweir #endif 48cdf0e10cSrcweir #ifndef _STRING_HXX //autogen 49cdf0e10cSrcweir #include <tools/string.hxx> 50cdf0e10cSrcweir #endif 51cdf0e10cSrcweir 52cdf0e10cSrcweir #ifndef _DBAUI_TABLETREE_HXX_ 53cdf0e10cSrcweir #include "tabletree.hxx" 54cdf0e10cSrcweir #endif 55cdf0e10cSrcweir 56cdf0e10cSrcweir #include <memory> 57cdf0e10cSrcweir 58cdf0e10cSrcweir namespace dbaui 59cdf0e10cSrcweir { 60cdf0e10cSrcweir //======================================================================== 61cdf0e10cSrcweir /** unifies the access to a list of table/query objects 62cdf0e10cSrcweir */ 63cdf0e10cSrcweir class TableObjectListFacade 64cdf0e10cSrcweir { 65cdf0e10cSrcweir public: 66cdf0e10cSrcweir virtual void updateTableObjectList( bool _bAllowViews ) = 0; 67cdf0e10cSrcweir virtual String getSelectedName( String& _out_rAliasName ) const = 0; 68cdf0e10cSrcweir virtual bool isLeafSelected() const = 0; 69cdf0e10cSrcweir 70cdf0e10cSrcweir virtual ~TableObjectListFacade(); 71cdf0e10cSrcweir }; 72cdf0e10cSrcweir 73cdf0e10cSrcweir //======================================================================== 74cdf0e10cSrcweir class IAddTableDialogContext 75cdf0e10cSrcweir { 76cdf0e10cSrcweir public: 77cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > 78cdf0e10cSrcweir getConnection() const = 0; 79cdf0e10cSrcweir virtual bool allowViews() const = 0; 80cdf0e10cSrcweir virtual bool allowQueries() const = 0; 81cdf0e10cSrcweir virtual bool allowAddition() const = 0; 82cdf0e10cSrcweir virtual void addTableWindow( const String& _rQualifiedTableName, const String& _rAliasName ) = 0; 83cdf0e10cSrcweir virtual void onWindowClosing( const Window* _pWindow ) = 0; 84cdf0e10cSrcweir }; 85cdf0e10cSrcweir 86cdf0e10cSrcweir //======================================================================== 87cdf0e10cSrcweir class OAddTableDlg : public ModelessDialog 88cdf0e10cSrcweir { 89cdf0e10cSrcweir RadioButton m_aCaseTables; 90cdf0e10cSrcweir RadioButton m_aCaseQueries; 91cdf0e10cSrcweir 92cdf0e10cSrcweir OTableTreeListBox m_aTableList; 93cdf0e10cSrcweir SvTreeListBox m_aQueryList; 94cdf0e10cSrcweir ::std::auto_ptr< TableObjectListFacade > 95cdf0e10cSrcweir m_pCurrentList; 96cdf0e10cSrcweir 97cdf0e10cSrcweir PushButton aAddButton; 98cdf0e10cSrcweir CancelButton aCloseButton; 99cdf0e10cSrcweir HelpButton aHelpButton; 100cdf0e10cSrcweir 101cdf0e10cSrcweir IAddTableDialogContext& 102cdf0e10cSrcweir m_rContext; 103cdf0e10cSrcweir 104cdf0e10cSrcweir DECL_LINK( AddClickHdl, Button* ); 105cdf0e10cSrcweir DECL_LINK( CloseClickHdl, Button* ); 106cdf0e10cSrcweir DECL_LINK( TableListDoubleClickHdl, void* ); 107cdf0e10cSrcweir DECL_LINK( TableListSelectHdl, void* ); 108cdf0e10cSrcweir DECL_LINK( OnTypeSelected, void* ); 109cdf0e10cSrcweir 110cdf0e10cSrcweir public: 111cdf0e10cSrcweir OAddTableDlg( 112cdf0e10cSrcweir Window* _pParent, 113cdf0e10cSrcweir IAddTableDialogContext& _rContext ); 114cdf0e10cSrcweir virtual ~OAddTableDlg(); 115cdf0e10cSrcweir DetermineAddTable()116cdf0e10cSrcweir void DetermineAddTable() { aAddButton.Enable( impl_isAddAllowed() ); } 117cdf0e10cSrcweir void Update(); 118cdf0e10cSrcweir 119cdf0e10cSrcweir static String getDialogTitleForContext( 120cdf0e10cSrcweir IAddTableDialogContext& _rContext ); 121cdf0e10cSrcweir 122cdf0e10cSrcweir private: 123cdf0e10cSrcweir virtual sal_Bool Close(); 124cdf0e10cSrcweir 125cdf0e10cSrcweir bool impl_isAddAllowed(); 126cdf0e10cSrcweir void impl_addTable(); 127cdf0e10cSrcweir 128cdf0e10cSrcweir enum ObjectList 129cdf0e10cSrcweir { 130cdf0e10cSrcweir Tables, 131cdf0e10cSrcweir Queries 132cdf0e10cSrcweir }; 133cdf0e10cSrcweir void impl_switchTo( ObjectList _eList ); 134cdf0e10cSrcweir }; 135cdf0e10cSrcweir } 136cdf0e10cSrcweir #endif // DBAUI_QYDLGTAB_HXX 137