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 : VclPtr<OQueryDesignView> m_pDesignView;
38 : VclPtr<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 : bool isCutAllowed();
45 : bool isPasteAllowed();
46 : bool isCopyAllowed();
47 : void copy();
48 : void cut();
49 : void paste();
50 : // clears the whole query
51 : void clear();
52 : // check if the statement is correct when not returning false
53 : bool checkStatement();
54 : // set the statement for representation
55 : void setStatement(const OUString& _rsStatement);
56 : // returns the current sql statement
57 : OUString getStatement();
58 : /// late construction
59 : void Construct();
60 : void initialize();
61 : /** show the text or the design view
62 : @return
63 : <TRUE/> if and only if the view could be successfully, switched, <FALSE/> otherwise
64 : (In the latter case, the controller will issue another switchView call to restore the
65 : old state)
66 : */
67 : bool switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo );
68 : void forceInitialView();
69 : bool isSlotEnabled(sal_Int32 _nSlotId);
70 : void setSlotEnabled(sal_Int32 _nSlotId, bool _bEnable);
71 : void setNoneVisbleRow(sal_Int32 _nRows);
72 : void SaveUIConfig();
73 : bool reset( ::dbtools::SQLExceptionInfo* _pErrorInfo );
74 : void GrabFocus();
75 :
76 : // returns the add table dialog from the design view
77 : OAddTableDlg* getAddTableDialog();
78 :
79 0 : OQueryDesignView* getDesignView() const { return m_pDesignView; }
80 : OQueryContainerWindow* getContainer() const;
81 :
82 : void SetPosSizePixel( Point _rPt,Size _rSize);
83 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getORB() const;
84 :
85 : private:
86 : void impl_forceSQLView();
87 : bool impl_postViewSwitch( const bool i_bGraphicalDesign, const bool i_bSuccess );
88 : };
89 : }
90 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYVIEWSWITCH_HXX
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|