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: JoinController.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_JOINCONTROLLER_HXX
31 #define DBAUI_JOINCONTROLLER_HXX
33 #ifndef DBAUI_SINGLEDOCCONTROLLER_HXX
34 #include "singledoccontroller.hxx"
36 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
37 #include <com/sun/star/beans/XPropertySet.hpp>
39 #ifndef _DBAUI_MODULE_DBU_HXX_
40 #include "moduledbu.hxx"
42 #ifndef DBAUI_JOINTABLEVIEW_HXX
43 #include "JoinTableView.hxx"
45 #ifndef DBAUI_JOINDESIGNVIEW_HXX
46 #include "JoinDesignView.hxx"
48 #include "TableConnectionData.hxx"
49 #include "TableWindowData.hxx"
53 #include <boost/shared_ptr.hpp>
59 class AddTableDialogContext
;
60 class OTableConnectionData
;
61 class OTableWindowData
;
63 typedef OSingleDocumentController OJoinController_BASE
;
65 class OJoinController
: public OJoinController_BASE
67 OModuleClient m_aModuleClient
;
69 TTableConnectionData m_vTableConnectionData
;
70 TTableWindowData m_vTableData
;
73 ::dbtools::SQLExceptionInfo m_aExceptionInfo
;
75 OAddTableDlg
* m_pAddTableDialog
;
76 ::std::auto_ptr
< AddTableDialogContext
> m_pDialogContext
;
77 Point m_aMinimumTableViewSize
;
79 // state of a feature. 'feature' may be the handle of a ::com::sun::star::util::URL somebody requested a dispatch interface for OR a toolbar slot.
80 virtual FeatureState
GetState(sal_uInt16 nId
) const;
82 virtual void Execute(sal_uInt16 nId
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& aArgs
);
84 /** loads the information for the windows.
86 The properties which comes from the layout information.
88 void loadTableWindows(const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _aViewProps
);
90 /** loads the information for one window.
92 The properties which comes from the layout information.
94 void loadTableWindow(const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _rTable
);
96 /** saves the TableWindows structure in a sequence of property values
98 Contains the new sequence.
100 void saveTableWindows(::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _rViewProps
);
102 virtual ~OJoinController();
104 OJoinController(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rM
);
106 // ---------------------------------------------------------------
108 inline TTableWindowData
* getTableWindowData() { return &m_vTableData
; }
109 inline TTableConnectionData
* getTableConnectionData() { return &m_vTableConnectionData
;}
110 inline OAddTableDlg
* getAddTableDialog()const { return m_pAddTableDialog
; }
112 // ---------------------------------------------------------------
113 // OSingleDocumentController overridables
114 virtual void reconnect( sal_Bool _bUI
);
115 virtual void setModified( sal_Bool _bModified
= sal_True
);
117 // ---------------------------------------------------------------
119 /** determines whether or not it's allowed for database views to participate in the game
121 virtual bool allowViews() const = 0;
123 /** determines whether or not it's allowed for queries to participate in the game
125 virtual bool allowQueries() const = 0;
127 /** provides access to the OJoinDesignView belonging to the controller, which might
128 or might not be the direct view (getView)
130 virtual OJoinDesignView
* getJoinView();
133 // ---------------------------------------------------------------
134 /** erase the data in the data vector
136 the data whioch should be erased
138 void removeConnectionData(const TTableConnectionData::value_type
& _pData
);
140 void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap
* pTabWinList
, long nOffsetX
, long nOffsetY
);
142 void SaveTabWinPosSize(OTableWindow
* pTabWin
, long nOffsetX
, long nOffsetY
);
144 // ---------------------------------------------------------------
145 // UNO interface overridables
147 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
);
149 // ::com::sun::star::lang::XComponent
150 virtual void SAL_CALL
disposing();
151 // ::com::sun::star::frame::XController
152 virtual sal_Bool SAL_CALL
suspend(sal_Bool bSuspend
) throw( ::com::sun::star::uno::RuntimeException
);
155 // ---------------------------------------------------------------
157 /** only defines a method to save a SQLException in d&d methods to show the error at a later state
158 set the internal member m_aExceptionInfo to _rInfo
160 void setErrorOccured(const ::dbtools::SQLExceptionInfo
& _rInfo
)
162 m_aExceptionInfo
= _rInfo
;
165 just returns the internal member and clears it
167 ::dbtools::SQLExceptionInfo
clearOccuredError()
169 ::dbtools::SQLExceptionInfo aInfo
= m_aExceptionInfo
;
170 m_aExceptionInfo
= ::dbtools::SQLExceptionInfo();
175 TTableWindowData::value_type
createTableWindowData(const ::rtl::OUString
& _sComposedName
,const ::rtl::OUString
& _sTableName
,const ::rtl::OUString
& _sWindowName
);
176 // ask the user if the design should be saved when it is modified
177 virtual short saveModified() = 0;
178 // called when the orignal state should be reseted (first time load)
179 virtual void reset() = 0;
180 virtual void describeSupportedFeatures();
182 AddTableDialogContext
& impl_getDialogContext() const;
185 #endif // DBAUI_JOINCONTROLLER_HXX