Apache OpenOffice (AOO) Bugzilla – Issue 21669
code missing for SwXTableColumns::getByIndex()
Last modified: 2013-02-24 21:08:29 UTC
Looking at the code in sw/source/core/unocore/unotbl.cxx : uno::Any SwXTableColumns::getByIndex(sal_Int32 nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); uno::Reference< uno::XInterface > xRet; SwFrmFmt* pFrmFmt = GetFrmFmt(); if(!pFrmFmt) throw uno::RuntimeException(); else { USHORT nCount = 0; SwTable* pTable = SwTable::FindTable( pFrmFmt ); if(!pTable->IsTblComplex()) { SwTableLines& rLines = pTable->GetTabLines(); SwTableLine* pLine = rLines.GetObject(0); nCount = pLine->GetTabBoxes().Count(); } if(nCount <= nIndex || nIndex < 0) throw IndexOutOfBoundsException(); xRet = *new cppu::OWeakObject(); } return uno::Any(&xRet, ::getCppuType((const uno::Reference<uno::XInterface>*)0)); } you can see that even though the code in the middle retrieves some information it does not set xRet with any value except " *new cppu::OWeakObject();" which is so close to 0 that it is useless :) The result of this is that when I have the following python code : cols = currentTable.getColumns() print cols.getByIndex(1) I would expect to get something like : pyuno object (com.sun.star.beans.XPropertySet)0x82963d0 { implementationName=SwXTextTableColumn, supportedServices={com.sun.star.text.TextTableColumn}, supportedInterfaces= { com.sun.star.beans.XPropertySet, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.uno.XWeak}} but instead I get : pyuno object (com.sun.star.uno.XInterface)0x82a2370{} :(
implementation issue
The model for text tables is row orientated there is no such thing as a column. Especially if you consider the splitting and merging of cells there is no way for a proper column object to exist and be handled. Thus the implementation just returns sth that can not be used to do anything but mets the API requirements.
Task set to invalid.
Since currentTable.getColumns() only returns an XInterface what good is it ? I'm reopening this issue as something has to change : 1) the documentation fro the API needs to be updated; or 2) the API should be removed; or 3) the implementation should be added with an exception thrown for complex tables
thomas lange said: > The model for text tables is row orientated there is no such thing > as a column. then how can i set the width of a column (a cell if you prefer)? the api docs say it's a property of TableColumn. and: can't cells can be splitted an merged in both directions -- horizontal and vertical. a row oriented approach has the same issues, then.
Because fo limited resources changes cannot be implemented for OOo2.0. I change the target to Office Later and assigne back to TL.
The problem itself is that the internal table representation does not have columns! Thus the original implementation for the function only returned an object that did not support any interface. Since the fact that tables do not have caolumns cannot be changed I only changed the function to return an empty XInterface (which is matching the element type) instead of the object that can not do anything at all. Fixed in CWS tl14. Files changed: - unotbl.cxx new revision: 1.91.168.1
new target OO2.0.1
Reassigned for verification re-open issue and reassign to cn@openoffice.org
reassign to cn@openoffice.org
reset resolution to FIXED
ok in tl14
ok in src680_m143 => zu