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 10*2e2212a7SAndrew Rist * 11*2e2212a7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2e2212a7SAndrew Rist * 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. 19*2e2212a7SAndrew Rist * 20*2e2212a7SAndrew Rist *************************************************************/ 21*2e2212a7SAndrew Rist 22*2e2212a7SAndrew Rist 23cdf0e10cSrcweir #ifndef DBAUI_QUERYVIEWSWITCH_HXX 24cdf0e10cSrcweir #define DBAUI_QUERYVIEWSWITCH_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "queryview.hxx" 27cdf0e10cSrcweir 28cdf0e10cSrcweir namespace dbtools 29cdf0e10cSrcweir { 30cdf0e10cSrcweir class SQLExceptionInfo; 31cdf0e10cSrcweir } 32cdf0e10cSrcweir 33cdf0e10cSrcweir namespace dbaui 34cdf0e10cSrcweir { 35cdf0e10cSrcweir class OQueryDesignView; 36cdf0e10cSrcweir class OQueryTextView; 37cdf0e10cSrcweir class OAddTableDlg; 38cdf0e10cSrcweir class OQueryContainerWindow; 39cdf0e10cSrcweir class OQueryViewSwitch 40cdf0e10cSrcweir { 41cdf0e10cSrcweir OQueryDesignView* m_pDesignView; 42cdf0e10cSrcweir OQueryTextView* m_pTextView; 43cdf0e10cSrcweir sal_Bool m_bAddTableDialogWasVisible; // true if so 44cdf0e10cSrcweir public: 45cdf0e10cSrcweir OQueryViewSwitch(OQueryContainerWindow* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); 46cdf0e10cSrcweir virtual ~OQueryViewSwitch(); 47cdf0e10cSrcweir 48cdf0e10cSrcweir virtual sal_Bool isCutAllowed(); 49cdf0e10cSrcweir virtual sal_Bool isPasteAllowed(); 50cdf0e10cSrcweir virtual sal_Bool isCopyAllowed(); 51cdf0e10cSrcweir virtual void copy(); 52cdf0e10cSrcweir virtual void cut(); 53cdf0e10cSrcweir virtual void paste(); 54cdf0e10cSrcweir // clears the whole query 55cdf0e10cSrcweir virtual void clear(); 56cdf0e10cSrcweir // set the view readonly or not 57cdf0e10cSrcweir virtual void setReadOnly(sal_Bool _bReadOnly); 58cdf0e10cSrcweir // check if the statement is correct when not returning false 59cdf0e10cSrcweir virtual sal_Bool checkStatement(); 60cdf0e10cSrcweir // set the statement for representation 61cdf0e10cSrcweir virtual void setStatement(const ::rtl::OUString& _rsStatement); 62cdf0e10cSrcweir // returns the current sql statement 63cdf0e10cSrcweir virtual ::rtl::OUString getStatement(); 64cdf0e10cSrcweir /// late construction 65cdf0e10cSrcweir virtual void Construct(); 66cdf0e10cSrcweir virtual void initialize(); 67cdf0e10cSrcweir /** show the text or the design view 68cdf0e10cSrcweir @return 69cdf0e10cSrcweir <TRUE/> if and only if the view could be successfully, switched, <FALSE/> otherwise 70cdf0e10cSrcweir (In the latter case, the controller will issue another switchView call to restore the 71cdf0e10cSrcweir old state) 72cdf0e10cSrcweir */ 73cdf0e10cSrcweir bool switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo ); 74cdf0e10cSrcweir void forceInitialView(); 75cdf0e10cSrcweir sal_Bool isSlotEnabled(sal_Int32 _nSlotId); 76cdf0e10cSrcweir void setSlotEnabled(sal_Int32 _nSlotId,sal_Bool _bEnable); 77cdf0e10cSrcweir void setNoneVisbleRow(sal_Int32 _nRows); 78cdf0e10cSrcweir void SaveUIConfig(); 79cdf0e10cSrcweir bool reset( ::dbtools::SQLExceptionInfo* _pErrorInfo ); 80cdf0e10cSrcweir void GrabFocus(); 81cdf0e10cSrcweir 82cdf0e10cSrcweir // returs the add table dialog from the design view 83cdf0e10cSrcweir OAddTableDlg* getAddTableDialog(); 84cdf0e10cSrcweir getDesignView() const85cdf0e10cSrcweir OQueryDesignView* getDesignView() const { return m_pDesignView; } 86cdf0e10cSrcweir OQueryContainerWindow* getContainer() const; 87cdf0e10cSrcweir 88cdf0e10cSrcweir void SetPosSizePixel( Point _rPt,Size _rSize); 89cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const; 90cdf0e10cSrcweir protected: 91cdf0e10cSrcweir // return the Rectangle where I can paint myself 92cdf0e10cSrcweir virtual void resizeDocumentView(Rectangle& rRect); 93cdf0e10cSrcweir 94cdf0e10cSrcweir private: 95cdf0e10cSrcweir void impl_forceSQLView(); 96cdf0e10cSrcweir bool impl_postViewSwitch( const bool i_bGraphicalDesign, const bool i_bSuccess ); 97cdf0e10cSrcweir }; 98cdf0e10cSrcweir } 99cdf0e10cSrcweir #endif // DBAUI_QUERYVIEWSWITCH_HXX 100cdf0e10cSrcweir 101