masterfix DEV300: #i10000# build fix
[LibreOffice.git] / extensions / source / propctrlr / sqlcommanddesign.hxx
blob72dea2b20f74c2ca12fe51b753bbd4518a12612a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX
29 #define EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX
31 /** === begin UNO includes === **/
32 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
33 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
34 #include <com/sun/star/frame/XController.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/uno/XComponentContext.hpp>
37 #include <com/sun/star/inspection/XObjectInspectorUI.hpp>
38 /** === end UNO includes === **/
40 #include <connectivity/dbtools.hxx>
41 #include <tools/link.hxx>
42 #include <cppuhelper/implbase1.hxx>
43 #include <rtl/ref.hxx>
45 //........................................................................
46 namespace pcr
48 //........................................................................
50 class ISQLCommandAdapter;
51 //====================================================================
52 //= SQLCommandDesigner
53 //====================================================================
54 typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener
55 > SQLCommandDesigner_Base;
56 /** encapsulates the code for calling and managing a query design frame, used
57 for interactively designing the Command property of a ->RowSet
59 class SQLCommandDesigner : public SQLCommandDesigner_Base
61 private:
62 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
63 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > m_xORB;
64 ::dbtools::SharedConnection m_xConnection;
65 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xDesigner;
66 ::rtl::Reference< ISQLCommandAdapter > m_xObjectAdapter;
67 Link m_aCloseLink;
69 public:
70 /** creates the instance, and immediately opens the SQL command design frame
72 @param _rxContext
73 our component context. Must not be <NULL/>, and must provide a non-<NULL/> XMultiComponentFactory
74 @param _rxPropertyAdapter
75 an adapter to the object's SQL command related properties
76 @param _rConnection
77 the current connection of ->_rxRowSet. Must not be <NULL/>.
78 @param _rCloseLink
79 link to call when the component has been closed
80 @throws ::com::sun::star::lang::NullPointerException
81 if any of the arguments (except ->_rCloseLink) is <NULL/>, or if the component context
82 does not provide a valid component factory.
84 SQLCommandDesigner(
85 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
86 const ::rtl::Reference< ISQLCommandAdapter >& _rxPropertyAdapter,
87 const ::dbtools::SharedConnection& _rConnection,
88 const Link& _rCloseLink
91 /** determines whether the SQL Command designer is currently active, i.e.
92 if there currently exists a frame which allows the user entering the SQL command
94 inline bool isActive() const { return m_xDesigner.is(); }
96 /** returns the property adapter used by the instance
98 inline const ::rtl::Reference< ISQLCommandAdapter >& getPropertyAdapter() const { return m_xObjectAdapter; }
100 /** raises the designer window to top
101 @precond
102 the designer is active (->isActive)
103 @precond
104 the instance is not disposed
106 void raise() const;
108 /** suspends the designer
109 @precond
110 the designer is active (->isActive)
111 @precond
112 the instance is not disposed
114 bool suspend() const;
116 /** disposes the instance so that it becomes non-functional
118 void dispose();
120 protected:
121 // XPropertyChangeListener
122 virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
124 // XEventListener
125 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
127 protected:
128 ~SQLCommandDesigner();
130 /** opens a new frame for interactively designing an SQL command
131 @precond
132 the designer is not currently active (see ->isActive)
133 @precond
134 ->m_xConnection is not <NULL/>
136 void impl_doOpenDesignerFrame_nothrow();
138 /** impl-version of ->raise
140 void impl_raise_nothrow() const;
142 /** determines whether we are already disposed
144 bool impl_isDisposed() const
146 return !m_xContext.is();
148 /** checks whether we are already disposed
149 @throws ::com::sun::star::lang::DisposedException
150 if we in fact are disposed
152 void impl_checkDisposed_throw() const;
154 /** create an empty top-level frame, which does not belong to the desktop's frame list
155 @precond
156 ->m_xORB is not <NULL/>
158 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
159 impl_createEmptyParentlessTask_nothrow() const;
161 /** called whenever the component denoted by m_xDesigner has been closed
162 <em>by an external instance</em>
164 void impl_designerClosed_nothrow();
166 /** closes the component denoted by m_xDesigner
167 @precond
168 our designer component is actually active (->isActive)
169 @precond
170 we're not disposed already
172 void impl_closeDesigner_nothrow();
174 /** suspends our designer component
175 @precond
176 the designer component is actually active (->isActive)
177 @return
178 <TRUE/> if the suspension was successful, <FALSE/> if it was vetoed
180 bool impl_trySuspendDesigner_nothrow() const;
182 /** gets the current value of the command property
184 ::rtl::OUString
185 impl_getCommandPropertyValue_nothrow();
187 /** sets anew value for the command property
189 void impl_setCommandPropertyValue_nothrow( const ::rtl::OUString& _rCommand ) const;
191 private:
192 SQLCommandDesigner(); // never implemented
193 SQLCommandDesigner( const SQLCommandDesigner& ); // never implemented
194 SQLCommandDesigner& operator=( const SQLCommandDesigner& ); // never implemented
197 //====================================================================
198 //= ISQLCommandAdapter
199 //====================================================================
200 /** an adapter to forward changed SQL command property values to a component
202 class ISQLCommandAdapter : public ::rtl::IReference
204 public:
205 /// retrieves the current SQL command of the component
206 virtual ::rtl::OUString getSQLCommand() const = 0;
207 /// retrieves the current value of the EscapeProcessing property of the component
208 virtual sal_Bool getEscapeProcessing() const = 0;
210 /// sets a new SQL command
211 virtual void setSQLCommand( const ::rtl::OUString& _rCommand ) const = 0;
212 /// sets a new EscapeProcessing property value
213 virtual void setEscapeProcessing( const sal_Bool _bEscapeProcessing ) const = 0;
215 virtual ~ISQLCommandAdapter();
218 //........................................................................
219 } // namespace pcr
220 //........................................................................
222 #endif // EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX