update dev300-m58
[ooovba.git] / dbaccess / source / ui / inc / QueryDesignView.hxx
blob7f85b879a94f472f19e4ca45e99518f2fe23f971
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: QueryDesignView.hxx,v $
10 * $Revision: 1.24 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_QUERYDESIGNVIEW_HXX
31 #define DBAUI_QUERYDESIGNVIEW_HXX
33 #ifndef DBAUI_QUERYVIEW_HXX
34 #include "queryview.hxx"
35 #endif
36 #ifndef _SV_SPLIT_HXX
37 #include <vcl/split.hxx>
38 #endif
39 #ifndef _STRING_HXX
40 #include <tools/string.hxx>
41 #endif
42 #ifndef DBAUI_ENUMTYPES_HXX
43 #include "QEnumTypes.hxx"
44 #endif
45 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
46 #include <com/sun/star/beans/XPropertySet.hpp>
47 #endif
48 #ifndef DBAUI_QUERYCONTROLLER_HXX
49 #include "querycontroller.hxx"
50 #endif
51 #ifndef DBAUI_CONNECTIONLINEDATA_HXX
52 #include "ConnectionLineData.hxx"
53 #endif
55 namespace connectivity
57 class OSQLParseNode;
60 class ComboBox;
61 namespace dbaui
63 enum SqlParseError
65 eIllegalJoin,
66 eStatementTooLong,
67 eNoConnection,
68 eNoSelectStatement,
69 eStatementTooComplex,
70 eColumnInLikeNotFound,
71 eNoColumnInLike,
72 eColumnNotFound,
73 eNativeMode,
74 eTooManyTables,
75 eTooManyConditions,
76 eTooManyColumns,
77 eIllegalJoinCondition,
78 eOk
81 class OQueryViewSwitch;
82 class OAddTableDlg;
83 class OQueryTableWindow;
84 class OSelectionBrowseBox;
85 class OTableConnection;
86 class OQueryTableConnectionData;
87 class OQueryContainerWindow;
89 class OQueryDesignView : public OQueryView
91 enum ChildFocusState
93 SELECTION,
94 TABLEVIEW,
95 NONE
98 Splitter m_aSplitter;
100 ::com::sun::star::lang::Locale m_aLocale;
101 ::rtl::OUString m_sDecimalSep;
103 OSelectionBrowseBox* m_pSelectionBox; // presents the lower window
104 ChildFocusState m_eChildFocus;
105 sal_Bool m_bInKeyEvent;
106 sal_Bool m_bInSplitHandler;
108 public:
109 OQueryDesignView(OQueryContainerWindow* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
110 virtual ~OQueryDesignView();
112 virtual sal_Bool isCutAllowed();
113 virtual sal_Bool isPasteAllowed();
114 virtual sal_Bool isCopyAllowed();
115 virtual void copy();
116 virtual void cut();
117 virtual void paste();
118 // clears the whole query
119 virtual void clear();
120 // set the view readonly or not
121 virtual void setReadOnly(sal_Bool _bReadOnly);
122 // check if the statement is correct when not returning false
123 virtual sal_Bool checkStatement();
124 // set the statement for representation
125 virtual void setStatement(const ::rtl::OUString& _rsStatement);
126 // returns the current sql statement
127 virtual ::rtl::OUString getStatement();
128 /// late construction
129 virtual void Construct();
130 virtual void initialize();
131 // window overloads
132 virtual long PreNotify( NotifyEvent& rNEvt );
133 virtual void GetFocus();
135 sal_Bool isSlotEnabled(sal_Int32 _nSlotId);
136 void setSlotEnabled(sal_Int32 _nSlotId,sal_Bool _bEnable);
137 void setNoneVisbleRow(sal_Int32 _nRows);
139 ::com::sun::star::lang::Locale getLocale() const { return m_aLocale;}
140 ::rtl::OUString getDecimalSeparator() const { return m_sDecimalSep;}
142 SqlParseError InsertField( const OTableFieldDescRef& rInfo, sal_Bool bVis=sal_True, sal_Bool bActivate = sal_True);
143 bool HasFieldByAliasName(const ::rtl::OUString& rFieldName, OTableFieldDescRef& rInfo) const;
144 // save the position of the table window and the pos of the splitters
145 // called when fields are deleted
146 void DeleteFields( const ::rtl::OUString& rAliasName );
147 // called when a table from tabeview was deleted
148 void TableDeleted(const ::rtl::OUString& rAliasName);
150 sal_Int32 getColWidth( sal_uInt16 _nColPos) const;
151 void fillValidFields(const ::rtl::OUString& strTableName, ComboBox* pFieldList);
153 void SaveUIConfig();
154 void stopTimer();
155 void startTimer();
156 void reset();
158 /** initializes the view from the current parser / parse iterator of the controller
160 @param _pErrorInfo
161 When not <NULL/>, the instance pointed to by this parameter takes the error
162 which happened during the initialization.
163 If it is not <NULL/>, then any such error will be displayed, using the controller's
164 showError method.
166 @return <TRUE/> if and only if the initialization was successful
168 bool initByParseIterator( ::dbtools::SQLExceptionInfo* _pErrorInfo );
170 ::connectivity::OSQLParseNode* getPredicateTreeFromEntry( OTableFieldDescRef pEntry,
171 const String& _sCriteria,
172 ::rtl::OUString& _rsErrorMessage,
173 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn) const;
174 protected:
175 // return the Rectangle where I can paint myself
176 virtual void resizeDocumentView(Rectangle& rRect);
177 DECL_LINK( SplitHdl, void* );
179 private:
180 using OQueryView::SaveTabWinUIConfig;
183 #endif // DBAUI_QUERYDESIGNVIEW_HXX