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 .
21 #include "singledoccontroller.hxx"
22 #include "JoinTableView.hxx"
23 #include "JoinDesignView.hxx"
24 #include "TableConnectionData.hxx"
25 #include "TableWindowData.hxx"
30 class NamedValueCollection
;
36 class AddTableDialogContext
;
38 typedef OSingleDocumentController OJoinController_BASE
;
40 class OJoinController
: public OJoinController_BASE
43 TTableConnectionData m_vTableConnectionData
;
44 TTableWindowData m_vTableData
;
46 ::dbtools::SQLExceptionInfo m_aExceptionInfo
;
48 std::shared_ptr
<OAddTableDlg
> m_xAddTableDialog
;
49 std::unique_ptr
< AddTableDialogContext
> m_pDialogContext
;
50 Point m_aMinimumTableViewSize
;
52 // state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot.
53 virtual FeatureState
GetState(sal_uInt16 nId
) const override
;
55 virtual void Execute(sal_uInt16 nId
, const css::uno::Sequence
< css::beans::PropertyValue
>& aArgs
) override
;
57 /** loads the information for the windows.
58 @param i_rViewSettings
59 The properties which comes from the layout information.
61 void loadTableWindows( const ::comphelper::NamedValueCollection
& i_rViewSettings
);
63 /** loads the information for one window.
65 The properties which comes from the layout information.
67 void loadTableWindow( const ::comphelper::NamedValueCollection
& i_rTableWindowSettings
);
69 /** saves the TableWindows structure in a sequence of property values
71 Contains the new sequence.
73 void saveTableWindows( ::comphelper::NamedValueCollection
& o_rViewSettings
) const;
75 virtual ~OJoinController() override
;
77 OJoinController(const css::uno::Reference
< css::uno::XComponentContext
>& _rM
);
80 TTableWindowData
& getTableWindowData() { return m_vTableData
; }
81 TTableConnectionData
& getTableConnectionData() { return m_vTableConnectionData
;}
82 OAddTableDlg
* getAddTableDialog()const { return m_xAddTableDialog
.get(); }
84 // OSingleDocumentController overridables
85 virtual void reconnect( bool _bUI
) override
;
86 virtual void impl_onModifyChanged() override
;
89 /** determines whether or not it's allowed for database views to participate in the game
91 virtual bool allowViews() const = 0;
93 /** determines whether or not it's allowed for queries to participate in the game
95 virtual bool allowQueries() const = 0;
97 /** provides access to the OJoinDesignView belonging to the controller, which might
98 or might not be the direct view (getView)
100 virtual OJoinDesignView
* getJoinView();
102 /** erase the data in the data vector
104 the data which should be erased
106 void removeConnectionData(const TTableConnectionData::value_type
& _pData
);
108 void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap
* pTabWinList
, tools::Long nOffsetX
, tools::Long nOffsetY
);
110 static void SaveTabWinPosSize(OTableWindow
const * pTabWin
, tools::Long nOffsetX
, tools::Long nOffsetY
);
112 // UNO interface overridables
114 using OJoinController_BASE::disposing
;
116 // css::lang::XComponent
117 virtual void SAL_CALL
disposing() override
;
118 // css::frame::XController
119 virtual sal_Bool SAL_CALL
suspend(sal_Bool bSuspend
) override
;
122 /** only defines a method to save a SQLException in d&d methods to show the error at a later state
123 set the internal member m_aExceptionInfo to _rInfo
125 void setErrorOccurred(const ::dbtools::SQLExceptionInfo
& _rInfo
)
127 m_aExceptionInfo
= _rInfo
;
130 just returns the internal member and clears it
132 ::dbtools::SQLExceptionInfo
clearOccurredError()
134 ::dbtools::SQLExceptionInfo aInfo
= m_aExceptionInfo
;
135 m_aExceptionInfo
= ::dbtools::SQLExceptionInfo();
140 void runDialogAsync();
143 TTableWindowData::value_type
createTableWindowData(const OUString
& _sComposedName
,const OUString
& _sTableName
,const OUString
& _sWindowName
);
144 // ask the user if the design should be saved when it is modified
145 virtual short saveModified() = 0;
146 // called when the original state should be reset (first time load)
147 virtual void reset() = 0;
148 virtual void describeSupportedFeatures() override
;
150 AddTableDialogContext
& impl_getDialogContext() const;
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */