LibreOffice Module dbaccess (master) 1
TableFieldControl.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
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>
28
29using namespace ::com::sun::star::uno;
30using namespace ::com::sun::star::beans;
31using namespace ::com::sun::star::util;
32using namespace ::com::sun::star::lang;
33using namespace ::com::sun::star::sdbc;
34using namespace dbaui;
35
36OTableFieldControl::OTableFieldControl(weld::Container* pParent, OTableDesignHelpBar* pHelpBar, OTableDesignView* pView)
37 : OFieldDescControl(pParent, pHelpBar)
38 , m_xView(pView)
39{
40}
41
43{
44 m_xView.clear();
45}
46
48{
49 dispose();
50}
51
52void OTableFieldControl::CellModified(sal_Int32 nRow, sal_uInt16 nColId )
53{
54 GetCtrl()->CellModified(nRow,nColId);
55}
56
58{
59 assert(m_xView && "no view!");
60 return m_xView->GetEditorCtrl();
61}
62
64{
65 bool bRead(GetCtrl()->IsReadOnly());
66 if( !bRead )
67 {
68 // The columns of a css::sdbcx::View could not be locked
70 if(xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == "VIEW")
71 bRead = true;
72 else
73 {
74 std::shared_ptr<OTableRow> pCurRow = GetCtrl()->GetActRow();
75 if( pCurRow )
76 bRead = pCurRow->IsReadOnly();
77 }
78 }
79 return bRead;
80}
81
83{
84 switch(eType)
85 {
86 case tpColumnName:
87 case tpType:
88 break;
89 default:
91 }
92}
93
95{
96 switch(eType)
97 {
98 case tpColumnName:
99 case tpType:
100 break;
101 default:
103 }
104}
105
107{
108 GetCtrl()->GetView()->getController().setModified(bModified);
109}
110
111css::uno::Reference< css::sdbc::XConnection> OTableFieldControl::getConnection()
112{
113 return GetCtrl()->GetView()->getController().getConnection();
114}
115
116css::uno::Reference< css::sdbc::XDatabaseMetaData> OTableFieldControl::getMetaData()
117{
118 Reference<XConnection> xCon = GetCtrl()->GetView()->getController().getConnection();
119 if(!xCon.is())
120 return nullptr;
121 return xCon->getMetaData();
122}
123
125{
126 return GetCtrl()->GetView()->getController().getNumberFormatter();
127}
128
130{
132}
133
135{
136 return &GetCtrl()->GetView()->getController().getTypeInfo();
137}
138
140{
141 return GetCtrl()->GetView()->getLocale();
142}
143
145{
147}
148
150{
152}
153
154/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void ActivateAggregate(EControlType eType)
virtual void DeactivateAggregate(EControlType eType)
const OTypeInfoMap & getTypeInfo() const
const OUString & getAutoIncrementValue() const
bool isAutoIncrementValueEnabled() const
const css::uno::Reference< css::beans::XPropertySet > & getTable() const
const css::lang::Locale & getLocale() const
OTableController & getController() const
virtual void CellModified() override
const std::shared_ptr< OTableRow > & GetActRow() const
virtual OTableDesignView * GetView() const override
VclPtr< OTableDesignView > m_xView
virtual css::uno::Reference< css::util::XNumberFormatter > GetFormatter() const override
virtual void CellModified(sal_Int32 nRow, sal_uInt16 nColId) override
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > getMetaData() override
virtual css::lang::Locale GetLocale() const override
virtual void ActivateAggregate(EControlType eType) override
virtual css::uno::Reference< css::sdbc::XConnection > getConnection() override
virtual bool IsReadOnly() override
virtual bool isAutoIncrementValueEnabled() const override
virtual void SetModified(bool bModified) override
OTableEditorCtrl * GetCtrl() const
virtual OUString getAutoIncrementValue() const override
virtual const OTypeInfoMap * getTypeInfo() const override
virtual void DeactivateAggregate(EControlType eType) override
virtual ~OTableFieldControl() override
OUString eType
Definition: generalpage.cxx:78
std::multimap< sal_Int32, TOTypeInfoSP > OTypeInfoMap
Definition: TypeInfo.hxx:100
std::shared_ptr< OTypeInfo > TOTypeInfoSP
Definition: TypeInfo.hxx:99
EControlType
Definition: QEnumTypes.hxx:63
@ tpType
Definition: QEnumTypes.hxx:74
@ tpColumnName
Definition: QEnumTypes.hxx:73
constexpr OUStringLiteral PROPERTY_TYPE(u"Type")
sal_Int32 _nPos