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