1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_JOINCONTROLLER_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_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 <tools/fract.hxx>
34 class NamedValueCollection
;
40 class AddTableDialogContext
;
42 typedef OSingleDocumentController OJoinController_BASE
;
44 class OJoinController
: public OJoinController_BASE
46 OModuleClient m_aModuleClient
;
48 TTableConnectionData m_vTableConnectionData
;
49 TTableWindowData m_vTableData
;
51 ::dbtools::SQLExceptionInfo m_aExceptionInfo
;
53 VclPtr
<OAddTableDlg
> m_pAddTableDialog
;
54 ::std::unique_ptr
< AddTableDialogContext
> m_pDialogContext
;
55 Point m_aMinimumTableViewSize
;
57 // state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot.
58 virtual FeatureState
GetState(sal_uInt16 nId
) const override
;
60 virtual void Execute(sal_uInt16 nId
, const css::uno::Sequence
< css::beans::PropertyValue
>& aArgs
) override
;
62 /** loads the information for the windows.
63 @param i_rViewSettings
64 The properties which comes from the layout information.
66 void loadTableWindows( const ::comphelper::NamedValueCollection
& i_rViewSettings
);
68 /** loads the information for one window.
70 The properties which comes from the layout information.
72 void loadTableWindow( const ::comphelper::NamedValueCollection
& i_rTableWindowSettings
);
74 /** saves the TableWindows structure in a sequence of property values
76 Contains the new sequence.
78 void saveTableWindows( ::comphelper::NamedValueCollection
& o_rViewSettings
) const;
80 virtual ~OJoinController();
82 OJoinController(const css::uno::Reference
< css::uno::XComponentContext
>& _rM
);
85 inline TTableWindowData
& getTableWindowData() { return m_vTableData
; }
86 inline TTableConnectionData
& getTableConnectionData() { return m_vTableConnectionData
;}
87 inline OAddTableDlg
* getAddTableDialog()const { return m_pAddTableDialog
; }
89 // OSingleDocumentController overridables
90 virtual void reconnect( bool _bUI
) override
;
91 virtual void impl_onModifyChanged() override
;
94 /** determines whether or not it's allowed for database views to participate in the game
96 virtual bool allowViews() const = 0;
98 /** determines whether or not it's allowed for queries to participate in the game
100 virtual bool allowQueries() const = 0;
102 /** provides access to the OJoinDesignView belonging to the controller, which might
103 or might not be the direct view (getView)
105 virtual OJoinDesignView
* getJoinView();
107 /** erase the data in the data vector
109 the data which should be erased
111 void removeConnectionData(const TTableConnectionData::value_type
& _pData
);
113 void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap
* pTabWinList
, long nOffsetX
, long nOffsetY
);
115 static void SaveTabWinPosSize(OTableWindow
* pTabWin
, long nOffsetX
, long nOffsetY
);
117 // UNO interface overridables
119 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) throw(css::uno::RuntimeException
, std::exception
) override
;
121 // css::lang::XComponent
122 virtual void SAL_CALL
disposing() override
;
123 // css::frame::XController
124 virtual sal_Bool SAL_CALL
suspend(sal_Bool bSuspend
) throw( css::uno::RuntimeException
, std::exception
) override
;
127 /** only defines a method to save a SQLException in d&d methods to show the error at a later state
128 set the internal member m_aExceptionInfo to _rInfo
130 void setErrorOccurred(const ::dbtools::SQLExceptionInfo
& _rInfo
)
132 m_aExceptionInfo
= _rInfo
;
135 just returns the internal member and clears it
137 ::dbtools::SQLExceptionInfo
clearOccurredError()
139 ::dbtools::SQLExceptionInfo aInfo
= m_aExceptionInfo
;
140 m_aExceptionInfo
= ::dbtools::SQLExceptionInfo();
145 TTableWindowData::value_type
createTableWindowData(const OUString
& _sComposedName
,const OUString
& _sTableName
,const OUString
& _sWindowName
);
146 // ask the user if the design should be saved when it is modified
147 virtual short saveModified() = 0;
148 // called when the orignal state should be reseted (first time load)
149 virtual void reset() = 0;
150 virtual void describeSupportedFeatures() override
;
152 AddTableDialogContext
& impl_getDialogContext() const;
155 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_JOINCONTROLLER_HXX
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */