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 : Splitter m_aSplitter;
68 :
69 : ::com::sun::star::lang::Locale m_aLocale;
70 : OUString m_sDecimalSep;
71 :
72 : 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 :
80 : virtual bool isCutAllowed() SAL_OVERRIDE;
81 : virtual bool isPasteAllowed() SAL_OVERRIDE;
82 : virtual bool isCopyAllowed() SAL_OVERRIDE;
83 : virtual void copy() SAL_OVERRIDE;
84 : virtual void cut() SAL_OVERRIDE;
85 : virtual void paste() SAL_OVERRIDE;
86 : // clears the whole query
87 : virtual void clear() SAL_OVERRIDE;
88 : // set the view readonly or not
89 : virtual void setReadOnly(bool _bReadOnly) SAL_OVERRIDE;
90 : // check if the statement is correct when not returning false
91 : virtual bool checkStatement();
92 : // set the statement for representation
93 : virtual void setStatement(const OUString& _rsStatement) SAL_OVERRIDE;
94 : // returns the current sql statement
95 : virtual OUString getStatement() SAL_OVERRIDE;
96 : /// late construction
97 : virtual void Construct() SAL_OVERRIDE;
98 : virtual void initialize() SAL_OVERRIDE;
99 : // window overloads
100 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
101 : virtual void GetFocus() SAL_OVERRIDE;
102 :
103 : bool isSlotEnabled(sal_Int32 _nSlotId);
104 : void setSlotEnabled(sal_Int32 _nSlotId, bool _bEnable);
105 : void setNoneVisbleRow(sal_Int32 _nRows);
106 :
107 0 : ::com::sun::star::lang::Locale getLocale() const { return m_aLocale;}
108 0 : OUString getDecimalSeparator() const { return m_sDecimalSep;}
109 :
110 : SqlParseError InsertField( const OTableFieldDescRef& rInfo, bool bVis = true, bool bActivate = true);
111 : bool HasFieldByAliasName(const OUString& rFieldName, OTableFieldDescRef& rInfo) const;
112 : // save the position of the table window and the pos of the splitters
113 : // called when fields are deleted
114 : void DeleteFields( const OUString& rAliasName );
115 : // called when a table from tabeview was deleted
116 : void TableDeleted(const OUString& rAliasName);
117 :
118 : sal_Int32 getColWidth( sal_uInt16 _nColPos) const;
119 : void fillValidFields(const OUString& strTableName, ComboBox* pFieldList);
120 :
121 : void SaveUIConfig();
122 : void stopTimer();
123 : void startTimer();
124 : void reset();
125 :
126 : /** initializes the view from the current parser / parse iterator of the controller
127 :
128 : @param _pErrorInfo
129 : When not <NULL/>, the instance pointed to by this parameter takes the error
130 : which happened during the initialization.
131 : If it is not <NULL/>, then any such error will be displayed, using the controller's
132 : showError method.
133 :
134 : @return <TRUE/> if and only if the initialization was successful
135 : */
136 : bool initByParseIterator( ::dbtools::SQLExceptionInfo* _pErrorInfo );
137 :
138 : void initByFieldDescriptions(
139 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rFieldDescriptions
140 : );
141 :
142 : ::connectivity::OSQLParseNode* getPredicateTreeFromEntry( OTableFieldDescRef pEntry,
143 : const OUString& _sCriteria,
144 : OUString& _rsErrorMessage,
145 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn) const;
146 :
147 : void fillFunctionInfo( const ::connectivity::OSQLParseNode* pNode
148 : ,const OUString& sFunctionTerm
149 : ,OTableFieldDescRef& aInfo);
150 : protected:
151 : // return the Rectangle where I can paint myself
152 : virtual void resizeDocumentView(Rectangle& rRect) SAL_OVERRIDE;
153 : DECL_LINK( SplitHdl, void* );
154 :
155 : private:
156 : using OQueryView::SaveTabWinUIConfig;
157 : };
158 : }
159 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYDESIGNVIEW_HXX
160 :
161 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|