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_QUERYDESIGNVIEW_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYDESIGNVIEW_HXX
21 :
22 : #include "queryview.hxx"
23 : #include <vcl/split.hxx>
24 : #include "QEnumTypes.hxx"
25 : #include <com/sun/star/beans/XPropertySet.hpp>
26 : #include "querycontroller.hxx"
27 : #include "ConnectionLineData.hxx"
28 :
29 : namespace connectivity
30 : {
31 : class OSQLParseNode;
32 : }
33 :
34 : class ComboBox;
35 : namespace dbaui
36 : {
37 : enum SqlParseError
38 : {
39 : eIllegalJoin,
40 : eStatementTooLong,
41 : eNoConnection,
42 : eNoSelectStatement,
43 : eStatementTooComplex,
44 : eColumnInLikeNotFound,
45 : eNoColumnInLike,
46 : eColumnNotFound,
47 : eNativeMode,
48 : eTooManyTables,
49 : eTooManyConditions,
50 : eTooManyColumns,
51 : eIllegalJoinCondition,
52 : eOk
53 : };
54 :
55 : class OSelectionBrowseBox;
56 : class OQueryContainerWindow;
57 :
58 : class OQueryDesignView : public OQueryView
59 : {
60 : enum ChildFocusState
61 : {
62 : SELECTION,
63 : TABLEVIEW,
64 : NONE
65 : };
66 :
67 : VclPtr<Splitter> m_aSplitter;
68 :
69 : ::com::sun::star::lang::Locale m_aLocale;
70 : OUString m_sDecimalSep;
71 :
72 : VclPtr<OSelectionBrowseBox> m_pSelectionBox; // presents the lower window
73 : ChildFocusState m_eChildFocus;
74 : bool m_bInSplitHandler;
75 :
76 : public:
77 : OQueryDesignView(OQueryContainerWindow* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
78 : virtual ~OQueryDesignView();
79 : virtual void dispose() SAL_OVERRIDE;
80 :
81 : virtual bool isCutAllowed() SAL_OVERRIDE;
82 : virtual bool isPasteAllowed() SAL_OVERRIDE;
83 : virtual bool isCopyAllowed() SAL_OVERRIDE;
84 : virtual void copy() SAL_OVERRIDE;
85 : virtual void cut() SAL_OVERRIDE;
86 : virtual void paste() SAL_OVERRIDE;
87 : // clears the whole query
88 : virtual void clear() SAL_OVERRIDE;
89 : // set the view readonly or not
90 : virtual void setReadOnly(bool _bReadOnly) SAL_OVERRIDE;
91 : // check if the statement is correct when not returning false
92 : bool checkStatement();
93 : // set the statement for representation
94 : virtual void setStatement(const OUString& _rsStatement) SAL_OVERRIDE;
95 : // returns the current sql statement
96 : virtual OUString getStatement() SAL_OVERRIDE;
97 : /// late construction
98 : virtual void Construct() SAL_OVERRIDE;
99 : virtual void initialize() SAL_OVERRIDE;
100 : // Window overrides
101 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
102 : virtual void GetFocus() SAL_OVERRIDE;
103 :
104 : bool isSlotEnabled(sal_Int32 _nSlotId);
105 : void setSlotEnabled(sal_Int32 _nSlotId, bool _bEnable);
106 : void setNoneVisbleRow(sal_Int32 _nRows);
107 :
108 0 : ::com::sun::star::lang::Locale getLocale() const { return m_aLocale;}
109 0 : OUString getDecimalSeparator() const { return m_sDecimalSep;}
110 :
111 : SqlParseError InsertField( const OTableFieldDescRef& rInfo, bool bVis = true, bool bActivate = true);
112 : bool HasFieldByAliasName(const OUString& rFieldName, OTableFieldDescRef& rInfo) const;
113 : // save the position of the table window and the pos of the splitters
114 : // called when fields are deleted
115 : void DeleteFields( const OUString& rAliasName );
116 : // called when a table from tabeview was deleted
117 : void TableDeleted(const OUString& rAliasName);
118 :
119 : sal_Int32 getColWidth( sal_uInt16 _nColPos) const;
120 : void fillValidFields(const OUString& strTableName, ComboBox* pFieldList);
121 :
122 : void SaveUIConfig();
123 : void stopTimer();
124 : void startTimer();
125 : void reset();
126 :
127 : /** initializes the view from the current parser / parse iterator of the controller
128 :
129 : @param _pErrorInfo
130 : When not <NULL/>, the instance pointed to by this parameter takes the error
131 : which happened during the initialization.
132 : If it is not <NULL/>, then any such error will be displayed, using the controller's
133 : showError method.
134 :
135 : @return <TRUE/> if and only if the initialization was successful
136 : */
137 : bool initByParseIterator( ::dbtools::SQLExceptionInfo* _pErrorInfo );
138 :
139 : void initByFieldDescriptions(
140 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rFieldDescriptions
141 : );
142 :
143 : ::connectivity::OSQLParseNode* getPredicateTreeFromEntry( OTableFieldDescRef pEntry,
144 : const OUString& _sCriteria,
145 : OUString& _rsErrorMessage,
146 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn) const;
147 :
148 : void fillFunctionInfo( const ::connectivity::OSQLParseNode* pNode
149 : ,const OUString& sFunctionTerm
150 : ,OTableFieldDescRef& aInfo);
151 : protected:
152 : // return the Rectangle where I can paint myself
153 : virtual void resizeDocumentView(Rectangle& rRect) SAL_OVERRIDE;
154 : DECL_LINK( SplitHdl, void* );
155 :
156 : private:
157 : using OQueryView::SaveTabWinUIConfig;
158 : };
159 : }
160 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYDESIGNVIEW_HXX
161 :
162 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|