fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / ui / tabledesign / TableFieldControl.cxx
blob2ff476abbabdea752a2402304b0a767cc9670cf3
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 .
20 #include "TableFieldControl.hxx"
21 #include "TableController.hxx"
22 #include "TableDesignView.hxx"
23 #include "TEditControl.hxx"
24 #include "dbustrings.hrc"
25 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
26 #include <com/sun/star/beans/PropertyAttribute.hpp>
27 #include <comphelper/types.hxx>
28 #include "TypeInfo.hxx"
29 #include "UITools.hxx"
31 using namespace ::com::sun::star::uno;
32 using namespace ::com::sun::star::beans;
33 using namespace ::com::sun::star::util;
34 using namespace ::com::sun::star::lang;
35 using namespace ::com::sun::star::sdbc;
36 using namespace dbaui;
38 OTableFieldControl::OTableFieldControl( vcl::Window* pParent, OTableDesignHelpBar* pHelpBar) :OFieldDescControl(pParent,pHelpBar)
42 void OTableFieldControl::CellModified(long nRow, sal_uInt16 nColId )
44 GetCtrl()->CellModified(nRow,nColId);
47 OTableEditorCtrl* OTableFieldControl::GetCtrl() const
49 OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent()->GetParent());
50 OSL_ENSURE(pDesignWin,"no view!");
51 return pDesignWin->GetEditorCtrl();
54 bool OTableFieldControl::IsReadOnly()
56 bool bRead(GetCtrl()->IsReadOnly());
57 if( !bRead )
59 // The columns of a ::com::sun::star::sdbcx::View could not be locked
60 Reference<XPropertySet> xTable = GetCtrl()->GetView()->getController().getTable();
61 if(xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == "VIEW")
62 bRead = true;
63 else
65 ::boost::shared_ptr<OTableRow> pCurRow = GetCtrl()->GetActRow();
66 if( pCurRow )
67 bRead = pCurRow->IsReadOnly();
70 return bRead;
73 void OTableFieldControl::ActivateAggregate( EControlType eType )
75 switch(eType)
77 case tpColumnName:
78 case tpType:
79 break;
80 default:
81 OFieldDescControl::ActivateAggregate(eType);
85 void OTableFieldControl::DeactivateAggregate( EControlType eType )
87 switch(eType)
89 case tpColumnName:
90 case tpType:
91 break;
92 default:
93 OFieldDescControl::DeactivateAggregate(eType);
97 void OTableFieldControl::SetModified(bool bModified)
99 GetCtrl()->GetView()->getController().setModified(bModified);
102 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> OTableFieldControl::getConnection()
104 return GetCtrl()->GetView()->getController().getConnection();
107 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> OTableFieldControl::getMetaData()
109 Reference<XConnection> xCon = GetCtrl()->GetView()->getController().getConnection();
110 if(!xCon.is())
111 return NULL;
112 return xCon->getMetaData();
115 Reference< XNumberFormatter > OTableFieldControl::GetFormatter() const
117 return GetCtrl()->GetView()->getController().getNumberFormatter();
120 TOTypeInfoSP OTableFieldControl::getTypeInfo(sal_Int32 _nPos)
122 return GetCtrl()->GetView()->getController().getTypeInfo(_nPos);
125 const OTypeInfoMap* OTableFieldControl::getTypeInfo() const
127 return &GetCtrl()->GetView()->getController().getTypeInfo();
130 Locale OTableFieldControl::GetLocale() const
132 return GetCtrl()->GetView()->getLocale();
135 bool OTableFieldControl::isAutoIncrementValueEnabled() const
137 return GetCtrl()->GetView()->getController().isAutoIncrementValueEnabled();
140 OUString OTableFieldControl::getAutoIncrementValue() const
142 return GetCtrl()->GetView()->getController().getAutoIncrementValue();
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */