Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / dbaccess / source / ui / inc / QueryDesignView.hxx
blob4632104fac1194091311e2eb9fef1b0c433b3f06
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYDESIGNVIEW_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYDESIGNVIEW_HXX
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"
29 namespace connectivity
31 class OSQLParseNode;
34 class ComboBox;
35 namespace dbaui
37 enum SqlParseError
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
55 class OSelectionBrowseBox;
56 class OQueryContainerWindow;
58 class OQueryDesignView : public OQueryView
60 enum ChildFocusState
62 SELECTION,
63 TABLEVIEW,
64 NONE
67 VclPtr<Splitter> m_aSplitter;
69 css::lang::Locale m_aLocale;
70 OUString m_sDecimalSep;
72 VclPtr<OSelectionBrowseBox> m_pSelectionBox; // presents the lower window
73 ChildFocusState m_eChildFocus;
74 bool m_bInSplitHandler;
76 public:
77 OQueryDesignView(OQueryContainerWindow* pParent, OQueryController& _rController,const css::uno::Reference< css::uno::XComponentContext >& );
78 virtual ~OQueryDesignView();
79 virtual void dispose() override;
81 virtual bool isCutAllowed() override;
82 virtual bool isPasteAllowed() override;
83 virtual bool isCopyAllowed() override;
84 virtual void copy() override;
85 virtual void cut() override;
86 virtual void paste() override;
87 // clears the whole query
88 virtual void clear() override;
89 // set the view readonly or not
90 virtual void setReadOnly(bool _bReadOnly) 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) override;
95 // returns the current sql statement
96 virtual OUString getStatement() override;
97 /// late construction
98 virtual void Construct() override;
99 virtual void initialize() override;
100 // Window overrides
101 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
102 virtual void GetFocus() override;
104 bool isSlotEnabled(sal_Int32 _nSlotId);
105 void setSlotEnabled(sal_Int32 _nSlotId, bool _bEnable);
106 void setNoneVisbleRow(sal_Int32 _nRows);
108 const css::lang::Locale& getLocale() const { return m_aLocale;}
109 const OUString& getDecimalSeparator() const { return m_sDecimalSep;}
111 SqlParseError InsertField( const OTableFieldDescRef& rInfo, 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 tabview was deleted
117 void TableDeleted(const OUString& rAliasName);
119 sal_Int32 getColWidth( sal_uInt16 _nColPos) const;
120 void fillValidFields(const OUString& strTableName, ComboBox* pFieldList);
122 void SaveUIConfig();
123 void stopTimer();
124 void startTimer();
125 void reset();
127 /** initializes the view from the current parser / parse iterator of the controller
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.
135 @return <TRUE/> if and only if the initialization was successful
137 bool initByParseIterator( ::dbtools::SQLExceptionInfo* _pErrorInfo );
139 void initByFieldDescriptions(
140 const css::uno::Sequence< css::beans::PropertyValue >& i_rFieldDescriptions
143 ::connectivity::OSQLParseNode* getPredicateTreeFromEntry( const OTableFieldDescRef& pEntry,
144 const OUString& _sCriteria,
145 OUString& _rsErrorMessage,
146 css::uno::Reference< css::beans::XPropertySet>& _rxColumn) const;
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) override;
154 DECL_LINK_TYPED( SplitHdl, Splitter*, void );
156 private:
157 using OQueryView::SaveTabWinUIConfig;
160 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYDESIGNVIEW_HXX
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */