1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: QueryDesignView.hxx,v $
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"
37 #include <vcl/split.hxx>
40 #include <tools/string.hxx>
42 #ifndef DBAUI_ENUMTYPES_HXX
43 #include "QEnumTypes.hxx"
45 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
46 #include <com/sun/star/beans/XPropertySet.hpp>
48 #ifndef DBAUI_QUERYCONTROLLER_HXX
49 #include "querycontroller.hxx"
51 #ifndef DBAUI_CONNECTIONLINEDATA_HXX
52 #include "ConnectionLineData.hxx"
55 namespace connectivity
70 eColumnInLikeNotFound
,
77 eIllegalJoinCondition
,
81 class OQueryViewSwitch
;
83 class OQueryTableWindow
;
84 class OSelectionBrowseBox
;
85 class OTableConnection
;
86 class OQueryTableConnectionData
;
87 class OQueryContainerWindow
;
89 class OQueryDesignView
: public OQueryView
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
;
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();
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();
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
);
158 /** initializes the view from the current parser / parse iterator of the controller
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
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;
175 // return the Rectangle where I can paint myself
176 virtual void resizeDocumentView(Rectangle
& rRect
);
177 DECL_LINK( SplitHdl
, void* );
180 using OQueryView::SaveTabWinUIConfig
;
183 #endif // DBAUI_QUERYDESIGNVIEW_HXX