1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef DBAUI_QUERYVIEWSWITCH_HXX 28 #define DBAUI_QUERYVIEWSWITCH_HXX 29 30 #include "queryview.hxx" 31 32 namespace dbtools 33 { 34 class SQLExceptionInfo; 35 } 36 37 namespace dbaui 38 { 39 class OQueryDesignView; 40 class OQueryTextView; 41 class OAddTableDlg; 42 class OQueryContainerWindow; 43 class OQueryViewSwitch 44 { 45 OQueryDesignView* m_pDesignView; 46 OQueryTextView* m_pTextView; 47 sal_Bool m_bAddTableDialogWasVisible; // true if so 48 public: 49 OQueryViewSwitch(OQueryContainerWindow* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); 50 virtual ~OQueryViewSwitch(); 51 52 virtual sal_Bool isCutAllowed(); 53 virtual sal_Bool isPasteAllowed(); 54 virtual sal_Bool isCopyAllowed(); 55 virtual void copy(); 56 virtual void cut(); 57 virtual void paste(); 58 // clears the whole query 59 virtual void clear(); 60 // set the view readonly or not 61 virtual void setReadOnly(sal_Bool _bReadOnly); 62 // check if the statement is correct when not returning false 63 virtual sal_Bool checkStatement(); 64 // set the statement for representation 65 virtual void setStatement(const ::rtl::OUString& _rsStatement); 66 // returns the current sql statement 67 virtual ::rtl::OUString getStatement(); 68 /// late construction 69 virtual void Construct(); 70 virtual void initialize(); 71 /** show the text or the design view 72 @return 73 <TRUE/> if and only if the view could be successfully, switched, <FALSE/> otherwise 74 (In the latter case, the controller will issue another switchView call to restore the 75 old state) 76 */ 77 bool switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo ); 78 void forceInitialView(); 79 sal_Bool isSlotEnabled(sal_Int32 _nSlotId); 80 void setSlotEnabled(sal_Int32 _nSlotId,sal_Bool _bEnable); 81 void setNoneVisbleRow(sal_Int32 _nRows); 82 void SaveUIConfig(); 83 bool reset( ::dbtools::SQLExceptionInfo* _pErrorInfo ); 84 void GrabFocus(); 85 86 // returs the add table dialog from the design view 87 OAddTableDlg* getAddTableDialog(); 88 89 OQueryDesignView* getDesignView() const { return m_pDesignView; } 90 OQueryContainerWindow* getContainer() const; 91 92 void SetPosSizePixel( Point _rPt,Size _rSize); 93 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const; 94 protected: 95 // return the Rectangle where I can paint myself 96 virtual void resizeDocumentView(Rectangle& rRect); 97 98 private: 99 void impl_forceSQLView(); 100 bool impl_postViewSwitch( const bool i_bGraphicalDesign, const bool i_bSuccess ); 101 }; 102 } 103 #endif // DBAUI_QUERYVIEWSWITCH_HXX 104 105