summaryrefslogtreecommitdiff
path: root/automation
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2010-05-21 16:40:24 +0200
committerKurt Zenker <kz@openoffice.org>2010-05-21 16:40:24 +0200
commitaa9ff28ea9237d6098d59b7608f64111174a9cdd (patch)
tree695b0f46ee65b71d3f90b6cb76b05ccfc141c754 /automation
parent8577fa6db9a7e24720cb9391f443cd0717104c7f (diff)
parent771a23df1757f5aecbd2cb722e15691e9a6f28ff (diff)
CWS-TOOLING: integrate CWS gridcontrol_03
Notes
Notes: split repo tag: components_ooo/DEV300_m79
Diffstat (limited to 'automation')
-rw-r--r--automation/source/inc/rcontrol.hxx8
-rw-r--r--automation/source/server/sta_list.cxx3
-rw-r--r--automation/source/server/statemnt.cxx183
3 files changed, 184 insertions, 10 deletions
diff --git a/automation/source/inc/rcontrol.hxx b/automation/source/inc/rcontrol.hxx
index 829dd320beb6..7313603096b4 100644
--- a/automation/source/inc/rcontrol.hxx
+++ b/automation/source/inc/rcontrol.hxx
@@ -305,7 +305,7 @@
#define RC_Profile ( M_SOFFICE | M_MOZILLA | 9 )
// (Popup)Menu
#define RC_MenuSelect ( M_SOFFICE | M_MOZILLA | 10 )
-#define RC_SetControlType ( M_SOFFICE | 11 )
+#define RC_SetControlType ( M_SOFFICE | 11 ) // deprecated since RTTI
// RemoteFileAccess
#define RC_Kill ( M_SOFFICE | 12 )
#define RC_RmDir ( M_SOFFICE | 13 )
@@ -429,14 +429,14 @@
-// Konstanten die im Basic zur Verfügung stehen sollen
+// Constants which are available in VCLTestTool scripts
-// Verschiedene Typen von Controls für den Befehl SetControlType
-// !!!!!!!!!!! Müssen alle bei SetControlType eingetragen werden !!!!!!!!!!!!
+// Different types of controls recognized via RTTI
#define CONST_CTBrowseBox 100
#define CONST_CTValueSet 103
#define CONST_CTORoadmap 104
#define CONST_CTIExtensionListBox 105
+#define CONST_CTTableControl 106
#define CONST_CTUnknown 199
// Konstanten für das ALignment des gesuchten Splitters
diff --git a/automation/source/server/sta_list.cxx b/automation/source/server/sta_list.cxx
index 7f346c298563..c0abcb057f8b 100644
--- a/automation/source/server/sta_list.cxx
+++ b/automation/source/server/sta_list.cxx
@@ -53,6 +53,7 @@
#include <svtools/valueset.hxx>
#include <svtools/roadmap.hxx>
#include <svtools/extensionlistbox.hxx>
+#include <svtools/table/tablecontrol.hxx>
#define WINDOW_ANYTYPE WINDOW_BASE
@@ -999,6 +1000,8 @@ String StatementList::ClientTree(Window *pBase, int Indent)
WRITEc("/RoadMap")
else if ( dynamic_cast< svt::IExtensionListBox* >(pBase) )
WRITEc("/ExtensionListBox")
+ else if ( dynamic_cast< svt::table::TableControl* >(pBase) )
+ WRITEc("/TableControl")
else
WRITEc("/Unknown")
}
diff --git a/automation/source/server/statemnt.cxx b/automation/source/server/statemnt.cxx
index 68ff61bbaa0d..2d1cccd9fc51 100644
--- a/automation/source/server/statemnt.cxx
+++ b/automation/source/server/statemnt.cxx
@@ -82,6 +82,7 @@
#include <vcl/wintypes.hxx>
#include <svtools/valueset.hxx>
#include <svtools/roadmap.hxx>
+#include <svtools/table/tablecontrol.hxx>
#include <svl/poolitem.hxx>
#include <svtools/extensionlistbox.hxx>
// Hat keinen Includeschutz
@@ -96,6 +97,7 @@
#include <basic/ttstrhlp.hxx>
#endif
#include <basic/dispdefs.hxx>
+#include <basic/sbuno.hxx>
#include <vos/socket.hxx>
#include <svl/pickerhistory.hxx>
#include <com/sun/star/util/XCancellable.hpp>
@@ -128,9 +130,10 @@
using namespace com::sun::star::frame;
using namespace com::sun::star::uno;
-using namespace com::sun::star::util;
+//using namespace com::sun::star::util; geht wegen Color nicht
using namespace com::sun::star::beans;
using namespace svt;
+//using namespace svt::table;
#ifndef SBX_VALUE_DECL_DEFINED
@@ -618,7 +621,7 @@ BOOL StatementSlot::Execute()
AddReferer();
if ( !aUnoUrl.Len() )
aUnoUrl = CUniString("slot:").Append( String::CreateFromInt32( nFunctionId ) );
- URL aTargetURL;
+ ::com::sun::star::util::URL aTargetURL;
aTargetURL.Complete = aUnoUrl;
Reference < XFramesSupplier > xDesktop = Reference < XFramesSupplier >( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.frame.Desktop") ), UNO_QUERY );
Reference < XFrame > xFrame;
@@ -664,7 +667,7 @@ BOOL StatementSlot::Execute()
ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_NO_FRAME, aTargetURL.Complete ) );
else
{
- Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.util.URLTransformer" )), UNO_QUERY );
+ Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.util.URLTransformer" )), UNO_QUERY );
xTrans->parseStrict( aTargetURL );
Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY );
@@ -865,6 +868,13 @@ void StatementCommand::WriteControlData( Window *pBase, ULONG nConf, BOOL bFirst
if ( bFirst )
pRet->GenReturn ( RET_WinInfo, SmartId(), (comm_ULONG)nConf | DH_MODE_DATA_VALID, UniString(), TRUE );
+ if ( bFirst )
+ {
+ if ( pBase->GetType() == WINDOW_WINDOW && pBase->GetParent() && pBase->GetParent()->GetType() == WINDOW_CONTROL &&
+ dynamic_cast< svt::table::TableControl* > ( pBase->GetParent() ) )
+ pBase = pBase->GetParent();
+ }
+
{ // Klammerung, so daß der String nicht während der Rekursion bestehen bleibt
String aName;
BOOL bSkip = FALSE;
@@ -958,6 +968,8 @@ void StatementCommand::WriteControlData( Window *pBase, ULONG nConf, BOOL bFirst
aTypeSuffix.AppendAscii( "/RoadMap", 8 );
else if ( dynamic_cast< IExtensionListBox* >(pBase) )
aTypeSuffix.AppendAscii( "/ExtensionListBox" );
+ else if ( dynamic_cast< svt::table::TableControl* >(pBase) )
+ aTypeSuffix.AppendAscii( "/TableControl" );
else
aTypeSuffix.AppendAscii( "/Unknown", 8 );
}
@@ -3388,17 +3400,17 @@ BOOL StatementCommand::Execute()
{
if( (nParams & PARAM_USHORT_1) )
{
- Reference < XCancellable > xPicker;
+ Reference < ::com::sun::star::util::XCancellable > xPicker;
switch( nNr1 )
{
case CONST_FilePicker:
{
- xPicker.set( Reference < XCancellable >( svt::GetTopMostFilePicker(), UNO_QUERY ) );
+ xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFilePicker(), UNO_QUERY ) );
}
break;
case CONST_FolderPicker:
{
- xPicker.set( Reference < XCancellable >( svt::GetTopMostFolderPicker(), UNO_QUERY ) );
+ xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFolderPicker(), UNO_QUERY ) );
}
break;
default:
@@ -5807,6 +5819,8 @@ BOOL StatementControl::Execute()
nRealControlType = CONST_CTORoadmap;
else if ( dynamic_cast< IExtensionListBox* >(pControl) )
nRealControlType = CONST_CTIExtensionListBox;
+ else if ( dynamic_cast< ::svt::table::TableControl* >(pControl) )
+ nRealControlType = CONST_CTTableControl;
else
nRealControlType = CONST_CTUnknown;
@@ -6148,6 +6162,163 @@ protected:
}
}
break;
+
+ case CONST_CTTableControl:
+ {
+ ::svt::table::TableControl *pTC = dynamic_cast< ::svt::table::TableControl* >(pControl);
+ switch ( nMethodId )
+ {
+ case M_GetItemType :
+ {
+ if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) &&
+ ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() ))
+ {
+ ::svt::table::PTableModel pModel = pTC->GetModel();
+ Any aCell = pModel->getCellContent()[nNr2-1][nNr1-1];
+ pRet->GenReturn ( RET_Value, aUId, String( aCell.getValueTypeName() ));
+ }
+ }
+ break;
+ case M_GetItemText :
+ {
+ if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) &&
+ ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() ))
+ {
+ ::svt::table::PTableModel pModel = pTC->GetModel();
+ Any aCell = pModel->getCellContent()[nNr2-1][nNr1-1];
+ /* doesn't work ATM since it gets casted to SbxDATE in VCLTestTool unfortunately
+ SbxVariableRef xRes = new SbxVariable( SbxVARIANT );
+ unoToSbxValue( xRes, aCell );
+ pRet->GenReturn ( RET_Value, aUId, *xRes );*/
+
+ Type aType = aCell.getValueType();
+ TypeClass eTypeClass = aType.getTypeClass();
+ switch( eTypeClass )
+ {
+ /*case TypeClass_ENUM:
+ {
+ sal_Int32 nEnum = 0;
+ enum2int( nEnum, aValue );
+ pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)nEnum );
+ }
+ break;*/
+ case TypeClass_BOOLEAN:
+ pRet->GenReturn ( RET_Value, aUId, *(sal_Bool*)aCell.getValue() );
+ break;
+ case TypeClass_CHAR:
+ {
+ ::rtl::OUString aContent( *(sal_Unicode*)aCell.getValue() );
+ pRet->GenReturn ( RET_Value, aUId, aContent );
+ }
+ break;
+ case TypeClass_STRING:
+ {
+ ::rtl::OUString aContent;
+ aCell >>= aContent;
+ pRet->GenReturn ( RET_Value, aUId, aContent );
+ }
+ break;
+ //case TypeClass_FLOAT: break;
+ //case TypeClass_DOUBLE: break;
+ //case TypeClass_OCTET: break;
+ case TypeClass_BYTE:
+ case TypeClass_SHORT:
+ case TypeClass_LONG:
+ case TypeClass_HYPER:
+ case TypeClass_UNSIGNED_LONG:
+ case TypeClass_UNSIGNED_HYPER:
+ {
+ comm_ULONG val = 0;
+ aCell >>= val;
+ pRet->GenReturn ( RET_Value, aUId, val );
+ }
+ break;
+ //case TypeClass_UNSIGNED_OCTET:break;
+ case TypeClass_UNSIGNED_SHORT:
+ {
+ comm_USHORT val = 0;
+ aCell >>= val;
+ pRet->GenReturn ( RET_Value, aUId, val );
+ }
+ break;
+ default:
+ pRet->GenReturn ( RET_Value, aUId, comm_USHORT(0) );
+ break;
+ }
+ }
+ }
+ break;
+ case M_GetColumnCount :
+ {
+ pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTC->GetColumnCount() );
+ }
+ break;
+ case M_GetRowCount :
+ {
+ pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTC->GetRowCount() );
+ }
+ break;
+ case M_Select :
+ {
+ if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetRowCount() ))
+ {
+ if ( pTC->GoToRow( ::svt::table::RowPos( nNr1-1 ) ) )
+ {
+ Size aSize( pTC->GetSizePixel() );
+// DirectLog( S_QAError, UniString::CreateFromInt32( aSize.Width() ).Append( UniString::CreateFromInt32( aSize.Height() ) ) );
+ Point aPos( aSize.Width() / 2, aSize.Height() / 2 );
+ long nStep = aSize.Height() / 4;
+ ::svt::table::RowPos nLastPos;
+ while ( ( nLastPos = pTC->GetCurrentRow( aPos ) ) != nNr1-1 && nStep > 0 )
+ {
+ if ( nLastPos > nNr1-1 || nLastPos == ROW_INVALID )
+ aPos.Y() -= nStep;
+ else
+ aPos.Y() += nStep;
+ nStep /= 2;
+ }
+ if ( pTC->GetCurrentRow( aPos ) == nNr1-1 )
+ {
+ MouseEvent aMEvnt(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,MOUSE_LEFT,KEY_MOD1);
+ pTC->getSelEngine()->SelMouseButtonDown( aMEvnt );
+ pTC->getSelEngine()->SelMouseButtonUp( aMEvnt );
+ }
+ else
+ ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "find pos" ) );
+ }
+ else
+ ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "GoTo" ) );
+ }
+ }
+ break;
+ case M_GetSelCount :
+ pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRows().size() ));
+ break;
+ case M_GetSelIndex :
+ if ( ! (nParams & PARAM_USHORT_1) )
+ nNr1 = 1;
+ if ( ValueOK( aUId, CUniString("GetSelIndex"), nNr1, pTC->GetSelectedRows().size() ) )
+ pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRows()[nNr1-1] +1 ) );
+ break;
+/* case M_GetSelText :
+ if ( ! (nParams & PARAM_USHORT_1) )
+ nNr1 = 1;
+ if ( ValueOK(aUId, CUniString("GetSelText"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) )
+ {
+ nNr1--;
+ COUNT_LBOX( FirstSelected, NextSelected, nNr1);
+ GetFirstValidTextItem( pThisEntry );
+ pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
+ }
+ break;
+ */
+ default:
+ ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TableControl" ) );
+ break;
+ }
+ }
+ break;
+
case CONST_CTUnknown:
ReportError( aUId, GEN_RES_STR2( S_UNKNOWN_TYPE, UniString::CreateFromInt32( nRT ), MethodString(nMethodId) ) );
break;