bump product version to 4.1.6.2
[LibreOffice.git] / dbaccess / source / ui / inc / JoinController.hxx
blobf7477d9ba134188d4d9d166fd7bd5c67cb092cbe
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 DBAUI_JOINCONTROLLER_HXX
20 #define DBAUI_JOINCONTROLLER_HXX
22 #include "singledoccontroller.hxx"
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include "moduledbu.hxx"
25 #include "JoinTableView.hxx"
26 #include "JoinDesignView.hxx"
27 #include "TableConnectionData.hxx"
28 #include "TableWindowData.hxx"
29 #include <memory>
30 #include <boost/shared_ptr.hpp>
32 namespace comphelper
34 class NamedValueCollection;
37 namespace dbaui
39 class OAddTableDlg;
40 class AddTableDialogContext;
41 class OTableWindow;
42 typedef OSingleDocumentController OJoinController_BASE;
44 class OJoinController : public OJoinController_BASE
46 OModuleClient m_aModuleClient;
47 protected:
48 TTableConnectionData m_vTableConnectionData;
49 TTableWindowData m_vTableData;
51 Fraction m_aZoom;
52 ::dbtools::SQLExceptionInfo m_aExceptionInfo;
54 OAddTableDlg* m_pAddTableDialog;
55 ::std::auto_ptr< AddTableDialogContext > m_pDialogContext;
56 Point m_aMinimumTableViewSize;
58 // 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.
59 virtual FeatureState GetState(sal_uInt16 nId) const;
60 // execute a feature
61 virtual void Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
63 /** loads the information for the windows.
64 @param i_rViewSettings
65 The properties which comes from the layout information.
67 void loadTableWindows( const ::comphelper::NamedValueCollection& i_rViewSettings );
69 /** loads the information for one window.
70 @param _rTable
71 The properties which comes from the layout information.
73 void loadTableWindow( const ::comphelper::NamedValueCollection& i_rTableWindowSettings );
75 /** saves the TableWindows structure in a sequence of property values
76 @param _rViewProps
77 Contains the new sequence.
79 void saveTableWindows( ::comphelper::NamedValueCollection& o_rViewSettings ) const;
81 virtual ~OJoinController();
82 public:
83 OJoinController(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rM);
85 // ---------------------------------------------------------------
86 // attribute access
87 inline TTableWindowData* getTableWindowData() { return &m_vTableData; }
88 inline TTableConnectionData* getTableConnectionData() { return &m_vTableConnectionData;}
89 inline OAddTableDlg* getAddTableDialog()const { return m_pAddTableDialog; }
91 // ---------------------------------------------------------------
92 // OSingleDocumentController overridables
93 virtual void reconnect( sal_Bool _bUI );
94 virtual void impl_onModifyChanged();
96 // ---------------------------------------------------------------
97 // own overridables
98 /** determines whether or not it's allowed for database views to participate in the game
100 virtual bool allowViews() const = 0;
102 /** determines whether or not it's allowed for queries to participate in the game
104 virtual bool allowQueries() const = 0;
106 /** provides access to the OJoinDesignView belonging to the controller, which might
107 or might not be the direct view (getView)
109 virtual OJoinDesignView* getJoinView();
112 // ---------------------------------------------------------------
113 /** erase the data in the data vector
114 @param _pData
115 the data whioch should be erased
117 void removeConnectionData(const TTableConnectionData::value_type& _pData);
119 void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY );
121 void SaveTabWinPosSize(OTableWindow* pTabWin, long nOffsetX, long nOffsetY);
123 // ---------------------------------------------------------------
124 // UNO interface overridables
125 // XEventListener
126 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
128 // ::com::sun::star::lang::XComponent
129 virtual void SAL_CALL disposing();
130 // ::com::sun::star::frame::XController
131 virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException );
134 // ---------------------------------------------------------------
135 // misc
136 /** only defines a method to save a SQLException in d&d methods to show the error at a later state
137 set the internal member m_aExceptionInfo to _rInfo
139 void setErrorOccurred(const ::dbtools::SQLExceptionInfo& _rInfo)
141 m_aExceptionInfo = _rInfo;
144 just returns the internal member and clears it
146 ::dbtools::SQLExceptionInfo clearOccurredError()
148 ::dbtools::SQLExceptionInfo aInfo = m_aExceptionInfo;
149 m_aExceptionInfo = ::dbtools::SQLExceptionInfo();
150 return aInfo;
153 protected:
154 TTableWindowData::value_type createTableWindowData(const OUString& _sComposedName,const OUString& _sTableName,const OUString& _sWindowName);
155 // ask the user if the design should be saved when it is modified
156 virtual short saveModified() = 0;
157 // called when the orignal state should be reseted (first time load)
158 virtual void reset() = 0;
159 virtual void describeSupportedFeatures();
161 AddTableDialogContext& impl_getDialogContext() const;
164 #endif // DBAUI_JOINCONTROLLER_HXX
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */