Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYVIEWSWITCH_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYVIEWSWITCH_HXX
21 :
22 : #include "queryview.hxx"
23 :
24 : namespace dbtools
25 : {
26 : class SQLExceptionInfo;
27 : }
28 :
29 : namespace dbaui
30 : {
31 : class OQueryDesignView;
32 : class OQueryTextView;
33 : class OAddTableDlg;
34 : class OQueryContainerWindow;
35 : class OQueryViewSwitch
36 : {
37 : OQueryDesignView* m_pDesignView;
38 : OQueryTextView* m_pTextView;
39 : bool m_bAddTableDialogWasVisible; // true if so
40 : public:
41 : OQueryViewSwitch(OQueryContainerWindow* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
42 : virtual ~OQueryViewSwitch();
43 :
44 : virtual bool isCutAllowed();
45 : virtual bool isPasteAllowed();
46 : virtual bool isCopyAllowed();
47 : virtual void copy();
48 : virtual void cut();
49 : virtual void paste();
50 : // clears the whole query
51 : virtual void clear();
52 : // set the view readonly or not
53 : virtual void setReadOnly(bool _bReadOnly);
54 : // check if the statement is correct when not returning false
55 : virtual bool checkStatement();
56 : // set the statement for representation
57 : virtual void setStatement(const OUString& _rsStatement);
58 : // returns the current sql statement
59 : virtual OUString getStatement();
60 : /// late construction
61 : virtual void Construct();
62 : virtual void initialize();
63 : /** show the text or the design view
64 : @return
65 : <TRUE/> if and only if the view could be successfully, switched, <FALSE/> otherwise
66 : (In the latter case, the controller will issue another switchView call to restore the
67 : old state)
68 : */
69 : bool switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo );
70 : void forceInitialView();
71 : bool isSlotEnabled(sal_Int32 _nSlotId);
72 : void setSlotEnabled(sal_Int32 _nSlotId, bool _bEnable);
73 : void setNoneVisbleRow(sal_Int32 _nRows);
74 : void SaveUIConfig();
75 : bool reset( ::dbtools::SQLExceptionInfo* _pErrorInfo );
76 : void GrabFocus();
77 :
78 : // returs the add table dialog from the design view
79 : OAddTableDlg* getAddTableDialog();
80 :
81 0 : OQueryDesignView* getDesignView() const { return m_pDesignView; }
82 : OQueryContainerWindow* getContainer() const;
83 :
84 : void SetPosSizePixel( Point _rPt,Size _rSize);
85 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getORB() const;
86 : protected:
87 : // return the Rectangle where I can paint myself
88 : virtual void resizeDocumentView(Rectangle& rRect);
89 :
90 : private:
91 : void impl_forceSQLView();
92 : bool impl_postViewSwitch( const bool i_bGraphicalDesign, const bool i_bSuccess );
93 : };
94 : }
95 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYVIEWSWITCH_HXX
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|