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 .
20 #include "TableFieldControl.hxx"
21 #include <TableController.hxx>
22 #include <TableDesignView.hxx>
23 #include "TEditControl.hxx"
24 #include <strings.hxx>
25 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
26 #include <comphelper/types.hxx>
27 #include <TypeInfo.hxx>
29 using namespace ::com::sun::star::uno
;
30 using namespace ::com::sun::star::beans
;
31 using namespace ::com::sun::star::util
;
32 using namespace ::com::sun::star::lang
;
33 using namespace ::com::sun::star::sdbc
;
34 using namespace dbaui
;
36 OTableFieldControl::OTableFieldControl(weld::Container
* pParent
, OTableDesignHelpBar
* pHelpBar
, OTableDesignView
* pView
)
37 : OFieldDescControl(pParent
, pHelpBar
)
42 void OTableFieldControl::dispose()
47 OTableFieldControl::~OTableFieldControl()
52 void OTableFieldControl::CellModified(sal_Int32 nRow
, sal_uInt16 nColId
)
54 GetCtrl()->CellModified(nRow
,nColId
);
57 OTableEditorCtrl
* OTableFieldControl::GetCtrl() const
59 assert(m_xView
&& "no view!");
60 return m_xView
->GetEditorCtrl();
63 bool OTableFieldControl::IsReadOnly()
65 bool bRead(GetCtrl()->IsReadOnly());
68 // The columns of a css::sdbcx::View could not be locked
69 Reference
<XPropertySet
> xTable
= GetCtrl()->GetView()->getController().getTable();
70 if(xTable
.is() && ::comphelper::getString(xTable
->getPropertyValue(PROPERTY_TYPE
)) == "VIEW")
74 std::shared_ptr
<OTableRow
> pCurRow
= GetCtrl()->GetActRow();
76 bRead
= pCurRow
->IsReadOnly();
82 void OTableFieldControl::ActivateAggregate( EControlType eType
)
90 OFieldDescControl::ActivateAggregate(eType
);
94 void OTableFieldControl::DeactivateAggregate( EControlType eType
)
102 OFieldDescControl::DeactivateAggregate(eType
);
106 void OTableFieldControl::SetModified(bool bModified
)
108 GetCtrl()->GetView()->getController().setModified(bModified
);
111 css::uno::Reference
< css::sdbc::XConnection
> OTableFieldControl::getConnection()
113 return GetCtrl()->GetView()->getController().getConnection();
116 css::uno::Reference
< css::sdbc::XDatabaseMetaData
> OTableFieldControl::getMetaData()
118 Reference
<XConnection
> xCon
= GetCtrl()->GetView()->getController().getConnection();
121 return xCon
->getMetaData();
124 Reference
< XNumberFormatter
> OTableFieldControl::GetFormatter() const
126 return GetCtrl()->GetView()->getController().getNumberFormatter();
129 TOTypeInfoSP
OTableFieldControl::getTypeInfo(sal_Int32 _nPos
)
131 return GetCtrl()->GetView()->getController().getTypeInfo(_nPos
);
134 const OTypeInfoMap
* OTableFieldControl::getTypeInfo() const
136 return &GetCtrl()->GetView()->getController().getTypeInfo();
139 Locale
OTableFieldControl::GetLocale() const
141 return GetCtrl()->GetView()->getLocale();
144 bool OTableFieldControl::isAutoIncrementValueEnabled() const
146 return GetCtrl()->GetView()->getController().isAutoIncrementValueEnabled();
149 OUString
OTableFieldControl::getAutoIncrementValue() const
151 return GetCtrl()->GetView()->getController().getAutoIncrementValue();
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */