Issue 21669

Summary: code missing for SwXTableColumns::getByIndex()
Product: App Dev Reporter: con.hennessy
Component: apiAssignee: chne
Status: CLOSED FIXED QA Contact: issues@api <issues>
Severity: Trivial    
Priority: P3 CC: buti, issues
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: Other   
OS: Linux, all   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description con.hennessy 2003-10-24 17:53:45 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{} 
 
:(
Comment 1 ooo 2003-10-27 11:56:14 UTC
implementation issue
Comment 2 thomas.lange 2003-10-28 11:59:44 UTC
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.
Comment 3 thomas.lange 2003-10-28 12:00:09 UTC
Task set to invalid.
Comment 4 con.hennessy 2003-10-28 19:18:25 UTC
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 
Comment 5 buti 2003-10-30 15:29:11 UTC
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. 
Comment 6 thorsten.ziehm 2004-11-10 14:49:48 UTC
Because fo limited resources changes cannot be implemented for OOo2.0. I change
the target to Office Later and assigne back to TL.
Comment 7 thomas.lange 2005-07-13 14:48:14 UTC
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
Comment 8 chne 2005-09-21 08:40:59 UTC
new target OO2.0.1
Comment 9 Oliver Specht 2005-11-08 12:19:35 UTC
Reassigned for verification

re-open issue and reassign to cn@openoffice.org
Comment 10 Oliver Specht 2005-11-08 12:19:39 UTC
reassign to cn@openoffice.org
Comment 11 Oliver Specht 2005-11-08 12:19:45 UTC
reset resolution to FIXED
Comment 12 chne 2005-11-09 09:48:47 UTC
ok in tl14
Comment 13 chne 2005-12-12 11:28:27 UTC
ok in src680_m143 => zu