diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx index 8def9591d5b9..7d0cc1411263 100644 --- a/sc/inc/cellsuno.hxx +++ b/sc/inc/cellsuno.hxx @@ -152,8 +152,10 @@ public: namespace ooo { namespace vba { + namespace excel { class ScVbaCellRangeAccess; // Vba Helper class } + } } class SC_DLLPUBLIC ScCellRangesBase : public com::sun::star::beans::XPropertySet, @@ -175,7 +177,7 @@ class SC_DLLPUBLIC ScCellRangesBase : public com::sun::star::beans::XPropertySet { friend class ScTabViewObj; // fuer select() friend class ScTableSheetObj; // fuer createCursorByRange() - friend class ooo::vba::ScVbaCellRangeAccess; + friend class ooo::vba::excel::ScVbaCellRangeAccess; private: const SfxItemPropertySet* pPropSet; diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 375eebe30964..461a3eb970c2 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -662,7 +662,9 @@ //#define SID_OPENDLG_MODCHART (SC_MESSAGE_START + 58) #define SID_OPENDLG_CONDFRMT (SC_MESSAGE_START + 59) #define SID_OPENDLG_OPTSOLVER (SC_MESSAGE_START + 60) - +//Added by PengYunQuan for Validity Cell Range Picker #define SC_HINT_NAVIGATOR_UPDATEALL (SC_MESSAGE_START + 65) // Funktionen ------------------------------------------------------------ diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index f9895ff15ebb..94084aab4f1b 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -55,6 +55,9 @@ class SfxStyleSheetBase; class ScDPObject; struct ScDPFuncData; struct ScDPNumGroupInfo; +//Added by PengYunQuan for Validity Cell Range Picker namespace com { namespace sun { namespace star { namespace sheet { struct DataPilotFieldReference; @@ -459,8 +462,13 @@ public: virtual SfxAbstractTabDialog * CreateScParagraphDlg( Window* pParent, const SfxItemSet* pAttr ,//add for ScParagraphDlg int nId ) = 0; + //Modified by PengYunQuan for Validity Cell Range Picker virtual SfxAbstractTabDialog * CreateScSortDlg( Window* pParent, //add for ScSortDlg const SfxItemSet* pArgSet,int nId ) = 0; // for tabpage diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 86d1d5b789aa..bf7f8810fec3 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -41,6 +41,12 @@ #include #include +//Added by PengYunQuan for Validity Cell Range Picker + class KeyEvent; class SdrModel; @@ -145,6 +151,9 @@ class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener bool mbIsInSharedDocLoading; bool mbIsInSharedDocSaving; + //Added by PengYunQuan for Validity Cell Range Picker public: SFX_DECL_INTERFACE(SCID_APP) @@ -254,7 +263,10 @@ SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rO ScFormEditData* GetFormEditData() { return pFormEditData; } // Referenzeingabe: - void SetRefDialog( USHORT nId, BOOL bVis, SfxViewFrame* pViewFrm = NULL ); + //Added by PengYunQuan for Validity Cell Range Picker BOOL IsModalMode(SfxObjectShell* pDocSh = NULL); BOOL IsFormulaMode(); BOOL IsRefDialogOpen(); @@ -277,6 +289,14 @@ SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rO bool IsInSharedDocLoading() const { return mbIsInSharedDocLoading; } void SetInSharedDocSaving( bool bNew ) { mbIsInSharedDocSaving = bNew; } bool IsInSharedDocSaving() const { return mbIsInSharedDocSaving; } + + //Added by PengYunQuan for Validity Cell Range Picker }; #define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) ) diff --git a/sc/prj/build.lst b/sc/prj/build.lst index 788c8e58c463..115e92990f3c 100755 --- a/sc/prj/build.lst +++ b/sc/prj/build.lst @@ -1,4 +1,4 @@ -sc sc : filter l10n oovbaapi svx stoc BOOST:boost formula oox NULL +sc sc : filter l10n vbahelper oovbaapi svx uui stoc BOOST:boost formula oox NULL sc sc usr1 - all sc_mkout NULL sc sc\inc nmake - all sc_inc NULL sc sc\prj get - all sc_prj NULL diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 8b6d488baee6..bdabc363738f 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -52,6 +52,9 @@ interface CellSelection SID_OPENDLG_FUNCTION [ ExecMethod = Execute; StateMethod = GetCellState; ] SID_INS_FUNCTION [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] + // no Exec/StateMethod needed, but SfxDispatcher complains if the slot is not included in the shell + SID_VALIDITY_REFERENCE [] + // Datenbank-Operationen { SID_SORT_ASCENDING [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_SORT_DESCENDING [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 8ed57a8dfc5d..de3e3fff56bd 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -2779,6 +2779,33 @@ SfxVoidItem SolverDialog SID_OPENDLG_OPTSOLVER GroupId = GID_OPTIONS; ] +//-------------------------------------------------------------------------- +//Added by PengYunQuan for Validity Cell Range Picker + //-------------------------------------------------------------------------- SfxVoidItem GoDownToEndOfData SID_CURSORBLKDOWN (SfxInt16Item By FN_PARAM_1,SfxBoolItem Sel FN_PARAM_2) diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 5c42032236a4..a172bd63e69b 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -102,6 +102,10 @@ #include #include +#include +#include +#include +#include using namespace com::sun::star; @@ -248,16 +252,6 @@ void ImportExcel8::SheetProtection( void ) GetSheetProtectBuffer().ReadOptions( aIn, GetCurrScTab() ); } -bool lcl_hasVBAEnabled() -{ - uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY); - // test if vba service is present - uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY ); - uno::Reference< uno::XInterface > xGlobals( xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.theGlobals") ), uno::UNO_QUERY ); - - return xGlobals.is(); -} - void ImportExcel8::ReadBasic( void ) { bHasBasic = TRUE; @@ -273,7 +267,7 @@ void ImportExcel8::ReadBasic( void ) if( bLoadCode || bLoadStrg ) { SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg ); - bool bAsComment = !bLoadExecutable || !lcl_hasVBAEnabled(); + bool bAsComment = !bLoadExecutable; aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment ); } } diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index feeae8c73023..fd01269729db 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -1181,7 +1181,7 @@ ScAccessibleEditLineTextData::ScAccessibleEditLineTextData(EditView* pEditView, ScTextWnd* pTxtWnd = (ScTextWnd*)pWin; if (pTxtWnd) - pTxtWnd->SetAccessibleTextData(this); + pTxtWnd->InsertAccessibleTextData( *this ); } ScAccessibleEditLineTextData::~ScAccessibleEditLineTextData() @@ -1189,7 +1189,7 @@ ScAccessibleEditLineTextData::~ScAccessibleEditLineTextData() ScTextWnd* pTxtWnd = (ScTextWnd*)mpWindow; if (pTxtWnd) - pTxtWnd->SetAccessibleTextData(NULL); + pTxtWnd->RemoveAccessibleTextData( *this ); if (mbEditEngineCreated && mpEditEngine) { @@ -1210,7 +1210,7 @@ void ScAccessibleEditLineTextData::Dispose() ScTextWnd* pTxtWnd = (ScTextWnd*)mpWindow; if (pTxtWnd) - pTxtWnd->SetAccessibleTextData(NULL); + pTxtWnd->RemoveAccessibleTextData( *this ); ResetEditMode(); mpWindow = NULL; diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 1f2c81200298..a5b481d3174a 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -31,9 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - - -//------------------------------------------------------------------ +#include #include "scitems.hxx" #include @@ -738,7 +736,6 @@ ScTextWnd::ScTextWnd( Window* pParent ) DragSourceHelper( this ), pEditEngine ( NULL ), pEditView ( NULL ), - pAccTextData ( NULL ), bIsInsertMode( TRUE ), bFormulaMode ( FALSE ), bInputMode ( FALSE ) @@ -774,8 +771,8 @@ __EXPORT ScTextWnd::~ScTextWnd() { delete pEditView; delete pEditEngine; - if (pAccTextData) - pAccTextData->Dispose(); + for( AccTextDataVector::reverse_iterator aIt = maAccTextDatas.rbegin(), aEnd = maAccTextDatas.rend(); aIt != aEnd; ++aIt ) + (*aIt)->Dispose(); } void __EXPORT ScTextWnd::Paint( const Rectangle& rRec ) @@ -1112,8 +1109,8 @@ void ScTextWnd::StartEditEngine() pEditEngine->SetModifyHdl(LINK(this, ScTextWnd, NotifyHdl)); - if (pAccTextData) - pAccTextData->StartEdit(); + if (!maAccTextDatas.empty()) + maAccTextDatas.back()->StartEdit(); // as long as EditEngine and DrawText sometimes differ for CTL text, // repaint now to have the EditEngine's version visible @@ -1154,8 +1151,8 @@ void ScTextWnd::StopEditEngine( BOOL bAll ) { if (pEditView) { - if (pAccTextData) - pAccTextData->EndEdit(); + if (!maAccTextDatas.empty()) + maAccTextDatas.back()->EndEdit(); ScModule* pScMod = SC_MOD(); @@ -1259,8 +1256,8 @@ void ScTextWnd::SetTextString( const String& rNewString ) aString = rNewString; - if (pAccTextData) - pAccTextData->TextChanged(); + if (!maAccTextDatas.empty()) + maAccTextDatas.back()->TextChanged(); bInputMode = FALSE; } @@ -1317,8 +1314,8 @@ void ScTextWnd::MakeDialogEditView() if ( bIsRTL ) lcl_ModifyRTLVisArea( pEditView ); - if (pAccTextData) - pAccTextData->StartEdit(); + if (!maAccTextDatas.empty()) + maAccTextDatas.back()->StartEdit(); } void ScTextWnd::ImplInitSettings() @@ -1343,6 +1340,22 @@ void ScTextWnd::ImplInitSettings() rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), EditLine); } +void ScTextWnd::InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) +{ + OSL_ENSURE( ::std::find( maAccTextDatas.begin(), maAccTextDatas.end(), &rTextData ) == maAccTextDatas.end(), + "ScTextWnd::InsertAccessibleTextData - passed object already registered" ); + maAccTextDatas.push_back( &rTextData ); +} + +void ScTextWnd::RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) +{ + AccTextDataVector::iterator aEnd = maAccTextDatas.end(); + AccTextDataVector::iterator aIt = ::std::find( maAccTextDatas.begin(), aEnd, &rTextData ); + OSL_ENSURE( aIt != aEnd, "ScTextWnd::RemoveAccessibleTextData - passed object not registered" ); + if( aIt != aEnd ) + maAccTextDatas.erase( aIt ); +} + // ----------------------------------------------------------------------- void ScTextWnd::DataChanged( const DataChangedEvent& rDCEvt ) diff --git a/sc/source/ui/app/makefile.mk b/sc/source/ui/app/makefile.mk index 4f3c2bdcb504..1dbac01e6a44 100644 --- a/sc/source/ui/app/makefile.mk +++ b/sc/source/ui/app/makefile.mk @@ -63,7 +63,8 @@ EXCEPTIONSFILES= \ $(SLO)$/drwtrans.obj \ $(SLO)$/scmod2.obj \ $(SLO)$/scmod.obj \ - $(SLO)$/client.obj + $(SLO)$/client.obj \ + $(SLO)$/inputwin.obj #LIB3TARGET=$(SLB)$/ysclib.lib #LIB3OBJFILES=$(SLO)$/sclib.obj diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 8bae4f1762d4..2be737d9a717 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -328,6 +328,10 @@ void ScDLL::Init() ScSpellDialogChildWindow ::RegisterChildWindow(FALSE, pMod); ::avmedia::MediaPlayer ::RegisterChildWindow(FALSE, pMod); + //Added by PengYunQuan for Validity Cell Range Picker + // Edit-Engine-Felder, soweit nicht schon in OfficeApplication::Init SvClassManager& rClassManager = SvxFieldItem::GetClassManager(); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index d72c94022123..b9d8682c412b 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2219,4 +2219,82 @@ IMPL_LINK( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo ) +//Modified by PengYunQuan for Validity Cell Range Picke { SfxTabDialog* pDlg=NULL; switch ( nId ) { case TAB_DLG_VALIDATION : - pDlg = new ScValidationDlg( pParent, pArgSet ); + //Modified by PengYunQuan for Validity Cell Range Picker break; default: break; diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 40f6d3bee976..530220858f35 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -546,7 +546,10 @@ public: int nId ); virtual SfxAbstractTabDialog * CreateScValidationDlg( Window* pParent, //add for ScValidationDlg - const SfxItemSet* pArgSet,int nId ); + //Modified by PengYunQuan for Validity Cell Range Picker virtual SfxAbstractTabDialog * CreateScSortDlg( Window* pParent, //add for ScSortDlg const SfxItemSet* pArgSet,int nId ); diff --git a/sc/source/ui/dbgui/makefile.mk b/sc/source/ui/dbgui/makefile.mk index 5d716552ca71..b495b5eabcc9 100644 --- a/sc/source/ui/dbgui/makefile.mk +++ b/sc/source/ui/dbgui/makefile.mk @@ -81,7 +81,8 @@ EXCEPTIONSFILES= \ $(SLO)$/csvtablebox.obj \ $(SLO)$/fieldwnd.obj \ $(SLO)$/pvlaydlg.obj \ - $(SLO)$/dapidata.obj + $(SLO)$/dapidata.obj \ + $(SLO)$/validate.obj SRS1NAME=$(TARGET) SRC1FILES = \ diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index b23836d44cda..81e8ff35195d 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -53,6 +53,12 @@ #include "validate.hxx" #include "compiler.hxx" #include "formula/opcode.hxx" //CHINA001 +//Added by PengYunQuan for Validity Cell Range Picker // ============================================================================ @@ -66,8 +72,19 @@ static USHORT pValueRanges[] = // ============================================================================ -ScValidationDlg::ScValidationDlg( Window* pParent, const SfxItemSet* pArgSet ) : - SfxTabDialog( pParent, ScResId( TAB_DLG_VALIDATION ), pArgSet ) +//Modified by PengYunQuan for Validity Cell Range Picker { AddTabPage( TP_VALIDATION_VALUES, ScTPValidationValue::Create, 0 ); AddTabPage( TP_VALIDATION_INPUTHELP, ScTPValidationHelp::Create, 0 ); @@ -75,8 +92,100 @@ ScValidationDlg::ScValidationDlg( Window* pParent, const SfxItemSet* pArgSet ) : FreeResource(); } +//Added by PengYunQuan for Validity Cell Range Picker + ScValidationDlg::~ScValidationDlg() { + //Added by PengYunQuan for Validity Cell Range Picker } @@ -236,7 +345,10 @@ ScTPValidationValue::ScTPValidationValue( Window* pParent, const SfxItemSet& rAr maStrMax ( ScResId( SCSTR_VALID_MAXIMUM ) ), maStrValue( ScResId( SCSTR_VALID_VALUE ) ), maStrRange( ScResId( SCSTR_VALID_RANGE ) ), - maStrList ( ScResId( SCSTR_VALID_LIST ) ) + maStrList ( ScResId( SCSTR_VALID_LIST ) ), +//Added by PengYunQuan for Validity Cell Range Picker { Init(); FreeResource(); @@ -246,6 +358,9 @@ ScTPValidationValue::ScTPValidationValue( Window* pParent, const SfxItemSet& rAr String aListSep = ::GetScCompilerNativeSymbol( ocSep ); //CHINA001 DBG_ASSERT( aListSep.Len() == 1, "ScTPValidationValue::ScTPValidationValue - list separator error" ); mcFmlaSep = aListSep.Len() ? aListSep.GetChar( 0 ) : ';'; + //Added by PengYunQuan for Validity Cell Range Picker } ScTPValidationValue::~ScTPValidationValue() @@ -257,6 +372,13 @@ void ScTPValidationValue::Init() maLbAllow.SetSelectHdl( LINK( this, ScTPValidationValue, SelectHdl ) ); maLbValue.SetSelectHdl( LINK( this, ScTPValidationValue, SelectHdl ) ); maCbShow.SetClickHdl( LINK( this, ScTPValidationValue, CheckHdl ) ); + //Added by PengYunQuan for Validity Cell Range Picker maLbAllow.SelectEntryPos( SC_VALIDDLG_ALLOW_ANY ); maLbValue.SelectEntryPos( SC_VALIDDLG_DATA_EQUAL ); @@ -374,6 +496,133 @@ void ScTPValidationValue::SetSecondFormula( const String& rFmlaStr ) maEdMax.SetText( rFmlaStr ); } +//Added by PengYunQuan for Validity Cell Range Picker // ---------------------------------------------------------------------------- @@ -427,7 +676,9 @@ IMPL_LINK( ScTPValidationValue, SelectHdl, ListBox*, EMPTYARG ) maFtMax.Show( bShowMax ); maEdMax.Show( bShowMax ); maFtHint.Show( bRange ); - + //Added by PengYunQuan for Validity Cell Range Picker return 0; } @@ -660,3 +911,114 @@ IMPL_LINK( ScTPValidationError, ClickSearchHdl, PushButton*, EMPTYARG ) return( 0L ); } +//Added by PengYunQuan for Validity Cell Range Picker diff --git a/sc/source/ui/dbgui/validate.src b/sc/source/ui/dbgui/validate.src index afd3fc213391..1f8e4b48deac 100644 --- a/sc/source/ui/dbgui/validate.src +++ b/sc/source/ui/dbgui/validate.src @@ -65,7 +65,9 @@ TabDialog TAB_DLG_VALIDATION }; Text [ en-US ] = "Validity" ; }; - +//Added by PengYunQuan for Validity Cell Range Picker TabPage TP_VALIDATION_VALUES { Hide = TRUE ; @@ -75,13 +77,19 @@ TabPage TP_VALIDATION_VALUES FixedText FT_ALLOW { Pos = MAP_APPFONT ( 6 , 16 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker Text [ en-US ] = "~Allow" ; }; ListBox LB_ALLOW { Border = TRUE ; - Pos = MAP_APPFONT ( 80 , 14 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker Size = MAP_APPFONT ( 90 , 80 ) ; TabStop = TRUE ; DropDown = TRUE ; @@ -100,13 +108,19 @@ TabPage TP_VALIDATION_VALUES FixedText FT_VALUE { Pos = MAP_APPFONT ( 6 , 58 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker Text [ en-US ] = "~Data" ; }; ListBox LB_VALUE { Border = TRUE ; - Pos = MAP_APPFONT ( 80 , 56 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker Size = MAP_APPFONT ( 90 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; @@ -126,54 +140,81 @@ TabPage TP_VALIDATION_VALUES FixedText FT_MIN { Pos = MAP_APPFONT ( 6 , 76 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker Text [ en-US ] = "~Minimum" ; }; Edit EDT_MIN { Border = TRUE ; - Pos = MAP_APPFONT ( 80 , 74 ) ; - Size = MAP_APPFONT ( 174 , 12 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker TabStop = TRUE ; }; MultiLineEdit EDT_LIST { Border = TRUE ; - Pos = MAP_APPFONT ( 80 , 74 ) ; - Size = MAP_APPFONT ( 174 , 105 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker VScroll = TRUE ; IgnoreTab = TRUE ; }; FixedText FT_MAX { Pos = MAP_APPFONT ( 6 , 92 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker Text [ en-US ] = "Ma~ximum" ; }; Edit EDT_MAX { Border = TRUE ; - Pos = MAP_APPFONT ( 80 , 90 ) ; - Size = MAP_APPFONT ( 174 , 12 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker TabStop = TRUE ; }; CheckBox TSB_ALLOW_BLANKS { - Pos = MAP_APPFONT ( 80 , 30 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker Size = MAP_APPFONT ( 174 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Allow ~blank cells" ; }; CheckBox CB_SHOWLIST { - Pos = MAP_APPFONT ( 80 , 44 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker Size = MAP_APPFONT ( 174 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Show selection ~list" ; }; CheckBox CB_SORTLIST { - Pos = MAP_APPFONT ( 90 , 58 ) ; + //Modified by PengYunQuan for Validity Cell Range Picker Size = MAP_APPFONT ( 164 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Sor~t entries ascending" ; @@ -185,6 +226,15 @@ TabPage TP_VALIDATION_VALUES WordBreak = TRUE ; Text [ en-US ] = "A valid source can only consist of a contiguous selection of rows and columns, or a formula that results in an area or array."; }; + //Added by PengYunQuan for Validity Cell Range Picker }; TabPage TP_VALIDATION_INPUTHELP diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 8f757f257328..17cb07ca0a49 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -127,7 +127,8 @@ #include #include - +#include +#include using namespace com::sun::star; // STATIC DATA ----------------------------------------------------------- @@ -357,6 +358,26 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet) } else aDocument.SetInsertingFromOtherDoc( FALSE ); + // add vba globals ( if they are availabl ) + uno::Any aGlobs; + uno::Sequence< uno::Any > aArgs(1); + aArgs[ 0 ] <<= GetModel(); + aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs ); + GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs ); + // Fake ThisComponent being setup by Activate ( which is a view + // related thing ), + // a) if another document is opened then in theory ThisComponent + // will be reset as before, + // b) when this document is 'really' Activated then ThisComponent + // again will be set as before + // The only wrinkle seems if this document is loaded 'InVisible' + // but.. I don't see that this is possible from the vba API + // I could be wrong though + // There may be implications setting the current component + // too early :-/ so I will just manually set the Basic Variables + BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); + if ( pAppMgr ) + pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] ); aDocument.SetImportingXML( FALSE ); aDocument.EnableExecuteLink( true ); @@ -2558,3 +2579,16 @@ void ScDocShellModificator::SetDocumentModified() pDoc->BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); } } + +//Added by PengYunQuan for Validity Cell Range Picker diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index 9ac98af7b043..386ac8528cec 100644 --- a/sc/source/ui/docshell/docsh2.cxx +++ b/sc/source/ui/docshell/docsh2.cxx @@ -53,7 +53,10 @@ #include #include - +#include +#include +#include +#include // INCLUDE --------------------------------------------------------------- /* @@ -102,6 +105,25 @@ BOOL __EXPORT ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xSt InitItems(); CalcOutputFactor(); + uno::Any aGlobs; + uno::Sequence< uno::Any > aArgs(1); + aArgs[ 0 ] <<= GetModel(); + aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs ); + GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs ); + // Fake ThisComponent being setup by Activate ( which is a view + // related thing ), + // a) if another document is opened then in theory ThisComponent + // will be reset as before, + // b) when this document is 'really' Activated then ThisComponent + // again will be set as before + // The only wrinkle seems if this document is loaded 'InVisible' + // but.. I don't see that this is possible from the vba API + // I could be wrong though + // There may be implications setting the current component + // too early :-/ so I will just manually set the Basic Variables + BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); + if ( pAppMgr ) + pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] ); return bRet; } diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index 9e2d833b27d0..18125076d5cf 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -42,19 +42,28 @@ #endif #include #include "address.hxx" +#include "cell.hxx" +#include "compiler.hxx" #include "formula/funcutl.hxx" #include "IAnyRefDialog.hxx" +#include "scresid.hxx" #include class SfxObjectShell; class ScRange; class ScDocument; class ScTabViewShell; -class ScAnyRefDlg; -class ScFormulaCell; -class ScCompiler; +//The class of ScAnyRefDlg is rewritten by PengYunQuan for Validity Cell Range Picker +//class ScAnyRefDlg; +class ScRefHandler; class ScRangeList; +//Added by PengYunQuan for Validity Cell Range Picker class ScFormulaReferenceHelper { IAnyRefDialog* m_pDlg; @@ -104,12 +113,28 @@ public: void ViewShellChanged( ScTabViewShell* pScViewShell ); static void enableInput(BOOL _bInput); +//Added by PengYunQuan for Validity Cell Range Picker friend class formula::RefButton; friend class formula::RefEdit; @@ -130,7 +155,8 @@ protected: void SetDispatcherLock( BOOL bLock ); - virtual long PreNotify( NotifyEvent& rNEvt ); + //Overwrite TWindow will implemented by ScRefHdlrImplBase + //virtual long PreNotify( NotifyEvent& rNEvt ); virtual void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL ); virtual void RefInputDone( BOOL bForced = FALSE ); @@ -140,9 +166,9 @@ protected: bool ParseWithNames( ScRangeList& rRanges, const String& rStr, ScDocument* pDoc ); public: - ScAnyRefDlg( SfxBindings* pB, SfxChildWindow* pCW, - Window* pParent, USHORT nResId); - virtual ~ScAnyRefDlg(); + ScRefHandler( Window &rWindow, SfxBindings* pB/*, SfxChildWindow* pCW, + Window* pParent, USHORT nResId*/, bool bBindRef ); + virtual ~ScRefHandler(); virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) = 0; virtual void AddRefEntry(); @@ -159,15 +185,100 @@ public: virtual void ViewShellChanged( ScTabViewShell* pScViewShell ); void SwitchToDocument(); - SfxBindings& GetBindings(); + //SfxBindings& GetBindings(); virtual void SetActive() = 0; // virtual BOOL Close(); - virtual void StateChanged( StateChangedType nStateChange ); + //Overwrite TWindow will implemented by ScRefHdlrImplBase + //virtual void StateChanged( StateChangedType nStateChange ); + +//Added by PengYunQuan for Validity Cell Range Picker }; //============================================================================ +//Added by PengYunQuan for Validity Cell Range Picker ScSheetSaveData* GetSheetSaveData(); }; diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx index 99d03f2bfa2c..a5b7c4d94e5f 100644 --- a/sc/source/ui/inc/inputwin.hxx +++ b/sc/source/ui/inc/inputwin.hxx @@ -31,15 +31,11 @@ #ifndef SC_INPUTWIN_HXX #define SC_INPUTWIN_HXX - -#ifndef _TOOLBOX_HXX //autogen +#include #include -#endif #include #include -#ifndef _COMBOBOX_HXX //autogen #include -#endif #include #include @@ -77,7 +73,8 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); - void SetAccessibleTextData(ScAccessibleEditLineTextData* pTextData) {pAccTextData = pTextData;} + void InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData ); + void RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData ); DECL_LINK( NotifyHdl, EENotify* ); @@ -102,11 +99,13 @@ private: void UpdateAutoCorrFlag(); private: + typedef ::std::vector< ScAccessibleEditLineTextData* > AccTextDataVector; + String aString; Font aTextFont; ScEditEngineDefaulter* pEditEngine; // erst bei Bedarf angelegt EditView* pEditView; - ScAccessibleEditLineTextData* pAccTextData; + AccTextDataVector maAccTextDatas; // #i105267# text datas may be cloned, remember all copies BOOL bIsRTL; BOOL bIsInsertMode; BOOL bFormulaMode; diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx index cbd5da901a63..bc43aedf918f 100644 --- a/sc/source/ui/inc/reffact.hxx +++ b/sc/source/ui/inc/reffact.hxx @@ -102,6 +102,22 @@ class ScSimpleRefDlgWrapper: public SfxChildWindow void StartRefInput(); }; +//Added by PengYunQuan for Validity Cell Range Picker //================================================================== diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index fe5da618e895..dab44cdf33df 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -292,7 +292,7 @@ public: void TabChanged(); void SetZoom( const Fraction& rNewX, const Fraction& rNewY, BOOL bAll ); - void RefreshZoom(); + SC_DLLPUBLIC void RefreshZoom(); void SetPagebreakMode( BOOL bSet ); void UpdateLayerLocks(); @@ -390,7 +390,10 @@ public: void SetNewStartIfMarking(); - void SetTabNo( SCTAB nTab, BOOL bNew = FALSE, BOOL bExtendSelection = FALSE ); + //Added by PengYunQuan for Validity Cell Range Picker void SelectNextTab( short nDir, BOOL bExtendSelection = FALSE ); void ActivateView( BOOL bActivate, BOOL bFirst ); diff --git a/sc/source/ui/inc/validate.hrc b/sc/source/ui/inc/validate.hrc index 0f69e6a55136..4d46d42263b2 100644 --- a/sc/source/ui/inc/validate.hrc +++ b/sc/source/ui/inc/validate.hrc @@ -61,6 +61,9 @@ #define CB_SORTLIST 28 #define EDT_LIST 29 #define FT_SOURCEHINT 30 +//Added by PengYunQuan for Validity Cell Range Picker /* Position indexes for "Allow" list box. They do not map directly to ScValidationMode and can safely be modified to diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx index 2844a9f74e0f..0ac51e75b5d5 100644 --- a/sc/source/ui/inc/validate.hxx +++ b/sc/source/ui/inc/validate.hxx @@ -36,23 +36,164 @@ #include #include #include - +//Added by PengYunQuan for Validity Cell Range Picker // ============================================================================ -/** The "Validity" tab dialog. */ -class ScValidationDlg : public SfxTabDialog +//Added by PengYunQuan for Validity Cell Range Picker + +/** The "Validity" tab dialog. */ +//Modified by PengYunQuan for Validity Cell Range Picker +{ + //Added by PengYunQuan for Validity Cell Range Picker +public: + //Modified by PengYunQuan for Validity Cell Range Picker + //Added by PengYunQuan for Validity Cell Range Picker }; // ============================================================================ /** The tab page "Criteria" from the Validation dialog. */ -class ScTPValidationValue : public SfxTabPage +//Modified by PengYunQuan for Validity Cell Range Picker { public: explicit ScTPValidationValue( Window* pParent, const SfxItemSet& rArgSet ); @@ -84,10 +225,16 @@ private: FixedText maFtValue; ListBox maLbValue; FixedText maFtMin; - Edit maEdMin; + //Modified by PengYunQuan for Validity Cell Range Picker MultiLineEdit maEdList; /// Entries for explicit list FixedText maFtMax; - Edit maEdMax; + //Modified by PengYunQuan for Validity Cell Range Picker FixedText maFtHint; /// Hint text for cell range validity. String maStrMin; @@ -96,6 +243,33 @@ private: String maStrRange; String maStrList; sal_Unicode mcFmlaSep; /// List separator in formulas. + //Added by PengYunQuan for Validity Cell Range Picker }; @@ -161,6 +335,16 @@ public: virtual void Reset ( const SfxItemSet& rArgSet ); }; +//Added by PengYunQuan for Validity Cell Range Picker #endif // SC_VALIDATE_HXX diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index 709bd7898e22..dc2fe4522ecd 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -225,6 +225,7 @@ private: SC_DLLPRIVATE void CalcPPT(); SC_DLLPRIVATE void CreateTabData( SCTAB nNewTab ); + SC_DLLPRIVATE void CreateTabData( std::vector< SCTAB >& rvTabs ); SC_DLLPRIVATE void CreateSelectedTabData(); public: @@ -311,6 +312,8 @@ public: void SetPagebreakMode( BOOL bSet ); void SetZoomType( SvxZoomType eNew, BOOL bAll ); + void SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs ); + void SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs ); void SetZoom( const Fraction& rNewX, const Fraction& rNewY, BOOL bAll ); void RefreshZoom(); diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index befabb51a17c..0d93eb0c7a93 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -377,7 +377,10 @@ IMPL_LINK( ScFormulaReferenceHelper, AccelSelectHdl, Accelerator *, pSelAccel ) //---------------------------------------------------------------------------- void ScFormulaReferenceHelper::RefInputDone( BOOL bForced ) { - if (pRefEdit && (bForced || !pRefBtn)) + //Modified by PengYunQuan for Validity Cell Range Picker { if (bAccInserted) // Accelerator wieder abschalten { @@ -677,23 +680,33 @@ void lcl_HideAllReferences() } //============================================================================ -// class ScAnyRefDlg +//The class of ScAnyRefDlg is rewritten by PengYunQuan for Validity Cell Range Picker +// class ScRefHandler //---------------------------------------------------------------------------- -ScAnyRefDlg::ScAnyRefDlg( SfxBindings* pB, SfxChildWindow* pCW, - Window* pParent, USHORT nResId) - : SfxModelessDialog ( pB, pCW, pParent, ScResId( nResId ) ), +ScRefHandler::ScRefHandler( Window &rWindow, SfxBindings* pB/*, SfxChildWindow* pCW, + Window* pParent, USHORT nResId*/, bool bBindRef ) + : //SfxModelessDialog ( pB, pCW, pParent, ScResId( nResId ) ), + m_rWindow( rWindow ), + m_bInRefMode( false ), m_aHelper(this,pB), pMyBindings( pB ), pActiveWin(NULL) { - m_aHelper.SetWindow(this); - if(GetHelpId()==0) //Hack, da im SfxModelessDialog die HelpId - SetHelpId(GetUniqueId()); //fuer einen ModelessDialog entfernt und + m_aHelper.SetWindow(/*this*/&m_rWindow); + if(m_rWindow.GetHelpId()==0) //Hack, da im SfxModelessDialog die HelpId + m_rWindow.SetHelpId(m_rWindow.GetUniqueId()); //fuer einen ModelessDialog entfernt und //in eine UniqueId gewandelt wird, machen //wir das an dieser Stelle rueckgaengig. aTimer.SetTimeout(200); - aTimer.SetTimeoutHdl(LINK( this, ScAnyRefDlg, UpdateFocusHdl)); + aTimer.SetTimeoutHdl(LINK( this, ScRefHandler, UpdateFocusHdl)); + + if( bBindRef ) EnterRefMode(); +} + +bool ScRefHandler::EnterRefMode() +{ + if( m_bInRefMode ) return false; SC_MOD()->InputEnterHandler(); // ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell(); @@ -740,15 +753,25 @@ ScAnyRefDlg::ScAnyRefDlg( SfxBindings* pB, SfxChildWindow* pCW, m_aHelper.SetDispatcherLock( TRUE ); //@Test //SFX_APPWINDOW->Disable(TRUE); //@BugID 54702 + + return m_bInRefMode = true; } //---------------------------------------------------------------------------- -ScAnyRefDlg::~ScAnyRefDlg() +ScRefHandler::~ScRefHandler() { + LeaveRefMode(); +} + +bool ScRefHandler::LeaveRefMode() +{ + if( !m_bInRefMode ) return false; + lcl_HideAllReferences(); - SetModalInputMode(FALSE); + if( Dialog *pDlg = dynamic_cast( static_cast(*this) ) ) + pDlg->SetModalInputMode(FALSE); SetDispatcherLock( FALSE ); //! here and in DoClose ? ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell(); @@ -757,20 +780,23 @@ ScAnyRefDlg::~ScAnyRefDlg() //SFX_APPWINDOW->Enable(TRUE,TRUE); lcl_InvalidateWindows(); + + m_bInRefMode = false; + return true; } //---------------------------------------------------------------------------- -SfxBindings& ScAnyRefDlg::GetBindings() -{ - //! SfxModelessDialog should allow access to pBindings pointer - - return *pMyBindings; -} +//SfxBindings& ScRefHandler::GetBindings() +//{ +// //! SfxModelessDialog should allow access to pBindings pointer +// +// return *pMyBindings; +//} //---------------------------------------------------------------------------- -void ScAnyRefDlg::SwitchToDocument() +void ScRefHandler::SwitchToDocument() { ScTabViewShell* pCurrent = ScTabViewShell::GetActiveViewShell(); if (pCurrent) @@ -800,7 +826,7 @@ void ScAnyRefDlg::SwitchToDocument() //---------------------------------------------------------------------------- -BOOL ScAnyRefDlg::IsDocAllowed(SfxObjectShell* pDocSh) const // pDocSh may be 0 +BOOL ScRefHandler::IsDocAllowed(SfxObjectShell* pDocSh) const // pDocSh may be 0 { // default: allow only same document (overridden in function dialog) String aCmpName; @@ -813,41 +839,41 @@ BOOL ScAnyRefDlg::IsDocAllowed(SfxObjectShell* pDocSh) const // pDocSh may be //---------------------------------------------------------------------------- -BOOL __EXPORT ScAnyRefDlg::IsRefInputMode() const +BOOL __EXPORT ScRefHandler::IsRefInputMode() const { - return IsVisible(); // nur wer sichtbar ist kann auch Referenzen bekommen + return m_rWindow.IsVisible(); // nur wer sichtbar ist kann auch Referenzen bekommen } //---------------------------------------------------------------------------- -BOOL __EXPORT ScAnyRefDlg::DoClose( USHORT nId ) +BOOL __EXPORT ScRefHandler::DoClose( USHORT nId ) { m_aHelper.DoClose(nId); return TRUE; } -void ScAnyRefDlg::SetDispatcherLock( BOOL bLock ) +void ScRefHandler::SetDispatcherLock( BOOL bLock ) { m_aHelper.SetDispatcherLock( bLock ); } //---------------------------------------------------------------------------- -void ScAnyRefDlg::ViewShellChanged(ScTabViewShell* pScViewShell ) +void ScRefHandler::ViewShellChanged(ScTabViewShell* pScViewShell ) { m_aHelper.ViewShellChanged(pScViewShell); } //---------------------------------------------------------------------------- -void ScAnyRefDlg::AddRefEntry() +void ScRefHandler::AddRefEntry() { // wenn nicht ueberladen, gibt es keine Mehrfach-Referenzen } //---------------------------------------------------------------------------- -BOOL __EXPORT ScAnyRefDlg::IsTableLocked() const +BOOL __EXPORT ScRefHandler::IsTableLocked() const { // per Default kann bei Referenzeingabe auch die Tabelle umgeschaltet werden @@ -861,48 +887,99 @@ BOOL __EXPORT ScAnyRefDlg::IsTableLocked() const // //---------------------------------------------------------------------------- -void ScAnyRefDlg::RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton ) +void ScRefHandler::RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton ) { m_aHelper.RefInputStart( pEdit, pButton ); } -void ScAnyRefDlg::ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton ) +void ScRefHandler::ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton ) { m_aHelper.ToggleCollapsed( pEdit, pButton ); } -long ScAnyRefDlg::PreNotify( NotifyEvent& rNEvt ) -{ - USHORT nSwitch=rNEvt.GetType(); - if(nSwitch==EVENT_GETFOCUS) - { - pActiveWin=rNEvt.GetWindow(); - } - return SfxModelessDialog::PreNotify(rNEvt); + +//The two following function is commentted out by PengYunQuan for Validity Cell Range Picker +//long ScAnyRefDlg::PreNotify( NotifyEvent& rNEvt ) +//{ +// USHORT nSwitch=rNEvt.GetType(); +// if(nSwitch==EVENT_GETFOCUS) +// { +// pActiveWin=rNEvt.GetWindow(); +// } +// return SfxModelessDialog::PreNotify(rNEvt); +//} +// +//void ScAnyRefDlg::StateChanged( StateChangedType nStateChange ) +//{ +// SfxModelessDialog::StateChanged( nStateChange ); +// +// if(nStateChange == STATE_CHANGE_VISIBLE) +// { +// if(IsVisible()) +// { +// m_aHelper.enableInput( FALSE ); +// m_aHelper.EnableSpreadsheets(); +// m_aHelper.SetDispatcherLock( TRUE ); +// aTimer.Start(); +// } +// else +// { +// m_aHelper.enableInput( TRUE ); +// m_aHelper.SetDispatcherLock( FALSE ); //! here and in DoClose ? +// } +// } +//} + +#if defined( _MSC_VER ) +#define INTRODUCE_TEMPLATE +#else +#define INTRODUCE_TEMPLATE template <> +#endif + +#define IMPL_TWINDOW_PRENOTIFY( TWindow,bBindRef ) \ +INTRODUCE_TEMPLATE long ScRefHdlrImplBase::PreNotify( NotifyEvent& rNEvt )\ +{\ + if( bBindRef || m_bInRefMode )\ + {\ + USHORT nSwitch=rNEvt.GetType();\ + if(nSwitch==EVENT_GETFOCUS)\ + {\ + pActiveWin=rNEvt.GetWindow();\ + }\ + }\ + return TWindow::PreNotify(rNEvt);\ } -void ScAnyRefDlg::StateChanged( StateChangedType nStateChange ) -{ - SfxModelessDialog::StateChanged( nStateChange ); - - if(nStateChange == STATE_CHANGE_VISIBLE) - { - if(IsVisible()) - { - m_aHelper.enableInput( FALSE ); - m_aHelper.EnableSpreadsheets(); - m_aHelper.SetDispatcherLock( TRUE ); - aTimer.Start(); - } - else - { - m_aHelper.enableInput( TRUE ); - m_aHelper.SetDispatcherLock( FALSE ); //! here and in DoClose ? - } - } +#define IMPL_TWINDOW_STATECHANGED( TWindow,bBindRef ) \ +INTRODUCE_TEMPLATE void ScRefHdlrImplBase::StateChanged( StateChangedType nStateChange )\ +{\ + TWindow::StateChanged( nStateChange );\ +\ + if( !bBindRef && !m_bInRefMode ) return;\ + \ + if(nStateChange == STATE_CHANGE_VISIBLE)\ + {\ + if(m_rWindow.IsVisible())\ + {\ + m_aHelper.enableInput( FALSE );\ + m_aHelper.EnableSpreadsheets();\ + m_aHelper.SetDispatcherLock( TRUE );\ + aTimer.Start();\ + }\ + else\ + {\ + m_aHelper.enableInput( TRUE );\ + m_aHelper.SetDispatcherLock( FALSE ); /*//! here and in DoClose ?*/\ + }\ + }\ } -IMPL_LINK( ScAnyRefDlg, UpdateFocusHdl, Timer*, EMPTYARG ) +IMPL_TWINDOW_PRENOTIFY( SfxModelessDialog, true ) +IMPL_TWINDOW_PRENOTIFY( SfxTabDialog, false ) +IMPL_TWINDOW_STATECHANGED( SfxModelessDialog, true ) +IMPL_TWINDOW_STATECHANGED( SfxTabDialog, false ) + +IMPL_LINK( ScRefHandler, UpdateFocusHdl, Timer*, EMPTYARG ) { if (pActiveWin) { @@ -911,27 +988,27 @@ IMPL_LINK( ScAnyRefDlg, UpdateFocusHdl, Timer*, EMPTYARG ) return 0; } // ----------------------------------------------------------------------------- -bool ScAnyRefDlg::ParseWithNames( ScRangeList& rRanges, const String& rStr, ScDocument* pDoc ) +bool ScRefHandler::ParseWithNames( ScRangeList& rRanges, const String& rStr, ScDocument* pDoc ) { return m_aHelper.ParseWithNames( rRanges, rStr, pDoc ); } // ----------------------------------------------------------------------------- -void ScAnyRefDlg::HideReference( BOOL bDoneRefMode ) +void ScRefHandler::HideReference( BOOL bDoneRefMode ) { m_aHelper.HideReference( bDoneRefMode ); } // ----------------------------------------------------------------------------- -void ScAnyRefDlg::ShowReference( const XubString& rStr ) +void ScRefHandler::ShowReference( const XubString& rStr ) { m_aHelper.ShowReference( rStr ); } // ----------------------------------------------------------------------------- -void ScAnyRefDlg::ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton ) +void ScRefHandler::ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton ) { m_aHelper.ReleaseFocus( pEdit,pButton ); } //---------------------------------------------------------------------------- -void ScAnyRefDlg::RefInputDone( BOOL bForced ) +void ScRefHandler::RefInputDone( BOOL bForced ) { m_aHelper.RefInputDone( bForced ); } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index dd6873454724..5f4f1a7aa93f 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -244,7 +244,8 @@ ScModelObj::~ScModelObj() uno::Reference< uno::XAggregation> ScModelObj::GetFormatter() { - if ( !xNumberAgg.is() ) + // pDocShell may be NULL if this is the base of a ScDocOptionsObj + if ( !xNumberAgg.is() && pDocShell ) { // setDelegator veraendert den RefCount, darum eine Referenz selber halten // (direkt am m_refCount, um sich beim release nicht selbst zu loeschen) diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx new file mode 100644 index 000000000000..dd0550709b96 --- /dev/null +++ b/sc/source/ui/vba/excelvbahelper.cxx @@ -0,0 +1,222 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.cxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include "excelvbahelper.hxx" +#include "tabvwsh.hxx" +#include "transobj.hxx" +#include "scmod.hxx" +#include "cellsuno.hxx" +#include + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +namespace ooo +{ +namespace vba +{ +namespace excel +{ +void implSetZoom( const uno::Reference< frame::XModel >& xModel, sal_Int16 nZoom, std::vector< SCTAB >& nTabs ) +{ + ScTabViewShell* pViewSh = excel::getBestViewShell( xModel ); + Fraction aFract( nZoom, 100 ); + pViewSh->GetViewData()->SetZoom( aFract, aFract, nTabs ); + pViewSh->RefreshZoom(); +} +bool isInPrintPreview( SfxViewFrame* pView ) +{ + sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0; + if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() > +nViewNo && !pView->GetObjectShell()->IsInPlaceActive() ) + { + SfxViewFactory &rViewFactory = + pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo); + if ( pView->GetCurViewId() == rViewFactory.GetOrdinal() ) + return true; + } + return false; +} + +const ::rtl::OUString REPLACE_CELLS_WARNING( RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning")); + +class PasteCellsWarningReseter +{ +private: + bool bInitialWarningState; + static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException ) + { + static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + static uno::Reference xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW ); + static uno::Reference xServiceManager( + xContext->getServiceManager(), uno::UNO_QUERY_THROW ); + static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW ); + return xProps; + } + + bool getReplaceCellsWarning() throw ( uno::RuntimeException ) + { + sal_Bool res = sal_False; + getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res; + return ( res == sal_True ); + } + + void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException ) + { + getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) ); + } +public: + PasteCellsWarningReseter() throw ( uno::RuntimeException ) + { + bInitialWarningState = getReplaceCellsWarning(); + if ( bInitialWarningState ) + setReplaceCellsWarning( false ); + } + ~PasteCellsWarningReseter() + { + if ( bInitialWarningState ) + { + // don't allow dtor to throw + try + { + setReplaceCellsWarning( true ); + } + catch ( uno::Exception& /*e*/ ){} + } + } +}; + +void +implnPaste( const uno::Reference< frame::XModel>& xModel ) +{ + PasteCellsWarningReseter resetWarningBox; + ScTabViewShell* pViewShell = getBestViewShell( xModel ); + if ( pViewShell ) + { + pViewShell->PasteFromSystem(); + pViewShell->CellContentChanged(); + } +} + + +void +implnCopy( const uno::Reference< frame::XModel>& xModel ) +{ + ScTabViewShell* pViewShell = getBestViewShell( xModel ); + if ( pViewShell ) + pViewShell->CopyToClip(NULL,false,false,true); +} + +void +implnCut( const uno::Reference< frame::XModel>& xModel ) +{ + ScTabViewShell* pViewShell = getBestViewShell( xModel ); + if ( pViewShell ) + pViewShell->CutToClip( NULL, TRUE ); +} + +void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose) +{ + PasteCellsWarningReseter resetWarningBox; + sal_Bool bAsLink(sal_False), bOtherDoc(sal_False); + InsCellCmd eMoveMode = INS_NONE; + + ScTabViewShell* pTabViewShell = getBestViewShell( xModel ); + if ( pTabViewShell ) + { + ScViewData* pView = pTabViewShell->GetViewData(); + Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL; + if ( pView && pWin ) + { + if ( bAsLink && bOtherDoc ) + pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK + else + { + ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); + ScDocument* pDoc = NULL; + if ( pOwnClip ) + pDoc = pOwnClip->GetDocument(); + pTabViewShell->PasteFromClip( nFlags, pDoc, + nFunction, bSkipEmpty, bTranspose, bAsLink, + eMoveMode, IDF_NONE, TRUE ); + pTabViewShell->CellContentChanged(); + } + } + } + +} + +ScDocShell* +getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ) +{ + uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW ); + ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() ); + ScDocShell* pDocShell = NULL; + if ( pModel ) + pDocShell = (ScDocShell*)pModel->GetEmbeddedObject(); + return pDocShell; + +} + +ScTabViewShell* +getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel ) +{ + ScDocShell* pDocShell = getDocShell( xModel ); + if ( pDocShell ) + return pDocShell->GetBestViewShell(); + return NULL; +} + +ScTabViewShell* +getCurrentBestViewShell( const uno::Reference< uno::XComponentContext >& xContext ) +{ + uno::Reference< frame::XModel > xModel = getCurrentExcelDoc( xContext ); + return getBestViewShell( xModel ); +} + +SfxViewFrame* +getViewFrame( const uno::Reference< frame::XModel >& xModel ) +{ + ScTabViewShell* pViewShell = getBestViewShell( xModel ); + if ( pViewShell ) + return pViewShell->GetViewFrame(); + return NULL; +} + +SfxItemSet* +ScVbaCellRangeAccess::GetDataSet( ScCellRangeObj* pRangeObj ) +{ + SfxItemSet* pDataSet = pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : NULL ; + return pDataSet; + +} +} //excel +} //vba +} //ooo diff --git a/sc/source/ui/vba/excelvbahelper.hxx b/sc/source/ui/vba/excelvbahelper.hxx new file mode 100644 index 000000000000..bb222688236a --- /dev/null +++ b/sc/source/ui/vba/excelvbahelper.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.hxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_EXCEL_VBA_HELPER_HXX +#define SC_EXCEL_VBA_HELPER_HXX + +#include +#include + +class ScCellRangeObj; + +namespace ooo +{ + namespace vba + { + namespace excel + { + // nTabs empty means apply zoom to all sheets + void implSetZoom( const css::uno::Reference< css::frame::XModel >& xModel, sal_Int16 nZoom, std::vector< SCTAB >& nTabs ); + void implnCopy( const css::uno::Reference< css::frame::XModel>& xModel ); + void implnPaste ( const css::uno::Reference< css::frame::XModel>& xModel ); + void implnCut( const css::uno::Reference< css::frame::XModel>& xModel ); + void implnPasteSpecial( const css::uno::Reference< css::frame::XModel>& xModel, sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose); + ScTabViewShell* getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel ) ; + ScDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ) ; + ScTabViewShell* getCurrentBestViewShell( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + SfxViewFrame* getViewFrame( const css::uno::Reference< css::frame::XModel >& xModel ); + class ScVbaCellRangeAccess + { + public: + static SfxItemSet* GetDataSet( ScCellRangeObj* pRangeObj ); + }; +} +} +} +#endif diff --git a/sc/source/ui/vba/helperdecl.hxx b/sc/source/ui/vba/helperdecl.hxx index 95569a993b9c..9c37d418a561 100644 --- a/sc/source/ui/vba/helperdecl.hxx +++ b/sc/source/ui/vba/helperdecl.hxx @@ -32,107 +32,25 @@ namespace comphelper { namespace service_decl { - -namespace detail { -namespace css = ::com::sun::star; -template -class OwnServiceImpl - : public ImplT, - private ::boost::noncopyable -{ - typedef ImplT BaseT; - -public: - OwnServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Sequence const& args, - css::uno::Reference const& xContext ) - :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {} - OwnServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Reference const& xContext ) - : BaseT(xContext), m_rServiceDecl(rServiceDecl) {} - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw (css::uno::RuntimeException) { - return m_rServiceDecl.getImplementationName(); - } - virtual sal_Bool SAL_CALL supportsService( ::rtl::OUString const& name ) - throw (css::uno::RuntimeException) { - return m_rServiceDecl.supportsService(name); - } - virtual css::uno::Sequence< ::rtl::OUString> - SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) { - return m_rServiceDecl.getSupportedServiceNames(); - } - -private: - ServiceDecl const& m_rServiceDecl; -}; - - -template -struct OwnCreateFunc; - -template -struct OwnCreateFunc > { - explicit OwnCreateFunc( ) - {} - - css::uno::Reference - operator()( ServiceDecl const& rServiceDecl, - css::uno::Sequence const&, - css::uno::Reference - const& xContext ) const - { - return css::uno::Reference< ooo::vba::XHelperInterface >(new OwnServiceImpl( rServiceDecl, xContext )); - } -}; - -template -struct OwnCreateFunc > { - explicit OwnCreateFunc( ) - {} - - css::uno::Reference - operator()( ServiceDecl const& rServiceDecl, - css::uno::Sequence const& args, - css::uno::Reference - const& xContext ) const - { - css::uno::Reference< ooo::vba::XHelperInterface > xHelp( - new OwnServiceImpl( rServiceDecl, args, xContext ) ); - css::uno::Reference< css::uno::XInterface > xIf( xHelp, css::uno::UNO_QUERY ) ; - return xIf; - } -}; - -} // namespace detail - -/** Defines a service implementation class. - - @tpl ImplT_ service implementation class - @WithArgsT whether the implementation class ctor expects arguments - (uno::Sequence, uno::Reference) - or just (uno::Reference) -*/ template > -struct vba_service_class_ { - typedef ImplT_ ImplT; - typedef detail::OwnServiceImpl ServiceImplT; - - detail::CreateFuncF const m_createFunc; - +struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl, WithArgsT > +{ + typedef serviceimpl_base< detail::OwnServiceImpl, WithArgsT > baseT; /** Default ctor. Implementation class without args, expecting component context as single argument. */ - vba_service_class_() : m_createFunc( - detail::OwnCreateFunc() ) {} + vba_service_class_() : baseT() {} + template + /** Ctor to pass a post processing function/functor. + @tpl PostProcessDefaultT let your compiler deduce this + @param postProcessFunc function/functor that gets the yet unacquired + ImplT_ pointer returning a + uno::Reference + */ + explicit vba_service_class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {} }; - } // namespace service_decl } // namespace comphelper diff --git a/sc/source/ui/vba/makefile.mk b/sc/source/ui/vba/makefile.mk index 71727297d078..253d0f52ab96 100644 --- a/sc/source/ui/vba/makefile.mk +++ b/sc/source/ui/vba/makefile.mk @@ -64,7 +64,7 @@ SLOFILES= \ $(SLO)$/vbaworksheet.obj \ $(SLO)$/vbaoutline.obj \ $(SLO)$/vbafont.obj\ - $(SLO)$/vbahelper.obj\ + $(SLO)$/excelvbahelper.obj\ $(SLO)$/vbainterior.obj\ $(SLO)$/vbawsfunction.obj\ $(SLO)$/vbawindow.obj\ @@ -81,28 +81,11 @@ SLOFILES= \ $(SLO)$/vbapalette.obj \ $(SLO)$/vbaborders.obj \ $(SLO)$/vbacharacters.obj \ - $(SLO)$/vbacombobox.obj \ $(SLO)$/vbavalidation.obj \ - $(SLO)$/vbacontrol.obj \ - $(SLO)$/vbacontrols.obj \ $(SLO)$/vbaoleobject.obj \ $(SLO)$/vbaoleobjects.obj \ - $(SLO)$/vbabutton.obj \ - $(SLO)$/vbalabel.obj \ - $(SLO)$/vbatextbox.obj \ $(SLO)$/vbatextboxshape.obj \ - $(SLO)$/vbaradiobutton.obj \ - $(SLO)$/vbalistbox.obj \ - $(SLO)$/vbalistcontrolhelper.obj \ - $(SLO)$/vbapropvalue.obj \ $(SLO)$/vbapane.obj \ - $(SLO)$/vbashape.obj \ - $(SLO)$/vbacolorformat.obj \ - $(SLO)$/vbashapes.obj \ - $(SLO)$/vbalineformat.obj \ - $(SLO)$/vbafillformat.obj \ - $(SLO)$/vbapictureformat.obj \ - $(SLO)$/vbashaperange.obj \ $(SLO)$/vbatextframe.obj \ $(SLO)$/vbacharttitle.obj \ $(SLO)$/vbacharts.obj \ @@ -116,24 +99,10 @@ SLOFILES= \ $(SLO)$/vbastyle.obj \ $(SLO)$/vbastyles.obj \ $(SLO)$/vbaassistant.obj \ - $(SLO)$/vbauserform.obj \ - $(SLO)$/vbacheckbox.obj \ - $(SLO)$/vbatogglebutton.obj \ - $(SLO)$/vbaframe.obj \ - $(SLO)$/vbascrollbar.obj \ - $(SLO)$/vbaprogressbar.obj \ - $(SLO)$/vbamultipage.obj \ - $(SLO)$/vbapages.obj \ - $(SLO)$/vbacommandbarcontrol.obj \ - $(SLO)$/vbacommandbarcontrols.obj \ - $(SLO)$/vbacommandbar.obj \ - $(SLO)$/vbacommandbars.obj \ $(SLO)$/vbahyperlink.obj \ $(SLO)$/vbapagesetup.obj \ $(SLO)$/vbapagebreak.obj \ $(SLO)$/vbapagebreaks.obj \ - $(SLO)$/vbaspinbutton.obj \ - $(SLO)$/vbaimage.obj \ $(SLO)$/service.obj .ENDIF # --- Targets ------------------------------------------------------ diff --git a/sc/source/ui/vba/service.cxx b/sc/source/ui/vba/service.cxx index 53ed2d3bebcb..6286b6873321 100644 --- a/sc/source/ui/vba/service.cxx +++ b/sc/source/ui/vba/service.cxx @@ -61,11 +61,15 @@ namespace globals { extern sdecl::ServiceDecl const serviceDecl; } -namespace userform +namespace hyperlink { extern sdecl::ServiceDecl const serviceDecl; } -namespace hyperlink +namespace application +{ +extern sdecl::ServiceDecl const serviceDecl; +} +namespace textframe { extern sdecl::ServiceDecl const serviceDecl; } @@ -83,10 +87,10 @@ extern "C" lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey ) { OSL_TRACE("In component_writeInfo"); - +#if 0 // Component registration if ( component_writeInfoHelper( pServiceManager, pRegistryKey, - range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ) ) + range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) ) { // Singleton registration try @@ -106,6 +110,12 @@ extern "C" } } return sal_False; +#else + // Component registration + return component_writeInfoHelper( pServiceManager, pRegistryKey, + range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, textframe::serviceDecl ); +#endif + } SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( @@ -114,7 +124,9 @@ extern "C" { OSL_TRACE("In component_getFactory for %s", pImplName ); void* pRet = component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ); + pImplName, pServiceManager, pRegistryKey, range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ); + if( !pRet ) + pRet = component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, textframe::serviceDecl ); OSL_TRACE("Ret is 0x%x", pRet); return pRet; } diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/ApplicationRunTest.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/ApplicationRunTest.xls new file mode 100644 index 000000000000..a5a591c1f849 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/ApplicationRunTest.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/AutoFilter.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/AutoFilter.xls new file mode 100644 index 000000000000..9b3a1043c5ee Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/AutoFilter.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/CalcFont.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/CalcFont.xls new file mode 100644 index 000000000000..9ddb69600643 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/CalcFont.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/CalcZoom.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/CalcZoom.xls new file mode 100644 index 000000000000..5db47c76dbe9 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/CalcZoom.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/FinancialFuncTests.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/FinancialFuncTests.xls new file mode 100644 index 000000000000..d4776b98fe1d Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/FinancialFuncTests.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/FinancialFuncs.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/FinancialFuncs.xls new file mode 100644 index 000000000000..bb8941809947 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/FinancialFuncs.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/MiscOperatorTests.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/MiscOperatorTests.xls new file mode 100644 index 000000000000..23227ae37e24 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/MiscOperatorTests.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/MiscRangeTests.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/MiscRangeTests.xls new file mode 100644 index 000000000000..ebd9e91b5b28 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/MiscRangeTests.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/PageBreaks.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/PageBreaks.xls new file mode 100644 index 000000000000..b6651fa5d617 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/PageBreaks.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges-2.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges-2.xls new file mode 100644 index 000000000000..f6e81cf933fd Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges-2.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges-3.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges-3.xls new file mode 100644 index 000000000000..8722f6d3057e Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges-3.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges.xls new file mode 100644 index 000000000000..1c1d74d37486 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Shapes.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Shapes.xls new file mode 100644 index 000000000000..254f3c97756c Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Shapes.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/StrConv-test.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/StrConv-test.xls new file mode 100644 index 000000000000..198abbec5871 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/StrConv-test.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Template.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Template.xls new file mode 100644 index 000000000000..4387231fe744 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Template.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestAddress.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestAddress.xls new file mode 100644 index 000000000000..48d30cbe2e9e Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestAddress.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestCalc_Rangetest.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestCalc_Rangetest.xls new file mode 100644 index 000000000000..a497d4f10f3e Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestCalc_Rangetest.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestCalc_Rangetest2.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestCalc_Rangetest2.xls new file mode 100644 index 000000000000..34c606fc28f5 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestCalc_Rangetest2.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestIntersection.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestIntersection.xls new file mode 100644 index 000000000000..24f88db87ccc Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestIntersection.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestUnion.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestUnion.xls new file mode 100644 index 000000000000..5b8f0968cf38 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestUnion.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/VariantTest.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/VariantTest.xls new file mode 100644 index 000000000000..f604cfbe3975 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/VariantTest.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Window.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Window.xls new file mode 100644 index 000000000000..6fb6963c2f31 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/Window.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/bytearraystring.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/bytearraystring.xls new file mode 100644 index 000000000000..471bbc349e5b Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/bytearraystring.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/dateserial.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/dateserial.xls new file mode 100644 index 000000000000..768fb513eba4 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/dateserial.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/datevalue.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/datevalue.xls new file mode 100644 index 000000000000..852a51d100b8 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/datevalue.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/format.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/format.xls new file mode 100644 index 000000000000..99ed64d38915 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/format.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/AutoFilter.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/AutoFilter.log new file mode 100644 index 000000000000..1fe0cbd01fe5 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/AutoFilter.log @@ -0,0 +1,20 @@ +Test run started : 17/07/2007 17:36:22 +---------------------------------------------------------------- +TestAddress + TEST START : TestAddress + ITEM Assertion OK : test1 'starts with' string criteria + ITEM Assertion OK : test2 'not equal to' string criteria + ITEM Assertion OK : test3 'ends with' string criteria + ITEM Assertion OK : test4 field 'all' + ITEM Assertion OK : test5 numeric '<15' + ITEM Assertion OK : test6 numeric '>=15' + ITEM Assertion OK : test7 numeric '<=12' +Test Results +============ + +Tests passed: 7 +Tests failed: 0 + +END 'TestAddress + TEST OK : TestAddress +Test run finished : 17/07/2007 17:36:23 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/MiscRangeTests.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/MiscRangeTests.log new file mode 100644 index 000000000000..260465386d07 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/MiscRangeTests.log @@ -0,0 +1,45 @@ +Test run started : 17/07/2007 15:01:37 +---------------------------------------------------------------- +MiscRangeTests + TEST START : MiscRangeTests + ITEM Assertion OK : test 1 + ITEM Assertion OK : test 2 + ITEM Assertion OK : test 3 + ITEM Assertion OK : test 4 + ITEM Assertion OK : test 5 + ITEM Assertion OK : test 6 + ITEM Assertion OK : test 7 + ITEM Assertion OK : test 8 + ITEM Assertion OK : test 9 + ITEM Assertion OK : test 10 + ITEM Assertion OK : test 11 + ITEM Assertion OK : test 12 + ITEM Assertion OK : test 13 + ITEM Assertion OK : test 14 + ITEM Assertion OK : test 15 + ITEM Assertion OK : test 16 + ITEM Assertion OK : test 17 + ITEM Assertion OK : test 18 + ITEM Assertion OK : test 19 + ITEM Assertion OK : test 20 + ITEM Assertion OK : test 21 + ITEM Assertion OK : test 22 + ITEM Assertion OK : test 23 + ITEM Assertion OK : test 24 + ITEM Assertion OK : test 25 + ITEM Assertion OK : test 26 + ITEM Assertion OK : test 27 + ITEM Assertion OK : test 28 + ITEM Assertion OK : test 29 + ITEM Assertion OK : test 30 + ITEM Assertion OK : test 31 +No. tests: 31 +Summary +======= +Run: 31 +Passed: 31 +Failed: 0 + +END 'MiscRangeTests + TEST OK : MiscRangeTests +Test run finished : 17/07/2007 15:01:39 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges-2.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges-2.log new file mode 100644 index 000000000000..736d5bbc42d0 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges-2.log @@ -0,0 +1,68 @@ +Test run started : 18/06/2007 17:50:04 +---------------------------------------------------------------- +ClearFormtsIssue + TEST START : ClearFormtsIssue + ITEM Assertion OK : Range.Font.Bold is: True + ITEM Assertion OK : Range.Font.Bold is: False +END 'ClearFormtsIssue' Symbol + TEST OK : ClearFormtsIssue +---------------------------------------------------------------- +VerticalAlignment-Issue + TEST START : VerticalAlignment-Issue + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (set) + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (set) + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (set) + ITEM Assertion OK : Range.VeritcalAlignment is Null +END 'VerticalAlignment-Issue' Symbol + TEST OK : VerticalAlignment-Issue +---------------------------------------------------------------- +HorizontalAlignment-Issue + TEST START : HorizontalAlignment-Issue + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : Range.HorizontalAlignment is Null +END 'HorizontalAlignment-Issue' Symbol + TEST OK : HorizontalAlignment-Issue +---------------------------------------------------------------- +WrapText-Issue + TEST START : WrapText-Issue + ITEM Assertion OK : - Range.WrapText (get) + ITEM Assertion OK : - Range.WrapText (get) + ITEM Assertion OK : Range.WrapText is Null +END 'WrapText-Issue' Symbol + TEST OK : WrapText-Issue +---------------------------------------------------------------- +FontBorderIssues + TEST START : FontBorderIssues + ITEM Assertion OK : - = Borders.Color (getColor) + ITEM Assertion OK : - = Font.Color (getColor) +END 'FontBorderIssues' Symbol + TEST OK : FontBorderIssues +---------------------------------------------------------------- +RangeSizeIssues + TEST START : RangeSizeIssues + ITEM Assertion OK : Range.Left is: 114 + ITEM Assertion OK : Range.Top is: 95.25 + ITEM Assertion OK : Range.Width is: 216 + ITEM Assertion OK : Range.Height is: 271.5 +END 'RangeSizeIssues' Symbol + TEST OK : RangeSizeIssues +---------------------------------------------------------------- +ApplicationIssues + TEST START : ApplicationIssues + ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Application.ActiveSheet.Name: Sheet1 +END 'ApplicationIssues' Symbol + TEST OK : ApplicationIssues +Test run finished : 18/06/2007 17:50:04 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges-3.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges-3.log new file mode 100644 index 000000000000..a7de979d5e13 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges-3.log @@ -0,0 +1,8 @@ +Test run started : 19/06/2007 11:21:42 +---------------------------------------------------------------- +MyGoalseek-Issue + TEST START : MyGoalseek-Issue + ITEM Assertion OK : Variable Range value: 15 +END 'MyGoalseek-Issue' Symbol + TEST OK : MyGoalseek-Issue +Test run finished : 19/06/2007 11:21:42 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges.log new file mode 100644 index 000000000000..8c9644aac155 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges.log @@ -0,0 +1,280 @@ +Test run started : 01/06/2007 11:28:58 +---------------------------------------------------------------- +ApplicationMethods + TEST START : ApplicationMethods + ITEM Assertion OK : Name of Workbook is: Ranges.xls + ITEM Assertion OK : Address of Application.Columns is: $A:$A + ITEM Assertion OK : Address of Application.Rows is: $1:$1 + ITEM Assertion OK : Address of Application.Range is: $1:$1,$5:$7 + ITEM Assertion OK : Please check manually: DefaultFilePath is: C:\Documents and Settings\vituosity\My Documents + ITEM Assertion OK : Please check manually: Library Path is: C:\Program Files\Microsoft Office\OFFICE11\LIBRARY + ITEM Assertion OK : Please check manually: Template Path is: C:\Documents and Settings\vituosity\Application Data\Microsoft\Templates\ + ITEM Assertion OK : FileSeparator is \ + ITEM Assertion OK : Name of ActiveWorkbook is: Ranges.xls +END 'ApplicationMethods' Symbol + TEST OK : ApplicationMethods +---------------------------------------------------------------- +Insert-Issue + TEST START : Insert-Issue + ITEM Assertion OK : Insert with xlShiftToRight: 10 +END 'Insert-Issue' Symbol + TEST OK : Insert-Issue +---------------------------------------------------------------- +MergeCells-Issue + TEST START : MergeCells-Issue + ITEM Assertion OK : Range.MergeCells is True + ITEM Assertion OK : MergeCells is null: True + ITEM Assertion OK : RowCount after Merge: 6 + ITEM Assertion OK : Range.MergeCells is False + ITEM Assertion OK : MergeCells is null: False + ITEM Assertion OK : MergeCells of Second Area is null : True + ITEM Assertion OK : MergeCells of Ranges is Null: True + ITEM Assertion OK : RowCount after Merge: 7 + ITEM Assertion OK : Range.MergeCells is False + ITEM Assertion OK : MergeCells is null: False + ITEM Assertion OK : RowCount after Merge: 7 +END 'MergeCells-Issue' Symbol + TEST OK : MergeCells-Issue +---------------------------------------------------------------- +Areas-Issue + TEST START : Areas-Issue + ITEM Assertion OK : Range Areas Count is2 + ITEM Assertion OK : First Range Address is: $E$8:$G$13 + ITEM Assertion OK : First Row is: 8 + ITEM Assertion OK : First Column is: 5 + ITEM Assertion OK : EntireRow Address is: $8:$13,$13:$19 + ITEM Assertion OK : EntireColumn Address is: $E:$G,$G:$K + ITEM Assertion OK : Range Count:53 +END 'Areas-Issue' Symbol + TEST OK : Areas-Issue +---------------------------------------------------------------- +Fill-Methods-Issue + TEST START : Fill-Methods-Issue + ITEM Assertion OK : Range Value after FillDown: MyFillValue + ITEM Assertion OK : Range Value after FillDown: MyFillValue + ITEM Assertion OK : Range Value after FillDown: MyRightFillValue + ITEM Assertion OK : Range Value after FillDown: MyBottomFillValue +END 'Fill-Methods-Issue' Symbol + TEST OK : Fill-Methods-Issue +---------------------------------------------------------------- +Range/Item-Method-Issue + TEST START : Range/Item-Method-Issue + ITEM Assertion OK : Range of multiple columns is: $A:$A,$C:$C + ITEM Assertion OK : Range of multiple rows is: $1:$1,$5:$7 + ITEM Assertion OK : Range of several columns is: $C:$E,$D:$D + ITEM Assertion OK : Range of several rows is: $5:$8,$6:$10 + ITEM Assertion OK : Range of several single cells is: $C$5,$E$8 + ITEM Assertion OK : Range of several named ranges is: $L$1:$M$6,$E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Range of a single Item Cell is: $E$21 + ITEM Assertion OK : Range of a single Item Cell is: $F$21 + ITEM Assertion OK : Range of a single Item Cell is: $F$10 +END 'Range/Item-Method-Issue' Symbol + TEST OK : Range/Item-Method-Issue +---------------------------------------------------------------- +R1C1-Formulas-Issue + TEST START : R1C1-Formulas-Issue + ITEM Assertion OK : R1C1 Range.Formula is: =IF(OR(R[-2]C[1]=0,RC[2]="YES"),"") + ITEM Assertion OK : Range.Formula is: =IF(OR(J8=0,K10="YES"),"") +END 'R1C1-Formulas-Issue' Symbol + TEST OK : R1C1-Formulas-Issue +---------------------------------------------------------------- +Verify_Delete + TEST START : Verify_Delete + ITEM Assertion OK : Ranges are intersecting: $G$13 + ITEM Assertion OK : Delete with Default: $AJ$4 + ITEM Assertion OK : Delete with ShifttoLeft: $AJ$4 + ITEM Assertion OK : Delete with ShiftUp: $M$22 +END 'Verify_Delete' Symbol + TEST OK : Verify_Delete +---------------------------------------------------------------- +Value-Issue + TEST START : Value-Issue + ITEM Assertion OK : Value of Range is: 12.3 + ITEM Assertion OK : Text of Range is: 12.3 + ITEM Assertion OK : Range has Formula: False + ITEM Assertion OK : Cell has Formula: False + ITEM Assertion OK : Text of Range is null: True + ITEM Assertion OK : Range has Formula: True + ITEM Assertion OK : Cell has Formula: True + ITEM Assertion OK : Value of Cell is: 12 + ITEM Assertion OK : Application.Calculation is : -4135 + ITEM Assertion OK : Calculation is automated: True + ITEM Assertion OK : Range has Formula: True + ITEM Assertion OK : Value of Cell is: 16 + ITEM Assertion OK : Text of Cell is: 16 + ITEM Assertion OK : Text of Cell is: 16 + ITEM Assertion OK : Range has Formula after 'ClearContents: False + ITEM Assertion OK : Text of Cell is: + ITEM Assertion OK : Text of Cell is: +END 'Value-Issue' Symbol + TEST OK : Value-Issue +---------------------------------------------------------------- +AutoFit issue + TEST START : AutoFit issue + ITEM Assertion OK : Columns.AutoFit: CurrentWidth is 673 + ITEM Assertion OK : Rows.AutoFit: CurrentHeight is 612 +END 'AutoFit issue' Symbol + TEST OK : AutoFit issue +---------------------------------------------------------------- +Selections + TEST START : Selections + ITEM Assertion OK : ActiveCell is : $E$8 + ITEM Assertion OK : Active Cell is : $E$8 + ITEM Assertion OK : Number of Cells in Range: 53 + ITEM Assertion OK : Number of Cells in Range: 53 + ITEM Assertion OK : Number of Cells in Range: 53 +END 'Selections' Symbol + TEST OK : Selections +---------------------------------------------------------------- +Offset-Resize + TEST START : Offset-Resize + ITEM Assertion OK : Offset is : $G$10:$I$15,$I$15:$M$21 + ITEM Assertion OK : Offset is : $G$7:$I$12,$I$12:$M$18 + ITEM Assertion OK : Resized Range is : $A$20:$D$23 +END 'Offset-Resize' Symbol + TEST OK : Offset-Resize +---------------------------------------------------------------- +Ranges-Address + TEST START : Ranges-Address + ITEM Assertion OK : Range Address is: $E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Range Address is: $E8:$G13,$G13:$K19 + ITEM Assertion OK : Range Address is: E$8:G$13,G$13:K$19 + ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11 + ITEM Assertion OK : Range Address is: $E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11 + ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5],R[11]C[5]:R[17]C[9] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13,$G$13:$K$19 +END 'Ranges-Address' Symbol + TEST OK : Ranges-Address +---------------------------------------------------------------- +Range-Address + TEST START : Range-Address + ITEM Assertion OK : Range Address is: $E$8:$G$13 + ITEM Assertion OK : Range Address is: $E8:$G13 + ITEM Assertion OK : Range Address is: E$8:G$13 + ITEM Assertion OK : Range Address is: R8C5:R13C7 + ITEM Assertion OK : Range Address is: $E$8:$G$13 + ITEM Assertion OK : Range Address is: R8C5:R13C7 + ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13 +END 'Range-Address' Symbol + TEST OK : Range-Address +---------------------------------------------------------------- +Column-Address + TEST START : Column-Address + ITEM Assertion OK : Range Address is: $F$8:$F$13 + ITEM Assertion OK : Range Address is: $F8:$F13 + ITEM Assertion OK : Range Address is: F$8:F$13 + ITEM Assertion OK : Range Address is: R8C6:R13C6 + ITEM Assertion OK : Range Address is: $F$8:$F$13 + ITEM Assertion OK : Range Address is: R8C6:R13C6 + ITEM Assertion OK : Range Address is: R[6]C[4]:R[11]C[4] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$8:$F$13 +END 'Column-Address' Symbol + TEST OK : Column-Address +---------------------------------------------------------------- +Row-Address + TEST START : Row-Address + ITEM Assertion OK : Range Address is: $E$9:$G$9 + ITEM Assertion OK : Range Address is: $E9:$G9 + ITEM Assertion OK : Range Address is: E$9:G$9 + ITEM Assertion OK : Range Address is: R9C5:R9C7 + ITEM Assertion OK : Range Address is: $E$9:$G$9 + ITEM Assertion OK : Range Address is: R9C5:R9C7 + ITEM Assertion OK : Range Address is: R[7]C[3]:R[7]C[5] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$9:$G$9 +END 'Row-Address' Symbol + TEST OK : Row-Address +---------------------------------------------------------------- +SingleCell-Address + TEST START : SingleCell-Address + ITEM Assertion OK : Range Address is: $F$9 + ITEM Assertion OK : Range Address is: $F9 + ITEM Assertion OK : Range Address is: F$9 + ITEM Assertion OK : Range Address is: R9C6 + ITEM Assertion OK : Range Address is: $F$9 + ITEM Assertion OK : Range Address is: R9C6 + ITEM Assertion OK : Range Address is: R[7]C[4] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$9 +END 'SingleCell-Address' Symbol + TEST OK : SingleCell-Address +---------------------------------------------------------------- +Heights and Widths + TEST START : Heights and Widths + ITEM Assertion OK : Range RowHeight is 40 + ITEM Assertion OK : Range ColumnWidth is 50 + ITEM Assertion OK : Range Height is 238 + ITEM Assertion OK : Range Width is 798.75 + ITEM Assertion OK : Range RowHeight is 50 + ITEM Assertion OK : Range ColumnWidth is 50 + ITEM Assertion OK : Range Height is 297 + ITEM Assertion OK : Range Width is 798.75 + ITEM Assertion OK : RowHeight is null: True + ITEM Assertion OK : ColumnWidth is null: True +END 'Heights and Widths' Symbol + TEST OK : Heights and Widths +---------------------------------------------------------------- +RangeRowColumn-Issue + TEST START : RangeRowColumn-Issue + ITEM Assertion OK : Row is: 8 + ITEM Assertion OK : Column is: 5 + ITEM Assertion OK : EntireRow.Columns.Count = 256 + ITEM Assertion OK : EntireColumn.Rows.Count = 65536 +END 'RangeRowColumn-Issue' Symbol + TEST OK : RangeRowColumn-Issue +---------------------------------------------------------------- +Replace-Issue + TEST START : Replace-Issue + ITEM Assertion OK : Value after Replace: YourValue + ITEM Assertion OK : Value after Replace: YourValue + ITEM Assertion OK : Value after Replace: ReplaceValue + ITEM Assertion OK : Value after Replace: New ReplaceValue + ITEM Assertion OK : Value after Replace: New ReplaceValue + ITEM Assertion OK : Value after Replace: New Replace + ITEM Assertion OK : Value after Replace: +END 'Replace-Issue' Symbol + TEST OK : Replace-Issue +---------------------------------------------------------------- +Hidden-Issue + TEST START : Hidden-Issue + ITEM Assertion OK : - Range.Rows.Hidden (set) + ITEM Assertion OK : - Range.Rows.Hidden (get) + ITEM Assertion OK : - Range.Rows.Item(1).Hidden (set) + ITEM Assertion OK : - Range.Rows.Item(1).Hidden (get) + ITEM Assertion OK : - Range.Columns.Hidden (set) + ITEM Assertion OK : - Range.Columns.Hidden (get) + ITEM Assertion OK : - Range.Columns.Item(1).Hidden (set) + ITEM Assertion OK : - Range.Columns.Item(1).Hidden (get) +END 'Hidden-Issue' Symbol + TEST OK : Hidden-Issue +---------------------------------------------------------------- +End issue + TEST START : End issue + ITEM Assertion OK : - = $E$48 + ITEM Assertion OK : - = $E$1 + ITEM Assertion OK : - = $E$3 + ITEM Assertion OK : - = $A$8 + ITEM Assertion OK : - = $B$8 + ITEM Assertion OK : - = $IV$8 + ITEM Assertion OK : - = $Z$8 +END 'End issue' Symbol + TEST OK : End issue +---------------------------------------------------------------- +Outline issue + TEST START : Outline issue + ITEM Assertion OK : - Range.clearOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually +END 'Outline issue' Symbol + TEST OK : Outline issue +---------------------------------------------------------------- +Validation + TEST START : Validation + ITEM Assertion OK : Validation Input Message is : Attention! + ITEM Assertion OK : Validation Input Message is : Enter an integer from five to ten + ITEM Assertion OK : Validation Error Title is : You must enter a number from five to ten + ITEM Assertion OK : Validation Error Message is : An Error occured + ITEM Assertion OK : Validation Error Title is : Microsoft Excel +END 'Validation' Symbol + TEST OK : Validation +Test run finished : 01/06/2007 11:29:00 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestAddress.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestAddress.log new file mode 100644 index 000000000000..01e5503a7e62 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestAddress.log @@ -0,0 +1,62 @@ +Test run started : 17/07/2007 15:25:17 +---------------------------------------------------------------- +TestAddress + TEST START : TestAddress + ITEM Assertion OK : test1 Range('e3:f3') A1 style addressing + ITEM Assertion OK : test2 Range('e3:f3') R1C1 style addressing + ITEM Assertion OK : test3 Range ('e:f') A1 style addressing + ITEM Assertion OK : test4 Range ('e:f') R1C1 style addressing + ITEM Assertion OK : test5 Columns A1 style addressing + ITEM Assertion OK : test6 Columns R1C1 style addressing + ITEM Assertion OK : test7 Columns(3) A1 style addressing + ITEM Assertion OK : test8 Columns(3) R1C1 style addressing + ITEM Assertion OK : test9 Columns('e') A1 style addressing + ITEM Assertion OK : test10 Columns('e') R1C1 style addressing + ITEM Assertion OK : test11 Columns('b:d') A1 style addressing + ITEM Assertion OK : test12 Columns('b:d') R1C1 style addressing + ITEM Assertion OK : test13 Range('c1:g10').Columns A1 style addressing + ITEM Assertion OK : test14 Range('c1:g10').Columns R1C1 style addressing + ITEM Assertion OK : test15 Range('c1:g10').Columns(1) A1 style addressing + ITEM Assertion OK : test16 Range('c1:g10').Columns(1) R1C1 style addressing + ITEM Assertion OK : test17 Range('c1:g10').Columns('a') A1 style addressing + ITEM Assertion OK : test18 Range('c1:g10').Columns('a') R1C1 style addressing + ITEM Assertion OK : test19 Range('c1:g10').Columns('c') A1 style addressing + ITEM Assertion OK : test20 Range('c1:g10').Columns('c') R1C1 style addressing + ITEM Assertion OK : test21 Range('c1:g10').Columns('x:z') A1 style addressing + ITEM Assertion OK : test22 Range('c1:g10').Columns('x:z') R1C1 style addressing + ITEM Assertion OK : test23 Range('c1:g10').Columns(30) A1 style addressing + ITEM Assertion OK : test24 Range('c1:g10').Columns(30) R1C1 style addressing + ITEM Assertion OK : test25 Worksheets('Sheet2').Cells(1, 1) A1 style addressing + ITEM Assertion OK : test26 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, RowAddressAbsolute is false + ITEM Assertion OK : test27 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, ColAddressAbsolute is false + ITEM Assertion OK : test28 Worksheets('Sheet2').Cells(1, 1) R1C1 style addressing + ITEM Assertion OK : test29 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing + ITEM Assertion OK : test30 Worksheets('Sheet2').Range('A1').EntireColumn A1 style addressing + ITEM Assertion OK : test31 Worksheets('Sheet2').Range('A1:E5').EntireRow A1 style addressing + ITEM Assertion OK : test32 Worksheets('Sheet2').Range('A1') A1 style addressing + ITEM Assertion OK : test33 Worksheets('Sheet2').Range('IV65536').EntireRow A1 style addressing + ITEM Assertion OK : test34 Worksheets('Sheet2').Range('IU2:IV65536') A1 style addressing + ITEM Assertion OK : test35 Range('c1:g10').Columns('x:z') R1C1 style addressing + ITEM Assertion OK : test36 Worksheets('Sheet2').Range('A1') A1 style addressing + ITEM Assertion OK : test37 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing + ITEM Assertion OK : test38 Worksheets('Sheet2').Range('10:12') A1 style addressing + ITEM Assertion OK : test39 Worksheets('Sheet2').Range('10:12') R1C1 style addressing + ITEM Assertion OK : test40 Range('Sheet3!A1:B4') A1 style addressing + ITEM Assertion OK : test41 Range('Sheet3!A1,B1,D4:F20') A1 style addressing + ITEM Assertion OK : test42 Range('g20:h40').Columns('c:c') + ITEM Assertion OK : test43 Range('g20:h40').Columns('c:f') + ITEM Assertion OK : test44 Range('g20:h40').Columns(-1) + ITEM Assertion OK : test45 Range('c4:g10').Rows(-1) + ITEM Assertion OK : test46 Range('a2:b4').Rows('1:1') + ITEM Assertion OK : test47 Range('a2:b4').Rows('1:2') + ITEM Assertion OK : test48 Range('a2:b4').Rows('2:2') + ITEM Assertion OK : test49 Range('a2:b4').Rows('2:3') +Test Results +============ + +Tests passed: 49 +Tests failed: 0 + +END 'TestAddress + TEST OK : TestAddress +Test run finished : 17/07/2007 15:25:19 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestCalc_Rangetest.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestCalc_Rangetest.log new file mode 100644 index 000000000000..f055279ec6f4 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestCalc_Rangetest.log @@ -0,0 +1,60 @@ +Test run started : 30/05/2007 11:33:13 +BEGIN TestCalc + TEST START : RangeTest2 + ITEM Assertion OK : - Range("D15").Row + ITEM Assertion OK : - WorkSheet("D15").Range.Row + ITEM Assertion OK : - Range("D15").Column + ITEM Assertion OK : - Worksheet.Range("D15").Column + ITEM Assertion OK : - Range("D1").EntireRow.Valuer + ITEM Assertion OK : - Range("D1").EntireRow.Valuer + ITEM Assertion OK : - Range("D1").EntireRow.Columns.Count + ITEM Assertion OK : - Range("D1").EntireColumn.Rows.Count + ITEM Assertion OK : - Range("D15").ClearContent + ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (get) + ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (get) + ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (get) + ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (get) + ITEM Assertion OK : - Range("B38").Orientation (get) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlDownward) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlUpward) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical) + ITEM Assertion OK : - Range("B39").WrapText (get) + ITEM Assertion OK : - Range("B39").WrapText (set) + ITEM Assertion OK : - Range("B39").WrapText (set) + ITEM Assertion OK : - Range("E39").MergeCells (get) + ITEM Assertion OK : - Range("F39").MergeCells (get) + ITEM Assertion OK : - Range("E39").MergeCells (set) + ITEM Assertion OK : - Range("F39").MergeCells (set) + ITEM Assertion OK : - Range("E39").MergeCells (set) + ITEM Assertion OK : - Range("F39").MergeCells (set) + ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True + ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True + ITEM Assertion OK : - Range("D41:D42").Replace MatchCase:=False + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (set) + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (set) + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM OK (RangeTest2) + TEST succesfully completed : RangeTest2 +END TestCalc +Test run finished : 30/05/2007 11:33:14 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestCalc_Rangetest2.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestCalc_Rangetest2.log new file mode 100644 index 000000000000..19a5ba96b54a --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestCalc_Rangetest2.log @@ -0,0 +1,64 @@ +Test run started : 31/05/2007 11:02:10 +BEGIN TestCalc + TEST START : RangeTest3 + ITEM Assertion OK : - setFormulaR1C1 + ITEM Assertion OK : - getFormulaR1C1 + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Copy(Range("I10")) + ITEM Assertion OK : PasteSpecial Paste:=xlPasteValues + ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormulas + ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormats + ITEM Assertion OK : PasteSpecial + ITEM Assertion OK : PasteSpecial SkipBlanks:=True + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationAdd + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationSubtract + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationMultiply + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationDivide + ITEM Assertion OK : PasteSpecial Transpose:=True + ITEM Assertion OK : ActiveWorkbook.Name + ITEM Assertion OK : ActiveWorkbook.FullName und ActiveWorkbook.Path + ITEM Assertion OK : - = Range("K22").End (xlDown) + ITEM Assertion OK : - = Range("K22").End (xlUo) + ITEM Assertion OK : - = Range("K22").End (xlToLeft) + ITEM Assertion OK : - = Range("K22").End (xlRight) + ITEM Assertion OK : - ActiveSpreadsheet.Next + ITEM Assertion OK : - ActiveSpreadsheet.Next + ITEM Assertion OK : - ActiveSpreadsheet.Previous + ITEM Assertion OK : - ActiveSpreadsheet.Previous + ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="x" + ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="<>" + ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="=" + ITEM Assertion OK : - Range("J4:J11").AutoFilter + ITEM Assertion OK : - ActiveSheet.Resize.Select + ITEM Assertion OK : - Application.GoTo Reference:="R8C2" + ITEM Assertion OK : - Application.GoTo Reference:="R[8]C[2]" + ITEM Assertion OK : - Application.GoTo Reference:="R8C2" + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.Ungroup- please check visually + ITEM Assertion OK : - Range.Ungroup - please check visually + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.clearOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually + ITEM Assertion OK : - ActiveSheet.UsedRange.Select + ITEM Assertion FAIL : - Range("A13").AddIndent + ITEM Assertion OK : - Range("A13").IndentLevel set + ITEM Assertion OK : - Range("A13").IndentLevel get + ITEM Assertion OK : - Range("A13").IndentLevel get + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Calculate + ITEM Assertion OK : Worksheet.Calculate + ITEM Assertion OK : - Application.Calculate + ITEM Assertion OK : Global.Calculate + ITEM Assertion OK : Calculation set + ITEM Assertion OK : - = ActiveWorkbook.Colors(3) set + ITEM Assertion OK : - = ActiveWorkbook.ResetColors + ITEM Assertion OK : - = ActiveWorkbook.Colors(3) get + ITEM FAIL (RangeTest3) + TEST Not succesfully completed : RangeTest3 +END TestCalc +Test run finished : 31/05/2007 11:02:12 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/format.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/format.log new file mode 100644 index 000000000000..5226a161c61a --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/format.log @@ -0,0 +1,36 @@ +Test run started : 08/10/2008 13:08:40 +BEGIN Format + TEST START : Test Predefined_Number_Format_Sample function + ITEM Assertion OK : General Number: 562486.2356 + ITEM Assertion OK : Fixed: 0.20 + ITEM Assertion OK : Standard: 562,486.24 + ITEM Assertion OK : Percent: 75.21% + ITEM Assertion OK : Scientific: 5.62E+05 + ITEM Assertion OK : Scientific: -3.46E+03 + ITEM Assertion OK : Yes/No: No + ITEM Assertion OK : Yes/No: Yes + ITEM Assertion OK : True/False: False + ITEM Assertion OK : True/False: True + ITEM Assertion OK : On/Off: Off + ITEM Assertion OK : On/Off: On + TEST OK : Test Predefined_Number_Format_Sample function + TEST START : Test Custom_Number_Format_Sample function + ITEM Assertion OK : 00.0000: 23.6750 + ITEM Assertion OK : 00.00: 23.68 + ITEM Assertion OK : 00000: 02658 + ITEM Assertion OK : 00.00: 2658.00 + ITEM Assertion OK : ##.####: 23.675 + ITEM Assertion OK : ##.##: 23.68 + ITEM Assertion OK : #,###.##: 12,345.25 + ITEM Assertion OK : ##.00%: 25.00% + ITEM Assertion OK : #,###: 1,000,000 + ITEM Assertion OK : ######E-###: 109838E-5 + ITEM Assertion OK : $#,###.##: $2,345.25 + ITEM Assertion OK : ##.###\%: .25% + TEST OK : Test Custom_Number_Format_Sample function + TEST START : Test Custom_Text_Format_Sample function + ITEM Assertion OK : <: vba + ITEM Assertion OK : >: VBA + TEST OK : Test Custom_Text_Format_Sample function +END Format +Test run finished : 08/10/2008 13:08:40 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/AutoFilter.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/AutoFilter.log new file mode 100644 index 000000000000..55f5d9526618 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/AutoFilter.log @@ -0,0 +1,20 @@ +Test run started : 18/07/2007 10:56:38 +---------------------------------------------------------------- +TestAddress + TEST START : TestAddress + ITEM Assertion OK : test1 'starts with' string criteria + ITEM Assertion OK : test2 'not equal to' string criteria + ITEM Assertion OK : test3 'ends with' string criteria + ITEM Assertion OK : test4 field 'all' + ITEM Assertion OK : test5 numeric '<15' + ITEM Assertion OK : test6 numeric '>=15' + ITEM Assertion OK : test7 numeric '<=12' +Test Results +============ + +Tests passed: 7 +Tests failed: 0 + +END 'TestAddress + TEST OK : TestAddress +Test run finished : 18/07/2007 10:56:44 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/CalcFont.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/CalcFont.log new file mode 100644 index 000000000000..f3583e4cbb12 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/CalcFont.log @@ -0,0 +1,17 @@ +Test run started : 10/09/2008 02:40:17 PM +CalcFont_Format + TEST START : Font_Format + ITEM Assertion OK : correctly set font to Bold + ITEM Assertion OK : correctly set font to Italic + ITEM Assertion OK : correctly read FontStyle + ITEM Assertion OK : correctly set font to Shadow + ITEM Assertion OK : correctly set font color + ITEM Assertion OK : correctly set font color index + ITEM Assertion OK : correctly set font name + ITEM Assertion OK : correctly set font outline + ITEM Assertion OK : correctly set font size + ITEM Assertion OK : correctly set font strikethrough + ITEM Assertion OK : correctly set font underline + TEST Success. : Font_Format +CalcFont_Format +Test run finished : 10/09/2008 02:40:17 PM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/CalcZoom.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/CalcZoom.log new file mode 100644 index 000000000000..f8c83531a8a2 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/CalcZoom.log @@ -0,0 +1,18 @@ +Test run started : 15/06/2009 12:49:35 +CalcZoom + TEST START : CalcZoom + ITEM Assertion OK : test1 read window.zoom activesheet = sheet1 + ITEM Assertion OK : test2 read window.zoom activesheet = sheet2 + ITEM Assertion OK : test3 read window.zoom activesheet = sheet3 + ITEM Assertion OK : test4 read window.zoom activesheet = sheet3 + ITEM Assertion OK : test4 read window.zoom activesheet = sheet2 + ITEM Assertion OK : test4 read window.zoom activesheet = sheet1 + TEST Success. : CalcZoom +CalcZoom +Test Results +============ + +Tests passed: 6 +Tests failed: 0 + +Test run finished : 15/06/2009 12:49:37 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/FinancialFuncTests.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/FinancialFuncTests.log new file mode 100644 index 000000000000..5633a8100e08 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/FinancialFuncTests.log @@ -0,0 +1,31 @@ +Test run started : 04/08/2009 12:42:26 +---------------------------------------------------------------- +FinancialFuncs + TEST START : FinancialFuncs + ITEM Assertion OK : DDB test + ITEM Assertion OK : FV test + ITEM Assertion OK : IPmt test + ITEM Assertion FAIL : IRR test + ITEM Assertion OK : MIRR test + ITEM Assertion FAIL : NPer test + ITEM Assertion FAIL : NPV test + ITEM Assertion FAIL : Pmt test + ITEM Assertion OK : PPmt test + ITEM Assertion OK : PV test + ITEM Assertion FAIL : Rate test + ITEM Assertion OK : SLN test + ITEM Assertion OK : SYD test +Test Results +============ + +IRR test Failed: expected 35.8625323270733 got 35.8625323273411 +NPer test Failed: expected 21.5365977313406 got 21.5365977313408 +NPV test Failed: expected 3874.42183648785 got 3874.42183648784 +Pmt test Failed: expected 20276.3942884139 got 20276.3942884138 +Rate test Failed: expected 4.67819164224935E-02 got 4.67819164225E-02 +Tests passed: 8 +Tests failed: 5 + +END 'FinancialFuncs + TEST OK : FinancialFuncs +Test run finished : 04/08/2009 12:42:36 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/MiscOperatorTests.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/MiscOperatorTests.log new file mode 100644 index 000000000000..116f9f98c7e8 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/MiscOperatorTests.log @@ -0,0 +1,30 @@ +Test run started : 12/05/2009 12:36:15 +---------------------------------------------------------------- +TestAddress + TEST START : TestAddress + ITEM Assertion OK : test1: res = Not ( A > B ) + ITEM Assertion OK : test2: res = Not ( B > A ) + ITEM Assertion OK : test3: res = Not ( D ) + ITEM Assertion OK : test4: res = Not A + ITEM Assertion OK : test5: res = ( A > D ) + ITEM Assertion OK : test6: res = ( D > A ) + ITEM Assertion OK : test7: res = ( A < D ) + ITEM Assertion OK : test8: res = ( D < A ) + ITEM Assertion OK : test9: res = ( A >= D ) + ITEM Assertion OK : test10: res = ( D >= A ) + ITEM Assertion OK : test11: res = ( A <= D ) + ITEM Assertion OK : test12: res = ( D <= A ) + ITEM Assertion OK : test13: res = ( D = A ) + ITEM Assertion OK : test14: res = ( A = D ) + ITEM Assertion OK : test15: res = ( D <> A ) + ITEM Assertion OK : test16: res = ( A <> D ) + ITEM Assertion OK : test17: ( A = D ) = True +Test Results +============ + +Tests passed: 17 +Tests failed: 0 + +END 'TestAddress + TEST OK : TestAddress +Test run finished : 12/05/2009 12:36:15 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/MiscRangeTests.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/MiscRangeTests.log new file mode 100644 index 000000000000..215842f9a7e6 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/MiscRangeTests.log @@ -0,0 +1,45 @@ +Test run started : 17/07/2007 20:54:56 +---------------------------------------------------------------- +MiscRangeTests + TEST START : MiscRangeTests + ITEM Assertion OK : test 1 + ITEM Assertion OK : test 2 + ITEM Assertion OK : test 3 + ITEM Assertion OK : test 4 + ITEM Assertion OK : test 5 + ITEM Assertion OK : test 6 + ITEM Assertion OK : test 7 + ITEM Assertion OK : test 8 + ITEM Assertion OK : test 9 + ITEM Assertion OK : test 10 + ITEM Assertion OK : test 11 + ITEM Assertion OK : test 12 + ITEM Assertion OK : test 13 + ITEM Assertion OK : test 14 + ITEM Assertion OK : test 15 + ITEM Assertion OK : test 16 + ITEM Assertion OK : test 17 + ITEM Assertion OK : test 18 + ITEM Assertion OK : test 19 + ITEM Assertion OK : test 20 + ITEM Assertion OK : test 21 + ITEM Assertion OK : test 22 + ITEM Assertion OK : test 23 + ITEM Assertion OK : test 24 + ITEM Assertion OK : test 25 + ITEM Assertion OK : test 26 + ITEM Assertion OK : test 27 + ITEM Assertion OK : test 28 + ITEM Assertion OK : test 29 + ITEM Assertion OK : test 30 + ITEM Assertion OK : test 31 +No. tests: 31 +Summary +======= +Run: 31 +Passed: 31 +Failed: 0 + +END 'MiscRangeTests + TEST OK : MiscRangeTests +Test run finished : 17/07/2007 20:55:03 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/PageBreaks.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/PageBreaks.log new file mode 100644 index 000000000000..0ff400d49e85 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/PageBreaks.log @@ -0,0 +1,10 @@ +Test run started : 07/24/2008 05:06:12 PM +---------------------------------------------------------------- + TEST START : PageBreaks-Issue + ITEM Assertion OK : HPageBreaks.Count is 3 + ITEM Assertion OK : HPageBreak.Type is -4135 + ITEM Assertion OK : HPageBreak.Location: Range.Row is 5 + ITEM Assertion OK : HPageBreak.Delete: HPageBreaks.Count is 2 +END 'PageBreaks-Issue' Symbol + TEST OK : PageBreaks-Issue +Test run finished : 07/24/2008 05:06:13 PM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges-2.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges-2.log new file mode 100644 index 000000000000..8b7076efaea0 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges-2.log @@ -0,0 +1,68 @@ +Test run started : 19/06/2007 11:14:01 +---------------------------------------------------------------- +ClearFormtsIssue + TEST START : ClearFormtsIssue + ITEM Assertion OK : Range.Font.Bold is: True + ITEM Assertion OK : Range.Font.Bold is: False +END 'ClearFormtsIssue' Symbol + TEST OK : ClearFormtsIssue +---------------------------------------------------------------- +VerticalAlignment-Issue + TEST START : VerticalAlignment-Issue + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (set) + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (set) + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (set) + ITEM Assertion OK : Range.VeritcalAlignment is Null +END 'VerticalAlignment-Issue' Symbol + TEST OK : VerticalAlignment-Issue +---------------------------------------------------------------- +HorizontalAlignment-Issue + TEST START : HorizontalAlignment-Issue + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : Range.HorizontalAlignment is Null +END 'HorizontalAlignment-Issue' Symbol + TEST OK : HorizontalAlignment-Issue +---------------------------------------------------------------- +WrapText-Issue + TEST START : WrapText-Issue + ITEM Assertion OK : - Range.WrapText (get) + ITEM Assertion OK : - Range.WrapText (get) + ITEM Assertion OK : Range.WrapText is Null +END 'WrapText-Issue' Symbol + TEST OK : WrapText-Issue +---------------------------------------------------------------- +FontBorderIssues + TEST START : FontBorderIssues + ITEM Assertion OK : - = Borders.Color (getColor) + ITEM Assertion OK : - = Font.Color (getColor) +END 'FontBorderIssues' Symbol + TEST OK : FontBorderIssues +---------------------------------------------------------------- +RangeSizeIssues + TEST START : RangeSizeIssues + ITEM Assertion OK : Range.Left is: 118.8432 + ITEM Assertion OK : Range.Top is: 92.16585 + ITEM Assertion OK : Range.Width is: 226.2 + ITEM Assertion OK : Range.Height is: 271.5 +END 'RangeSizeIssues' Symbol + TEST OK : RangeSizeIssues +---------------------------------------------------------------- +ApplicationIssues + TEST START : ApplicationIssues + ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Application.ActiveSheet.Name: Sheet1 +END 'ApplicationIssues' Symbol + TEST OK : ApplicationIssues +Test run finished : 19/06/2007 11:14:02 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges-3.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges-3.log new file mode 100644 index 000000000000..a130737ceb65 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges-3.log @@ -0,0 +1,8 @@ +Test run started : 19/06/2007 11:26:09 +---------------------------------------------------------------- +MyGoalseek-Issue + TEST START : MyGoalseek-Issue + ITEM Assertion OK : Variable Range value: 15 +END 'MyGoalseek-Issue' Symbol + TEST OK : MyGoalseek-Issue +Test run finished : 19/06/2007 11:26:10 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges.log new file mode 100644 index 000000000000..cdd18685e977 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges.log @@ -0,0 +1,280 @@ +Test run started : 10/03/2008 15:15:11 +---------------------------------------------------------------- +ApplicationMethods + TEST START : ApplicationMethods + ITEM Assertion OK : Name of Workbook is: Ranges.xls + ITEM Assertion OK : Address of Application.Columns is: $A:$A + ITEM Assertion OK : Address of Application.Rows is: $1:$1 + ITEM Assertion OK : Address of Application.Range is: $1:$1,$5:$7 + ITEM Assertion OK : Please check manually: DefaultFilePath is: /data4/home/npower/Documents + ITEM Assertion OK : Please check manually: Library Path is: /data4/home/npower/.ooo-2.0/user/basic + ITEM Assertion OK : Please check manually: Template Path is: /data4/home/npower/.ooo-2.0/user/template + ITEM Assertion OK : FileSeparator is / + ITEM Assertion OK : Name of ActiveWorkbook is: Ranges.xls +END 'ApplicationMethods' Symbol + TEST OK : ApplicationMethods +---------------------------------------------------------------- +Insert-Issue + TEST START : Insert-Issue + ITEM Assertion OK : Insert with xlShiftToRight: 10 +END 'Insert-Issue' Symbol + TEST OK : Insert-Issue +---------------------------------------------------------------- +MergeCells-Issue + TEST START : MergeCells-Issue + ITEM Assertion OK : Range.MergeCells is True + ITEM Assertion FAIL : MergeCells is null: False + ITEM Assertion OK : RowCount after Merge: 13 + ITEM Assertion OK : Range.MergeCells is False + ITEM Assertion OK : MergeCells is null: False + ITEM Assertion FAIL : MergeCells of Second Area is null : False + ITEM Assertion FAIL : MergeCells of Ranges is Null: False + ITEM Assertion OK : RowCount after Merge: 7 + ITEM Assertion OK : Range.MergeCells is False + ITEM Assertion OK : MergeCells is null: False + ITEM Assertion OK : RowCount after Merge: 7 +END 'MergeCells-Issue' Symbol + TEST OK : MergeCells-Issue +---------------------------------------------------------------- +Areas-Issue + TEST START : Areas-Issue + ITEM Assertion OK : Range Areas Count is2 + ITEM Assertion OK : First Range Address is: $E$8:$G$13 + ITEM Assertion OK : First Row is: 8 + ITEM Assertion OK : First Column is: 5 + ITEM Assertion OK : EntireRow Address is: $8:$13,$13:$19 + ITEM Assertion OK : EntireColumn Address is: $E:$G,$G:$K + ITEM Assertion OK : Range Count:53 +END 'Areas-Issue' Symbol + TEST OK : Areas-Issue +---------------------------------------------------------------- +Fill-Methods-Issue + TEST START : Fill-Methods-Issue + ITEM Assertion OK : Range Value after FillDown: MyFillValue + ITEM Assertion OK : Range Value after FillDown: MyFillValue + ITEM Assertion OK : Range Value after FillDown: MyRightFillValue + ITEM Assertion OK : Range Value after FillDown: MyBottomFillValue +END 'Fill-Methods-Issue' Symbol + TEST OK : Fill-Methods-Issue +---------------------------------------------------------------- +Range/Item-Method-Issue + TEST START : Range/Item-Method-Issue + ITEM Assertion OK : Range of multiple columns is: $A:$A,$C:$C + ITEM Assertion OK : Range of multiple rows is: $1:$1,$5:$7 + ITEM Assertion OK : Range of several columns is: $C:$E,$D:$D + ITEM Assertion OK : Range of several rows is: $5:$8,$6:$10 + ITEM Assertion OK : Range of several single cells is: $C$5,$E$8 + ITEM Assertion OK : Range of several named ranges is: $L$1:$M$6,$E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Range of a single Item Cell is: $E$21 + ITEM Assertion OK : Range of a single Item Cell is: $F$21 + ITEM Assertion OK : Range of a single Item Cell is: $F$10 +END 'Range/Item-Method-Issue' Symbol + TEST OK : Range/Item-Method-Issue +---------------------------------------------------------------- +R1C1-Formulas-Issue + TEST START : R1C1-Formulas-Issue + ITEM Assertion OK : R1C1 Range.Formula is: =IF(OR(R[-2]C[1]=0,RC[2]="YES"),"") + ITEM Assertion OK : Range.Formula is: =IF(OR(J8=0,K10="YES"),"") +END 'R1C1-Formulas-Issue' Symbol + TEST OK : R1C1-Formulas-Issue +---------------------------------------------------------------- +Verify_Delete + TEST START : Verify_Delete + ITEM Assertion OK : Ranges are intersecting: $G$13 + ITEM Assertion OK : Delete with Default: $AJ$4 + ITEM Assertion OK : Delete with ShifttoLeft: $AJ$4 + ITEM Assertion OK : Delete with ShiftUp: $M$22 +END 'Verify_Delete' Symbol + TEST OK : Verify_Delete +---------------------------------------------------------------- +Value-Issue + TEST START : Value-Issue + ITEM Assertion OK : Value of Range is: 12.3 + ITEM Assertion OK : Text of Range is: 12.3 + ITEM Assertion OK : Range has Formula: False + ITEM Assertion OK : Cell has Formula: False + ITEM Assertion FAIL : Text of Range is null: False + ITEM Assertion OK : Range has Formula: True + ITEM Assertion OK : Cell has Formula: True + ITEM Assertion OK : Value of Cell is: 12 + ITEM Assertion OK : Application.Calculation is : -4135 + ITEM Assertion OK : Calculation is automated: True + ITEM Assertion OK : Range has Formula: True + ITEM Assertion OK : Value of Cell is: 16 + ITEM Assertion OK : Text of Cell is: 16 + ITEM Assertion OK : Text of Cell is: 16 + ITEM Assertion OK : Range has Formula after 'ClearContents: False + ITEM Assertion OK : Text of Cell is: + ITEM Assertion OK : Text of Cell is: +END 'Value-Issue' Symbol + TEST OK : Value-Issue +---------------------------------------------------------------- +AutoFit issue + TEST START : AutoFit issue + ITEM Assertion OK : Columns.AutoFit: CurrentWidth is 680 + ITEM Assertion OK : Rows.AutoFit: CurrentHeight is 554 +END 'AutoFit issue' Symbol + TEST OK : AutoFit issue +---------------------------------------------------------------- +Selections + TEST START : Selections + ITEM Assertion OK : ActiveCell is : $E$8 + ITEM Assertion OK : Active Cell is : $E$8 + ITEM Assertion OK : Number of Cells in Range: 52 + ITEM Assertion OK : Number of Cells in Range: 52 + ITEM Assertion OK : Number of Cells in Range: 52 +END 'Selections' Symbol + TEST OK : Selections +---------------------------------------------------------------- +Offset-Resize + TEST START : Offset-Resize + ITEM Assertion OK : Offset is : $G$10:$I$15,$I$15:$M$21 + ITEM Assertion OK : Offset is : $G$7:$I$12,$I$12:$M$18 + ITEM Assertion OK : Resized Range is : $A$20:$D$23 +END 'Offset-Resize' Symbol + TEST OK : Offset-Resize +---------------------------------------------------------------- +Ranges-Address + TEST START : Ranges-Address + ITEM Assertion OK : Range Address is: $E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Range Address is: $E8:$G13,$G13:$K19 + ITEM Assertion OK : Range Address is: E$8:G$13,G$13:K$19 + ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11 + ITEM Assertion FAIL : Range Address is: R8C5:R13C7,R13C7:R19C11 + ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11 + ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5],R[11]C[5]:R[17]C[9] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13,$G$13:$K$19 +END 'Ranges-Address' Symbol + TEST OK : Ranges-Address +---------------------------------------------------------------- +Range-Address + TEST START : Range-Address + ITEM Assertion OK : Range Address is: $E$8:$G$13 + ITEM Assertion OK : Range Address is: $E8:$G13 + ITEM Assertion OK : Range Address is: E$8:G$13 + ITEM Assertion OK : Range Address is: R8C5:R13C7 + ITEM Assertion FAIL : Range Address is: R8C5:R13C7 + ITEM Assertion OK : Range Address is: R8C5:R13C7 + ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13 +END 'Range-Address' Symbol + TEST OK : Range-Address +---------------------------------------------------------------- +Column-Address + TEST START : Column-Address + ITEM Assertion OK : Range Address is: $F$8:$F$13 + ITEM Assertion OK : Range Address is: $F8:$F13 + ITEM Assertion OK : Range Address is: F$8:F$13 + ITEM Assertion OK : Range Address is: R8C6:R13C6 + ITEM Assertion FAIL : Range Address is: R8C6:R13C6 + ITEM Assertion OK : Range Address is: R8C6:R13C6 + ITEM Assertion OK : Range Address is: R[6]C[4]:R[11]C[4] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$8:$F$13 +END 'Column-Address' Symbol + TEST OK : Column-Address +---------------------------------------------------------------- +Row-Address + TEST START : Row-Address + ITEM Assertion OK : Range Address is: $E$9:$G$9 + ITEM Assertion OK : Range Address is: $E9:$G9 + ITEM Assertion OK : Range Address is: E$9:G$9 + ITEM Assertion OK : Range Address is: R9C5:R9C7 + ITEM Assertion FAIL : Range Address is: R9C5:R9C7 + ITEM Assertion OK : Range Address is: R9C5:R9C7 + ITEM Assertion OK : Range Address is: R[7]C[3]:R[7]C[5] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$9:$G$9 +END 'Row-Address' Symbol + TEST OK : Row-Address +---------------------------------------------------------------- +SingleCell-Address + TEST START : SingleCell-Address + ITEM Assertion OK : Range Address is: $F$9 + ITEM Assertion OK : Range Address is: $F9 + ITEM Assertion OK : Range Address is: F$9 + ITEM Assertion OK : Range Address is: R9C6 + ITEM Assertion FAIL : Range Address is: R9C6 + ITEM Assertion OK : Range Address is: R9C6 + ITEM Assertion OK : Range Address is: R[7]C[4] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$9 +END 'SingleCell-Address' Symbol + TEST OK : SingleCell-Address +---------------------------------------------------------------- +Heights and Widths + TEST START : Heights and Widths + ITEM Assertion OK : Range RowHeight is 40 + ITEM Assertion OK : Range ColumnWidth is 50 + ITEM Assertion OK : Range Height is 240 + ITEM Assertion OK : Range Width is 795 + ITEM Assertion OK : Range RowHeight is 50 + ITEM Assertion OK : Range ColumnWidth is 50 + ITEM Assertion OK : Range Height is 300 + ITEM Assertion OK : Range Width is 795 + ITEM Assertion OK : RowHeight is null: True + ITEM Assertion OK : ColumnWidth is null: True +END 'Heights and Widths' Symbol + TEST OK : Heights and Widths +---------------------------------------------------------------- +RangeRowColumn-Issue + TEST START : RangeRowColumn-Issue + ITEM Assertion OK : Row is: 8 + ITEM Assertion OK : Column is: 5 + ITEM Assertion OK : EntireRow.Columns.Count = 256 + ITEM Assertion OK : EntireColumn.Rows.Count = 131072 +END 'RangeRowColumn-Issue' Symbol + TEST OK : RangeRowColumn-Issue +---------------------------------------------------------------- +Replace-Issue + TEST START : Replace-Issue + ITEM Assertion OK : Value after Replace: YourValue + ITEM Assertion OK : Value after Replace: YourValue + ITEM Assertion OK : Value after Replace: ReplaceValue + ITEM Assertion OK : Value after Replace: New ReplaceValue + ITEM Assertion OK : Value after Replace: New ReplaceValue + ITEM Assertion OK : Value after Replace: New Replace + ITEM Assertion OK : Value after Replace: +END 'Replace-Issue' Symbol + TEST OK : Replace-Issue +---------------------------------------------------------------- +Hidden-Issue + TEST START : Hidden-Issue + ITEM Assertion OK : - Range.Rows.Hidden (set) + ITEM Assertion OK : - Range.Rows.Hidden (get) + ITEM Assertion OK : - Range.Rows.Item(1).Hidden (set) + ITEM Assertion OK : - Range.Rows.Item(1).Hidden (get) + ITEM Assertion OK : - Range.Columns.Hidden (set) + ITEM Assertion OK : - Range.Columns.Hidden (get) + ITEM Assertion OK : - Range.Columns.Item(1).Hidden (set) + ITEM Assertion OK : - Range.Columns.Item(1).Hidden (get) +END 'Hidden-Issue' Symbol + TEST OK : Hidden-Issue +---------------------------------------------------------------- +End issue + TEST START : End issue + ITEM Assertion OK : - = $E$48 + ITEM Assertion OK : - = $E$1 + ITEM Assertion OK : - = $E$3 + ITEM Assertion OK : - = $A$8 + ITEM Assertion OK : - = $B$8 + ITEM Assertion OK : - = $IV$8 + ITEM Assertion OK : - = $Z$8 +END 'End issue' Symbol + TEST OK : End issue +---------------------------------------------------------------- +Outline issue + TEST START : Outline issue + ITEM Assertion OK : - Range.clearOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually +END 'Outline issue' Symbol + TEST OK : Outline issue +---------------------------------------------------------------- +Validation + TEST START : Validation + ITEM Assertion OK : Validation Input Message is : Attention! + ITEM Assertion OK : Validation Input Message is : Enter an integer from five to ten + ITEM Assertion OK : Validation Error Title is : You must enter a number from five to ten + ITEM Assertion OK : Validation Error Message is : An Error occured + ITEM Assertion OK : Validation Error Title is : Microsoft Excel +END 'Validation' Symbol + TEST OK : Validation +Test run finished : 10/03/2008 15:15:13 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Shapes.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Shapes.log new file mode 100644 index 000000000000..3193a0b1094d --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Shapes.log @@ -0,0 +1,77 @@ +Test run started : 10/16/2007 05:25:21 PM +BEGIN Shapes_Collection_Behaviour + TEST START : Shapes_Collection_Behaviour + ITEM Assertion OK : Name of indexed shape should be 'Sheet2Shape1' + ITEM Assertion OK : Name of indexed shape should be 'Sheet2Shape2' + TEST Success. : Shapes_Collection_Behaviour +END Shapes_Collection_Behaviour +BEGIN Shapes_Select_Item + TEST START : Shapes_Select_Item + ITEM Assertion OK : Correctly selected shape through Range + ITEM Assertion OK : Correctly selected shape through Item + ITEM Assertion OK : Needs to be visually checked. Is there a line on the document? + ITEM Assertion OK : Needs to be visually checked. Are All Shapes Selected? + TEST Success. : Shapes_Select_Item +END Shapes_Select_Item +BEGIN Shapes_Fill + TEST START : Shapes_Fill + ITEM Assertion OK : correctly set visibility of shape fill + ITEM Assertion OK : correctly set transparency of shape line + ITEM Assertion OK : correctly set forecolor of shape fill + ITEM Assertion FAIL : correctly set backcolor of shape fill + ITEM Assertion OK : the success of the TwoColorGradient method needs to be verified visually! + ITEM Assertion OK : correctly set forecolor of shape fill + ITEM Assertion FAIL : correctly set forecolor of shape fill + TEST Success. : Shapes_Fill +END Shapes_Fill +BEGIN Shapes_Line + TEST START : Shapes_Line + ITEM Assertion FAIL : correctly set weight of shape line + ITEM Assertion OK : correctly set visibility of shape line + ITEM Assertion OK : correctly set transparency of shape line + ITEM Assertion OK : correctly set dash style of shape line + ITEM Assertion OK : correctly set dash style of shape line + ITEM Assertion OK : correctly set forecolor of shape line + ITEM Assertion FAIL : correctly set backcolor of shape line + TEST Success. : Shapes_Line +END Shapes_Line +BEGIN Shapes_TextFrame + TEST START : Shapes_TextFrame + ITEM Assertion OK : correctly set Autosize of Shape TextFrame + TEST Success. : Shapes_TextFrame +END Shapes_TextFrame +BEGIN Shapes_SimpleGeometry + TEST START : Shapes_SimpleGeometery + ITEM Assertion OK : shape height should be 47.0425168477155 and got 46.9984222363199 + ITEM Assertion OK : shape width should be 101.467710269751 and got 101.423615658355 + ITEM Assertion OK : shape left should be 68.5574761223637 and got 68.5417279658754 + ITEM Assertion OK : shape top should be 42.0251943291216 and got 42.0094461726333 + ITEM Assertion OK : shape rotation should be 0 and got 0 + ITEM Assertion OK : shape rotation should be 25 and got 25 + ITEM Assertion OK : shape incrementrotation should be 50 and got 50 + ITEM Assertion OK : shape incrementleft should be 70.6834602404119 and got 70.6677120839236 + ITEM Assertion OK : shape incrementtop should be 91.262986503119 and got 91.2472383466307 + TEST Success. : Shapes_SimpleGeometery +END Shapes_SimpleGeometry +BEGIN Shapes_Range + TEST START : Shapes_Range + ITEM Assertion OK : expected Sheets(2).Shapes.Range(1) to contain 1 element, it contains 1 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(1) to return Sheet2Shape1 got Sheet2Shape1 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Sheet2Shape3) to contain 1 element, it contains 1 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Sheet2Shape3) to return Sheet2Shape3 got Sheet2Shape3 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array(3, 1) to contain 2 elements, it contains 2 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array(3, 1) to return concated element/shape names Sheet2Shape3Sheet2Shape1 and got Sheet2Shape3Sheet2Shape1 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array('Sheet2Shape3', 1, 'Sheet2Shape2')) to contain 3 elements, it contains 3 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array('Sheet2Shape3', 1, 'Sheet2Shape2')) to return concated element/shape names Sheet2Shape3Sheet2Shape1Sheet2Shape2 and got Sheet2Shape3Sheet2Shape1Sheet2Shape2 + TEST Success. : Shapes_Range +END Shapes_Range +BEGIN Shapes_ShapeRange + TEST START : Shapes_ShapeRange + ITEM Assertion OK : ShapeRange.IncrementLeft shp1.left should be 90.6677120839236 and got 90.6519627935771 + ITEM Assertion OK : ShapeRange.IncrementLeft shp2.left should be 240.02518299054 and got 240.009433700193 + ITEM Assertion OK : ShapeRange.IncrementTop shp1.Top should be 111.247238346631 and got 111.231489056284 + ITEM Assertion OK : ShapeRange.IncrementTop shp2.Top should be 65.0708633026228 and got 65.0551140122763 + ITEM Assertion OK : ShapeRange.IncrementRotation shp1.Rotation should be 70 and got 70 + ITEM Assertion OK : ShapeRange.IncrementRotation shp2.Rotation should be 20 and got 20 +END Shapes_ShapeRange +Test run finished : 10/16/2007 05:25:22 PM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/StrConv-test.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/StrConv-test.log new file mode 100644 index 000000000000..c7a7d8750583 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/StrConv-test.log @@ -0,0 +1,9 @@ +Test run started : 05/29/2008 02:51:03 PM +BEGIN StrConv + TEST START : Test StrConv function + ITEM Assertion OK : Converts the string to uppercase characters:ABC EFG HIJ + ITEM Assertion OK : Converts the string to lowercase characters:abc efg hij + ITEM Assertion OK : Converts the first letter of every word in string to uppercase:Abc Efg Hij + TEST OK : Test StrConv function +END StrConv +Test run finished : 05/29/2008 02:51:03 PM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Template.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Template.log new file mode 100644 index 000000000000..c6376c5b3732 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Template.log @@ -0,0 +1,14 @@ +Test run started : 2008/07/10 11:57:05 +---------------------------------------------------------------- +TestCaseName + TEST START : TestCaseName + ITEM Assertion OK : Something has been done. +Test Results +============ + +Tests passed: 1 +Tests failed: 0 + +END 'TestCaseName + TEST OK : TestCaseName +Test run finished : 2008/07/10 11:57:05 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestAddress.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestAddress.log new file mode 100644 index 000000000000..4fa4bc820f59 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestAddress.log @@ -0,0 +1,67 @@ +Test run started : 12/05/2009 11:23:35 +---------------------------------------------------------------- +TestAddress + TEST START : TestAddress + ITEM Assertion OK : test1 Range('e3:f3') A1 style addressing + ITEM Assertion OK : test2 Range('e3:f3') R1C1 style addressing + ITEM Assertion OK : test3 Range ('e:f') A1 style addressing + ITEM Assertion OK : test4 Range ('e:f') R1C1 style addressing + ITEM Assertion OK : test5 Columns A1 style addressing + ITEM Assertion OK : test6 Columns R1C1 style addressing + ITEM Assertion OK : test7 Columns(3) A1 style addressing + ITEM Assertion OK : test8 Columns(3) R1C1 style addressing + ITEM Assertion OK : test9 Columns('e') A1 style addressing + ITEM Assertion OK : test10 Columns('e') R1C1 style addressing + ITEM Assertion OK : test11 Columns('b:d') A1 style addressing + ITEM Assertion OK : test12 Columns('b:d') R1C1 style addressing + ITEM Assertion OK : test13 Range('c1:g10').Columns A1 style addressing + ITEM Assertion OK : test14 Range('c1:g10').Columns R1C1 style addressing + ITEM Assertion OK : test15 Range('c1:g10').Columns(1) A1 style addressing + ITEM Assertion OK : test16 Range('c1:g10').Columns(1) R1C1 style addressing + ITEM Assertion OK : test17 Range('c1:g10').Columns('a') A1 style addressing + ITEM Assertion OK : test18 Range('c1:g10').Columns('a') R1C1 style addressing + ITEM Assertion OK : test19 Range('c1:g10').Columns('c') A1 style addressing + ITEM Assertion OK : test20 Range('c1:g10').Columns('c') R1C1 style addressing + ITEM Assertion OK : test21 Range('c1:g10').Columns('x:z') A1 style addressing + ITEM Assertion OK : test22 Range('c1:g10').Columns('x:z') R1C1 style addressing + ITEM Assertion OK : test23 Range('c1:g10').Columns(30) A1 style addressing + ITEM Assertion OK : test24 Range('c1:g10').Columns(30) R1C1 style addressing + ITEM Assertion OK : test25 Worksheets('Sheet2').Cells(1, 1) A1 style addressing + ITEM Assertion OK : test26 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, RowAddressAbsolute is false + ITEM Assertion OK : test27 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, ColAddressAbsolute is false + ITEM Assertion OK : test28 Worksheets('Sheet2').Cells(1, 1) R1C1 style addressing + ITEM Assertion OK : test29 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing + ITEM Assertion OK : test30 Worksheets('Sheet2').Range('A1').EntireColumn A1 style addressing + ITEM Assertion OK : test31 Worksheets('Sheet2').Range('A1:E5').EntireRow A1 style addressing + ITEM Assertion OK : test32 Worksheets('Sheet2').Range('A1') A1 style addressing + ITEM Assertion OK : test33 Worksheets('Sheet2').Range('IV65536').EntireRow A1 style addressing + ITEM Assertion OK : test34 Worksheets('Sheet2').Range('IU2:IV65536') A1 style addressing + ITEM Assertion OK : test35 Range('c1:g10').Columns('x:z') R1C1 style addressing + ITEM Assertion OK : test36 Worksheets('Sheet2').Range('A1') A1 style addressing + ITEM Assertion OK : test37 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing + ITEM Assertion OK : test38 Worksheets('Sheet2').Range('10:12') A1 style addressing + ITEM Assertion OK : test39 Worksheets('Sheet2').Range('10:12') R1C1 style addressing + ITEM Assertion OK : test40 Range('Sheet3!A1:B4') A1 style addressing + ITEM Assertion OK : test41 Range('Sheet3!A1,B1,D4:F20') A1 style addressing + ITEM Assertion OK : test42 Range('g20:h40').Columns('c:c') + ITEM Assertion OK : test43 Range('g20:h40').Columns('c:f') + ITEM Assertion OK : test44 Range('g20:h40').Columns(-1) + ITEM Assertion OK : test45 Range('c4:g10').Rows(-1) + ITEM Assertion OK : test46 Range('a2:b4').Rows('1:1') + ITEM Assertion OK : test47 Range('a2:b4').Rows('1:2') + ITEM Assertion OK : test48 Range('a2:b4').Rows('2:2') + ITEM Assertion OK : test49 Range('a2:b4').Rows('2:3') + ITEM Assertion OK : test50 Range(' A2:B4 ') + ITEM Assertion OK : test51 Range('A 2:B 4') + ITEM Assertion OK : test52 Range('A2 : B4 ') + ITEM Assertion OK : test53 Range('Sheet1 !A2 : B4 ') + ITEM Assertion OK : test54 Range('Sheet1! A2 : B4 ') +Test Results +============ + +Tests passed: 54 +Tests failed: 0 + +END 'TestAddress + TEST OK : TestAddress +Test run finished : 12/05/2009 11:23:35 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestCalc_Rangetest.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestCalc_Rangetest.log new file mode 100644 index 000000000000..083819d4b64e --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestCalc_Rangetest.log @@ -0,0 +1,60 @@ +Test run started : 30/05/2007 15:59:40 +BEGIN TestCalc + TEST START : RangeTest2 + ITEM Assertion OK : - Range("D15").Row + ITEM Assertion OK : - WorkSheet("D15").Range.Row + ITEM Assertion OK : - Range("D15").Column + ITEM Assertion OK : - Worksheet.Range("D15").Column + ITEM Assertion OK : - Range("D1").EntireRow.Valuer + ITEM Assertion OK : - Range("D1").EntireRow.Valuer + ITEM Assertion OK : - Range("D1").EntireRow.Columns.Count + ITEM Assertion OK : - Range("D1").EntireColumn.Rows.Count + ITEM Assertion OK : - Range("D15").ClearContent + ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (get) + ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (get) + ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (get) + ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (get) + ITEM Assertion OK : - Range("B38").Orientation (get) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlDownward) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlUpward) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical) + ITEM Assertion OK : - Range("B39").WrapText (get) + ITEM Assertion OK : - Range("B39").WrapText (set) + ITEM Assertion OK : - Range("B39").WrapText (set) + ITEM Assertion OK : - Range("E39").MergeCells (get) + ITEM Assertion OK : - Range("F39").MergeCells (get) + ITEM Assertion OK : - Range("E39").MergeCells (set) + ITEM Assertion FAIL : - Range("F39").MergeCells (set) + ITEM Assertion OK : - Range("E39").MergeCells (set) + ITEM Assertion OK : - Range("F39").MergeCells (set) + ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True + ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True + ITEM Assertion OK : - Range("D41:D42").Replace MatchCase:=False + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (set) + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (set) + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM FAIL (RangeTest2) + TEST Not succesfully completed : RangeTest2 +END TestCalc +Test run finished : 30/05/2007 15:59:42 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestCalc_Rangetest2.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestCalc_Rangetest2.log new file mode 100644 index 000000000000..b1573c06d90e --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestCalc_Rangetest2.log @@ -0,0 +1,65 @@ +Test run started : 10/03/2008 15:15:19 +BEGIN TestCalc + TEST START : RangeTest3 + ITEM Assertion OK : - setFormulaR1C1 + ITEM Assertion OK : - getFormulaR1C1 + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Copy(Range("I10")) + ITEM Assertion OK : PasteSpecial Paste:=xlPasteValues + ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormulas + ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormats + ITEM Assertion OK : PasteSpecial + ITEM Assertion OK : PasteSpecial SkipBlanks:=True + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationAdd + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationSubtract + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationMultiply + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationDivide + ITEM Assertion OK : PasteSpecial Transpose:=True + ITEM Assertion FAIL : ActiveWorkbook.FileFormat + ITEM Assertion OK : ActiveWorkbook.Name + ITEM Assertion OK : ActiveWorkbook.FullName und ActiveWorkbook.Path + ITEM Assertion FAIL : - = ActiveWorkbook.Colors(3) set + ITEM Assertion OK : - = ActiveWorkbook.ResetColors + ITEM Assertion OK : - = ActiveWorkbook.Colors(3) get + ITEM Assertion OK : - = Range("K22").End (xlDown) + ITEM Assertion OK : - = Range("K22").End (xlUo) + ITEM Assertion OK : - = Range("K22").End (xlToLeft) + ITEM Assertion OK : - = Range("K22").End (xlRight) + ITEM Assertion OK : - ActiveSpreadsheet.Next + ITEM Assertion OK : - ActiveSpreadsheet.Next + ITEM Assertion OK : - ActiveSpreadsheet.Previous + ITEM Assertion OK : - ActiveSpreadsheet.Previous + ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="x" + ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="<>" + ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="=" + ITEM Assertion OK : - Range("J4:J11").AutoFilter + ITEM Assertion OK : - ActiveSheet.Resize.Select + ITEM Assertion OK : - Application.GoTo Reference:="R8C2" + ITEM Assertion FAIL : - Application.GoTo Reference:="R[8]C[2]" + ITEM Assertion OK : - Application.GoTo Reference:="R8C2" + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.Ungroup- please check visually + ITEM Assertion OK : - Range.Ungroup - please check visually + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.clearOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually + ITEM Assertion OK : - ActiveSheet.UsedRange.Select + ITEM Assertion OK : - Range("A13").AddIndent + ITEM Assertion OK : - Range("A13").IndentLevel set + ITEM Assertion OK : - Range("A13").IndentLevel get + ITEM Assertion OK : - Range("A13").IndentLevel get + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Calculate + ITEM Assertion OK : Worksheet.Calculate + ITEM Assertion OK : - Application.Calculate + ITEM Assertion OK : Global.Calculate + ITEM Assertion OK : Calculation set + ITEM FAIL (RangeTest3) + TEST Not succesfully completed : RangeTest3 +END TestCalc +Test run finished : 10/03/2008 15:15:21 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestIntersection.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestIntersection.log new file mode 100644 index 000000000000..ea686a830cde --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestIntersection.log @@ -0,0 +1,26 @@ +Test run started : 13/01/2009 14:31:43 +---------------------------------------------------------------- +TestIntersection + TEST START : TestIntersection + ITEM Assertion OK : test1 Application.Intersect( Range('A2:D10'), Range('C4:E6')) + ITEM Assertion OK : test2 Application.Intersect( Range('A2:D10'), Range('A4:G10')) + ITEM Assertion OK : test3 Application.Intersect( Range('A2:c8,d2:f8,g2:i8'), Range('A4:G10')) + ITEM Assertion OK : test4 Application.Intersect( Range('A4:G10'), Range('A2:c8,d2:f8,g2:i8')) + ITEM Assertion OK : test5 Application.Intersect( Range('A2:c8,d2:f8,g2:i8'), Range('g4:i10,A4:G10')) + ITEM Assertion OK : test6 Application.Intersect( Range('g4:i10,A4:G10'), Range('A2:c8,d2:f8,g2:i8')) + ITEM Assertion OK : test7 Application.Intersect( Range('a2:d10,b5:e10'), Range('a5:i10')) + ITEM Assertion OK : test8 Application.Intersect( Range('a2:c8,d2:f8'), Range('b6:e9,a6:f9')) + ITEM Assertion OK : test9 Application.Intersect( Range('a2:c8,e2:f8'), Range('b6:e9,a6:f9')) + ITEM Assertion OK : test10 Application.Intersect( Range('a1:a3,c1:c3'), Range('a2:c3')) + ITEM Assertion OK : test11 Application.Intersect( Range('a1:a3,b1:b3'), Range('a2:c3')) + ITEM Assertion OK : test12 Application.Intersect( Range('a2:d5,b3:f7,c1:g4'), Range('b2:e6')) + ITEM Assertion OK : test13 Range(" a2:d10,b5:e10,g13:j32 "), Range(" a5:i10,b6:e9 "), Range("b2:r5,f10:h19") +Test Results +============ + +Tests passed: 13 +Tests failed: 0 + +END 'TestIntersection + TEST OK : TestIntersection +Test run finished : 13/01/2009 14:31:43 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestUnion.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestUnion.log new file mode 100644 index 000000000000..da3cb35dedb3 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestUnion.log @@ -0,0 +1,17 @@ +Test run started : 13/01/2009 14:32:16 +---------------------------------------------------------------- +TestUnion + TEST START : TestUnion + ITEM Assertion OK : test1Application.Range('A2:D10'), Range('C4:E6') + ITEM Assertion OK : test2Application.Range('A2:D5,a3:d4'), Range('A4:G10') + ITEM Assertion OK : test3Application.Range('A4:G10,A1:B6'), Range('A2:D5,A3:D4') + ITEM Assertion OK : test4Application.Range('A5:D10'), Range('B5:E10') +Test Results +============ + +Tests passed: 4 +Tests failed: 0 + +END 'TestUnion + TEST OK : TestUnion +Test run finished : 13/01/2009 14:32:16 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/VariantTest.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/VariantTest.log new file mode 100644 index 000000000000..a916ac4a37fd --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/VariantTest.log @@ -0,0 +1,47 @@ +Test run started : 24/09/2008 10:58:18 +---------------------------------------------------------------- +TestAddress + TEST START : TestAddress + ITEM Assertion OK : test1: res = (aboo = '') + ITEM Assertion OK : test 2: res = (aboo = 'fiddlesticks') + ITEM Assertion OK : test 3: res = ('' = aboo) + ITEM Assertion OK : test 4: res = ('fiddlesticks' = aboo ) + ITEM Assertion OK : test 5: res = (testString = '') + ITEM Assertion OK : test 6: res = (testString = 'fiddlesticks') + ITEM Assertion OK : test 7: res = ('' = testString) + ITEM Assertion OK : test 8: res = ('fiddlesticks' = testString ) + ITEM Assertion OK : test 9: res = ( aboo < " ) + ITEM Assertion OK : test 10: res = ( testString < " ) + ITEM Assertion OK : test 11: res = ( aboo > " ) + ITEM Assertion OK : test 12: res = ( testString > " ) + ITEM Assertion OK : test 13: res = ( aboo <> '' ) + ITEM Assertion OK : test 14: res = ( testString <> '' ) + ITEM Assertion OK : test 15: res = (aboo = something/14) + ITEM Assertion OK : test 16: res = something + 'string' + ITEM Assertion OK : test 17: res = something & 'string' + ITEM Assertion OK : test 18: res = something MOD 10 ) + ITEM Assertion OK : test 19: res = something AND 1 ) + ITEM Assertion OK : test 20: res = something AND 0 ) + ITEM Assertion OK : test 21: res = something OR 12) + ITEM Assertion OK : test 22: res = something OR 0 ) + ITEM Assertion OK : test 23: res = something XOR 0 ) + ITEM Assertion OK : test 24: res = something XOR 1 ) + ITEM Assertion OK : test 25: res = something EQV 0 ) + ITEM Assertion OK : test 26: res = something EQV 1 ) + ITEM Assertion OK : test 27: res = something IMP 0 ) + ITEM Assertion OK : test 28: res = something IMP 1 ) + ITEM Assertion OK : test 29: res = something IMP 14 ) + ITEM Assertion OK : test 30: res = NOT something ) + ITEM Assertion OK : test 31: res = something + 12 ) + ITEM Assertion OK : test 32: res = something - 12 ) + ITEM Assertion OK : test 33: res = -something ) + ITEM Assertion OK : test 34: res = something * 12 ) +Test Results +============ + +Tests passed: 34 +Tests failed: 0 + +END 'TestAddress + TEST OK : TestAddress +Test run finished : 24/09/2008 10:58:20 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Window.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Window.log new file mode 100644 index 000000000000..ec9a6656113e --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Window.log @@ -0,0 +1,46 @@ +Test run started : 05/29/2008 02:55:00 PM +---------------------------------------------------------------- + TEST START : Window-Issue + ITEM Assertion OK : Window.Left is: 0 (Test only applies to maximized Window) + ITEM Assertion OK : Window.Top is: 21 (Test only applies to maximized Window) + ITEM Assertion OK : Window.Width is: 1280 (Test only applies to maximized Window) + ITEM Assertion OK : Window.Height is: 752 (Test only applies to maximized Window) + ITEM Assertion OK : Window.ScrollColumn is: 100 + ITEM Assertion OK : Window.ScrollColumn is: 1 + ITEM Assertion OK : Window.ScrollRow is: 100 + ITEM Assertion OK : Window.ScrollRow is: 1 + ITEM Assertion OK : Window.LargeScroll(Down): ScrollRow is: 94 (Test may only apply to maximized Window) + ITEM Assertion OK : Window.LargeScroll(Up): ScrollRow is: 1 + ITEM Assertion OK : Window.LargeScroll(ToRight): ScrollColumn is: 58 (Test may only apply to maximized Window) + ITEM Assertion OK : Window.LargeScroll(ToLeft): ScrollColumn is: 1 + ITEM Assertion OK : Window.SmallScroll(ToRight): ScrollColumn is: 4 (Test may only apply to maximized Window) + ITEM Assertion OK : Window.SmallScroll(ToLeft): ScrollColumn is: 1 + ITEM Assertion OK : Window.DisplayWorkBookTabs is: False + ITEM Assertion OK : Window.DisplayWorkBookTabs is: True + ITEM Assertion OK : Window.DisplayVerticalScrollBar is: True + ITEM Assertion OK : Window.DisplayVerticalScrollBar is: False + ITEM Assertion OK : Window.DisplayHorizontalScrollBar is: False + ITEM Assertion OK : Window.DisplayHorizontalScrollBar is: True + ITEM Assertion OK : Window.DisplayHeadings is: False + ITEM Assertion OK : Window.DisplayHeadings is: True + ITEM Assertion OK : Window.DisplayOutline is: False + ITEM Assertion OK : Window.DisplayOutline is: True + ITEM Assertion OK : Window.Visible is: False + ITEM Assertion OK : Window.Visible is: True + ITEM Assertion OK : Window.Caption is: MyCaption + ITEM Assertion OK : Pane.ScrollColumn is: 100 + ITEM Assertion OK : Pane.ScrollColumn is: 1 + ITEM Assertion OK : Pane.ScrollRow is: 100 + ITEM Assertion OK : Pane.ScrollRow is: 1 + ITEM Assertion OK : Pane.LargeScroll(Down): ScrollRow is: 94 (Test may only apply to maximized Window) + ITEM Assertion OK : Pane.LargeScroll(Up): ScrollRow is: 1 + ITEM Assertion OK : Pane.LargeScroll(ToRight): ScrollColumn is: 58 (Test may only apply to maximized Window) + ITEM Assertion OK : Pane.LargeScroll(ToLeft): ScrollColumn is: 1 + ITEM Assertion OK : Pane.SmallScroll(ToRight): ScrollColumn is: 4 (Test may only apply to maximized Window) + ITEM Assertion OK : Pane.SmallScroll(ToLeft): ScrollColumn is: 1 + ITEM Assertion OK : Window Selection: $A$2:$D$5 + ITEM Assertion OK : ActiveSheet name of Window: Sheet1 + ITEM Assertion OK : Window ActiveCell: $A$1 +END 'Window-Issue' Symbol + TEST OK : Window-Issue +Test run finished : 05/29/2008 02:55:01 PM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/bytearraystring.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/bytearraystring.log new file mode 100644 index 000000000000..bd243283d8f1 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/bytearraystring.log @@ -0,0 +1,8 @@ +Test run started : 05/29/2008 02:25:58 PM +BEGIN Bytearray To String + TEST START : Test the conversion between bytearray and string + ITEM Assertion OK : The number of byte is:6 + ITEM Assertion OK : the return string is: abc + TEST OK : Test the conversion between bytearray and string +END Bytearray To String +Test run finished : 05/29/2008 02:25:58 PM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/dateserial.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/dateserial.log new file mode 100644 index 000000000000..4dd5f53160f2 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/dateserial.log @@ -0,0 +1,9 @@ +Test run started : 01/24/2008 01:24:50 PM +BEGIN DateSerial + TEST START : Test DateSerial function + ITEM Assertion OK : the return date is: 06/15/1999 + ITEM Assertion OK : the return date is: 06/15/1999 + ITEM Assertion OK : the return date is: 06/15/1999 + TEST OK : Test DateSerial function +END DateSerial +Test run finished : 01/24/2008 01:24:50 PM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/datevalue.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/datevalue.log new file mode 100644 index 000000000000..830d5e7b6c3e --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/datevalue.log @@ -0,0 +1,8 @@ +Test run started : 01/24/2008 01:24:41 PM +BEGIN DateValue + TEST START : Test DateValue function + ITEM Assertion OK : the return date is: 02/12/1969 + ITEM Assertion OK : the return date is: 01/21/2008 + TEST OK : Test DateValue function +END DateValue +Test run finished : 01/24/2008 01:24:41 PM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/format.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/format.log new file mode 100644 index 000000000000..96725bf7daa8 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/format.log @@ -0,0 +1,36 @@ +Test run started : 2008/09/18 11:35:34 +BEGIN Format + TEST START : Test Predefined_Number_Format_Sample function + ITEM Assertion OK : General Number: 562486.2356 + ITEM Assertion OK : Fixed: 0.20 + ITEM Assertion OK : Standard: 562,486.24 + ITEM Assertion OK : Percent: 75.21% + ITEM Assertion OK : Scientific: 5.62E+05 + ITEM Assertion OK : Scientific: -3.46E+03 + ITEM Assertion OK : Yes/No: No + ITEM Assertion OK : Yes/No: Yes + ITEM Assertion OK : True/False: False + ITEM Assertion OK : True/False: True + ITEM Assertion OK : On/Off: Off + ITEM Assertion OK : On/Off: On + TEST OK : Test Predefined_Number_Format_Sample function + TEST START : Test Custom_Number_Format_Sample function + ITEM Assertion OK : 00.0000: 23.6750 + ITEM Assertion OK : 00.00: 23.68 + ITEM Assertion OK : 00000: 02658 + ITEM Assertion OK : 00.00: 2658.00 + ITEM Assertion OK : ##.####: 23.675 + ITEM Assertion OK : ##.##: 23.68 + ITEM Assertion OK : #,###.##: 12,345.25 + ITEM Assertion OK : ##.00%: 25.00% + ITEM Assertion OK : #,###: 1,000,000 + ITEM Assertion OK : ######E-###: 109838E-5 + ITEM Assertion OK : $#,###.##: $2,345.25 + ITEM Assertion OK : ##.###\%: .25% + TEST OK : Test Custom_Number_Format_Sample function + TEST START : Test Custom_Text_Format_Sample function + ITEM Assertion OK : <: vba + ITEM Assertion OK : >: VBA + TEST OK : Test Custom_Text_Format_Sample function +END Format +Test run finished : 2008/09/18 11:35:34 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/pagesetup.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/pagesetup.log new file mode 100644 index 000000000000..f04585c3f9e1 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/pagesetup.log @@ -0,0 +1,77 @@ +Test run started : 07/21/2008 02:00:06 PM +BEGIN PageSetup + TEST START : Sheet_PrintArea + ITEM Assertion OK : PrintArea has changed as expected + TEST OK : Sheet_PrintArea + TEST START : Test margins (no headers) + ITEM Assertion OK : PageSetup.LeftMargin set/get + ITEM Assertion OK : PageSetup.RightMargin set/get + ITEM Assertion OK : PageSetup.TopMargin set/get + ITEM Assertion OK : PageSetup.BottomMargin set/get +Verify that page margins on sheet 1 are all 0.5inch + TEST OK : Test margins (no headers) + TEST START : Test margins (headers) + ITEM Assertion OK : PageSetup.HeaderMargin set/get + ITEM Assertion OK : PageSetup.FooterMargin set/get + ITEM Assertion OK : PageSetup.LeftMargin set/get + ITEM Assertion OK : PageSetup.LeftMargin set/get +Verify that top/bottom/header/footer page margins on sheet 2 are all 0.5inch + TEST OK : Test margins (headers) + TEST START : Test header/footer text + ITEM Assertion OK : PageSetup.LeftHeader set + ITEM Assertion OK : PageSetup.LeftHeader set/get + ITEM Assertion OK : PageSetup.CenterHeader set + ITEM Assertion OK : PageSetup.CenterHeader set/get + ITEM Assertion OK : PageSetup.RightHeader set + ITEM Assertion OK : PageSetup.RightHeader set/get + ITEM Assertion OK : PageSetup.LeftFooter set + ITEM Assertion OK : PageSetup.LeftFooter set/get + ITEM Assertion OK : PageSetup.CenterFooter set + ITEM Assertion OK : PageSetup.CenterFooter set/get + ITEM Assertion OK : PageSetup.RightFooter set + ITEM Assertion OK : PageSetup.RightFooter set/get +Verify that headers on sheet 2 are Ready,to,go +Verify that footers on sheet 2 are This,now,Works + TEST OK : Test header/footer text + TEST START : Test zoom + ITEM Assertion OK : PageSetup.Zoom set + ITEM Assertion OK : PageSetup.Zoom set/get +Verify that sheet 1 zoom is 10% + TEST OK : Test zoom + TEST START : Test orientation + ITEM Assertion OK : PageSetup.Zoom set + ITEM Assertion OK : PageSetup.Orientation set/get +Verify that sheet 1 orientation is now landscape + TEST OK : Test orientation + TEST START : Test order + ITEM Assertion OK : PageSetup.Order get + ITEM Assertion OK : PageSetup.Order set/get +Verify that order on sheet 1 is now over, then down. + TEST OK : Test order + TEST START : Test first page number + ITEM Assertion OK : PageSetup.FirstPageNumber get + ITEM Assertion OK : PageSetup.FirstPageNumber set/get +Verify that first page number on sheet 1 is now 2. + TEST OK : Test first page number + TEST START : Test center vertically + ITEM Assertion OK : PageSetup.CenterVertically get + ITEM Assertion OK : PageSetup.CenterVertically set/get +Verify that CenterVertically on sheet 1 is now true. + TEST OK : Test center vertically + TEST START : Test center horizontally + ITEM Assertion OK : PageSetup.CenterHorizontally get + ITEM Assertion OK : PageSetup.CenterHorizontally set/get +Verify that CenterHorizontally on sheet 1 is now true. + TEST OK : Test center horizontally + TEST START : Test FitToPagesTall + ITEM Assertion OK : PageSetup.FitToPagesTall set/get + TEST OK : Test FitToPagesTall + TEST START : Test FitToPagesWide + ITEM Assertion OK : PageSetup.FitToPagesWide set/get + TEST OK : Test FitToPagesWide + TEST START : Test PrintHeadings + ITEM Assertion OK : PageSetup.PrintHeadings set/get + ITEM Assertion OK : PageSetup.PrintHeadings set/get + TEST OK : Test PrintHeadings +END PageSetup +Test run finished : 07/21/2008 02:00:07 PM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/partition.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/partition.log new file mode 100644 index 000000000000..7b4f2a01bead --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/partition.log @@ -0,0 +1,11 @@ +Test run started : 12/10/2007 11:26:43 AM +BEGIN Partition + TEST START : Test Partition function + ITEM Assertion OK : the number 20 occurs in the range:20:24 + ITEM Assertion OK : the number 20 occurs in the range: 20: 20 + ITEM Assertion OK : the number 120 occurs in the range:100: + ITEM Assertion OK : the number -5 occurs in the range: : -1 + ITEM Assertion OK : the number 2 occurs in the range: 2: 3 + TEST OK : Test Partition function +END Partition +Test run finished : 12/10/2007 11:26:43 AM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/range-4.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/range-4.log new file mode 100644 index 000000000000..fb37b6ff201b --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/range-4.log @@ -0,0 +1,16 @@ +Test run started : 2008/06/19 17:14:57 +---------------------------------------------------------------- +ShowDetail-Issue + TEST START : ShowDetail-Issue + ITEM Assertion OK : Range.ShowDetail is True + ITEM Assertion OK : Range.ShowDetail is False +END 'ShowDetail-Issue' Symbol + TEST OK : ShowDetail-Issue +---------------------------------------------------------------- +RangeMerged-Issue + TEST START : RangeMerged-Issue + ITEM Assertion OK : Range.RangeMerged is $F$2:$H$5 + ITEM Assertion OK : The first address of Range.RangeMerged is $F$2 +END 'RangeMerged-Issue' Symbol + TEST OK : RangeMerged-Issue +Test run finished : 2008/06/19 17:14:57 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/replace.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/replace.log new file mode 100644 index 000000000000..8f600faaa6b1 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/replace.log @@ -0,0 +1,14 @@ +Test run started : 09/05/2008 10:21:46 AM +BEGIN Replace + TEST START : Test Replace function + ITEM Assertion OK : common string:aefefdBc + ITEM Assertion OK : expression string:aefefdef + ITEM Assertion OK : binanary compare:aefefdBc + ITEM Assertion OK : text compare:aefefdef + ITEM Assertion OK : text compare:aefefdef + ITEM Assertion OK : start = 3:cefdBc + ITEM Assertion OK : count = 2: aefefdBc + ITEM Assertion OK : start = 1, count = 0, not support in Unix: abcbcdBc + TEST OK : Test Replace function +END Replace +Test run finished : 09/05/2008 10:21:47 AM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/stringplusdouble.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/stringplusdouble.log new file mode 100644 index 000000000000..6e8b8d994bd1 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/stringplusdouble.log @@ -0,0 +1,62 @@ +Test run started : 05/29/2008 02:51:22 PM +BEGIN String Plus Double + TEST START : double = string + double +The next compute raises error: s = null, d = null, r = s + d + ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1 + ITEM Assertion OK : s = null, d = null, r = s & d .The result is: 0 +The next compute raises error: s = null, d = 20, r = s + d + ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: -1 + ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20 + ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10 + ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 100 + ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 30 + ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020 +The next compute raises error: s = 'abc', d = null, r = s + d + ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1 +The next compute raises error: s = 'abc', d = null, r = s & d + ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: -1 +The next compute raises error: s = 'abc', d = 20, r = s + d + ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1 +The next compute raises error: s = 'abc', d = 20, r = s & d + ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: -1 + TEST OK : double = string + double + TEST START : string = string + double +The next compute raises error: s = null, d = null, r = s + d + ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1 + ITEM Assertion OK : s = null, d = null, r = s & d .The result is: 0 +The next compute raises error: s = null, d = 20, r = s + d + ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: -1 + ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20 + ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10 + ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 100 + ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 30 + ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020 +The next compute raises error: s = 'abc', d = null, r = s + d + ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1 + ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: abc0 +The next compute raises error: s = 'abc', d = 20, r = s + d + ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1 + ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: abc20 + TEST OK : string = string + double + TEST START : double = string + string +The next compute raises error: s = null, d = null, r = s + d + ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1 +The next compute raises error: s = null, d = null, r = s & d + ITEM Assertion OK : s = null, d = null, r = s & d .The result is: -1 + ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: 20 + ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20 + ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10 + ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 10 + ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 1020 + ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020 +The next compute raises error: s = 'abc', d = null, r = s + d + ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1 +The next compute raises error: s = 'abc', d = null, r = s & d + ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: -1 +The next compute raises error: s = 'abc', d = 20, r = s + d + ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1 +The next compute raises error: s = 'abc', d = 20, r = s & d + ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: -1 + TEST OK : double = string + string +END String Plus Double +Test run finished : 05/29/2008 02:51:22 PM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/window2.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/window2.log new file mode 100644 index 000000000000..8e26d0580621 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/window2.log @@ -0,0 +1,41 @@ +Test run started : 2008/09/22 11:18:57 +BEGIN Window2 + TEST START : Test Window.SplitRow + ITEM Assertion OK : Test SplitColumn: 2 (Test only applies to maximized Window and at least has 800*600 solotion) + ITEM Assertion OK : Test SplitRow: 2 (Test only applies to maximized Window and at least has 800*600 solotion) + ITEM Assertion OK : Test SplitVertical: 242.465788476212 + ITEM Assertion OK : Test SplitHorizontal: 242.465788476212 + ITEM Assertion OK : Test SplitRow: 4 (Test only applies to maximized Window and at least has 800*600 solotion) + ITEM Assertion OK : Test SplitColumn: 3 (Test only applies to maximized Window and at least has 800*600 solotion) + ITEM Assertion OK : Test SplitColumn: 0 + ITEM Assertion OK : Test SplitRow: 0 + TEST OK : Test Window.SplitRow + TEST START : Test Window.DisplayGridlines + ITEM Assertion OK : Test gridlines are on + ITEM Assertion OK : Test gridlines are off + TEST OK : Test Window.DisplayGridlines + TEST START : Test Window.DisplayHeadings + ITEM Assertion OK : Test Headings are on + ITEM Assertion OK : Test Headings are off + TEST OK : Test Window.DisplayHeadings + TEST START : Test Window.Visibility + ITEM Assertion OK : Window is visible + ITEM Assertion OK : Window is not visible + TEST OK : Test Window.Visibility + TEST START : Test Window.FreezePanes + ITEM Assertion OK : Test no panes frozen + ITEM Assertion OK : Test panes frozen at center + ITEM Assertion OK : Test panes frozen at split + TEST OK : Test Window.FreezePanes + TEST START : Test Window.View + TEST OK : Test Window.View + TEST START : Test Window.Zoom + ITEM Assertion OK : Test zoom=100% + ITEM Assertion OK : Test zoom=150% + TEST OK : Test Window.Zoom + TEST START : Test Windows.Count + ITEM Assertion OK : Windows Count: 1 + ITEM Assertion OK : Application.Windows Count: 1 + TEST OK : Test Windows.Count +END Window2 +Test run finished : 2008/09/22 11:18:58 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/AutoFilter.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/AutoFilter.log new file mode 100644 index 000000000000..b8d0b85a8ff9 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/AutoFilter.log @@ -0,0 +1,20 @@ +Test run started : 16/10/2007 17:42:01 +---------------------------------------------------------------- +TestAddress + TEST START : TestAddress + ITEM Assertion OK : test1 'starts with' string criteria + ITEM Assertion OK : test2 'not equal to' string criteria + ITEM Assertion OK : test3 'ends with' string criteria + ITEM Assertion OK : test4 field 'all' + ITEM Assertion OK : test5 numeric '<15' + ITEM Assertion OK : test6 numeric '>=15' + ITEM Assertion OK : test7 numeric '<=12' +Test Results +============ + +Tests passed: 7 +Tests failed: 0 + +END 'TestAddress + TEST OK : TestAddress +Test run finished : 16/10/2007 17:42:02 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/CalcFont.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/CalcFont.log new file mode 100644 index 000000000000..e8695523a0a1 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/CalcFont.log @@ -0,0 +1,17 @@ +Test run started : 15/01/2009 17:00:35 +CalcFont_Format + TEST START : Font_Format + ITEM Assertion OK : correctly set font to Bold + ITEM Assertion OK : correctly set font to Italic + ITEM Assertion OK : correctly read FontStyle + ITEM Assertion OK : correctly set font to Shadow + ITEM Assertion OK : correctly set font color + ITEM Assertion OK : correctly set font color index + ITEM Assertion OK : correctly set font name + ITEM Assertion OK : correctly set font outline + ITEM Assertion OK : correctly set font size + ITEM Assertion OK : correctly set font strikethrough + ITEM Assertion OK : correctly set font underline + TEST Success. : Font_Format +CalcFont_Format +Test run finished : 15/01/2009 17:00:36 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/MiscOperatorTests.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/MiscOperatorTests.log new file mode 100644 index 000000000000..3ccec0a1577d --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/MiscOperatorTests.log @@ -0,0 +1,29 @@ +Test run started : 15/01/2009 17:03:13 +---------------------------------------------------------------- +TestAddress + TEST START : TestAddress + ITEM Assertion OK : test1: res = Not ( A > B ) + ITEM Assertion OK : test2: res = Not ( B > A ) + ITEM Assertion OK : test3: res = Not ( D ) + ITEM Assertion OK : test4: res = Not A + ITEM Assertion OK : test5: res = ( A > D ) + ITEM Assertion OK : test6: res = ( D > A ) + ITEM Assertion OK : test7: res = ( A < D ) + ITEM Assertion OK : test8: res = ( D < A ) + ITEM Assertion OK : test9: res = ( A >= D ) + ITEM Assertion OK : test10: res = ( D >= A ) + ITEM Assertion OK : test11: res = ( A <= D ) + ITEM Assertion OK : test12: res = ( D <= A ) + ITEM Assertion OK : test13: res = ( D = A ) + ITEM Assertion OK : test14: res = ( A = D ) + ITEM Assertion OK : test15: res = ( D <> A ) + ITEM Assertion OK : test16: res = ( A <> D ) +Test Results +============ + +Tests passed: 16 +Tests failed: 0 + +END 'TestAddress + TEST OK : TestAddress +Test run finished : 15/01/2009 17:03:15 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/MiscRangeTests.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/MiscRangeTests.log new file mode 100644 index 000000000000..d190abb5f645 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/MiscRangeTests.log @@ -0,0 +1,45 @@ +Test run started : 17/07/2007 15:08:56 +---------------------------------------------------------------- +MiscRangeTests + TEST START : MiscRangeTests + ITEM Assertion OK : test 1 + ITEM Assertion OK : test 2 + ITEM Assertion OK : test 3 + ITEM Assertion OK : test 4 + ITEM Assertion OK : test 5 + ITEM Assertion OK : test 6 + ITEM Assertion OK : test 7 + ITEM Assertion OK : test 8 + ITEM Assertion OK : test 9 + ITEM Assertion OK : test 10 + ITEM Assertion OK : test 11 + ITEM Assertion OK : test 12 + ITEM Assertion OK : test 13 + ITEM Assertion OK : test 14 + ITEM Assertion OK : test 15 + ITEM Assertion OK : test 16 + ITEM Assertion OK : test 17 + ITEM Assertion OK : test 18 + ITEM Assertion OK : test 19 + ITEM Assertion OK : test 20 + ITEM Assertion OK : test 21 + ITEM Assertion OK : test 22 + ITEM Assertion OK : test 23 + ITEM Assertion OK : test 24 + ITEM Assertion OK : test 25 + ITEM Assertion OK : test 26 + ITEM Assertion OK : test 27 + ITEM Assertion OK : test 28 + ITEM Assertion OK : test 29 + ITEM Assertion OK : test 30 + ITEM Assertion OK : test 31 +No. tests: 31 +Summary +======= +Run: 31 +Passed: 31 +Failed: 0 + +END 'MiscRangeTests + TEST OK : MiscRangeTests +Test run finished : 17/07/2007 15:08:59 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/PageBreaks.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/PageBreaks.log new file mode 100644 index 000000000000..30b6e45d1681 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/PageBreaks.log @@ -0,0 +1,10 @@ +Test run started : 08/10/2008 12:02:12 +---------------------------------------------------------------- + TEST START : PageBreaks-Issue + ITEM Assertion OK : HPageBreaks.Count is 3 + ITEM Assertion OK : HPageBreak.Type is -4135 + ITEM Assertion OK : HPageBreak.Location: Range.Row is 5 + ITEM Assertion OK : HPageBreak.Delete: HPageBreaks.Count is 2 +END 'PageBreaks-Issue' Symbol + TEST OK : PageBreaks-Issue +Test run finished : 08/10/2008 12:02:12 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges-2.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges-2.log new file mode 100644 index 000000000000..b80d996e3d3f --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges-2.log @@ -0,0 +1,68 @@ +Test run started : 10/07/2007 01:55:47 +---------------------------------------------------------------- +ClearFormtsIssue + TEST START : ClearFormtsIssue + ITEM Assertion OK : Range.Font.Bold is: True + ITEM Assertion OK : Range.Font.Bold is: False +END 'ClearFormtsIssue' Symbol + TEST OK : ClearFormtsIssue +---------------------------------------------------------------- +VerticalAlignment-Issue + TEST START : VerticalAlignment-Issue + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (set) + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (set) + ITEM Assertion OK : - Range.VerticalAlignment (get) + ITEM Assertion OK : - Range.VerticalAlignment (set) + ITEM Assertion OK : Range.VeritcalAlignment is Null +END 'VerticalAlignment-Issue' Symbol + TEST OK : VerticalAlignment-Issue +---------------------------------------------------------------- +HorizontalAlignment-Issue + TEST START : HorizontalAlignment-Issue + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : - Range.HorizontalAlignment (get) + ITEM Assertion OK : - Range.HorizontalAlignment (set) + ITEM Assertion OK : Range.HorizontalAlignment is Null +END 'HorizontalAlignment-Issue' Symbol + TEST OK : HorizontalAlignment-Issue +---------------------------------------------------------------- +WrapText-Issue + TEST START : WrapText-Issue + ITEM Assertion OK : - Range.WrapText (get) + ITEM Assertion OK : - Range.WrapText (get) + ITEM Assertion OK : Range.WrapText is Null +END 'WrapText-Issue' Symbol + TEST OK : WrapText-Issue +---------------------------------------------------------------- +FontBorderIssues + TEST START : FontBorderIssues + ITEM Assertion OK : - = Borders.Color (getColor) + ITEM Assertion OK : - = Font.Color (getColor) +END 'FontBorderIssues' Symbol + TEST OK : FontBorderIssues +---------------------------------------------------------------- +RangeSizeIssues + TEST START : RangeSizeIssues + ITEM Assertion OK : Range.Left is: 100.5291 + ITEM Assertion OK : Range.Top is: 95.39775 + ITEM Assertion OK : Range.Width is: 191.25 + ITEM Assertion OK : Range.Height is: 271.5 +END 'RangeSizeIssues' Symbol + TEST OK : RangeSizeIssues +---------------------------------------------------------------- +ApplicationIssues + TEST START : ApplicationIssues + ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Application.ActiveSheet.Name: Sheet1 +END 'ApplicationIssues' Symbol + TEST OK : ApplicationIssues +Test run finished : 10/07/2007 01:55:48 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges-3.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges-3.log new file mode 100644 index 000000000000..365d126a7e2d --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges-3.log @@ -0,0 +1,8 @@ +Test run started : 10/07/2007 01:55:51 +---------------------------------------------------------------- +MyGoalseek-Issue + TEST START : MyGoalseek-Issue + ITEM Assertion OK : Variable Range value: 15 +END 'MyGoalseek-Issue' Symbol + TEST OK : MyGoalseek-Issue +Test run finished : 10/07/2007 01:55:51 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges.log new file mode 100644 index 000000000000..6491fe4173ec --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges.log @@ -0,0 +1,280 @@ +Test run started : 08/10/2008 11:30:21 +---------------------------------------------------------------- +ApplicationMethods + TEST START : ApplicationMethods + ITEM Assertion OK : Name of Workbook is: Ranges.xls + ITEM Assertion OK : Address of Application.Columns is: $A:$A + ITEM Assertion OK : Address of Application.Rows is: $1:$1 + ITEM Assertion OK : Address of Application.Range is: $1:$1,$5:$7 + ITEM Assertion OK : Please check manually: DefaultFilePath is: C:\Documents and Settings\vituosity\My Documents + ITEM Assertion OK : Please check manually: Library Path is: C:\Documents and Settings\vituosity\Application Data\OpenOffice.org\3\user\basic + ITEM Assertion OK : Please check manually: Template Path is: C:\Documents and Settings\vituosity\Application Data\OpenOffice.org\3\user\template + ITEM Assertion OK : FileSeparator is \ + ITEM Assertion OK : Name of ActiveWorkbook is: Ranges.xls +END 'ApplicationMethods' Symbol + TEST OK : ApplicationMethods +---------------------------------------------------------------- +Insert-Issue + TEST START : Insert-Issue + ITEM Assertion OK : Insert with xlShiftToRight: 10 +END 'Insert-Issue' Symbol + TEST OK : Insert-Issue +---------------------------------------------------------------- +MergeCells-Issue + TEST START : MergeCells-Issue + ITEM Assertion OK : Range.MergeCells is True + ITEM Assertion FAIL : MergeCells is null: False + ITEM Assertion OK : RowCount after Merge: 13 + ITEM Assertion OK : Range.MergeCells is False + ITEM Assertion OK : MergeCells is null: False + ITEM Assertion FAIL : MergeCells of Second Area is null : False + ITEM Assertion FAIL : MergeCells of Ranges is Null: False + ITEM Assertion OK : RowCount after Merge: 7 + ITEM Assertion OK : Range.MergeCells is False + ITEM Assertion OK : MergeCells is null: False + ITEM Assertion OK : RowCount after Merge: 7 +END 'MergeCells-Issue' Symbol + TEST OK : MergeCells-Issue +---------------------------------------------------------------- +Areas-Issue + TEST START : Areas-Issue + ITEM Assertion OK : Range Areas Count is2 + ITEM Assertion OK : First Range Address is: $E$8:$G$13 + ITEM Assertion OK : First Row is: 8 + ITEM Assertion OK : First Column is: 5 + ITEM Assertion OK : EntireRow Address is: $8:$13,$13:$19 + ITEM Assertion OK : EntireColumn Address is: $E:$G,$G:$K + ITEM Assertion OK : Range Count:53 +END 'Areas-Issue' Symbol + TEST OK : Areas-Issue +---------------------------------------------------------------- +Fill-Methods-Issue + TEST START : Fill-Methods-Issue + ITEM Assertion OK : Range Value after FillDown: MyFillValue + ITEM Assertion OK : Range Value after FillDown: MyFillValue + ITEM Assertion OK : Range Value after FillDown: MyRightFillValue + ITEM Assertion OK : Range Value after FillDown: MyBottomFillValue +END 'Fill-Methods-Issue' Symbol + TEST OK : Fill-Methods-Issue +---------------------------------------------------------------- +Range/Item-Method-Issue + TEST START : Range/Item-Method-Issue + ITEM Assertion OK : Range of multiple columns is: $A:$A,$C:$C + ITEM Assertion OK : Range of multiple rows is: $1:$1,$5:$7 + ITEM Assertion OK : Range of several columns is: $C:$E,$D:$D + ITEM Assertion OK : Range of several rows is: $5:$8,$6:$10 + ITEM Assertion OK : Range of several single cells is: $C$5,$E$8 + ITEM Assertion OK : Range of several named ranges is: $L$1:$M$6,$E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Range of a single Item Cell is: $E$21 + ITEM Assertion OK : Range of a single Item Cell is: $F$21 + ITEM Assertion OK : Range of a single Item Cell is: $F$10 +END 'Range/Item-Method-Issue' Symbol + TEST OK : Range/Item-Method-Issue +---------------------------------------------------------------- +R1C1-Formulas-Issue + TEST START : R1C1-Formulas-Issue + ITEM Assertion OK : R1C1 Range.Formula is: =IF(OR(R[-2]C[1]=0,RC[2]="YES"),"") + ITEM Assertion OK : Range.Formula is: =IF(OR(J8=0,K10="YES"),"") +END 'R1C1-Formulas-Issue' Symbol + TEST OK : R1C1-Formulas-Issue +---------------------------------------------------------------- +Verify_Delete + TEST START : Verify_Delete + ITEM Assertion OK : Ranges are intersecting: $G$13 + ITEM Assertion OK : Delete with Default: $AJ$4 + ITEM Assertion OK : Delete with ShifttoLeft: $AJ$4 + ITEM Assertion OK : Delete with ShiftUp: $M$22 +END 'Verify_Delete' Symbol + TEST OK : Verify_Delete +---------------------------------------------------------------- +Value-Issue + TEST START : Value-Issue + ITEM Assertion OK : Value of Range is: 12.3 + ITEM Assertion OK : Text of Range is: 12.3 + ITEM Assertion OK : Range has Formula: False + ITEM Assertion OK : Cell has Formula: False + ITEM Assertion FAIL : Text of Range is null: False + ITEM Assertion OK : Range has Formula: True + ITEM Assertion OK : Cell has Formula: True + ITEM Assertion OK : Value of Cell is: 12 + ITEM Assertion OK : Application.Calculation is : -4135 + ITEM Assertion OK : Calculation is automated: True + ITEM Assertion OK : Range has Formula: True + ITEM Assertion OK : Value of Cell is: 16 + ITEM Assertion OK : Text of Cell is: 16 + ITEM Assertion OK : Text of Cell is: 16 + ITEM Assertion OK : Range has Formula after 'ClearContents: False + ITEM Assertion OK : Text of Cell is: + ITEM Assertion OK : Text of Cell is: +END 'Value-Issue' Symbol + TEST OK : Value-Issue +---------------------------------------------------------------- +AutoFit issue + TEST START : AutoFit issue + ITEM Assertion OK : Columns.AutoFit: CurrentWidth is 680 + ITEM Assertion OK : Rows.AutoFit: CurrentHeight is 582 +END 'AutoFit issue' Symbol + TEST OK : AutoFit issue +---------------------------------------------------------------- +Selections + TEST START : Selections + ITEM Assertion OK : ActiveCell is : $E$8 + ITEM Assertion OK : Active Cell is : $E$8 + ITEM Assertion OK : Number of Cells in Range: 52 + ITEM Assertion OK : Number of Cells in Range: 52 + ITEM Assertion OK : Number of Cells in Range: 52 +END 'Selections' Symbol + TEST OK : Selections +---------------------------------------------------------------- +Offset-Resize + TEST START : Offset-Resize + ITEM Assertion OK : Offset is : $G$10:$I$15,$I$15:$M$21 + ITEM Assertion OK : Offset is : $G$7:$I$12,$I$12:$M$18 + ITEM Assertion OK : Resized Range is : $A$20:$D$23 +END 'Offset-Resize' Symbol + TEST OK : Offset-Resize +---------------------------------------------------------------- +Ranges-Address + TEST START : Ranges-Address + ITEM Assertion OK : Range Address is: $E$8:$G$13,$G$13:$K$19 + ITEM Assertion OK : Range Address is: $E8:$G13,$G13:$K19 + ITEM Assertion OK : Range Address is: E$8:G$13,G$13:K$19 + ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11 + ITEM Assertion FAIL : Range Address is: R8C5:R13C7,R13C7:R19C11 + ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11 + ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5],R[11]C[5]:R[17]C[9] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13,$G$13:$K$19 +END 'Ranges-Address' Symbol + TEST OK : Ranges-Address +---------------------------------------------------------------- +Range-Address + TEST START : Range-Address + ITEM Assertion OK : Range Address is: $E$8:$G$13 + ITEM Assertion OK : Range Address is: $E8:$G13 + ITEM Assertion OK : Range Address is: E$8:G$13 + ITEM Assertion OK : Range Address is: R8C5:R13C7 + ITEM Assertion FAIL : Range Address is: R8C5:R13C7 + ITEM Assertion OK : Range Address is: R8C5:R13C7 + ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13 +END 'Range-Address' Symbol + TEST OK : Range-Address +---------------------------------------------------------------- +Column-Address + TEST START : Column-Address + ITEM Assertion OK : Range Address is: $F$8:$F$13 + ITEM Assertion OK : Range Address is: $F8:$F13 + ITEM Assertion OK : Range Address is: F$8:F$13 + ITEM Assertion OK : Range Address is: R8C6:R13C6 + ITEM Assertion FAIL : Range Address is: R8C6:R13C6 + ITEM Assertion OK : Range Address is: R8C6:R13C6 + ITEM Assertion OK : Range Address is: R[6]C[4]:R[11]C[4] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$8:$F$13 +END 'Column-Address' Symbol + TEST OK : Column-Address +---------------------------------------------------------------- +Row-Address + TEST START : Row-Address + ITEM Assertion OK : Range Address is: $E$9:$G$9 + ITEM Assertion OK : Range Address is: $E9:$G9 + ITEM Assertion OK : Range Address is: E$9:G$9 + ITEM Assertion OK : Range Address is: R9C5:R9C7 + ITEM Assertion FAIL : Range Address is: R9C5:R9C7 + ITEM Assertion OK : Range Address is: R9C5:R9C7 + ITEM Assertion OK : Range Address is: R[7]C[3]:R[7]C[5] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$9:$G$9 +END 'Row-Address' Symbol + TEST OK : Row-Address +---------------------------------------------------------------- +SingleCell-Address + TEST START : SingleCell-Address + ITEM Assertion OK : Range Address is: $F$9 + ITEM Assertion OK : Range Address is: $F9 + ITEM Assertion OK : Range Address is: F$9 + ITEM Assertion OK : Range Address is: R9C6 + ITEM Assertion FAIL : Range Address is: R9C6 + ITEM Assertion OK : Range Address is: R9C6 + ITEM Assertion OK : Range Address is: R[7]C[4] + ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$9 +END 'SingleCell-Address' Symbol + TEST OK : SingleCell-Address +---------------------------------------------------------------- +Heights and Widths + TEST START : Heights and Widths + ITEM Assertion OK : Range RowHeight is 40 + ITEM Assertion OK : Range ColumnWidth is 50 + ITEM Assertion OK : Range Height is 240 + ITEM Assertion FAIL : Range Width is 675 + ITEM Assertion OK : Range RowHeight is 50 + ITEM Assertion OK : Range ColumnWidth is 50 + ITEM Assertion OK : Range Height is 300 + ITEM Assertion FAIL : Range Width is 675 + ITEM Assertion OK : RowHeight is null: True + ITEM Assertion OK : ColumnWidth is null: True +END 'Heights and Widths' Symbol + TEST OK : Heights and Widths +---------------------------------------------------------------- +RangeRowColumn-Issue + TEST START : RangeRowColumn-Issue + ITEM Assertion OK : Row is: 8 + ITEM Assertion OK : Column is: 5 + ITEM Assertion OK : EntireRow.Columns.Count = 1024 + ITEM Assertion OK : EntireColumn.Rows.Count = 131072 +END 'RangeRowColumn-Issue' Symbol + TEST OK : RangeRowColumn-Issue +---------------------------------------------------------------- +Replace-Issue + TEST START : Replace-Issue + ITEM Assertion OK : Value after Replace: YourValue + ITEM Assertion OK : Value after Replace: YourValue + ITEM Assertion OK : Value after Replace: ReplaceValue + ITEM Assertion OK : Value after Replace: New ReplaceValue + ITEM Assertion OK : Value after Replace: New ReplaceValue + ITEM Assertion OK : Value after Replace: New Replace + ITEM Assertion OK : Value after Replace: +END 'Replace-Issue' Symbol + TEST OK : Replace-Issue +---------------------------------------------------------------- +Hidden-Issue + TEST START : Hidden-Issue + ITEM Assertion OK : - Range.Rows.Hidden (set) + ITEM Assertion OK : - Range.Rows.Hidden (get) + ITEM Assertion OK : - Range.Rows.Item(1).Hidden (set) + ITEM Assertion OK : - Range.Rows.Item(1).Hidden (get) + ITEM Assertion OK : - Range.Columns.Hidden (set) + ITEM Assertion OK : - Range.Columns.Hidden (get) + ITEM Assertion OK : - Range.Columns.Item(1).Hidden (set) + ITEM Assertion OK : - Range.Columns.Item(1).Hidden (get) +END 'Hidden-Issue' Symbol + TEST OK : Hidden-Issue +---------------------------------------------------------------- +End issue + TEST START : End issue + ITEM Assertion OK : - = $E$48 + ITEM Assertion OK : - = $E$1 + ITEM Assertion OK : - = $E$3 + ITEM Assertion OK : - = $A$8 + ITEM Assertion OK : - = $B$8 + ITEM Assertion OK : - = $AMJ$8 + ITEM Assertion OK : - = $Z$8 +END 'End issue' Symbol + TEST OK : End issue +---------------------------------------------------------------- +Outline issue + TEST START : Outline issue + ITEM Assertion OK : - Range.clearOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually +END 'Outline issue' Symbol + TEST OK : Outline issue +---------------------------------------------------------------- +Validation + TEST START : Validation + ITEM Assertion OK : Validation Input Message is : Attention! + ITEM Assertion OK : Validation Input Message is : Enter an integer from five to ten + ITEM Assertion OK : Validation Error Title is : You must enter a number from five to ten + ITEM Assertion OK : Validation Error Message is : An Error occured + ITEM Assertion OK : Validation Error Title is : Microsoft Excel +END 'Validation' Symbol + TEST OK : Validation +Test run finished : 08/10/2008 11:30:24 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Shapes.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Shapes.log new file mode 100644 index 000000000000..fe62ab03d3f2 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Shapes.log @@ -0,0 +1,77 @@ +Test run started : 16/10/2007 17:46:03 +BEGIN Shapes_Collection_Behaviour + TEST START : Shapes_Collection_Behaviour + ITEM Assertion OK : Name of indexed shape should be 'Sheet2Shape1' + ITEM Assertion OK : Name of indexed shape should be 'Sheet2Shape2' + TEST Success. : Shapes_Collection_Behaviour +END Shapes_Collection_Behaviour +BEGIN Shapes_Select_Item + TEST START : Shapes_Select_Item + ITEM Assertion OK : Correctly selected shape through Range + ITEM Assertion OK : Correctly selected shape through Item + ITEM Assertion OK : Needs to be visually checked. Is there a line on the document? + ITEM Assertion OK : Needs to be visually checked. Are All Shapes Selected? + TEST Success. : Shapes_Select_Item +END Shapes_Select_Item +BEGIN Shapes_Fill + TEST START : Shapes_Fill + ITEM Assertion OK : correctly set visibility of shape fill + ITEM Assertion OK : correctly set transparency of shape line + ITEM Assertion OK : correctly set forecolor of shape fill + ITEM Assertion FAIL : correctly set backcolor of shape fill + ITEM Assertion OK : the success of the TwoColorGradient method needs to be verified visually! + ITEM Assertion OK : correctly set forecolor of shape fill + ITEM Assertion FAIL : correctly set forecolor of shape fill + TEST Success. : Shapes_Fill +END Shapes_Fill +BEGIN Shapes_Line + TEST START : Shapes_Line + ITEM Assertion FAIL : correctly set weight of shape line + ITEM Assertion OK : correctly set visibility of shape line + ITEM Assertion OK : correctly set transparency of shape line + ITEM Assertion OK : correctly set dash style of shape line + ITEM Assertion OK : correctly set dash style of shape line + ITEM Assertion OK : correctly set forecolor of shape line + ITEM Assertion FAIL : correctly set backcolor of shape line + TEST Success. : Shapes_Line +END Shapes_Line +BEGIN Shapes_TextFrame + TEST START : Shapes_TextFrame + ITEM Assertion OK : correctly set Autosize of Shape TextFrame + TEST Success. : Shapes_TextFrame +END Shapes_TextFrame +BEGIN Shapes_SimpleGeometry + TEST START : Shapes_SimpleGeometery + ITEM Assertion OK : shape height should be 49.4519655148368 and got 49.4078709034412 + ITEM Assertion OK : shape width should be 101.467710269751 and got 101.423615658355 + ITEM Assertion OK : shape left should be 68.5574761223637 and got 68.5417279658754 + ITEM Assertion OK : shape top should be 44.1511784471699 and got 44.1354302906816 + ITEM Assertion OK : shape rotation should be 0 and got 0 + ITEM Assertion OK : shape rotation should be 25 and got 25 + ITEM Assertion OK : shape incrementrotation should be 50 and got 50 + ITEM Assertion OK : shape incrementleft should be 69.7480272284707 and got 69.7322790719824 + ITEM Assertion OK : shape incrementtop should be 93.8141674447769 and got 93.7984192882885 + TEST Success. : Shapes_SimpleGeometery +END Shapes_SimpleGeometry +BEGIN Shapes_Range + TEST START : Shapes_Range + ITEM Assertion OK : expected Sheets(2).Shapes.Range(1) to contain 1 element, it contains 1 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(1) to return Sheet2Shape1 got Sheet2Shape1 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Sheet2Shape3) to contain 1 element, it contains 1 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Sheet2Shape3) to return Sheet2Shape3 got Sheet2Shape3 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array(3, 1) to contain 2 elements, it contains 2 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array(3, 1) to return concated element/shape names Sheet2Shape3Sheet2Shape1 and got Sheet2Shape3Sheet2Shape1 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array('Sheet2Shape3', 1, 'Sheet2Shape2')) to contain 3 elements, it contains 3 + ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array('Sheet2Shape3', 1, 'Sheet2Shape2')) to return concated element/shape names Sheet2Shape3Sheet2Shape1Sheet2Shape2 and got Sheet2Shape3Sheet2Shape1Sheet2Shape2 + TEST Success. : Shapes_Range +END Shapes_Range +BEGIN Shapes_ShapeRange + TEST START : Shapes_ShapeRange + ITEM Assertion OK : ShapeRange.IncrementLeft shp1.left should be 89.7322790719824 and got 89.7165297816359 + ITEM Assertion OK : ShapeRange.IncrementLeft shp2.left should be 240.02518299054 and got 240.009433700193 + ITEM Assertion OK : ShapeRange.IncrementTop shp1.Top should be 113.798419288289 and got 113.782669997942 + ITEM Assertion OK : ShapeRange.IncrementTop shp2.Top should be 67.4519655148368 and got 67.4362162244903 + ITEM Assertion OK : ShapeRange.IncrementRotation shp1.Rotation should be 70 and got 70 + ITEM Assertion OK : ShapeRange.IncrementRotation shp2.Rotation should be 20 and got 20 +END Shapes_ShapeRange +Test run finished : 16/10/2007 17:46:04 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/StrConv-test.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/StrConv-test.log new file mode 100644 index 000000000000..b1f7794234f9 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/StrConv-test.log @@ -0,0 +1,9 @@ +Test run started : 08/10/2008 12:04:16 +BEGIN StrConv + TEST START : Test StrConv function + ITEM Assertion OK : Converts the string to uppercase characters:ABC EFG HIJ + ITEM Assertion OK : Converts the string to lowercase characters:abc efg hij + ITEM Assertion OK : Converts the first letter of every word in string to uppercase:Abc Efg Hij + TEST OK : Test StrConv function +END StrConv +Test run finished : 08/10/2008 12:04:16 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Template.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Template.log new file mode 100644 index 000000000000..774994adb02c --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Template.log @@ -0,0 +1,14 @@ +Test run started : 08/10/2008 12:05:52 +---------------------------------------------------------------- +TestCaseName + TEST START : TestCaseName + ITEM Assertion OK : Something has been done. +Test Results +============ + +Tests passed: 1 +Tests failed: 0 + +END 'TestCaseName + TEST OK : TestCaseName +Test run finished : 08/10/2008 12:05:52 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestAddress.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestAddress.log new file mode 100644 index 000000000000..0007e6f9c958 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestAddress.log @@ -0,0 +1,67 @@ +Test run started : 08/10/2008 11:30:32 +---------------------------------------------------------------- +TestAddress + TEST START : TestAddress + ITEM Assertion OK : test1 Range('e3:f3') A1 style addressing + ITEM Assertion OK : test2 Range('e3:f3') R1C1 style addressing + ITEM Assertion OK : test3 Range ('e:f') A1 style addressing + ITEM Assertion OK : test4 Range ('e:f') R1C1 style addressing + ITEM Assertion OK : test5 Columns A1 style addressing + ITEM Assertion OK : test6 Columns R1C1 style addressing + ITEM Assertion OK : test7 Columns(3) A1 style addressing + ITEM Assertion OK : test8 Columns(3) R1C1 style addressing + ITEM Assertion OK : test9 Columns('e') A1 style addressing + ITEM Assertion OK : test10 Columns('e') R1C1 style addressing + ITEM Assertion OK : test11 Columns('b:d') A1 style addressing + ITEM Assertion OK : test12 Columns('b:d') R1C1 style addressing + ITEM Assertion OK : test13 Range('c1:g10').Columns A1 style addressing + ITEM Assertion OK : test14 Range('c1:g10').Columns R1C1 style addressing + ITEM Assertion OK : test15 Range('c1:g10').Columns(1) A1 style addressing + ITEM Assertion OK : test16 Range('c1:g10').Columns(1) R1C1 style addressing + ITEM Assertion OK : test17 Range('c1:g10').Columns('a') A1 style addressing + ITEM Assertion OK : test18 Range('c1:g10').Columns('a') R1C1 style addressing + ITEM Assertion OK : test19 Range('c1:g10').Columns('c') A1 style addressing + ITEM Assertion OK : test20 Range('c1:g10').Columns('c') R1C1 style addressing + ITEM Assertion OK : test21 Range('c1:g10').Columns('x:z') A1 style addressing + ITEM Assertion OK : test22 Range('c1:g10').Columns('x:z') R1C1 style addressing + ITEM Assertion OK : test23 Range('c1:g10').Columns(30) A1 style addressing + ITEM Assertion OK : test24 Range('c1:g10').Columns(30) R1C1 style addressing + ITEM Assertion OK : test25 Worksheets('Sheet2').Cells(1, 1) A1 style addressing + ITEM Assertion OK : test26 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, RowAddressAbsolute is false + ITEM Assertion OK : test27 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, ColAddressAbsolute is false + ITEM Assertion OK : test28 Worksheets('Sheet2').Cells(1, 1) R1C1 style addressing + ITEM Assertion OK : test29 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing + ITEM Assertion OK : test30 Worksheets('Sheet2').Range('A1').EntireColumn A1 style addressing + ITEM Assertion OK : test31 Worksheets('Sheet2').Range('A1:E5').EntireRow A1 style addressing + ITEM Assertion OK : test32 Worksheets('Sheet2').Range('A1') A1 style addressing + ITEM Assertion OK : test33 Worksheets('Sheet2').Range('IV65536').EntireRow A1 style addressing + ITEM Assertion OK : test34 Worksheets('Sheet2').Range('IU2:IV65536') A1 style addressing + ITEM Assertion OK : test35 Range('c1:g10').Columns('x:z') R1C1 style addressing + ITEM Assertion OK : test36 Worksheets('Sheet2').Range('A1') A1 style addressing + ITEM Assertion OK : test37 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing + ITEM Assertion OK : test38 Worksheets('Sheet2').Range('10:12') A1 style addressing + ITEM Assertion OK : test39 Worksheets('Sheet2').Range('10:12') R1C1 style addressing + ITEM Assertion OK : test40 Range('Sheet3!A1:B4') A1 style addressing + ITEM Assertion OK : test41 Range('Sheet3!A1,B1,D4:F20') A1 style addressing + ITEM Assertion OK : test42 Range('g20:h40').Columns('c:c') + ITEM Assertion OK : test43 Range('g20:h40').Columns('c:f') + ITEM Assertion OK : test44 Range('g20:h40').Columns(-1) + ITEM Assertion OK : test45 Range('c4:g10').Rows(-1) + ITEM Assertion OK : test46 Range('a2:b4').Rows('1:1') + ITEM Assertion OK : test47 Range('a2:b4').Rows('1:2') + ITEM Assertion OK : test48 Range('a2:b4').Rows('2:2') + ITEM Assertion OK : test49 Range('a2:b4').Rows('2:3') + ITEM Assertion OK : test50 Range(' A2:B4 ') + ITEM Assertion OK : test51 Range('A 2:B 4') + ITEM Assertion OK : test52 Range('A2 : B4 ') + ITEM Assertion OK : test53 Range('Sheet1 !A2 : B4 ') + ITEM Assertion OK : test54 Range('Sheet1! A2 : B4 ') +Test Results +============ + +Tests passed: 54 +Tests failed: 0 + +END 'TestAddress + TEST OK : TestAddress +Test run finished : 08/10/2008 11:30:32 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestCalc_Rangetest.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestCalc_Rangetest.log new file mode 100644 index 000000000000..492c24bc023c --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestCalc_Rangetest.log @@ -0,0 +1,60 @@ +Test run started : 10/07/2007 01:56:07 +BEGIN TestCalc + TEST START : RangeTest2 + ITEM Assertion OK : - Range("D15").Row + ITEM Assertion OK : - WorkSheet("D15").Range.Row + ITEM Assertion OK : - Range("D15").Column + ITEM Assertion OK : - Worksheet.Range("D15").Column + ITEM Assertion OK : - Range("D1").EntireRow.Valuer + ITEM Assertion OK : - Range("D1").EntireRow.Valuer + ITEM Assertion OK : - Range("D1").EntireRow.Columns.Count + ITEM Assertion OK : - Range("D1").EntireColumn.Rows.Count + ITEM Assertion OK : - Range("D15").ClearContent + ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (get) + ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (get) + ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (get) + ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (set) + ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (get) + ITEM Assertion OK : - Range("B38").Orientation (get) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlDownward) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlUpward) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical) + ITEM Assertion OK : - Range("B38").Orientation (set) + ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical) + ITEM Assertion OK : - Range("B39").WrapText (get) + ITEM Assertion OK : - Range("B39").WrapText (set) + ITEM Assertion OK : - Range("B39").WrapText (set) + ITEM Assertion OK : - Range("E39").MergeCells (get) + ITEM Assertion OK : - Range("F39").MergeCells (get) + ITEM Assertion OK : - Range("E39").MergeCells (set) + ITEM Assertion FAIL : - Range("F39").MergeCells (set) + ITEM Assertion OK : - Range("E39").MergeCells (set) + ITEM Assertion OK : - Range("F39").MergeCells (set) + ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True + ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True + ITEM Assertion OK : - Range("D41:D42").Replace MatchCase:=False + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (set) + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (set) + ITEM Assertion OK : - Range("B39").VerticalAlignment (get) + ITEM Assertion OK : - Range("B39").VerticalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (get) + ITEM Assertion OK : - Range("B39").HorizontalAlignment (set) + ITEM FAIL (RangeTest2) + TEST Not succesfully completed : RangeTest2 +END TestCalc +Test run finished : 10/07/2007 01:56:12 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestCalc_Rangetest2.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestCalc_Rangetest2.log new file mode 100644 index 000000000000..9159217cb442 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestCalc_Rangetest2.log @@ -0,0 +1,65 @@ +Test run started : 08/10/2008 11:30:38 +BEGIN TestCalc + TEST START : RangeTest3 + ITEM Assertion OK : - setFormulaR1C1 + ITEM Assertion OK : - getFormulaR1C1 + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Copy(Range("I10")) + ITEM Assertion OK : PasteSpecial Paste:=xlPasteValues + ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormulas + ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormats + ITEM Assertion OK : PasteSpecial + ITEM Assertion OK : PasteSpecial SkipBlanks:=True + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationAdd + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationSubtract + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationMultiply + ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationDivide + ITEM Assertion OK : PasteSpecial Transpose:=True + ITEM Assertion FAIL : ActiveWorkbook.FileFormat + ITEM Assertion OK : ActiveWorkbook.Name + ITEM Assertion OK : ActiveWorkbook.FullName und ActiveWorkbook.Path + ITEM Assertion FAIL : - = ActiveWorkbook.Colors(3) set + ITEM Assertion OK : - = ActiveWorkbook.ResetColors + ITEM Assertion OK : - = ActiveWorkbook.Colors(3) get + ITEM Assertion OK : - = Range("K22").End (xlDown) + ITEM Assertion OK : - = Range("K22").End (xlUo) + ITEM Assertion OK : - = Range("K22").End (xlToLeft) + ITEM Assertion OK : - = Range("K22").End (xlRight) + ITEM Assertion OK : - ActiveSpreadsheet.Next + ITEM Assertion OK : - ActiveSpreadsheet.Next + ITEM Assertion OK : - ActiveSpreadsheet.Previous + ITEM Assertion OK : - ActiveSpreadsheet.Previous + ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="x" + ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="<>" + ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="=" + ITEM Assertion OK : - Range("J4:J11").AutoFilter + ITEM Assertion OK : - ActiveSheet.Resize.Select + ITEM Assertion OK : - Application.GoTo Reference:="R8C2" + ITEM Assertion FAIL : - Application.GoTo Reference:="R[8]C[2]" + ITEM Assertion OK : - Application.GoTo Reference:="R8C2" + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.Ungroup- please check visually + ITEM Assertion OK : - Range.Ungroup - please check visually + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.Group - please check visually + ITEM Assertion OK : - Range.clearOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually + ITEM Assertion OK : - Range.AutoOutline - please check visually + ITEM Assertion OK : - ActiveSheet.UsedRange.Select + ITEM Assertion OK : - Range("A13").AddIndent + ITEM Assertion OK : - Range("A13").IndentLevel set + ITEM Assertion OK : - Range("A13").IndentLevel get + ITEM Assertion OK : - Range("A13").IndentLevel get + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() + ITEM Assertion OK : - Range.Calculate + ITEM Assertion OK : Worksheet.Calculate + ITEM Assertion OK : - Application.Calculate + ITEM Assertion OK : Global.Calculate + ITEM Assertion OK : Calculation set + ITEM FAIL (RangeTest3) + TEST Not succesfully completed : RangeTest3 +END TestCalc +Test run finished : 08/10/2008 11:30:41 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestIntersection.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestIntersection.log new file mode 100644 index 000000000000..2cf4fe36ea6f --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestIntersection.log @@ -0,0 +1,26 @@ +Test run started : 15/01/2009 17:05:08 +---------------------------------------------------------------- +TestIntersection + TEST START : TestIntersection + ITEM Assertion OK : test1 Application.Intersect( Range('A2:D10'), Range('C4:E6')) + ITEM Assertion OK : test2 Application.Intersect( Range('A2:D10'), Range('A4:G10')) + ITEM Assertion OK : test3 Application.Intersect( Range('A2:c8,d2:f8,g2:i8'), Range('A4:G10')) + ITEM Assertion OK : test4 Application.Intersect( Range('A4:G10'), Range('A2:c8,d2:f8,g2:i8')) + ITEM Assertion OK : test5 Application.Intersect( Range('A2:c8,d2:f8,g2:i8'), Range('g4:i10,A4:G10')) + ITEM Assertion OK : test6 Application.Intersect( Range('g4:i10,A4:G10'), Range('A2:c8,d2:f8,g2:i8')) + ITEM Assertion OK : test7 Application.Intersect( Range('a2:d10,b5:e10'), Range('a5:i10')) + ITEM Assertion OK : test8 Application.Intersect( Range('a2:c8,d2:f8'), Range('b6:e9,a6:f9')) + ITEM Assertion OK : test9 Application.Intersect( Range('a2:c8,e2:f8'), Range('b6:e9,a6:f9')) + ITEM Assertion OK : test10 Application.Intersect( Range('a1:a3,c1:c3'), Range('a2:c3')) + ITEM Assertion OK : test11 Application.Intersect( Range('a1:a3,b1:b3'), Range('a2:c3')) + ITEM Assertion OK : test12 Application.Intersect( Range('a2:d5,b3:f7,c1:g4'), Range('b2:e6')) + ITEM Assertion OK : test13 Range(" a2:d10,b5:e10,g13:j32 "), Range(" a5:i10,b6:e9 "), Range("b2:r5,f10:h19") +Test Results +============ + +Tests passed: 13 +Tests failed: 0 + +END 'TestIntersection + TEST OK : TestIntersection +Test run finished : 15/01/2009 17:05:09 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestUnion.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestUnion.log new file mode 100644 index 000000000000..2382db549554 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestUnion.log @@ -0,0 +1,17 @@ +Test run started : 15/01/2009 17:06:07 +---------------------------------------------------------------- +TestUnion + TEST START : TestUnion + ITEM Assertion OK : test1Application.Range('A2:D10'), Range('C4:E6') + ITEM Assertion OK : test2Application.Range('A2:D5,a3:d4'), Range('A4:G10') + ITEM Assertion OK : test3Application.Range('A4:G10,A1:B6'), Range('A2:D5,A3:D4') + ITEM Assertion OK : test4Application.Range('A5:D10'), Range('B5:E10') +Test Results +============ + +Tests passed: 4 +Tests failed: 0 + +END 'TestUnion + TEST OK : TestUnion +Test run finished : 15/01/2009 17:06:08 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/VariantTest.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/VariantTest.log new file mode 100644 index 000000000000..d2bfeb8e14a1 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/VariantTest.log @@ -0,0 +1,47 @@ +Test run started : 08/10/2008 12:07:24 +---------------------------------------------------------------- +TestAddress + TEST START : TestAddress + ITEM Assertion OK : test1: res = (aboo = '') + ITEM Assertion OK : test 2: res = (aboo = 'fiddlesticks') + ITEM Assertion OK : test 3: res = ('' = aboo) + ITEM Assertion OK : test 4: res = ('fiddlesticks' = aboo ) + ITEM Assertion OK : test 5: res = (testString = '') + ITEM Assertion OK : test 6: res = (testString = 'fiddlesticks') + ITEM Assertion OK : test 7: res = ('' = testString) + ITEM Assertion OK : test 8: res = ('fiddlesticks' = testString ) + ITEM Assertion OK : test 9: res = ( aboo < " ) + ITEM Assertion OK : test 10: res = ( testString < " ) + ITEM Assertion OK : test 11: res = ( aboo > " ) + ITEM Assertion OK : test 12: res = ( testString > " ) + ITEM Assertion OK : test 13: res = ( aboo <> '' ) + ITEM Assertion OK : test 14: res = ( testString <> '' ) + ITEM Assertion OK : test 15: res = (aboo = something/14) + ITEM Assertion OK : test 16: res = something + 'string' + ITEM Assertion OK : test 17: res = something & 'string' + ITEM Assertion OK : test 18: res = something MOD 10 ) + ITEM Assertion OK : test 19: res = something AND 1 ) + ITEM Assertion OK : test 20: res = something AND 0 ) + ITEM Assertion OK : test 21: res = something OR 12) + ITEM Assertion OK : test 22: res = something OR 0 ) + ITEM Assertion OK : test 23: res = something XOR 0 ) + ITEM Assertion OK : test 24: res = something XOR 1 ) + ITEM Assertion OK : test 25: res = something EQV 0 ) + ITEM Assertion OK : test 26: res = something EQV 1 ) + ITEM Assertion OK : test 27: res = something IMP 0 ) + ITEM Assertion OK : test 28: res = something IMP 1 ) + ITEM Assertion OK : test 29: res = something IMP 14 ) + ITEM Assertion OK : test 30: res = NOT something ) + ITEM Assertion OK : test 31: res = something + 12 ) + ITEM Assertion OK : test 32: res = something - 12 ) + ITEM Assertion OK : test 33: res = -something ) + ITEM Assertion OK : test 34: res = something * 12 ) +Test Results +============ + +Tests passed: 34 +Tests failed: 0 + +END 'TestAddress + TEST OK : TestAddress +Test run finished : 08/10/2008 12:07:26 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Window.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Window.log new file mode 100644 index 000000000000..178582e753c7 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Window.log @@ -0,0 +1,46 @@ +Test run started : 08/10/2008 12:09:50 +---------------------------------------------------------------- + TEST START : Window-Issue + ITEM Assertion OK : Window.Left is: 0 (Test only applies to maximized Window) + ITEM Assertion OK : Window.Top is: 26 (Test only applies to maximized Window) + ITEM Assertion OK : Window.Width is: 1280 (Test only applies to maximized Window) + ITEM Assertion OK : Window.Height is: 968 (Test only applies to maximized Window) + ITEM Assertion OK : Window.ScrollColumn is: 100 + ITEM Assertion OK : Window.ScrollColumn is: 1 + ITEM Assertion OK : Window.ScrollRow is: 100 + ITEM Assertion OK : Window.ScrollRow is: 1 + ITEM Assertion OK : Window.LargeScroll(Down): ScrollRow is: 127 (Test may only apply to maximized Window) + ITEM Assertion OK : Window.LargeScroll(Up): ScrollRow is: 1 + ITEM Assertion OK : Window.LargeScroll(ToRight): ScrollColumn is: 58 (Test may only apply to maximized Window) + ITEM Assertion OK : Window.LargeScroll(ToLeft): ScrollColumn is: 1 + ITEM Assertion OK : Window.SmallScroll(ToRight): ScrollColumn is: 4 (Test may only apply to maximized Window) + ITEM Assertion OK : Window.SmallScroll(ToLeft): ScrollColumn is: 1 + ITEM Assertion OK : Window.DisplayWorkBookTabs is: False + ITEM Assertion OK : Window.DisplayWorkBookTabs is: True + ITEM Assertion OK : Window.DisplayVerticalScrollBar is: True + ITEM Assertion OK : Window.DisplayVerticalScrollBar is: False + ITEM Assertion OK : Window.DisplayHorizontalScrollBar is: False + ITEM Assertion OK : Window.DisplayHorizontalScrollBar is: True + ITEM Assertion OK : Window.DisplayHeadings is: False + ITEM Assertion OK : Window.DisplayHeadings is: True + ITEM Assertion OK : Window.DisplayOutline is: False + ITEM Assertion OK : Window.DisplayOutline is: True + ITEM Assertion OK : Window.Visible is: False + ITEM Assertion OK : Window.Visible is: True + ITEM Assertion OK : Window.Caption is: MyCaption + ITEM Assertion OK : Pane.ScrollColumn is: 100 + ITEM Assertion OK : Pane.ScrollColumn is: 1 + ITEM Assertion OK : Pane.ScrollRow is: 100 + ITEM Assertion OK : Pane.ScrollRow is: 1 + ITEM Assertion OK : Pane.LargeScroll(Down): ScrollRow is: 127 (Test may only apply to maximized Window) + ITEM Assertion OK : Pane.LargeScroll(Up): ScrollRow is: 1 + ITEM Assertion OK : Pane.LargeScroll(ToRight): ScrollColumn is: 58 (Test may only apply to maximized Window) + ITEM Assertion OK : Pane.LargeScroll(ToLeft): ScrollColumn is: 1 + ITEM Assertion OK : Pane.SmallScroll(ToRight): ScrollColumn is: 4 (Test may only apply to maximized Window) + ITEM Assertion OK : Pane.SmallScroll(ToLeft): ScrollColumn is: 1 + ITEM Assertion OK : Window Selection: $A$2:$D$5 + ITEM Assertion OK : ActiveSheet name of Window: Sheet1 + ITEM Assertion OK : Window ActiveCell: $A$1 +END 'Window-Issue' Symbol + TEST OK : Window-Issue +Test run finished : 08/10/2008 12:09:50 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/bytearraystring.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/bytearraystring.log new file mode 100644 index 000000000000..8913fc096dc2 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/bytearraystring.log @@ -0,0 +1,8 @@ +Test run started : 08/10/2008 12:54:46 +BEGIN Bytearray To String + TEST START : Test the conversion between bytearray and string + ITEM Assertion OK : The number of byte is:6 + ITEM Assertion OK : the return string is: abc + TEST OK : Test the conversion between bytearray and string +END Bytearray To String +Test run finished : 08/10/2008 12:54:46 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/dateserial.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/dateserial.log new file mode 100644 index 000000000000..0b02f7b91a2c --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/dateserial.log @@ -0,0 +1,9 @@ +Test run started : 08/10/2008 12:56:07 +BEGIN DateSerial + TEST START : Test DateSerial function + ITEM Assertion OK : the return date is: 15/06/1999 + ITEM Assertion OK : the return date is: 15/06/1999 + ITEM Assertion OK : the return date is: 15/06/1999 + TEST OK : Test DateSerial function +END DateSerial +Test run finished : 08/10/2008 12:56:07 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/datevalue.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/datevalue.log new file mode 100644 index 000000000000..4698463362d2 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/datevalue.log @@ -0,0 +1,8 @@ +Test run started : 08/10/2008 13:07:49 +BEGIN DateValue + TEST START : Test DateValue function + ITEM Assertion OK : the return date is: 12/02/1969 + ITEM Assertion OK : the return date is: 21/01/2008 + TEST OK : Test DateValue function +END DateValue +Test run finished : 08/10/2008 13:07:49 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/format.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/format.log new file mode 100644 index 000000000000..ef84cbbdb925 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/format.log @@ -0,0 +1,36 @@ +Test run started : 15/01/2009 17:07:59 +BEGIN Format + TEST START : Test Predefined_Number_Format_Sample function + ITEM Assertion OK : General Number: 562486.2356 + ITEM Assertion OK : Fixed: 0.20 + ITEM Assertion OK : Standard: 562,486.24 + ITEM Assertion OK : Percent: 75.21% + ITEM Assertion OK : Scientific: 5.62E+05 + ITEM Assertion OK : Scientific: -3.46E+03 + ITEM Assertion OK : Yes/No: No + ITEM Assertion OK : Yes/No: Yes + ITEM Assertion OK : True/False: False + ITEM Assertion OK : True/False: True + ITEM Assertion OK : On/Off: Off + ITEM Assertion OK : On/Off: On + TEST OK : Test Predefined_Number_Format_Sample function + TEST START : Test Custom_Number_Format_Sample function + ITEM Assertion OK : 00.0000: 23.6750 + ITEM Assertion OK : 00.00: 23.68 + ITEM Assertion OK : 00000: 02658 + ITEM Assertion OK : 00.00: 2658.00 + ITEM Assertion OK : ##.####: 23.675 + ITEM Assertion OK : ##.##: 23.68 + ITEM Assertion OK : #,###.##: 12,345.25 + ITEM Assertion OK : ##.00%: 25.00% + ITEM Assertion OK : #,###: 1,000,000 + ITEM Assertion OK : ######E-###: 109838E-5 + ITEM Assertion OK : $#,###.##: $2,345.25 + ITEM Assertion OK : ##.###\%: .25% + TEST OK : Test Custom_Number_Format_Sample function + TEST START : Test Custom_Text_Format_Sample function + ITEM Assertion OK : <: vba + ITEM Assertion OK : >: VBA + TEST OK : Test Custom_Text_Format_Sample function +END Format +Test run finished : 15/01/2009 17:07:59 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/pagesetup.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/pagesetup.log new file mode 100644 index 000000000000..a1c90473ce07 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/pagesetup.log @@ -0,0 +1,87 @@ +Test run started : 7/21/2008 10:37:24 AM +BEGIN PageSetup + TEST START : Sheet_PrintArea + ITEM Assertion OK : PrintArea has changed as expected + TEST OK : Sheet_PrintArea + TEST START : Test margins (no headers) + ITEM Assertion OK : PageSetup.LeftMargin set/get + ITEM Assertion OK : PageSetup.RightMargin set/get + ITEM Assertion OK : PageSetup.TopMargin set/get + ITEM Assertion OK : PageSetup.BottomMargin set/get +Verify that page margins on sheet 1 are all 0.5inch + TEST OK : Test margins (no headers) + TEST START : Test margins (headers) + ITEM Assertion OK : PageSetup.HeaderMargin set/get + ITEM Assertion OK : PageSetup.FooterMargin set/get + ITEM Assertion OK : PageSetup.LeftMargin set/get + ITEM Assertion OK : PageSetup.LeftMargin set/get +Verify that top/bottom/header/footer page margins on sheet 2 are all 0.5inch + TEST OK : Test margins (headers) + TEST START : Test header/footer text + ITEM Assertion OK : PageSetup.LeftHeader set + ITEM Assertion OK : PageSetup.LeftHeader set/get + ITEM Assertion OK : PageSetup.CenterHeader set + ITEM Assertion OK : PageSetup.CenterHeader set/get + ITEM Assertion OK : PageSetup.RightHeader set + ITEM Assertion OK : PageSetup.RightHeader set/get + ITEM Assertion OK : PageSetup.LeftFooter set + ITEM Assertion OK : PageSetup.LeftFooter set/get + ITEM Assertion OK : PageSetup.CenterFooter set + ITEM Assertion OK : PageSetup.CenterFooter set/get + ITEM Assertion OK : PageSetup.RightFooter set + ITEM Assertion OK : PageSetup.RightFooter set/get +Verify that headers on sheet 2 are Ready,to,go +Verify that footers on sheet 2 are This,now,Works + TEST OK : Test header/footer text + TEST START : Test zoom + ITEM Assertion OK : PageSetup.Zoom set + ITEM Assertion OK : PageSetup.Zoom set/get +Verify that sheet 1 zoom is 10% + TEST OK : Test zoom + TEST START : Test orientation + ITEM Assertion OK : PageSetup.Zoom set + ITEM Assertion OK : PageSetup.Orientation set/get +Verify that sheet 1 orientation is now landscape + TEST OK : Test orientation + TEST START : Test paper size + ITEM Assertion OK : PageSetup.PaperSize get + ITEM Assertion OK : PageSetup.PaperSize set/get +Verify that paper size on sheet 1 is now Letter + TEST OK : Test paper size + TEST START : Test order + ITEM Assertion OK : PageSetup.Order get + ITEM Assertion OK : PageSetup.Order set/get +Verify that order on sheet 1 is now over, then down. + TEST OK : Test order + TEST START : Test first page number + ITEM Assertion OK : PageSetup.FirstPageNumber get + ITEM Assertion OK : PageSetup.FirstPageNumber set/get +Verify that first page number on sheet 1 is now 2. + TEST OK : Test first page number + TEST START : Test center vertically + ITEM Assertion OK : PageSetup.CenterVertically get + ITEM Assertion OK : PageSetup.CenterVertically set/get +Verify that CenterVertically on sheet 1 is now true. + TEST OK : Test center vertically + TEST START : Test center horizontally + ITEM Assertion OK : PageSetup.CenterHorizontally get + ITEM Assertion OK : PageSetup.CenterHorizontally set/get +Verify that CenterHorizontally on sheet 1 is now true. + TEST OK : Test center horizontally + TEST START : Test FitToPagesTall + ITEM Assertion OK : PageSetup.FitToPagesTall set/get + TEST OK : Test FitToPagesTall + TEST START : Test FitToPagesWide + ITEM Assertion OK : PageSetup.FitToPagesWide set/get + TEST OK : Test FitToPagesWide + TEST START : Test PrintHeadings + ITEM Assertion OK : PageSetup.PrintHeadings set/get + ITEM Assertion OK : PageSetup.PrintHeadings set/get + TEST OK : Test PrintHeadings + TEST START : Test PrintTitleRows + ITEM Assertion OK : PageSetup.PrintTitleRows get + ITEM Assertion OK : PageSetup.PrintTitleRows set range/get + ITEM Assertion OK : PageSetup.PrintTitleRows set false/get + TEST OK : Test PrintTitleRows +END PageSetup +Test run finished : 7/21/2008 10:37:32 AM diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/partition.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/partition.log new file mode 100644 index 000000000000..1ea267d641e8 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/partition.log @@ -0,0 +1,11 @@ +Test run started : 08/10/2008 13:09:51 +BEGIN Partition + TEST START : Test Partition function + ITEM Assertion OK : the number 20 occurs in the range:20:24 + ITEM Assertion OK : the number 20 occurs in the range: 20: 20 + ITEM Assertion OK : the number 120 occurs in the range:100: + ITEM Assertion OK : the number -5 occurs in the range: : -1 + ITEM Assertion OK : the number 2 occurs in the range: 2: 3 + TEST OK : Test Partition function +END Partition +Test run finished : 08/10/2008 13:09:51 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/range-4.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/range-4.log new file mode 100644 index 000000000000..11de80133dfa --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/range-4.log @@ -0,0 +1,16 @@ +Test run started : 08/10/2008 11:30:16 +---------------------------------------------------------------- +ShowDetail-Issue + TEST START : ShowDetail-Issue + ITEM Assertion OK : Range.ShowDetail is True + ITEM Assertion OK : Range.ShowDetail is False +END 'ShowDetail-Issue' Symbol + TEST OK : ShowDetail-Issue +---------------------------------------------------------------- +RangeMerged-Issue + TEST START : RangeMerged-Issue + ITEM Assertion OK : Range.RangeMerged is $F$2:$H$5 + ITEM Assertion OK : The first address of Range.RangeMerged is $F$2 +END 'RangeMerged-Issue' Symbol + TEST OK : RangeMerged-Issue +Test run finished : 08/10/2008 11:30:16 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/replace.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/replace.log new file mode 100644 index 000000000000..e96004e4d2a6 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/replace.log @@ -0,0 +1,14 @@ +Test run started : 2007-11-21 11:24:04 +BEGIN Replace + TEST START : Test Replace function + ITEM Assertion OK : common string:aefefdBc + ITEM Assertion OK : expression string:aefefdef + ITEM Assertion OK : binanary compare:aefefdBc + ITEM Assertion OK : text compare:aefefdef + ITEM Assertion OK : text compare:aefefdef + ITEM Assertion OK : start = 3:cefdBc + ITEM Assertion OK : count = 2: aefefdBc + ITEM Assertion OK : start = 1, count = 0, not support in Unix: abcbcdBc + TEST OK : Test Replace function +END Replace +Test run finished : 2007-11-21 11:24:04 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/stringplusdouble.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/stringplusdouble.log new file mode 100644 index 000000000000..51a958a412cf --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/stringplusdouble.log @@ -0,0 +1,62 @@ +Test run started : 15/01/2009 17:09:03 +BEGIN String Plus Double + TEST START : double = string + double +The next compute raises error: s = null, d = null, r = s + d + ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1 + ITEM Assertion OK : s = null, d = null, r = s & d .The result is: 0 +The next compute raises error: s = null, d = 20, r = s + d + ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: -1 + ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20 + ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10 + ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 100 + ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 30 + ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020 +The next compute raises error: s = 'abc', d = null, r = s + d + ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1 +The next compute raises error: s = 'abc', d = null, r = s & d + ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: -1 +The next compute raises error: s = 'abc', d = 20, r = s + d + ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1 +The next compute raises error: s = 'abc', d = 20, r = s & d + ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: -1 + TEST OK : double = string + double + TEST START : string = string + double +The next compute raises error: s = null, d = null, r = s + d + ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1 + ITEM Assertion OK : s = null, d = null, r = s & d .The result is: 0 +The next compute raises error: s = null, d = 20, r = s + d + ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: -1 + ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20 + ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10 + ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 100 + ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 30 + ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020 +The next compute raises error: s = 'abc', d = null, r = s + d + ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1 + ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: abc0 +The next compute raises error: s = 'abc', d = 20, r = s + d + ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1 + ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: abc20 + TEST OK : string = string + double + TEST START : double = string + string +The next compute raises error: s = null, d = null, r = s + d + ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1 +The next compute raises error: s = null, d = null, r = s & d + ITEM Assertion OK : s = null, d = null, r = s & d .The result is: -1 + ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: 20 + ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20 + ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10 + ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 10 + ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 1020 + ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020 +The next compute raises error: s = 'abc', d = null, r = s + d + ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1 +The next compute raises error: s = 'abc', d = null, r = s & d + ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: -1 +The next compute raises error: s = 'abc', d = 20, r = s + d + ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1 +The next compute raises error: s = 'abc', d = 20, r = s & d + ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: -1 + TEST OK : double = string + string +END String Plus Double +Test run finished : 15/01/2009 17:09:03 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/window2.log b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/window2.log new file mode 100644 index 000000000000..01fba9c6dfa6 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/window2.log @@ -0,0 +1,41 @@ +Test run started : 15/01/2009 17:10:02 +BEGIN Window2 + TEST START : Test Window.SplitRow + ITEM Assertion OK : Test SplitColumn: 2 (Test only applies to maximized Window and at least has 800*600 solotion) + ITEM Assertion FAIL : Test SplitRow: 1 (Test only applies to maximized Window and at least has 800*600 solotion) + ITEM Assertion OK : Test SplitVertical: 242.283803521067 + ITEM Assertion OK : Test SplitHorizontal: 242.283803521067 + ITEM Assertion FAIL : Test SplitRow: 3 (Test only applies to maximized Window and at least has 800*600 solotion) + ITEM Assertion OK : Test SplitColumn: 3 (Test only applies to maximized Window and at least has 800*600 solotion) + ITEM Assertion OK : Test SplitColumn: 0 + ITEM Assertion OK : Test SplitRow: 0 + TEST OK : Test Window.SplitRow + TEST START : Test Window.DisplayGridlines + ITEM Assertion OK : Test gridlines are on + ITEM Assertion OK : Test gridlines are off + TEST OK : Test Window.DisplayGridlines + TEST START : Test Window.DisplayHeadings + ITEM Assertion OK : Test Headings are on + ITEM Assertion OK : Test Headings are off + TEST OK : Test Window.DisplayHeadings + TEST START : Test Window.Visibility + ITEM Assertion OK : Window is visible + ITEM Assertion OK : Window is not visible + TEST OK : Test Window.Visibility + TEST START : Test Window.FreezePanes + ITEM Assertion OK : Test no panes frozen + ITEM Assertion OK : Test panes frozen at center + ITEM Assertion OK : Test panes frozen at split + TEST OK : Test Window.FreezePanes + TEST START : Test Window.View + TEST OK : Test Window.View + TEST START : Test Window.Zoom + ITEM Assertion OK : Test zoom=100% + ITEM Assertion OK : Test zoom=150% + TEST OK : Test Window.Zoom + TEST START : Test Windows.Count + ITEM Assertion OK : Windows Count: 1 + ITEM Assertion OK : Application.Windows Count: 1 + TEST OK : Test Windows.Count +END Window2 +Test run finished : 15/01/2009 17:10:03 diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/error.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/error.xls new file mode 100644 index 000000000000..ea2095d5e3d7 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/error.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/imagecontrols.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/imagecontrols.xls new file mode 100644 index 000000000000..0de17b403f23 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/imagecontrols.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/keyword.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/keyword.xls new file mode 100644 index 000000000000..3bf711ed4f42 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/keyword.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/objectmodule.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/objectmodule.xls new file mode 100644 index 000000000000..d3aff35b938c Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/objectmodule.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/stringtodouble.ods b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/stringtodouble.ods new file mode 100644 index 000000000000..5a732a765886 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/stringtodouble.ods differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/partition.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/partition.xls new file mode 100644 index 000000000000..5c8d12b1d54f Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/partition.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/range-4.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/range-4.xls new file mode 100644 index 000000000000..52452369462f Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/range-4.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/replace.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/replace.xls new file mode 100644 index 000000000000..dcf3c6e8ec06 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/replace.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/stringplusdouble.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/stringplusdouble.xls new file mode 100644 index 000000000000..596be7f6b9bc Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/stringplusdouble.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments-ooo-build/window2.xls b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/window2.xls new file mode 100644 index 000000000000..4d5e1cbfe944 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments-ooo-build/window2.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments/ApplicationRunTest.xls b/sc/source/ui/vba/testvba/TestDocuments/ApplicationRunTest.xls new file mode 100644 index 000000000000..a5a591c1f849 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments/ApplicationRunTest.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments/CalcFont.xls b/sc/source/ui/vba/testvba/TestDocuments/CalcFont.xls new file mode 100644 index 000000000000..9ddb69600643 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments/CalcFont.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments/FinancialFuncs.xls b/sc/source/ui/vba/testvba/TestDocuments/FinancialFuncs.xls new file mode 100644 index 000000000000..bb8941809947 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments/FinancialFuncs.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments/Ranges.xls b/sc/source/ui/vba/testvba/TestDocuments/Ranges.xls index 3abdc4620aa8..1c1d74d37486 100644 Binary files a/sc/source/ui/vba/testvba/TestDocuments/Ranges.xls and b/sc/source/ui/vba/testvba/TestDocuments/Ranges.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments/TestAddress.xls b/sc/source/ui/vba/testvba/TestDocuments/TestAddress.xls index 1834bd649f3d..48d30cbe2e9e 100644 Binary files a/sc/source/ui/vba/testvba/TestDocuments/TestAddress.xls and b/sc/source/ui/vba/testvba/TestDocuments/TestAddress.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments/TestIntersection.xls b/sc/source/ui/vba/testvba/TestDocuments/TestIntersection.xls new file mode 100644 index 000000000000..24f88db87ccc Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments/TestIntersection.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments/TestUnion.xls b/sc/source/ui/vba/testvba/TestDocuments/TestUnion.xls new file mode 100644 index 000000000000..5b8f0968cf38 Binary files /dev/null and b/sc/source/ui/vba/testvba/TestDocuments/TestUnion.xls differ diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/CalcFont.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/CalcFont.log new file mode 100644 index 000000000000..f3583e4cbb12 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/CalcFont.log @@ -0,0 +1,17 @@ +Test run started : 10/09/2008 02:40:17 PM +CalcFont_Format + TEST START : Font_Format + ITEM Assertion OK : correctly set font to Bold + ITEM Assertion OK : correctly set font to Italic + ITEM Assertion OK : correctly read FontStyle + ITEM Assertion OK : correctly set font to Shadow + ITEM Assertion OK : correctly set font color + ITEM Assertion OK : correctly set font color index + ITEM Assertion OK : correctly set font name + ITEM Assertion OK : correctly set font outline + ITEM Assertion OK : correctly set font size + ITEM Assertion OK : correctly set font strikethrough + ITEM Assertion OK : correctly set font underline + TEST Success. : Font_Format +CalcFont_Format +Test run finished : 10/09/2008 02:40:17 PM diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges.log index dd4fb4923209..cdd18685e977 100644 --- a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges.log @@ -1,4 +1,4 @@ -Test run started : 17/12/2008 14:18:34 +Test run started : 10/03/2008 15:15:11 ---------------------------------------------------------------- ApplicationMethods TEST START : ApplicationMethods @@ -7,8 +7,8 @@ ApplicationMethods ITEM Assertion OK : Address of Application.Rows is: $1:$1 ITEM Assertion OK : Address of Application.Range is: $1:$1,$5:$7 ITEM Assertion OK : Please check manually: DefaultFilePath is: /data4/home/npower/Documents - ITEM Assertion OK : Please check manually: Library Path is: /media/disk/BUILD-related/CWS/my_working_copy/INSTALL_FOR_TEST/opt/UserInstallation/user/basic - ITEM Assertion OK : Please check manually: Template Path is: /media/disk/BUILD-related/CWS/my_working_copy/INSTALL_FOR_TEST/opt/UserInstallation/user/template + ITEM Assertion OK : Please check manually: Library Path is: /data4/home/npower/.ooo-2.0/user/basic + ITEM Assertion OK : Please check manually: Template Path is: /data4/home/npower/.ooo-2.0/user/template ITEM Assertion OK : FileSeparator is / ITEM Assertion OK : Name of ActiveWorkbook is: Ranges.xls END 'ApplicationMethods' Symbol @@ -111,8 +111,8 @@ END 'Value-Issue' Symbol ---------------------------------------------------------------- AutoFit issue TEST START : AutoFit issue - ITEM Assertion OK : Columns.AutoFit: CurrentWidth is 679 - ITEM Assertion OK : Rows.AutoFit: CurrentHeight is 546 + ITEM Assertion OK : Columns.AutoFit: CurrentWidth is 680 + ITEM Assertion OK : Rows.AutoFit: CurrentHeight is 554 END 'AutoFit issue' Symbol TEST OK : AutoFit issue ---------------------------------------------------------------- @@ -204,11 +204,11 @@ Heights and Widths ITEM Assertion OK : Range RowHeight is 40 ITEM Assertion OK : Range ColumnWidth is 50 ITEM Assertion OK : Range Height is 240 - ITEM Assertion OK : Range Width is 787.5 + ITEM Assertion OK : Range Width is 795 ITEM Assertion OK : Range RowHeight is 50 ITEM Assertion OK : Range ColumnWidth is 50 ITEM Assertion OK : Range Height is 300 - ITEM Assertion OK : Range Width is 787.5 + ITEM Assertion OK : Range Width is 795 ITEM Assertion OK : RowHeight is null: True ITEM Assertion OK : ColumnWidth is null: True END 'Heights and Widths' Symbol @@ -218,7 +218,7 @@ RangeRowColumn-Issue TEST START : RangeRowColumn-Issue ITEM Assertion OK : Row is: 8 ITEM Assertion OK : Column is: 5 - ITEM Assertion OK : EntireRow.Columns.Count = 1024 + ITEM Assertion OK : EntireRow.Columns.Count = 256 ITEM Assertion OK : EntireColumn.Rows.Count = 131072 END 'RangeRowColumn-Issue' Symbol TEST OK : RangeRowColumn-Issue @@ -255,7 +255,7 @@ End issue ITEM Assertion OK : - = $E$3 ITEM Assertion OK : - = $A$8 ITEM Assertion OK : - = $B$8 - ITEM Assertion FAIL : - = $AMJ$8 + ITEM Assertion OK : - = $IV$8 ITEM Assertion OK : - = $Z$8 END 'End issue' Symbol TEST OK : End issue @@ -277,4 +277,4 @@ Validation ITEM Assertion OK : Validation Error Title is : Microsoft Excel END 'Validation' Symbol TEST OK : Validation -Test run finished : 17/12/2008 14:18:40 +Test run finished : 10/03/2008 15:15:13 diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestAddress.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestAddress.log index 42360c3ffe8a..4fa4bc820f59 100644 --- a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestAddress.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestAddress.log @@ -1,4 +1,4 @@ -Test run started : 17/07/2007 20:56:04 +Test run started : 12/05/2009 11:23:35 ---------------------------------------------------------------- TestAddress TEST START : TestAddress @@ -51,12 +51,17 @@ TestAddress ITEM Assertion OK : test47 Range('a2:b4').Rows('1:2') ITEM Assertion OK : test48 Range('a2:b4').Rows('2:2') ITEM Assertion OK : test49 Range('a2:b4').Rows('2:3') + ITEM Assertion OK : test50 Range(' A2:B4 ') + ITEM Assertion OK : test51 Range('A 2:B 4') + ITEM Assertion OK : test52 Range('A2 : B4 ') + ITEM Assertion OK : test53 Range('Sheet1 !A2 : B4 ') + ITEM Assertion OK : test54 Range('Sheet1! A2 : B4 ') Test Results ============ -Tests passed: 49 +Tests passed: 54 Tests failed: 0 END 'TestAddress TEST OK : TestAddress -Test run finished : 17/07/2007 20:56:05 +Test run finished : 12/05/2009 11:23:35 diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestIntersection.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestIntersection.log new file mode 100644 index 000000000000..ea686a830cde --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestIntersection.log @@ -0,0 +1,26 @@ +Test run started : 13/01/2009 14:31:43 +---------------------------------------------------------------- +TestIntersection + TEST START : TestIntersection + ITEM Assertion OK : test1 Application.Intersect( Range('A2:D10'), Range('C4:E6')) + ITEM Assertion OK : test2 Application.Intersect( Range('A2:D10'), Range('A4:G10')) + ITEM Assertion OK : test3 Application.Intersect( Range('A2:c8,d2:f8,g2:i8'), Range('A4:G10')) + ITEM Assertion OK : test4 Application.Intersect( Range('A4:G10'), Range('A2:c8,d2:f8,g2:i8')) + ITEM Assertion OK : test5 Application.Intersect( Range('A2:c8,d2:f8,g2:i8'), Range('g4:i10,A4:G10')) + ITEM Assertion OK : test6 Application.Intersect( Range('g4:i10,A4:G10'), Range('A2:c8,d2:f8,g2:i8')) + ITEM Assertion OK : test7 Application.Intersect( Range('a2:d10,b5:e10'), Range('a5:i10')) + ITEM Assertion OK : test8 Application.Intersect( Range('a2:c8,d2:f8'), Range('b6:e9,a6:f9')) + ITEM Assertion OK : test9 Application.Intersect( Range('a2:c8,e2:f8'), Range('b6:e9,a6:f9')) + ITEM Assertion OK : test10 Application.Intersect( Range('a1:a3,c1:c3'), Range('a2:c3')) + ITEM Assertion OK : test11 Application.Intersect( Range('a1:a3,b1:b3'), Range('a2:c3')) + ITEM Assertion OK : test12 Application.Intersect( Range('a2:d5,b3:f7,c1:g4'), Range('b2:e6')) + ITEM Assertion OK : test13 Range(" a2:d10,b5:e10,g13:j32 "), Range(" a5:i10,b6:e9 "), Range("b2:r5,f10:h19") +Test Results +============ + +Tests passed: 13 +Tests failed: 0 + +END 'TestIntersection + TEST OK : TestIntersection +Test run finished : 13/01/2009 14:31:43 diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestUnion.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestUnion.log new file mode 100644 index 000000000000..da3cb35dedb3 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestUnion.log @@ -0,0 +1,17 @@ +Test run started : 13/01/2009 14:32:16 +---------------------------------------------------------------- +TestUnion + TEST START : TestUnion + ITEM Assertion OK : test1Application.Range('A2:D10'), Range('C4:E6') + ITEM Assertion OK : test2Application.Range('A2:D5,a3:d4'), Range('A4:G10') + ITEM Assertion OK : test3Application.Range('A4:G10,A1:B6'), Range('A2:D5,A3:D4') + ITEM Assertion OK : test4Application.Range('A5:D10'), Range('B5:E10') +Test Results +============ + +Tests passed: 4 +Tests failed: 0 + +END 'TestUnion + TEST OK : TestUnion +Test run finished : 13/01/2009 14:32:16 diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/format.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/format.log index 50fac171544b..96725bf7daa8 100644 --- a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/format.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/format.log @@ -1,4 +1,4 @@ -Test run started : 17/12/2008 14:15:22 +Test run started : 2008/09/18 11:35:34 BEGIN Format TEST START : Test Predefined_Number_Format_Sample function ITEM Assertion OK : General Number: 562486.2356 @@ -33,4 +33,4 @@ BEGIN Format ITEM Assertion OK : >: VBA TEST OK : Test Custom_Text_Format_Sample function END Format -Test run finished : 17/12/2008 14:15:22 +Test run finished : 2008/09/18 11:35:34 diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/replace.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/replace.log index 461955dc2402..8f600faaa6b1 100644 --- a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/replace.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/replace.log @@ -1,4 +1,4 @@ -Test run started : 17/12/2008 13:53:49 +Test run started : 09/05/2008 10:21:46 AM BEGIN Replace TEST START : Test Replace function ITEM Assertion OK : common string:aefefdBc @@ -11,4 +11,4 @@ BEGIN Replace ITEM Assertion OK : start = 1, count = 0, not support in Unix: abcbcdBc TEST OK : Test Replace function END Replace -Test run finished : 17/12/2008 13:53:49 +Test run finished : 09/05/2008 10:21:47 AM diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/window2.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/window2.log index 5d297f80a152..8e26d0580621 100644 --- a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/window2.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/window2.log @@ -1,20 +1,15 @@ -Test run started : 05/29/2008 02:55:48 PM +Test run started : 2008/09/22 11:18:57 BEGIN Window2 TEST START : Test Window.SplitRow - ITEM Assertion OK : Test SplitColumn: 2 - ITEM Assertion FAIL : Test SplitRow: 5 - ITEM Assertion FAIL : Test SplitVertical: 64.5090003183026 - ITEM Assertion OK : Test SplitHorizontal: 502.570118758869 - ITEM Assertion OK : Test SplitVertical: 242.283803521067 - ITEM Assertion OK : Test SplitRow: 19 - ITEM Assertion OK : Test SplitHorizontal: 242.283803521067 - ITEM Assertion OK : Test SplitColumn: 1 - ITEM Assertion FAIL : Test SplitRow: 8 - ITEM Assertion OK : Test SplitColumn: 10 + ITEM Assertion OK : Test SplitColumn: 2 (Test only applies to maximized Window and at least has 800*600 solotion) + ITEM Assertion OK : Test SplitRow: 2 (Test only applies to maximized Window and at least has 800*600 solotion) + ITEM Assertion OK : Test SplitVertical: 242.465788476212 + ITEM Assertion OK : Test SplitHorizontal: 242.465788476212 + ITEM Assertion OK : Test SplitRow: 4 (Test only applies to maximized Window and at least has 800*600 solotion) + ITEM Assertion OK : Test SplitColumn: 3 (Test only applies to maximized Window and at least has 800*600 solotion) ITEM Assertion OK : Test SplitColumn: 0 ITEM Assertion OK : Test SplitRow: 0 TEST OK : Test Window.SplitRow -TEST ERROR - no test begun: Test Window.SplitRow TEST START : Test Window.DisplayGridlines ITEM Assertion OK : Test gridlines are on ITEM Assertion OK : Test gridlines are off @@ -25,7 +20,8 @@ TEST ERROR - no test begun: Test Window.SplitRow TEST OK : Test Window.DisplayHeadings TEST START : Test Window.Visibility ITEM Assertion OK : Window is visible - TEST FAIL : Test Window.Visibility (hit error handler). + ITEM Assertion OK : Window is not visible + TEST OK : Test Window.Visibility TEST START : Test Window.FreezePanes ITEM Assertion OK : Test no panes frozen ITEM Assertion OK : Test panes frozen at center @@ -42,4 +38,4 @@ TEST ERROR - no test begun: Test Window.SplitRow ITEM Assertion OK : Application.Windows Count: 1 TEST OK : Test Windows.Count END Window2 -Test run finished : 05/29/2008 02:55:48 PM +Test run finished : 2008/09/22 11:18:58 diff --git a/sc/source/ui/vba/testvba/TestDocuments/PageSetup.xls b/sc/source/ui/vba/testvba/TestDocuments/pagesetup.xls similarity index 100% rename from sc/source/ui/vba/testvba/TestDocuments/PageSetup.xls rename to sc/source/ui/vba/testvba/TestDocuments/pagesetup.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/window2.xls b/sc/source/ui/vba/testvba/TestDocuments/window2.xls index 1bb2cd5a67da..4d5e1cbfe944 100755 Binary files a/sc/source/ui/vba/testvba/TestDocuments/window2.xls and b/sc/source/ui/vba/testvba/TestDocuments/window2.xls differ diff --git a/sc/source/ui/vba/testvba/runTests.pl b/sc/source/ui/vba/testvba/runTests.pl index 8f8f329504c0..f5051516a9c4 100644 --- a/sc/source/ui/vba/testvba/runTests.pl +++ b/sc/source/ui/vba/testvba/runTests.pl @@ -20,7 +20,7 @@ my $theResult; my $officepath = shift || die "please specify path to office installation program dir"; my $DocName = shift || ""; my $programpath = "$officepath"."3/program:$officepath/program:"; -my $basiclibrarypath = "$officepath/basis3.1/program"; +my $basiclibrarypath = "$officepath/basis3.2/program"; my $urelibpath = "$officepath/ure/lib"; my $binext = ""; my $testDocDir = "$binDir/TestDocuments"; diff --git a/sc/source/ui/vba/testvba/testclient b/sc/source/ui/vba/testvba/testclient new file mode 100755 index 000000000000..12e9ca1659f4 Binary files /dev/null and b/sc/source/ui/vba/testvba/testclient differ diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 32ed5f9e0af2..953a2aaee74e 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -57,10 +57,9 @@ #include "tabvwsh.hxx" #include "gridwin.hxx" #include "vbanames.hxx" -#include "vbashape.hxx" +#include #include "vbatextboxshape.hxx" #include "vbaassistant.hxx" -#include "vbacommandbars.hxx" #include "sc.hrc" #include @@ -85,6 +84,9 @@ #include "convuno.hxx" #include "cellsuno.hxx" #include "docsh.hxx" +#include +#include "excelvbahelper.hxx" + using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -102,20 +104,20 @@ using namespace ::com::sun::star; #define FILE_PATH_SEPERATOR "\\" #endif -#define EXCELVERSION "11.0" +uno::Any sbxToUnoValue( SbxVariable* pVar ); class ActiveWorkbook : public ScVbaWorkbook { protected: virtual uno::Reference< frame::XModel > getModel() { - return getCurrentDocument(); + return getCurrentExcelDoc(mxContext); } public: ActiveWorkbook( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) : ScVbaWorkbook( xParent, xContext ){} }; -ScVbaApplication::ScVbaApplication( uno::Reference& xContext ): ScVbaApplication_BASE( uno::Reference< XHelperInterface >(), xContext ), m_xCalculation( excel::XlCalculation::xlCalculationAutomatic ) +ScVbaApplication::ScVbaApplication( const uno::Reference& xContext ): ScVbaApplication_BASE( xContext ), m_xCalculation( excel::XlCalculation::xlCalculationAutomatic ) { } @@ -123,7 +125,10 @@ ScVbaApplication::~ScVbaApplication() { } - +SfxObjectShell* ScVbaApplication::GetDocShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) +{ + return static_cast< SfxObjectShell* >( excel::getDocShell( xModel ) ); +} uno::Reference< excel::XWorkbook > ScVbaApplication::getActiveWorkbook() throw (uno::RuntimeException) @@ -142,24 +147,16 @@ ScVbaApplication::getAssistant() throw (uno::RuntimeException) return uno::Reference< XAssistant >( new ScVbaAssistant( this, mxContext ) ); } -uno::Any SAL_CALL -ScVbaApplication::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - uno::Reference< XCommandBars > xCommandBars( new ScVbaCommandBars( this, mxContext, uno::Reference< container::XIndexAccess >() ) ); - if( aIndex.hasValue() ) - return uno::makeAny( xCommandBars->Item( aIndex, uno::Any() ) ); - return uno::makeAny( xCommandBars ); -} - uno::Any SAL_CALL ScVbaApplication::getSelection() throw (uno::RuntimeException) { OSL_TRACE("** ScVbaApplication::getSelection() ** "); - uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument()->getCurrentSelection(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XModel > xModel( getCurrentDocument() ); + uno::Reference< lang::XServiceInfo > xServiceInfo( xModel->getCurrentSelection(), uno::UNO_QUERY_THROW ); rtl::OUString sImpementaionName = xServiceInfo->getImplementationName(); if( sImpementaionName.equalsIgnoreAsciiCaseAscii("com.sun.star.drawing.SvxShapeCollection") ) { - uno::Reference< drawing::XShapes > xShapes( getCurrentDocument()->getCurrentSelection(), uno::UNO_QUERY_THROW ); + uno::Reference< drawing::XShapes > xShapes( xModel->getCurrentSelection(), uno::UNO_QUERY_THROW ); uno::Reference< container::XIndexAccess > xIndexAccess( xShapes, uno::UNO_QUERY_THROW ); uno::Reference< drawing::XShape > xShape( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW ); // if ScVbaShape::getType( xShape ) == office::MsoShapeType::msoAutoShape @@ -170,10 +167,10 @@ ScVbaApplication::getSelection() throw (uno::RuntimeException) uno::Reference< lang::XServiceInfo > xShapeServiceInfo( xShape, uno::UNO_QUERY_THROW ); if ( xShapeServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.Text" ) ) ) ) { - return uno::makeAny( uno::Reference< msforms::XTextBoxShape >(new ScVbaTextBoxShape( mxContext, xShape, xShapes, getCurrentDocument() ) ) ); + return uno::makeAny( uno::Reference< msforms::XTextBoxShape >(new ScVbaTextBoxShape( mxContext, xShape, xShapes, xModel ) ) ); } } - return uno::makeAny( uno::Reference< msforms::XShape >(new ScVbaShape( this, mxContext, xShape, xShapes, ScVbaShape::getType( xShape ) ) ) ); + return uno::makeAny( uno::Reference< msforms::XShape >(new ScVbaShape( this, mxContext, xShape, xShapes, xModel, ScVbaShape::getType( xShape ) ) ) ); } else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii("com.sun.star.sheet.SheetCellRange")) || xServiceInfo->supportsService( rtl::OUString::createFromAscii("com.sun.star.sheet.SheetCellRanges"))) @@ -199,7 +196,7 @@ ScVbaApplication::getActiveCell() throw (uno::RuntimeException ) { uno::Reference< sheet::XSpreadsheetView > xView( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW ); uno::Reference< table::XCellRange > xRange( xView->getActiveSheet(), ::uno::UNO_QUERY_THROW); - ScTabViewShell* pViewShell = getCurrentBestViewShell(); + ScTabViewShell* pViewShell = excel::getCurrentBestViewShell(mxContext); if ( !pViewShell ) throw uno::RuntimeException( rtl::OUString::createFromAscii("No ViewShell available"), uno::Reference< uno::XInterface >() ); ScViewData* pTabView = pViewShell->GetViewData(); @@ -212,65 +209,6 @@ ScVbaApplication::getActiveCell() throw (uno::RuntimeException ) return new ScVbaRange( this, mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) ); } -sal_Bool -ScVbaApplication::getScreenUpdating() throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - return !xModel->hasControllersLocked(); -} - -void -ScVbaApplication::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - if (bUpdate) - xModel->unlockControllers(); - else - xModel->lockControllers(); -} - -sal_Bool -ScVbaApplication::getDisplayStatusBar() throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); - - if( xProps.is() ){ - uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW ); - rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" )); - if( xLayoutManager.is() && xLayoutManager->isElementVisible( url ) ){ - return sal_True; - } - } - return sal_False; -} - -void -ScVbaApplication::setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); - - if( xProps.is() ){ - uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW ); - rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" )); - if( xLayoutManager.is() ){ - if( bDisplayStatusBar && !xLayoutManager->isElementVisible( url ) ){ - if( !xLayoutManager->showElement( url ) ) - xLayoutManager->createElement( url ); - return; - } - else if( !bDisplayStatusBar && xLayoutManager->isElementVisible( url ) ){ - xLayoutManager->hideElement( url ); - return; - } - } - } - return; -} - uno::Any SAL_CALL ScVbaApplication::Workbooks( const uno::Any& aIndex ) throw (uno::RuntimeException) { @@ -319,7 +257,7 @@ ScVbaApplication::Evaluate( const ::rtl::OUString& Name ) throw (uno::RuntimeExc uno::Any ScVbaApplication::Dialogs( const uno::Any &aIndex ) throw (uno::RuntimeException) { - uno::Reference< excel::XDialogs > xDialogs( new ScVbaDialogs( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication(), uno::UNO_QUERY_THROW ), mxContext ) ); + uno::Reference< excel::XDialogs > xDialogs( new ScVbaDialogs( uno::Reference< XHelperInterface >( this ), mxContext, getCurrentDocument() ) ); if( !aIndex.hasValue() ) return uno::Any( xDialogs ); return uno::Any( xDialogs->Item( aIndex ) ); @@ -341,12 +279,6 @@ ScVbaApplication::getCutCopyMode() throw (uno::RuntimeException) return result; } -::rtl::OUString -ScVbaApplication::getVersion() throw (uno::RuntimeException) -{ - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(EXCELVERSION)); -} - void SAL_CALL ScVbaApplication::setCutCopyMode( const uno::Any& /*_cutcopymode*/ ) throw (uno::RuntimeException) { @@ -432,7 +364,7 @@ ScVbaApplication::setCalculation( ::sal_Int32 _calculation ) throw (uno::Runtime uno::Any SAL_CALL ScVbaApplication::Windows( const uno::Any& aIndex ) throw (uno::RuntimeException) { - uno::Reference< XCollection > xWindows = ScVbaWindows::Windows( mxContext ); + uno::Reference< excel::XWindows > xWindows( new ScVbaWindows( this, mxContext ) ); if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID ) return uno::Any( xWindows ); return uno::Any( xWindows->Item( aIndex, uno::Any() ) ); @@ -543,11 +475,11 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll ) thro xModel->getCurrentController(), uno::UNO_QUERY_THROW ); uno::Reference< sheet::XSpreadsheet > xDoc = xSpreadsheet->getActiveSheet(); - ScTabViewShell* pShell = getCurrentBestViewShell(); + ScTabViewShell* pShell = excel::getCurrentBestViewShell( mxContext ); ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow(); try { - uno::Reference< excel::XRange > xVbaSheetRange = ScVbaRange::getRangeObjectForName( mxContext, sRangeName, getDocShell( xModel ), formula::FormulaGrammar::CONV_XL_R1C1 ); + uno::Reference< excel::XRange > xVbaSheetRange = ScVbaRange::getRangeObjectForName( mxContext, sRangeName, excel::getDocShell( xModel ), formula::FormulaGrammar::CONV_XL_R1C1 ); ; if( bScroll ) { @@ -585,7 +517,7 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll ) thro if( Reference >>= xRange ) { uno::Reference< excel::XRange > xVbaRange( Reference, uno::UNO_QUERY ); - ScTabViewShell* pShell = getCurrentBestViewShell(); + ScTabViewShell* pShell = excel::getCurrentBestViewShell( mxContext ); ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow(); if ( xVbaRange.is() ) { @@ -615,38 +547,10 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll ) thro uno::Reference< uno::XInterface >() ); } -namespace -{ - static uno::Reference< frame::XController > lcl_getCurrentController() - { - const uno::Reference< frame::XModel > xWorkingDoc( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY ); - uno::Reference< frame::XController > xController; - if ( xWorkingDoc.is() ) - xController.set( xWorkingDoc->getCurrentController(), uno::UNO_SET_THROW ); - else - xController.set( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY_THROW ); - return xController; - } -} - sal_Int32 SAL_CALL ScVbaApplication::getCursor() throw (uno::RuntimeException) { - sal_Int32 nPointerStyle( POINTER_ARROW ); - try - { - const uno::Reference< frame::XController > xController( lcl_getCurrentController(), uno::UNO_SET_THROW ); - const uno::Reference< frame::XFrame > xFrame ( xController->getFrame(), uno::UNO_SET_THROW ); - const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); - // why the heck isn't there an XWindowPeer::getPointer, but a setPointer only? - const Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - nPointerStyle = pWindow->GetSystemWindow()->GetPointer().GetStyle(); - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } + sal_Int32 nPointerStyle = getPointerStyle(getCurrentDocument()); switch( nPointerStyle ) { @@ -668,81 +572,34 @@ ScVbaApplication::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException) { try { - ::std::vector< uno::Reference< frame::XController > > aControllers; - - const uno::Reference< frame::XModel2 > xModel2( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY ); - if ( xModel2.is() ) + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); + switch( _cursor ) { - const uno::Reference< container::XEnumeration > xEnumControllers( xModel2->getControllers(), uno::UNO_SET_THROW ); - while ( xEnumControllers->hasMoreElements() ) + case excel::XlMousePointer::xlNorthwestArrow: { - const uno::Reference< frame::XController > xController( xEnumControllers->nextElement(), uno::UNO_QUERY_THROW ); - aControllers.push_back( xController ); + const Pointer& rPointer( POINTER_ARROW ); + setCursorHelper( xModel, rPointer, sal_False ); + break; } - } - else - { - const uno::Reference< frame::XModel > xModel( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY ); - if ( xModel.is() ) + case excel::XlMousePointer::xlWait: + case excel::XlMousePointer::xlIBeam: { - const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); - aControllers.push_back( xController ); + const Pointer& rPointer( static_cast< PointerStyle >( _cursor ) ); + //It will set the edit window, toobar and statusbar's mouse pointer. + setCursorHelper( xModel, rPointer, sal_True ); + break; } - else + case excel::XlMousePointer::xlDefault: { - const uno::Reference< frame::XController > xController( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY_THROW ); - aControllers.push_back( xController ); - } - } - - for ( ::std::vector< uno::Reference< frame::XController > >::const_iterator controller = aControllers.begin(); - controller != aControllers.end(); - ++controller - ) - { - const uno::Reference< frame::XFrame > xFrame ( (*controller)->getFrame(), uno::UNO_SET_THROW ); - const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); - - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - OSL_ENSURE( pWindow, "ScVbaApplication::setCursor: no window!" ); - if ( !pWindow ) - continue; - - switch( _cursor ) - { - case excel::XlMousePointer::xlNorthwestArrow: - { - const Pointer& rPointer( POINTER_ARROW ); - pWindow->GetSystemWindow()->SetPointer( rPointer ); - pWindow->GetSystemWindow()->EnableChildPointerOverwrite( sal_False ); - break; - } - case excel::XlMousePointer::xlWait: - case excel::XlMousePointer::xlIBeam: - { - const Pointer& rPointer( static_cast< PointerStyle >( _cursor ) ); - //It will set the edit window, toobar and statusbar's mouse pointer. - pWindow->GetSystemWindow()->SetPointer( rPointer ); - pWindow->GetSystemWindow()->EnableChildPointerOverwrite( sal_True ); - //It only set the edit window's mouse pointer - //pWindow->.SetPointer( rPointer ); - //pWindow->.EnableChildPointerOverwrite( sal_True ); - //printf("\nset Cursor...%d\n", pWindow->.GetType()); - break; - } - case excel::XlMousePointer::xlDefault: - { - const Pointer& rPointer( POINTER_NULL ); - pWindow->GetSystemWindow()->SetPointer( rPointer ); - pWindow->GetSystemWindow()->EnableChildPointerOverwrite( sal_False ); - break; - } - default: - throw uno::RuntimeException( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() ); - // TODO: isn't this a flaw in the API? It should be allowed to throw an - // IllegalArgumentException, or so + const Pointer& rPointer( POINTER_NULL ); + setCursorHelper( xModel, rPointer, sal_False ); + break; } + default: + throw uno::RuntimeException( rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() ); + // TODO: isn't this a flaw in the API? It should be allowed to throw an + // IllegalArgumentException, or so } } catch( const uno::Exception& ) @@ -1117,7 +974,7 @@ ScVbaApplication::Intersect( const uno::Reference< excel::XRange >& Arg1, const } uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - ScDocShell* pDocShell = getDocShell( xModel ); + ScDocShell* pDocShell = excel::getDocShell( xModel ); if ( aCellRanges.Count() == 1 ) { xRefRange = new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, new ScCellRangeObj( pDocShell, *aCellRanges.First() ) ); @@ -1206,7 +1063,7 @@ ScVbaApplication::Union( const uno::Reference< excel::XRange >& Arg1, const uno: aCellRanges.Append( *it ); uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - ScDocShell* pDocShell = getDocShell( xModel ); + ScDocShell* pDocShell = excel::getDocShell( xModel ); if ( aCellRanges.Count() == 1 ) { // normal range @@ -1228,29 +1085,17 @@ ScVbaApplication::Volatile( const uno::Any& aVolatile ) throw ( uno::RuntimeExc sal_Bool bVolatile = sal_True; aVolatile >>= bVolatile; return; -/* - if ( bVolatile ) - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Volatile - not supported" ) ), uno::Reference< uno::XInterface >() ); - // bVoloatile is false - currently this only would make sense if - // the autocalculate mode is set to be true. - - // so really this is crap, #TODO try and understand how ( or if ) - // the calculation mode and volatile interoperate - if ( ! getCalculation() == excel::XlCalculation::xlCalculationAutomatic ) - setCalculation( excel::XlCalculation::xlCalculationAutomatic ); -*/ } void SAL_CALL ScVbaApplication::DoEvents() throw ( uno::RuntimeException ) { } - ::sal_Bool SAL_CALL ScVbaApplication::getDisplayFormulaBar() throw ( css::uno::RuntimeException ) { sal_Bool bRes = sal_False; - ScTabViewShell* pViewShell = getCurrentBestViewShell(); + ScTabViewShell* pViewShell = excel::getCurrentBestViewShell( mxContext ); if ( pViewShell ) { SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE); @@ -1268,7 +1113,7 @@ ScVbaApplication::getDisplayFormulaBar() throw ( css::uno::RuntimeException ) void SAL_CALL ScVbaApplication::setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException ) { - ScTabViewShell* pViewShell = getCurrentBestViewShell(); + ScTabViewShell* pViewShell = excel::getCurrentBestViewShell( mxContext ); if ( pViewShell && ( _displayformulabar != getDisplayFormulaBar() ) ) { SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE, _displayformulabar); @@ -1278,6 +1123,31 @@ ScVbaApplication::setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( } } +uno::Any SAL_CALL +ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeException ) +{ + StarBASIC* pBasic = SFX_APP()->GetBasic(); + SFX_APP()->EnterBasicCall(); + SbMethod* pMeth = (SbMethod*)pBasic->GetRtl()->Find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FuncCaller") ), SbxCLASS_METHOD ); + uno::Any aRet; + if ( pMeth ) + { + SbxVariableRef refTemp = pMeth; + // forces a broadcast + SbxVariableRef pNew = new SbxMethod( *((SbxMethod*)pMeth)); + OSL_TRACE("pNew has type %d and string value %s", pNew->GetType(), rtl::OUStringToOString( pNew->GetString(), RTL_TEXTENCODING_UTF8 ).getStr() ); + aRet = sbxToUnoValue( pNew ); + } + SFX_APP()->LeaveBasicCall(); + return aRet; +} + +uno::Reference< frame::XModel > +ScVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException) +{ + return getCurrentExcelDoc(mxContext); +} + rtl::OUString& ScVbaApplication::getServiceImplName() { @@ -1296,3 +1166,13 @@ ScVbaApplication::getServiceNames() } return aServiceNames; } + +namespace application +{ +namespace sdecl = comphelper::service_decl; +sdecl::vba_service_class_ > serviceImpl; +extern sdecl::ServiceDecl const serviceDecl( + serviceImpl, + "ScVbaApplication", + "ooo.vba.excel.Application" ); +} diff --git a/sc/source/ui/vba/vbaapplication.hxx b/sc/source/ui/vba/vbaapplication.hxx index dd828298fe2a..8d5f4a3b2354 100644 --- a/sc/source/ui/vba/vbaapplication.hxx +++ b/sc/source/ui/vba/vbaapplication.hxx @@ -35,21 +35,25 @@ #include #include -#include "vbahelperinterface.hxx" +#include +#include +#include -typedef InheritedHelperInterfaceImpl1< ov::excel::XApplication > ScVbaApplication_BASE; +//typedef InheritedHelperInterfaceImpl1< ov::excel::XApplication > ScVbaApplication_BASE; +typedef cppu::ImplInheritanceHelper1< VbaApplicationBase, ov::excel::XApplication > ScVbaApplication_BASE; class ScVbaApplication : public ScVbaApplication_BASE { private: sal_Int32 m_xCalculation; rtl::OUString getOfficePath( const rtl::OUString& sPath ) throw ( css::uno::RuntimeException ); +protected: + virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException); public: - ScVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext ); + ScVbaApplication( const css::uno::Reference< css::uno::XComponentContext >& m_xContext ); virtual ~ScVbaApplication(); - // XHelperInterface ( parent is itself ) - virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; } + virtual SfxObjectShell* GetDocShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException); // XApplication virtual ::rtl::OUString SAL_CALL PathSeparator( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); @@ -68,15 +72,10 @@ public: virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getActiveCell() throw ( css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getScreenUpdating() throw (css::uno::RuntimeException); - virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getDisplayStatusBar() throw (css::uno::RuntimeException); - virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (css::uno::RuntimeException); virtual ::sal_Bool SAL_CALL getDisplayFormulaBar() throw ( css::uno::RuntimeException ); virtual void SAL_CALL setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException ); virtual css::uno::Reference< ov::XAssistant > SAL_CALL getAssistant() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XWorkbook > SAL_CALL getThisWorkbook() throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL Workbooks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL Worksheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); @@ -85,7 +84,6 @@ public: virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& DialogIndex ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getCutCopyMode() throw (css::uno::RuntimeException); virtual void SAL_CALL setCutCopyMode( const css::uno::Any& _cutcopymode ) throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getStatusBar() throw (css::uno::RuntimeException); virtual void SAL_CALL setStatusBar( const css::uno::Any& _statusbar ) throw (css::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getCursor() throw (css::uno::RuntimeException); @@ -103,6 +101,7 @@ public: virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Union( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException); virtual void SAL_CALL Volatile( const css::uno::Any& Volatile ) throw (css::uno::RuntimeException ); virtual void SAL_CALL DoEvents() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Caller( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); // XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence getServiceNames(); diff --git a/sc/source/ui/vba/vbaassistant.hxx b/sc/source/ui/vba/vbaassistant.hxx index a91d1bfd9c39..fa811f548430 100644 --- a/sc/source/ui/vba/vbaassistant.hxx +++ b/sc/source/ui/vba/vbaassistant.hxx @@ -40,8 +40,8 @@ #include -#include "vbahelper.hxx" -#include "vbahelperinterface.hxx" +#include "excelvbahelper.hxx" +#include typedef ::cppu::WeakImplHelper1< ov::XAssistant > Assistant; typedef InheritedHelperInterfaceImpl< Assistant > ScVbaAssistantImpl_BASE; diff --git a/sc/source/ui/vba/vbaaxes.hxx b/sc/source/ui/vba/vbaaxes.hxx index e0bfbe350acb..62be9ba97a39 100644 --- a/sc/source/ui/vba/vbaaxes.hxx +++ b/sc/source/ui/vba/vbaaxes.hxx @@ -32,7 +32,7 @@ #include #include #include -#include "vbacollectionimpl.hxx" +#include typedef CollTestImplHelper< ov::excel::XAxes > ScVbaAxes_BASE; class ScVbaAxes : public ScVbaAxes_BASE diff --git a/sc/source/ui/vba/vbaaxis.hxx b/sc/source/ui/vba/vbaaxis.hxx index b8fafed82ee1..72ff614805e4 100644 --- a/sc/source/ui/vba/vbaaxis.hxx +++ b/sc/source/ui/vba/vbaaxis.hxx @@ -32,8 +32,8 @@ #include #include #include -#include "vbahelperinterface.hxx" - +#include +#include typedef InheritedHelperInterfaceImpl1< ov::excel::XAxis > ScVbaAxis_BASE; class ScVbaChart; class ScVbaAxis : public ScVbaAxis_BASE diff --git a/sc/source/ui/vba/vbaborders.hxx b/sc/source/ui/vba/vbaborders.hxx index bcaecff05aff..ec7deed20ebe 100644 --- a/sc/source/ui/vba/vbaborders.hxx +++ b/sc/source/ui/vba/vbaborders.hxx @@ -38,7 +38,7 @@ #include -#include "vbacollectionimpl.hxx" +#include typedef CollTestImplHelper< ov::excel::XBorders > ScVbaBorders_BASE; class ScVbaPalette; diff --git a/sc/source/ui/vba/vbabutton.cxx b/sc/source/ui/vba/vbabutton.cxx deleted file mode 100644 index 4c21c70c88b5..000000000000 --- a/sc/source/ui/vba/vbabutton.cxx +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbabutton.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "vbabutton.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); -ScVbaButton::ScVbaButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ -} - -// Attributes -rtl::OUString SAL_CALL -ScVbaButton::getCaption() throw (css::uno::RuntimeException) -{ - rtl::OUString Label; - m_xProps->getPropertyValue( LABEL ) >>= Label; - return Label; -} - -void SAL_CALL -ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) -{ - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); -} - -rtl::OUString& -ScVbaButton::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaButton") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaButton::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Button" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbabutton.hxx b/sc/source/ui/vba/vbabutton.hxx deleted file mode 100644 index a2ce28b3ba53..000000000000 --- a/sc/source/ui/vba/vbabutton.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbabutton.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_BUTTON_HXX -#define SC_VBA_BUTTON_HXX -#include -#include - -#include "vbacontrol.hxx" -#include "vbahelper.hxx" - -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XButton > ButtonImpl_BASE; - -class ScVbaButton : public ButtonImpl_BASE -{ -public: - ScVbaButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); - // Attributes - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; -#endif //SC_VBA_BUTTON_HXX diff --git a/sc/source/ui/vba/vbacharacters.hxx b/sc/source/ui/vba/vbacharacters.hxx index 10fcfc5bbddf..092d80a91e02 100644 --- a/sc/source/ui/vba/vbacharacters.hxx +++ b/sc/source/ui/vba/vbacharacters.hxx @@ -36,7 +36,7 @@ #include #include -#include "vbahelperinterface.hxx" +#include #include "vbapalette.hxx" typedef InheritedHelperInterfaceImpl1< ov::excel::XCharacters > ScVbaCharacters_BASE; diff --git a/sc/source/ui/vba/vbachart.hxx b/sc/source/ui/vba/vbachart.hxx index 19efc430f2fd..3ec8e77c4dc5 100644 --- a/sc/source/ui/vba/vbachart.hxx +++ b/sc/source/ui/vba/vbachart.hxx @@ -41,7 +41,7 @@ #include #include #include -#include "vbahelperinterface.hxx" +#include typedef InheritedHelperInterfaceImpl1 ChartImpl_BASE; diff --git a/sc/source/ui/vba/vbachartobject.cxx b/sc/source/ui/vba/vbachartobject.cxx index feecb7182d97..85104ff20cde 100644 --- a/sc/source/ui/vba/vbachartobject.cxx +++ b/sc/source/ui/vba/vbachartobject.cxx @@ -120,10 +120,11 @@ ScVbaChartObject::Activate() throw ( script::BasicErrorException ) { try { - // #TODO #FIXME should be ThisWorkbook or equivelant - // XModel + // #TODO #FIXME should be ThisWorkbook or equivelant, or in + // fact probably the chart object should be created with + // the XModel owner //uno::Reference< view::XSelectionSupplier > xSelectionSupplier( getXModel().getCurrentController()); - uno::Reference< view::XSelectionSupplier > xSelectionSupplier( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW ); + uno::Reference< view::XSelectionSupplier > xSelectionSupplier( getCurrentExcelDoc(mxContext)->getCurrentController(), uno::UNO_QUERY_THROW ); xSelectionSupplier->select(uno::makeAny(xShape)); } catch (uno::Exception& ) diff --git a/sc/source/ui/vba/vbachartobject.hxx b/sc/source/ui/vba/vbachartobject.hxx index 3b2b6b3469ec..c7bfbd15c4c1 100644 --- a/sc/source/ui/vba/vbachartobject.hxx +++ b/sc/source/ui/vba/vbachartobject.hxx @@ -36,7 +36,7 @@ #include #include #include -#include "vbahelperinterface.hxx" +#include #include typedef InheritedHelperInterfaceImpl1 ChartObjectImpl_BASE; diff --git a/sc/source/ui/vba/vbachartobjects.hxx b/sc/source/ui/vba/vbachartobjects.hxx index a966dbb66518..5a11e92e8dbc 100644 --- a/sc/source/ui/vba/vbachartobjects.hxx +++ b/sc/source/ui/vba/vbachartobjects.hxx @@ -36,8 +36,8 @@ #include #include #include -#include"vbacollectionimpl.hxx" -#include "vbahelper.hxx" +#include +#include "excelvbahelper.hxx" #include typedef CollTestImplHelper< ov::excel::XChartObjects > ChartObjects_BASE; diff --git a/sc/source/ui/vba/vbacharts.cxx b/sc/source/ui/vba/vbacharts.cxx index 73be2b84e6c6..4c21720ca7f3 100644 --- a/sc/source/ui/vba/vbacharts.cxx +++ b/sc/source/ui/vba/vbacharts.cxx @@ -35,11 +35,9 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; -ScVbaCharts::ScVbaCharts( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext ) : Charts_BASE(_xParent, _xContext, uno::Reference< container::XIndexAccess >() ) +ScVbaCharts::ScVbaCharts( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const uno::Reference< frame::XModel >& xModel ) : Charts_BASE(_xParent, _xContext, uno::Reference< container::XIndexAccess >()) { - // #TODO #FIXME surely this is wrong, you should never use the - // currently documement ( it could be anything ) - xComponent.set( getCurrentDocument(), uno::UNO_QUERY_THROW ); + xComponent.set( xModel, uno::UNO_QUERY_THROW ); xSpreadsheetDocument.set( xComponent, uno::UNO_QUERY_THROW ); } diff --git a/sc/source/ui/vba/vbacharts.hxx b/sc/source/ui/vba/vbacharts.hxx index f3bbf80f8d16..ac804e5ac873 100644 --- a/sc/source/ui/vba/vbacharts.hxx +++ b/sc/source/ui/vba/vbacharts.hxx @@ -31,8 +31,8 @@ #define SC_VBA_CHARTS_HXX #include #include -#include"vbacollectionimpl.hxx" -#include "vbahelper.hxx" +#include +#include "excelvbahelper.hxx" #include typedef CollTestImplHelper< ov::excel::XCharts > Charts_BASE; @@ -43,7 +43,7 @@ class ScVbaCharts : public Charts_BASE css::uno::Reference< css::sheet::XSpreadsheetDocument > xSpreadsheetDocument; css::uno::Reference< css::lang::XComponent > xComponent; public: - ScVbaCharts( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext ); + ScVbaCharts( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::frame::XModel >& xModel ); // XCharts virtual css::uno::Any SAL_CALL Add() throw (css::script::BasicErrorException, css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XChart > SAL_CALL getActiveChart( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); diff --git a/sc/source/ui/vba/vbacheckbox.cxx b/sc/source/ui/vba/vbacheckbox.cxx deleted file mode 100644 index 0a53d05f985f..000000000000 --- a/sc/source/ui/vba/vbacheckbox.cxx +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include "vbacheckbox.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); -const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") ); -ScVbaCheckbox::ScVbaCheckbox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : CheckBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ -} - -// Attributes -rtl::OUString SAL_CALL -ScVbaCheckbox::getCaption() throw (css::uno::RuntimeException) -{ - rtl::OUString Label; - m_xProps->getPropertyValue( LABEL ) >>= Label; - return Label; -} - -void SAL_CALL -ScVbaCheckbox::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) -{ - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); -} - -uno::Any SAL_CALL -ScVbaCheckbox::getValue() throw (css::uno::RuntimeException) -{ - sal_Int16 nValue = -1; - m_xProps->getPropertyValue( STATE ) >>= nValue; - if( nValue != 0 ) - nValue = -1; -// return uno::makeAny( nValue ); -// I must be missing something MSO says value should be -1 if selected, 0 if not -// selected - return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False ); -} - -void SAL_CALL -ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException) -{ - sal_Int16 nValue = 0; - sal_Bool bValue = false; - if( _value >>= nValue ) - { - if( nValue == -1) - nValue = 1; - } - else if ( _value >>= bValue ) - { - if ( bValue ) - nValue = 1; - } - m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); -} -rtl::OUString& -ScVbaCheckbox::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCheckbox") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaCheckbox::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.CheckBox" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbacheckbox.hxx b/sc/source/ui/vba/vbacheckbox.hxx deleted file mode 100644 index 58805c6b4b7c..000000000000 --- a/sc/source/ui/vba/vbacheckbox.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_CHECKBOX_HXX -#define SC_VBA_CHECKBOX_HXX -#include -#include - -#include "vbacontrol.hxx" -#include "vbahelper.hxx" - -typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE; - -class ScVbaCheckbox : public CheckBoxImpl_BASE -{ -public: - ScVbaCheckbox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); - // Attributes - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; -#endif //SC_VBA_CHECKBOX_HXX diff --git a/sc/source/ui/vba/vbacollectionimpl.cxx b/sc/source/ui/vba/vbacollectionimpl.cxx deleted file mode 100644 index fdf7a2ebc976..000000000000 --- a/sc/source/ui/vba/vbacollectionimpl.cxx +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbacollectionimpl.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include "vbaglobals.hxx" -using namespace ::com::sun::star; -using namespace ::ooo::vba; - - -ScVbaCollectionBaseImpl::ScVbaCollectionBaseImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : m_xContext( xContext ), m_xIndexAccess( xIndexAccess ) -{ - m_xNameAccess.set( xIndexAccess, uno::UNO_QUERY ); -} - -uno::Any -ScVbaCollectionBaseImpl::getItemByStringIndex( const rtl::OUString& sIndex ) throw (::uno::RuntimeException) -{ - if ( !m_xNameAccess.is() ) - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBaseImpl string index access not supported by this object") ), uno::Reference< uno::XInterface >() ); - - return createCollectionObject( m_xNameAccess->getByName( sIndex ) ); -} - -uno::Any -ScVbaCollectionBaseImpl::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeException) -{ - if ( !m_xIndexAccess.is() ) - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBaseImpl numeric index access not supported by this object") ), uno::Reference< uno::XInterface >() ); - if ( nIndex <= 0 ) - { - throw lang::IndexOutOfBoundsException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "index is 0 or negative" ) ), - uno::Reference< uno::XInterface >() ); - } - // need to adjust for vba index ( for which first element is 1 ) - return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) ); -} - -::sal_Int32 SAL_CALL -ScVbaCollectionBaseImpl::getCount() throw (uno::RuntimeException) -{ - return m_xIndexAccess->getCount(); -} - -uno::Any SAL_CALL -ScVbaCollectionBaseImpl::getParent() throw (uno::RuntimeException) -{ - // #TODO #FIXME investigate whether this makes sense - uno::Reference< excel::XApplication > xApplication = - ScVbaGlobals::getGlobalsImpl( m_xContext )->getApplication(); - uno::Reference< excel::XWorkbook > xWorkbook; - if ( xApplication.is() ) - { - xWorkbook = xApplication->getActiveWorkbook(); - } - return uno::Any( xWorkbook ); -} - -::sal_Int32 SAL_CALL ScVbaCollectionBaseImpl::getCreator() throw (uno::RuntimeException) -{ - // #TODO #FIXE some sort of implementation - //SC_VBA_STUB(); - return 0; -} -uno::Reference< excel::XApplication > SAL_CALL ScVbaCollectionBaseImpl::getApplication() throw (uno::RuntimeException) -{ - // #TODO #FIXME investigate whether this makes sense - uno::Reference< excel::XApplication > xApplication = - ScVbaGlobals::getGlobalsImpl( m_xContext )->getApplication(); - return xApplication; -} - -uno::Any SAL_CALL ScVbaCollectionBaseImpl::Item( const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - if ( aIndex.getValueTypeClass() != uno::TypeClass_STRING ) - { - sal_Int32 nIndex = 0; - - if ( ( aIndex >>= nIndex ) != sal_True ) - { - rtl::OUString message; - message = rtl::OUString::createFromAscii( - "Couldn't convert index to Int32"); - throw lang::IndexOutOfBoundsException( message, - uno::Reference< uno::XInterface >() ); - } - return getItemByIntIndex( nIndex ); - } - rtl::OUString aStringSheet; - - aIndex >>= aStringSheet; - return getItemByStringIndex( aStringSheet ); -} - -::rtl::OUString SAL_CALL -ScVbaCollectionBaseImpl::getDefaultMethodName( ) throw (css::uno::RuntimeException) -{ - const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Item") ); - return sName; -} - - // XElementAccess - -::sal_Bool SAL_CALL ScVbaCollectionBaseImpl::hasElements() throw (uno::RuntimeException) -{ - return ( m_xIndexAccess->getCount() > 0 ); -} - - diff --git a/sc/source/ui/vba/vbacollectionimpl.hxx b/sc/source/ui/vba/vbacollectionimpl.hxx deleted file mode 100644 index 14fceb1b5f71..000000000000 --- a/sc/source/ui/vba/vbacollectionimpl.hxx +++ /dev/null @@ -1,259 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbacollectionimpl.hxx,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_COLLECTION_IMPL_HXX -#define SC_VBA_COLLECTION_IMPL_HXX - -#include -//#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "vbahelper.hxx" -#include "vbahelperinterface.hxx" -#include "vbaglobals.hxx" - -#include - -typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE; - -class EnumerationHelperImpl : public EnumerationHelper_BASE -{ -protected: - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::container::XEnumeration > m_xEnumeration; -public: - - EnumerationHelperImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xContext( xContext ), m_xEnumeration( xEnumeration ) { } - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); } -}; - -// a wrapper class for a providing a XIndexAccess, XNameAccess, XEnumerationAccess impl based on providing a vector of interfaces -// only requirement is the object needs to implement XName - - - -typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE; - -template< typename Ifc1 > -class XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE -{ -public: -typedef std::vector< css::uno::Reference< Ifc1 > > XNamedVec; -private: - - class XNamedEnumerationHelper : public EnumerationHelper_BASE - { - XNamedVec mXNamedVec; - typename XNamedVec::iterator mIt; - public: - XNamedEnumerationHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), mIt( mXNamedVec.begin() ) {} - - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) - { - return ( mIt != mXNamedVec.end() ); - } - - virtual css::uno::Any SAL_CALL nextElement( ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException) - { - if ( hasMoreElements() ) - return css::uno::makeAny( *mIt++ ); - throw css::container::NoSuchElementException(); - } - }; - -protected: - XNamedVec mXNamedVec; - typename XNamedVec::iterator cachePos; -public: - XNamedObjectCollectionHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), cachePos(mXNamedVec.begin()) {} - // XElementAccess - virtual css::uno::Type SAL_CALL getElementType( ) throw (css::uno::RuntimeException) { return Ifc1::static_type(0); } - virtual ::sal_Bool SAL_CALL hasElements( ) throw (css::uno::RuntimeException) { return ( mXNamedVec.size() > 0 ); } - // XNameAcess - virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException) - { - if ( !hasByName(aName) ) - throw css::container::NoSuchElementException(); - return css::uno::makeAny( *cachePos ); - } - virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (css::uno::RuntimeException) - { - css::uno::Sequence< rtl::OUString > sNames( mXNamedVec.size() ); - rtl::OUString* pString = sNames.getArray(); - typename XNamedVec::iterator it = mXNamedVec.begin(); - typename XNamedVec::iterator it_end = mXNamedVec.end(); - - for ( ; it != it_end; ++it, ++pString ) - { - css::uno::Reference< css::container::XNamed > xName( *it, css::uno::UNO_QUERY_THROW ); - *pString = xName->getName(); - } - return sNames; - } - virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException) - { - cachePos = mXNamedVec.begin(); - typename XNamedVec::iterator it_end = mXNamedVec.end(); - for ( ; cachePos != it_end; ++cachePos ) - { - css::uno::Reference< css::container::XNamed > xName( *cachePos, css::uno::UNO_QUERY_THROW ); - if ( aName.equals( xName->getName() ) ) - break; - } - return ( cachePos != it_end ); - } - - // XElementAccess - virtual ::sal_Int32 SAL_CALL getCount( ) throw (css::uno::RuntimeException) { return mXNamedVec.size(); } - virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException ) - { - if ( Index < 0 || Index >= getCount() ) - throw css::lang::IndexOutOfBoundsException(); - - return css::uno::makeAny( mXNamedVec[ Index ] ); - - } - // XEnumerationAccess - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) throw (css::uno::RuntimeException) - { - return new XNamedEnumerationHelper( mXNamedVec ); - } -}; - -// including a HelperInterface implementation -template< typename Ifc1 > -class ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc1 > -{ -typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase; -protected: - css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess; - css::uno::Reference< css::container::XNameAccess > m_xNameAccess; - - virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException) - { - if ( !m_xNameAccess.is() ) - throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase string index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() ); - - return createCollectionObject( m_xNameAccess->getByName( sIndex ) ); - } - - virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException) - { - if ( !m_xIndexAccess.is() ) - throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase numeric index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() ); - if ( nIndex <= 0 ) - { - throw css::lang::IndexOutOfBoundsException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "index is 0 or negative" ) ), - css::uno::Reference< css::uno::XInterface >() ); - } - // need to adjust for vba index ( for which first element is 1 ) - return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) ); - } -public: - ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); } - //XCollection - virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException) - { - return m_xIndexAccess->getCount(); - } - - virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw (css::uno::RuntimeException) - { - if ( Index1.getValueTypeClass() != css::uno::TypeClass_STRING ) - { - sal_Int32 nIndex = 0; - - if ( ( Index1 >>= nIndex ) != sal_True ) - { - rtl::OUString message; - message = rtl::OUString::createFromAscii( - "Couldn't convert index to Int32"); - throw css::lang::IndexOutOfBoundsException( message, - css::uno::Reference< css::uno::XInterface >() ); - } - return getItemByIntIndex( nIndex ); - } - rtl::OUString aStringSheet; - - Index1 >>= aStringSheet; - return getItemByStringIndex( aStringSheet ); - } - // XDefaultMethod - ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (css::uno::RuntimeException) - { - const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Item") ); - return sName; - } - // XEnumerationAccess - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0; - - // XElementAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0; - // XElementAccess - virtual ::sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException) - { - return ( m_xIndexAccess->getCount() > 0 ); - } - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0; - -}; - -typedef ::cppu::WeakImplHelper1 XCollection_InterfacesBASE; - -typedef ScVbaCollectionBase< XCollection_InterfacesBASE > CollImplBase1; -// compatible with the old collections ( pre XHelperInterface base class ) ( some internal objects still use this ) -class ScVbaCollectionBaseImpl : public CollImplBase1 -{ -public: - ScVbaCollectionBaseImpl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : CollImplBase1( xParent, xContext, xIndexAccess){} - -}; - -template // where Ifc must implement XCollectionTest -class CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > -{ -typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1; - -public: - CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess ) {} -}; - - -#endif //SC_VBA_COLLECTION_IMPL_HXX diff --git a/sc/source/ui/vba/vbacolorformat.cxx b/sc/source/ui/vba/vbacolorformat.cxx deleted file mode 100644 index df918e9d15fc..000000000000 --- a/sc/source/ui/vba/vbacolorformat.cxx +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbacolorformat.cxx,v $ - * $Revision: 1.3.146.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include -#include "vbacolorformat.hxx" - -using namespace ooo::vba; -using namespace com::sun::star; - -sal_Int32 -MsoColorIndizes::getColorIndex( sal_Int32 nIndex ) -{ - const static sal_Int32 COLORINDIZES[56] = - { HAPICOLOR_BLACK, HAPICOLOR_WITHE, HAPICOLOR_RED, HAPICOLOR_BRIGHTGREEN, HAPICOLOR_BLUE, HAPICOLOR_YELLOW, HAPICOLOR_PINK, - HAPICOLOR_TURQUOISE, HAPICOLOR_DARKRED, HAPICOLOR_GREEN, HAPICOLOR_DARKBLUE, HAPICOLOR_DARKYELLOW, HAPICOLOR_VIOLET, - HAPICOLOR_TEAL, HAPICOLOR_GRAY_25_PERCENT, HAPICOLOR_GRAY_50_PERCENT, HAPICOLOR_PERIWINCKLE, HAPICOLOR_PLUM, - HAPICOLOR_IVORY, HAPICOLOR_LIGHTTURQUOISE, HAPICOLOR_DARKPRUPLE, HAPICOLOR_CORAL, HAPICOLOR_OCEANBLUE, HAPICOLOR_ICEBLUE, - HAPICOLOR_GREEN, HAPICOLOR_PINK, HAPICOLOR_YELLOW, HAPICOLOR_TURQUOISE, HAPICOLOR_VIOLET, HAPICOLOR_DARKRED, HAPICOLOR_TEAL, - HAPICOLOR_BLUE, HAPICOLOR_SKYBLUE, HAPICOLOR_LIGHTTURQUOISE, HAPICOLOR_LIGHTGREEN, HAPICOLOR_LIGHTYELLOW, HAPICOLOR_PALEBLUE, - HAPICOLOR_ROSE, HAPICOLOR_LAVENDER, HAPICOLOR_TAN, HAPICOLOR_LIGHTBLUE, HAPICOLOR_AQUA, HAPICOLOR_LIME, HAPICOLOR_GOLD, - HAPICOLOR_LIGHTORANGE, HAPICOLOR_ORANGE, HAPICOLOR_BLUEGRAY, HAPICOLOR_GRAY_40_PERCENT, HAPICOLOR_DARKTEAL, - HAPICOLOR_SEAGREEN, HAPICOLOR_NONAME, HAPICOLOR_OLIVEGREEN, HAPICOLOR_BROWN, HAPICOLOR_PLUM, HAPICOLOR_INDIGO, - HAPICOLOR_GRAY_80_PERCENT - }; - return COLORINDIZES[nIndex]; -} -ScVbaColorFormat::ScVbaColorFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XHelperInterface > xInternalParent, const uno::Reference< drawing::XShape > xShape, const sal_Int16 nColorFormatType ) : ScVbaColorFormat_BASE( xParent, xContext ), m_xInternalParent( xInternalParent ), m_xShape( xShape ), m_nColorFormatType( nColorFormatType ) -{ - m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); - m_nFillFormatBackColor = 0; - try - { - uno::Reference< ov::msforms::XFillFormat > xFillFormat( xInternalParent, uno::UNO_QUERY_THROW ); - m_pFillFormat = ( ScVbaFillFormat* )( xFillFormat.get() ); - }catch ( uno::RuntimeException e ) - { - m_pFillFormat = NULL; - } -} - -void -ScVbaColorFormat::setColorFormat( sal_Int16 _ntype ) -{ - m_nColorFormatType = _ntype; -} - -// Attribute -sal_Int32 SAL_CALL -ScVbaColorFormat::getRGB() throw (uno::RuntimeException) -{ - sal_Int32 nRGB = 0; - switch( m_nColorFormatType ) - { - case ColorFormatType::LINEFORMAT_FORECOLOR: - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LineColor") ) >>= nRGB; - break; - case ColorFormatType::LINEFORMAT_BACKCOLOR: - //TODO BackColor not supported - // m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("Color"), uno::makeAny( nRGB ) ); - break; - case ColorFormatType::FILLFORMAT_FORECOLOR: - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillColor") ) >>= nRGB; - break; - case ColorFormatType::FILLFORMAT_BACKCOLOR: - nRGB = m_nFillFormatBackColor; - break; - default: - throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() ); - } - nRGB = OORGBToXLRGB( nRGB ); - return nRGB; -} - -void SAL_CALL -ScVbaColorFormat::setRGB( sal_Int32 _rgb ) throw (uno::RuntimeException) -{ - sal_Int32 nRGB = XLRGBToOORGB( _rgb ); - switch( m_nColorFormatType ) - { - case ColorFormatType::LINEFORMAT_FORECOLOR: - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineColor" ), uno::makeAny( nRGB ) ); - break; - case ColorFormatType::LINEFORMAT_BACKCOLOR: - // TODO BackColor not supported - break; - case ColorFormatType::FILLFORMAT_FORECOLOR: - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor" ), uno::makeAny( nRGB ) ); - if( m_pFillFormat ) - { - m_pFillFormat->setForeColorAndInternalStyle(nRGB); - } - break; - case ColorFormatType::FILLFORMAT_BACKCOLOR: - m_nFillFormatBackColor = nRGB; - if( m_pFillFormat ) - { - m_pFillFormat->setForeColorAndInternalStyle(nRGB); - } - break; - default: - throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() ); - } -} - -sal_Int32 SAL_CALL -ScVbaColorFormat::getSchemeColor() throw (uno::RuntimeException) -{ - sal_Int32 nColor = getRGB(); - // #TODO I guess the number of elements is determined by the correct scheme - // the implementation here seems to be a rehash of color index ( which seems to be a - // different thing ) - I would guess we need to know/import etc. the correct color scheme - // or at least find out a little more - sal_Int32 i = 0; - for( ; i < 56; i++ ) - { - if( nColor == MsoColorIndizes::getColorIndex(i) ) - break; - } - - if( i == 56 ) // this is most likely an error condition - --i; - return i; - // #TODO figure out what craziness is this, - // the 56 colors seems incorrect, as in default XL ( 2003 ) there are 80 colors -/* - if( i == 56 ) - { - i = -2; - } - - return ( i + 2 ); -*/ -} - -void SAL_CALL -ScVbaColorFormat::setSchemeColor( sal_Int32 _schemecolor ) throw (uno::RuntimeException) -{ - // the table is 0 based - sal_Int32 nColor = MsoColorIndizes::getColorIndex( _schemecolor ); - // nColor is already xl RGB - setRGB( nColor ); -} - - -rtl::OUString& -ScVbaColorFormat::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaColorFormat") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaColorFormat::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ColorFormat" ) ); - } - return aServiceNames; -} - diff --git a/sc/source/ui/vba/vbacolorformat.hxx b/sc/source/ui/vba/vbacolorformat.hxx deleted file mode 100644 index cff4f7c3719d..000000000000 --- a/sc/source/ui/vba/vbacolorformat.hxx +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbacolorformat.hxx,v $ - * $Revision: 1.3.146.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_XCOLORFORMAT_HXX -#define SC_VBA_XCOLORFORMAT_HXX - -#include -#include -#include -#include "vbahelperinterface.hxx" -#include "vbafillformat.hxx" - -typedef InheritedHelperInterfaceImpl1< ov::msforms::XColorFormat > ScVbaColorFormat_BASE; - -class ColorFormatType -{ -public: - const static sal_Int16 LINEFORMAT_FORECOLOR = 1; - const static sal_Int16 LINEFORMAT_BACKCOLOR = 2; - const static sal_Int16 FILLFORMAT_FORECOLOR = 3; - const static sal_Int16 FILLFORMAT_BACKCOLOR = 4; - const static sal_Int16 THREEDFORMAT_EXTRUSIONCOLOR = 5; -}; - -struct MsoColorIndizes -{ - const static sal_Int32 HAPICOLOR_BLACK = 0; - const static sal_Int32 HAPICOLOR_WITHE = 16777215; - const static sal_Int32 HAPICOLOR_RED = 16711680; - const static sal_Int32 HAPICOLOR_BRIGHTGREEN = 65280; - const static sal_Int32 HAPICOLOR_BLUE = 255; - const static sal_Int32 HAPICOLOR_YELLOW = 16776960; - const static sal_Int32 HAPICOLOR_PINK = 16711935; - const static sal_Int32 HAPICOLOR_TURQUOISE = 65535; - const static sal_Int32 HAPICOLOR_DARKRED = 8388608; - const static sal_Int32 HAPICOLOR_GREEN = 32768; - const static sal_Int32 HAPICOLOR_DARKBLUE = 128; - const static sal_Int32 HAPICOLOR_DARKYELLOW = 8421376; - const static sal_Int32 HAPICOLOR_VIOLET = 8388736; - const static sal_Int32 HAPICOLOR_TEAL = 32896; - const static sal_Int32 HAPICOLOR_GRAY_25_PERCENT = 12632256; - const static sal_Int32 HAPICOLOR_GRAY_50_PERCENT = 8421504; - const static sal_Int32 HAPICOLOR_PERIWINCKLE = 10066431; - const static sal_Int32 HAPICOLOR_PLUM = 10040166; - const static sal_Int32 HAPICOLOR_IVORY = 16777164; - const static sal_Int32 HAPICOLOR_LIGHTTURQUOISE = 13434879; - const static sal_Int32 HAPICOLOR_DARKPRUPLE = 6684774; - const static sal_Int32 HAPICOLOR_CORAL = 16744576; - const static sal_Int32 HAPICOLOR_OCEANBLUE = 26316; - const static sal_Int32 HAPICOLOR_ICEBLUE = 13421823; - const static sal_Int32 HAPICOLOR_SKYBLUE = 52479; - const static sal_Int32 HAPICOLOR_LIGHTGREEN = 13434828; - const static sal_Int32 HAPICOLOR_LIGHTYELLOW = 16777113; - const static sal_Int32 HAPICOLOR_PALEBLUE = 10079487; - const static sal_Int32 HAPICOLOR_ROSE = 16751052; - const static sal_Int32 HAPICOLOR_LAVENDER = 13408767; - const static sal_Int32 HAPICOLOR_TAN = 16764057; - const static sal_Int32 HAPICOLOR_LIGHTBLUE = 3368703; - const static sal_Int32 HAPICOLOR_AQUA = 3394764; - const static sal_Int32 HAPICOLOR_LIME = 10079232; - const static sal_Int32 HAPICOLOR_GOLD = 16763904; - const static sal_Int32 HAPICOLOR_LIGHTORANGE = 16750848; - const static sal_Int32 HAPICOLOR_ORANGE = 16737792; - const static sal_Int32 HAPICOLOR_BLUEGRAY = 6710937; - const static sal_Int32 HAPICOLOR_GRAY_40_PERCENT = 9868950; - const static sal_Int32 HAPICOLOR_DARKTEAL = 13158; - const static sal_Int32 HAPICOLOR_SEAGREEN = 3381606; - const static sal_Int32 HAPICOLOR_NONAME = 13056; - const static sal_Int32 HAPICOLOR_OLIVEGREEN = 3355392; - const static sal_Int32 HAPICOLOR_BROWN = 10040064; - const static sal_Int32 HAPICOLOR_INDIGO = 3355545; - const static sal_Int32 HAPICOLOR_GRAY_80_PERCENT = 3355443; - - static sal_Int32 getColorIndex( sal_Int32 nIndex ); - -}; - -class ScVbaColorFormat : public ScVbaColorFormat_BASE -{ -private: - css::uno::Reference< ov::XHelperInterface > m_xInternalParent; - css::uno::Reference< css::drawing::XShape > m_xShape; - css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; - ScVbaFillFormat *m_pFillFormat; - sal_Int16 m_nColorFormatType; - sal_Int32 m_nFillFormatBackColor; -protected: - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); - void setColorFormat( sal_Int16 nType ); -public: - ScVbaColorFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XHelperInterface > xInternalParent, const css::uno::Reference< css::drawing::XShape > xShape, const sal_Int16 nColorFormatType ); - - // Attributes - virtual sal_Int32 SAL_CALL getRGB() throw (css::uno::RuntimeException); - virtual void SAL_CALL setRGB( sal_Int32 _rgb ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSchemeColor() throw (css::uno::RuntimeException); - virtual void SAL_CALL setSchemeColor( sal_Int32 _schemecolor ) throw (css::uno::RuntimeException); - -}; - -#endif//SC_VBA_XCOLORFORMAT_HXX diff --git a/sc/source/ui/vba/vbacombobox.cxx b/sc/source/ui/vba/vbacombobox.cxx deleted file mode 100644 index e13ab7d7bf2d..000000000000 --- a/sc/source/ui/vba/vbacombobox.cxx +++ /dev/null @@ -1,175 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbacombobox.cxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "vbacombobox.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - -//SelectedItems list of integer indexes -//StringItemList list of items - -const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") ); -const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ); -const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ); -const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataFieldProperty") ); - -ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialogType ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialogType( bDialogType ) -{ - mpListHelper.reset( new ListControlHelper( m_xProps ) ); - // grab the default value property name - m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName; -} - -// Attributes - - -// Value, [read] e.g. getValue returns the value of ooo Text propery e.g. the value in -// the drop down -uno::Any SAL_CALL -ScVbaComboBox::getValue() throw (uno::RuntimeException) -{ - return m_xProps->getPropertyValue( sSourceName ); -} - -void SAL_CALL -ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException) -{ - uno::Sequence< sal_Int16 > sSelection(1); - _value >>= sSelection[ 0 ]; - m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( sSelection ) ); -} - -uno::Any SAL_CALL -ScVbaComboBox::getListIndex() throw (uno::RuntimeException) -{ - uno::Sequence< rtl::OUString > sItems; - m_xProps->getPropertyValue( ITEMS ) >>= sItems; - // should really return the item that has focus regardless of - // it been selected - if ( sItems.getLength() > 0 ) - { - rtl::OUString sText = getText(); - sal_Int32 nLen = sItems.getLength(); - for ( sal_Int32 index = 0; sText.getLength() && index < nLen; ++index ) - { - if ( sItems[ index ].equals( sText ) ) - { - OSL_TRACE("getListIndex returning %d", index ); - return uno::makeAny( index ); - } - - } - } - OSL_TRACE("getListIndex returning %d", -1 ); - return uno::makeAny( sal_Int32( -1 ) ); -} - -// Value, [write]e.g. setValue sets the value in the drop down, and if the value is one -// of the values in the list then the selection is also set -void SAL_CALL -ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException) -{ - m_xProps->setPropertyValue( sSourceName, _value ); -} - -// see Value - -::rtl::OUString SAL_CALL -ScVbaComboBox::getText() throw (uno::RuntimeException) -{ - rtl::OUString result; - getValue() >>= result; - return result; -} - -void SAL_CALL -ScVbaComboBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException) -{ - setValue( uno::makeAny( _text ) ); // seems the same -} - -// Methods -void SAL_CALL -ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException) -{ - mpListHelper->AddItem( pvargItem, pvargIndex ); -} - -void SAL_CALL -ScVbaComboBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException) - { - mpListHelper->removeItem( index ); -} - -void SAL_CALL -ScVbaComboBox::Clear( ) throw (uno::RuntimeException) - { - mpListHelper->Clear(); - } - -void SAL_CALL -ScVbaComboBox::setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException) -{ - ScVbaControl::setRowSource( _rowsource ); - mpListHelper->setRowSource( _rowsource ); - } - -sal_Int32 SAL_CALL -ScVbaComboBox::getListCount() throw (uno::RuntimeException) -{ - return mpListHelper->getListCount(); -} - -uno::Any SAL_CALL -ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException) -{ - return mpListHelper->List( pvargIndex, pvarColumn ); - } - -rtl::OUString& -ScVbaComboBox::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaComboBox") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaComboBox::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ComboBox" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbacombobox.hxx b/sc/source/ui/vba/vbacombobox.hxx deleted file mode 100644 index d1cf47c9c7b2..000000000000 --- a/sc/source/ui/vba/vbacombobox.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbacombobox.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_COMBOBOX_HXX -#define SC_VBA_COMBOBOX_HXX -#include -#include -#include -#include -#include -#include -#include -#include - -#include "vbacontrol.hxx" -#include "vbalistcontrolhelper.hxx" -#include "vbahelper.hxx" - -typedef cppu::ImplInheritanceHelper2 ComboBoxImpl_BASE; -class ScVbaComboBox : public ComboBoxImpl_BASE -{ - std::auto_ptr< ListControlHelper > mpListHelper; - rtl::OUString sSourceName; - rtl::OUString msDftPropName; - bool mbDialogType; - -public: - ScVbaComboBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialogType = false ); - - // Attributes - virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException); - virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); - virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException); - - // Methods - virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException); - virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException); - // XControl - virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); - - // XDefaultProperty - ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; - -#endif // diff --git a/sc/source/ui/vba/vbacommandbar.cxx b/sc/source/ui/vba/vbacommandbar.cxx deleted file mode 100644 index ca463a4f746b..000000000000 --- a/sc/source/ui/vba/vbacommandbar.cxx +++ /dev/null @@ -1,329 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include -#include -#include -#include -#include - -#include "vbacommandbar.hxx" -#include "vbacommandbarcontrols.hxx" -#include "vbahelper.hxx" - - -using namespace com::sun::star; -using namespace ooo::vba; - -ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, sal_Int32 nModuleType ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext ) -{ - // it's a menu bar - // only supporting factory menus ( no custom menus ) - m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW ); - initCommandBar(); - switch( nModuleType ) - { - case 0: - m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ); - break; - case 1: - m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ); - break; - default: - m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ); - } - getMenuSettings(); - m_bIsMenu = sal_True; - m_bCustom = sal_False; -} -ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext ) -{ - // it's a tool bar - m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW ); - initCommandBar(); - m_bTemporary = bTemporary; - m_bCreate = bCreate; - // get OOo ToolBarName - CommandBarNameMap::const_iterator iter = mCommandBarNameMap.find( sToolBarName.toAsciiLowerCase() ); - if( iter != mCommandBarNameMap.end() ) - { - m_sToolBarName = iter->second; - } - else - { - m_sToolBarName = sToolBarName; - } - m_sUIName = m_sToolBarName; - m_bIsMenu = sal_False; - getToolBarSettings( m_sToolBarName ); -} -void -ScVbaCommandBar::initCommandBar() throw (uno::RuntimeException) -{ - m_pScVbaCommandBars = dynamic_cast< ScVbaCommandBars* >( m_xParentHardRef.get() ); - if ( !m_pScVbaCommandBars ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Parent needs to be a ScVbaCommandBars"), uno::Reference< uno::XInterface >() ); - m_bIsMenu = sal_False; - m_bCustom = sal_False; - m_bTemporary = sal_True; - m_sToolBarName = rtl::OUString::createFromAscii(""); - m_sUIName = rtl::OUString::createFromAscii(""); - m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ); -} -void -ScVbaCommandBar::getToolBarSettings( rtl::OUString sToolBarName ) throw( uno::RuntimeException ) -{ - rtl::OUString sFactoryToolBar = rtl::OUString::createFromAscii("private:resource/toolbar/") + sToolBarName.toAsciiLowerCase(); - rtl::OUString sCustomToolBar = rtl::OUString::createFromAscii("private:resource/toolbar/custom_toolbar_") + sToolBarName; - uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xUICfgManagerSup( xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier") ), uno::UNO_QUERY_THROW ); - m_xUICfgManager.set( xUICfgManagerSup->getUIConfigurationManager( m_pScVbaCommandBars->GetModuleName() ), uno::UNO_QUERY_THROW ); - m_xUICfgPers.set( m_xUICfgManager, uno::UNO_QUERY_THROW ); - if( m_xUICfgManager->hasSettings( sFactoryToolBar ) ) - { - // exsiting standard ToolBar - m_xBarSettings.set( m_xUICfgManager->getSettings( sFactoryToolBar, sal_True ), uno::UNO_QUERY_THROW ); - m_sToolBarName = sFactoryToolBar; - } - else if( m_xUICfgManager->hasSettings( sCustomToolBar ) ) - { - // exisiting custom ToolBar - m_xBarSettings.set( m_xUICfgManager->getSettings( sCustomToolBar, sal_True ), uno::UNO_QUERY_THROW ); - m_sToolBarName = sCustomToolBar; - m_bCustom = sal_True; - } - else if( m_bCreate ) - { - // new custom ToolBar - m_xBarSettings.set( m_xUICfgManager->createSettings(), uno::UNO_QUERY_THROW ); - m_sToolBarName = sCustomToolBar; - m_bCustom = sal_True; - addCustomBar(); - } - else - throw uno::RuntimeException( rtl::OUString::createFromAscii("ToolBar do not exist"), uno::Reference< uno::XInterface >() ); - if( m_pScVbaCommandBars->GetWindows()->hasByName( m_sToolBarName ) ) - { - uno::Any aToolBar = m_pScVbaCommandBars->GetWindows()->getByName( m_sToolBarName ); - aToolBar >>= m_aToolBar; - } -} -void -ScVbaCommandBar::addCustomBar() -{ - uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); - xPropertySet->setPropertyValue(rtl::OUString::createFromAscii("UIName"), uno::makeAny( m_sUIName )); - - if( m_xUICfgManager->hasSettings(m_sToolBarName) ) - { - m_xUICfgManager->replaceSettings( m_sToolBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - else - { - m_xUICfgManager->insertSettings( m_sToolBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - if( !m_bTemporary ) - { - m_xUICfgPers->store(); - } -} -void -ScVbaCommandBar::getMenuSettings() -{ - try - { - rtl::OUString sMenuBar = rtl::OUString::createFromAscii( "private:resource/menubar/menubar" ); - uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xUICfgManagerSup( xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier") ), uno::UNO_QUERY_THROW ); - m_xUICfgManager.set( xUICfgManagerSup->getUIConfigurationManager( m_sMenuModuleName ), uno::UNO_QUERY_THROW ); - m_xUICfgPers.set( m_xUICfgManager, uno::UNO_QUERY_THROW ); - m_xBarSettings.set( m_xUICfgManager->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW ); - } - catch ( uno::Exception e) - { - OSL_TRACE( "getMenuSetting got a error\n" ); - } -} -::rtl::OUString SAL_CALL -ScVbaCommandBar::getName() throw ( uno::RuntimeException ) -{ - // This will get a "NULL length string" when Name is not set. - uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); - uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") ); - rtl::OUString sName; - aName >>= sName; - if( sName.getLength() < 1 && !m_bIsMenu ) - { - uno::Reference< container::XNameAccess > xNameAccess( m_pScVbaCommandBars->GetWindows(), uno::UNO_QUERY_THROW ); - if( xNameAccess->hasByName( m_sToolBarName ) ) - { - beans::PropertyValues aToolBar; - xNameAccess->getByName( m_sToolBarName ) >>= aToolBar; - sal_Int32 nCount = aToolBar.getLength(); - beans::PropertyValue aPropertyValue; - for( sal_Int32 i = 0; i < nCount; i++ ) - { - aPropertyValue = aToolBar[i]; - if( aPropertyValue.Name.equals( rtl::OUString::createFromAscii("UIName") ) ) - { - aPropertyValue.Value >>= sName; - return sName; - } - } - } - } - return sName; -} -void SAL_CALL -ScVbaCommandBar::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); - xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("UIName"), uno::makeAny( _name ) ); - uno::Reference< container::XIndexAccess > xIndexAccess( m_xBarSettings, uno::UNO_QUERY_THROW ); - - if( m_xUICfgManager->hasSettings( m_sToolBarName ) ) - { - m_xUICfgManager->replaceSettings( m_sToolBarName, xIndexAccess ); - } - else - { - // toolbar not found - } - if( !m_bTemporary ) - { - m_xUICfgPers->store(); - } -} -::sal_Bool SAL_CALL -ScVbaCommandBar::getVisible() throw (uno::RuntimeException) -{ - sal_Bool bVisible = sal_False; - try - { - sal_Int32 i = 0; - while( !m_aToolBar[i].Name.equals( rtl::OUString::createFromAscii( "Visible" ) ) ) - { - i++; - } - m_aToolBar[i].Value >>= bVisible; - } - catch ( uno::Exception e ) - { - } - return bVisible; -} -void SAL_CALL -ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException) -{ - try - { - uno::Reference< frame::XFrame > xFrame( getCurrentDocument()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xPropertySet( xFrame, uno::UNO_QUERY_THROW ); - uno::Reference< frame::XLayoutManager > xLayoutManager( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LayoutManager") ), uno::UNO_QUERY_THROW ); - if( _visible ) - { - xLayoutManager->createElement( m_sToolBarName ); - xLayoutManager->showElement( m_sToolBarName ); - } - else - { - xLayoutManager->hideElement( m_sToolBarName ); - xLayoutManager->destroyElement( m_sToolBarName ); - } - } - catch( uno::Exception e ) - { - OSL_TRACE( "SetVisible get an exception\n" ); - } -} -void SAL_CALL -ScVbaCommandBar::Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) -{ - if( m_bCustom ) - { - if( m_xUICfgManager->hasSettings( m_sToolBarName ) ) - { - m_xUICfgManager->removeSettings(m_sToolBarName); - // make it permanent - if( !m_bTemporary ) - { - m_xUICfgPers->store(); - } - } - else - { - // toolbar not found - // TODO throw Error - } - uno::Reference< container::XNameContainer > xNameContainer( m_pScVbaCommandBars->GetWindows(), uno::UNO_QUERY_THROW ); - if( xNameContainer->hasByName( m_sToolBarName ) ) - { - xNameContainer->removeByName( m_sToolBarName ); - } - } -} -uno::Any SAL_CALL -ScVbaCommandBar::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException) -{ - sal_Int32 nIndex; - uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >() ) ); - if( aIndex.hasValue() ) - { - if( aIndex >>= nIndex ) - { - uno::Reference< XCommandBarControl > xCommandBarControl( xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW ); - return uno::makeAny( xCommandBarControl ); - } - else - throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid index" ), uno::Reference< uno::XInterface >() ); - } - return uno::makeAny( xCommandBarControls ); -} -rtl::OUString& -ScVbaCommandBar::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBar") ); - return sImplName; -} -uno::Sequence -ScVbaCommandBar::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBar" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbacommandbar.hxx b/sc/source/ui/vba/vbacommandbar.hxx deleted file mode 100644 index 303dc0ada798..000000000000 --- a/sc/source/ui/vba/vbacommandbar.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_COMMANDBAR_HXX -#define SC_VBA_COMMANDBAR_HXX - -#include -#include -#include -#include -#include - -#include "vbahelperinterface.hxx" -#include "vbacommandbars.hxx" - -#include -typedef std::map< const rtl::OUString, rtl::OUString > CommandBarNameMap; -typedef std::pair< const rtl::OUString, rtl::OUString > CommandBarNamePair; -const CommandBarNamePair namePair[] = { - CommandBarNamePair( rtl::OUString::createFromAscii("standard"), rtl::OUString::createFromAscii("standardbar") ), - CommandBarNamePair( rtl::OUString::createFromAscii("formatting"), rtl::OUString::createFromAscii("formatobjectbar") ), -}; -static const CommandBarNameMap mCommandBarNameMap( namePair, ( namePair + sizeof(namePair) / sizeof(namePair[0]) ) ); - - -typedef InheritedHelperInterfaceImpl1< ov::XCommandBar > CommandBar_BASE; - -class ScVbaCommandBar : public CommandBar_BASE -{ -private: - rtl::OUString m_sToolBarName; - rtl::OUString m_sMenuModuleName; - rtl::OUString m_sUIName; - sal_Bool m_bTemporary; - sal_Bool m_bIsMenu; - sal_Bool m_bCustom; - sal_Bool m_bCreate; - ScVbaCommandBars* m_pScVbaCommandBars; - css::beans::PropertyValues m_aToolBar; - // hard reference for parent - css::uno::Reference< ov::XHelperInterface > m_xParentHardRef; - css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager; - css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers; - css::uno::Reference< css::container::XIndexContainer > m_xBarSettings; - void initCommandBar() throw( css::uno::RuntimeException ); -protected: - void getToolBarSettings( rtl::OUString sToolBarName ) throw( css::uno::RuntimeException ); - void getMenuSettings(); - void addCustomBar(); -public: - ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nModuleType ) throw( css::uno::RuntimeException ); - ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw( css::uno::RuntimeException ); - - sal_Bool IsMenu() { return m_bIsMenu; }; - css::uno::Reference< css::ui::XUIConfigurationManager > GetUICfgManager() { return m_xUICfgManager; }; - css::uno::Reference< css::ui::XUIConfigurationPersistence > GetUICfgPers() { return m_xUICfgPers; }; - css::uno::Reference< css::container::XIndexContainer > GetBarSettings() { return m_xBarSettings; }; - rtl::OUString GetToolBarName() { return m_sToolBarName; }; - - // Attributes - virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); - virtual void SAL_CALL setName( const ::rtl::OUString& _name ) throw (css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); - virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException); - - // Methods - virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException); - - // XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; -#endif//SC_VBA_COMMANDBAR_HXX diff --git a/sc/source/ui/vba/vbacommandbarcontrol.cxx b/sc/source/ui/vba/vbacommandbarcontrol.cxx deleted file mode 100644 index 74e38bffb81c..000000000000 --- a/sc/source/ui/vba/vbacommandbarcontrol.cxx +++ /dev/null @@ -1,403 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include "vbacommandbarcontrol.hxx" - -using namespace com::sun::star; -using namespace ooo::vba; - -uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName ) -{ - sal_Int32 nCount = aPropertyValues.getLength(); - for( sal_Int32 i = 0; i < nCount; i++ ) - { - if( aPropertyValues[i].Name.equalsIgnoreAsciiCase( sPropertyName ) ) - { - return aPropertyValues[i].Value; - } - } - return uno::Any(); -} - -beans::PropertyValues lcl_repalcePropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName, uno::Any aValue ) -{ - sal_Int32 nCount = aPropertyValues.getLength(); - for( sal_Int32 i = 0; i < nCount; i++ ) - { - if( aPropertyValues[i].Name.equalsIgnoreAsciiCase( sPropertyName ) ) - { - aPropertyValues[i].Value = aValue; - return aPropertyValues; - } - } - return aPropertyValues; -} - -ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_sName( sName ) -{ - // exsiting CommandBarBarControl - m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW ); - initObjects(); - if( m_xBarSettings->hasElements() ) - { - ScVbaCommandBarControl* pParentCommandBarControl = m_pCommandBarControls->GetParentCommandBarControl(); - if( pParentCommandBarControl ) - { - beans::PropertyValues aPropertyValues; - pParentCommandBarControl->GetCurrentSettings()->getByIndex( pParentCommandBarControl->GetPosition() ) >>= aPropertyValues; - pParentCommandBarControl->SetPropertyValues( aPropertyValues ); - m_xCurrentSettings.set( lcl_getPropertyValue( pParentCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ), uno::UNO_QUERY_THROW ); - } - if( !m_xCurrentSettings.is() ) - { - m_xCurrentSettings.set( m_xUICfgManager->getSettings( m_pCommandBarControls->GetParentToolBarName(), sal_True ), uno::UNO_QUERY_THROW ); - } - for( sal_Int32 i = 0; i < m_xCurrentSettings->getCount(); i++ ) - { - beans::PropertyValues aPropertyValuesTemp; - m_xCurrentSettings->getByIndex( i ) >>= aPropertyValuesTemp; - // Label always empty in OOo - rtl::OUString sLabel; - lcl_getPropertyValue( aPropertyValuesTemp, rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel; - if( sLabel.equalsIgnoreAsciiCase( sName ) ) - { - m_nPosition = i; - break; - } - // using CammandURL to find - rtl::OUString sCommandURL; - lcl_getPropertyValue( aPropertyValuesTemp, rtl::OUString::createFromAscii( "CommandURL" ) ) >>= sCommandURL; - sal_Int32 nLastIndex = sCommandURL.lastIndexOf( rtl::OUString::createFromAscii(":") ); - if( ( nLastIndex != -1 ) && ( ( nLastIndex + 1 ) < sCommandURL.getLength() ) ) - { - sCommandURL = sCommandURL.copy( nLastIndex + 1 ); - } - if( sCommandURL.equalsIgnoreAsciiCase( sName ) ) - { - m_nPosition = i; - break; - } - } - if( m_nPosition == -1 ) - throw uno::RuntimeException( rtl::OUString::createFromAscii("The CommandBarControl do not exist"), uno::Reference< uno::XInterface >() ); - } - if( m_bIsMenu ) - { - m_sBarName = rtl::OUString::createFromAscii("private:resource/menubar/menubar"); - } - else - { - m_sBarName = m_pCommandBarControls->GetParentToolBarName(); - } - m_bTemporary = sal_True; -} -ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, rtl::OUString sCommand, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_nPosition( nPosition ), m_bTemporary( bTemporary ) -{ - m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW ); - initObjects(); - if( sName.getLength() > 0 ) - { - m_sName = sName; - } - if( sCommand.getLength() > 0 ) - { - m_sCommand = sCommand; - } - else - { - m_sCommand = rtl::OUString::createFromAscii("vnd.openoffice.org:") + sName; - } - if( m_bIsMenu ) - { - m_sBarName = rtl::OUString::createFromAscii("private:resource/menubar/menubar"); - createNewMenuBarControl(); - } - else - { - m_sBarName = m_pCommandBarControls->GetParentToolBarName(); - createNewToolBarControl(); - } -} - -void -ScVbaCommandBarControl::initObjects() throw (uno::RuntimeException) -{ - m_pCommandBarControls = dynamic_cast< ScVbaCommandBarControls* >( m_xParentHardRef.get() ); - if( !m_pCommandBarControls ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Parent needs to be a ScVbaCommandBarControls"), uno::Reference< uno::XInterface >() ); - m_xUICfgManager.set( m_pCommandBarControls->GetUICfgManager(), uno::UNO_QUERY_THROW ); - m_xUICfgPers.set( m_pCommandBarControls->GetUICfgPers(), uno::UNO_QUERY_THROW ); - m_xBarSettings.set( m_pCommandBarControls->GetBarSettings(), uno::UNO_QUERY_THROW ); - m_bIsMenu = m_pCommandBarControls->IsMenu(); - m_sName = rtl::OUString::createFromAscii( "Custom" ); - m_nPosition = -1; -} - -void -ScVbaCommandBarControl::createNewMenuBarControl() -{ - uno::Sequence< beans::PropertyValue > aPropertys(4); - aPropertys[0].Name = rtl::OUString::createFromAscii("CommandURL"); - aPropertys[0].Value <<= m_sCommand; - aPropertys[1].Name = rtl::OUString::createFromAscii("Label"); - aPropertys[1].Value <<= m_sName; - aPropertys[2].Name = rtl::OUString::createFromAscii("Type"); - aPropertys[2].Value <<= m_nType; - aPropertys[3].Name = rtl::OUString::createFromAscii("ItemDescriptorContainer"); - - m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) ); - uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); - rtl::OUString sUIName; - xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") ) >>= sUIName; - - uno::Reference< lang::XSingleComponentFactory > xMenuMSF( m_xBarSettings, uno::UNO_QUERY_THROW ); - if( m_pCommandBarControls->GetParentCommandBar() != NULL ) - { - // create a new menu - m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) ); - m_xCurrentSettings.set( m_xBarSettings, uno::UNO_QUERY_THROW ); - } - else if( m_pCommandBarControls->GetParentCommandBarControl() != NULL ) - { - // create a new menu entry - // change the parent MenuItem to a PopupMenu - ScVbaCommandBarControl* pPc = m_pCommandBarControls->GetParentCommandBarControl(); - beans::PropertyValues aPropertyValues; - pPc->GetCurrentSettings()->getByIndex( pPc->GetPosition() ) >>= aPropertyValues; - pPc->SetPropertyValues( aPropertyValues ); - - // has the property already been set? - if( lcl_getPropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ).hasValue() ) - { - lcl_repalcePropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer"), uno::makeAny( xMenuMSF->createInstanceWithContext( mxContext ) ) ); - pPc->GetCurrentSettings()->replaceByIndex( pPc->GetPosition(), uno::makeAny( pPc->GetPropertyValues() ) ); - } - m_xCurrentSettings.set( lcl_getPropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY_THROW ); - m_xCurrentSettings->insertByIndex( m_nPosition, uno::makeAny( m_aPropertyValues ) ); - } - if( m_xUICfgManager->hasSettings( m_sBarName ) ) - { - m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - else - { - m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - if( !m_bTemporary ) - { - m_xUICfgPers->store(); - } -} - -void -ScVbaCommandBarControl::createNewToolBarControl() -{ - uno::Sequence< beans::PropertyValue > aPropertys(4); - aPropertys[0].Name = rtl::OUString::createFromAscii("CommandURL"); - aPropertys[0].Value <<= m_sCommand; - aPropertys[1].Name = rtl::OUString::createFromAscii("Label"); - aPropertys[1].Value <<= m_sName; - aPropertys[2].Name = rtl::OUString::createFromAscii("Type"); - aPropertys[2].Value <<= m_nType; - aPropertys[3].Name = rtl::OUString::createFromAscii("IsVisible"); - aPropertys[3].Value <<= sal_True; - - m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) ); - uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); - rtl::OUString sUIName; - xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") ) >>= sUIName; - - m_xCurrentSettings.set( m_xBarSettings, uno::UNO_QUERY_THROW ); - if( m_xUICfgManager->hasSettings( m_sBarName ) ) - { - m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - else - { - m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - if( !m_bTemporary ) - { - m_xUICfgPers->store(); - } -} - -::rtl::OUString SAL_CALL -ScVbaCommandBarControl::getCaption() throw ( uno::RuntimeException ) -{ - // "Label" always empty - rtl::OUString sCaption; - beans::PropertyValues aPropertyValues; - if( m_xCurrentSettings.is() ) - { - m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues; - lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption; - } - else if( m_xBarSettings.is() ) - { - m_xBarSettings->getByIndex( m_nPosition ) >>= aPropertyValues; - lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption; - } - return sCaption; -} -void SAL_CALL -ScVbaCommandBarControl::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException) -{ - if( m_xCurrentSettings.is() ) - { - beans::PropertyValues aPropertyValues; - m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues; - beans::PropertyValues aNewPropertyValues; - aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label"), uno::makeAny( _caption ) ); - m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) ); - if( m_xUICfgManager->hasSettings( m_sBarName ) ) - { - m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - else - { - m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - // make it permanent - if( !m_bTemporary ) - { - m_xUICfgPers->store(); - } - } -} -::rtl::OUString SAL_CALL -ScVbaCommandBarControl::getOnAction() throw (uno::RuntimeException) -{ - if( m_xCurrentSettings.is() ) - { - beans::PropertyValues aPropertyValues; - m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues; - rtl::OUString sCommandURL; - lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "CommandURL" ) ) >>= sCommandURL; - return sCommandURL; - } - return ::rtl::OUString(); -} -void SAL_CALL -ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (uno::RuntimeException) -{ - if( m_xCurrentSettings.is() ) - { - beans::PropertyValues aPropertyValues; - m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues; - beans::PropertyValues aNewPropertyValues; - aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( _onaction ) ); - m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) ); - if( m_xUICfgManager->hasSettings( m_sBarName ) ) - { - m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - else - { - m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - // make it permanent - if( !m_bTemporary ) - { - m_xUICfgPers->store(); - } - } -} -::sal_Bool SAL_CALL -ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException) -{ - // not possible in UNO? - return sal_True; -} -void SAL_CALL -ScVbaCommandBarControl::setVisible( ::sal_Bool /*_visible*/ ) throw (uno::RuntimeException) -{ - // "IsVisilbe" -} -void SAL_CALL -ScVbaCommandBarControl::Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) -{ - if( m_xCurrentSettings.is() ) - { - m_xCurrentSettings->removeByIndex( m_nPosition ); - - if( m_xUICfgManager->hasSettings( m_sBarName ) ) - { - m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - else - { - m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); - } - // make it permanent - if( !m_bTemporary ) - { - m_xUICfgPers->store(); - } - } -} -uno::Any SAL_CALL -ScVbaCommandBarControl::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException) -{ - sal_Int32 nIndex; - uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >() ) ); - if( aIndex.hasValue() ) - { - if( aIndex >>= nIndex ) - { - uno::Reference< XCommandBarControl > xCommandBarControl( xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW ); - return uno::makeAny( xCommandBarControl ); - } - else - throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid index" ), uno::Reference< uno::XInterface >() ); - } - return uno::makeAny( xCommandBarControls ); -} -rtl::OUString& -ScVbaCommandBarControl::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControl") ); - return sImplName; -} -uno::Sequence -ScVbaCommandBarControl::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarControl" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbacommandbarcontrol.hxx b/sc/source/ui/vba/vbacommandbarcontrol.hxx deleted file mode 100644 index a77c4b64b56f..000000000000 --- a/sc/source/ui/vba/vbacommandbarcontrol.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_COMMANDBARCONTROL_HXX -#define SC_VBA_COMMANDBARCONTROL_HXX - -#include - -#include "vbahelperinterface.hxx" -#include "vbacommandbarcontrols.hxx" - -typedef InheritedHelperInterfaceImpl1< ov::XCommandBarControl > CommandBarControl_BASE; - -class ScVbaCommandBarControl : public CommandBarControl_BASE -{ -private: - rtl::OUString m_sName; - rtl::OUString m_sBarName; - rtl::OUString m_sCommand; - sal_Int32 m_nType; - sal_Int32 m_nPosition; - sal_Bool m_bTemporary; - sal_Bool m_bIsMenu; - ScVbaCommandBarControls* m_pCommandBarControls; - css::uno::Reference< ov::XHelperInterface > m_xParentHardRef; - css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager; - css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers; - css::uno::Reference< css::container::XIndexContainer > m_xBarSettings; - css::uno::Reference< css::container::XIndexContainer > m_xCurrentSettings; - css::beans::PropertyValues m_aPropertyValues; - - void initObjects() throw (css::uno::RuntimeException); - void createNewMenuBarControl(); - void createNewToolBarControl(); -public: - ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName ) throw (css::uno::RuntimeException); - ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, rtl::OUString sCommand, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException); - sal_Int32 GetPosition() { return m_nPosition; }; - css::uno::Reference< css::container::XIndexContainer > GetCurrentSettings() { return m_xCurrentSettings; }; - css::beans::PropertyValues GetPropertyValues() { return m_aPropertyValues; }; - void SetPropertyValues( css::beans::PropertyValues aPropertyValues ) { m_aPropertyValues = aPropertyValues; }; - - // Attributes - virtual ::rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); - virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException); - virtual void SAL_CALL setOnAction( const ::rtl::OUString& _onaction ) throw (css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); - virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException); - - // Methods - virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException); - - // XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; -#endif//SC_VBA_COMMANDBARCONTROL_HXX diff --git a/sc/source/ui/vba/vbacommandbarcontrols.cxx b/sc/source/ui/vba/vbacommandbarcontrols.cxx deleted file mode 100644 index f40636369d95..000000000000 --- a/sc/source/ui/vba/vbacommandbarcontrols.cxx +++ /dev/null @@ -1,246 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include "vbacommandbarcontrols.hxx" -#include "vbacommandbarcontrol.hxx" - -using namespace com::sun::star; -using namespace ooo::vba; - -typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarControlEnumeration_BASE; -class CommandBarControlEnumeration : public CommandBarControlEnumeration_BASE -{ - //uno::Reference< uno::XComponentContext > m_xContext; - ScVbaCommandBarControls* m_pCommandBarControls; - sal_Int32 m_nCurrentPosition; -public: - CommandBarControlEnumeration( ScVbaCommandBarControls* pCommandBarControls ) : m_pCommandBarControls( pCommandBarControls ), m_nCurrentPosition( 0 ) {} - virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException ) - { - if( m_nCurrentPosition < m_pCommandBarControls->getCount() ) - return sal_True; - return sal_False; - } - virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ) - { - if( hasMoreElements() ) - { - rtl::OUString sName = m_pCommandBarControls->GetControlNameByIndex( m_nCurrentPosition ); - m_nCurrentPosition = m_nCurrentPosition + 1; - if( sName.getLength() > 0 ) - return m_pCommandBarControls->createCollectionObject( uno::makeAny( sName ) ); - else - return nextElement(); - } - else - throw container::NoSuchElementException(); - } -}; - -ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess> xIndexAccess ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ) -{ - m_bIsMenu = sal_False; - m_bHasElements = sal_False; - m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW ); - m_pCommandBar = dynamic_cast< ScVbaCommandBar* >( m_xParentHardRef.get() ); - m_pCommandBarControl = dynamic_cast< ScVbaCommandBarControl* >( m_xParentHardRef.get() ); - if( m_pCommandBar ) - { - m_xUICfgManager.set( m_pCommandBar->GetUICfgManager(), uno::UNO_QUERY_THROW ); - m_xUICfgPers.set( m_pCommandBar->GetUICfgPers(), uno::UNO_QUERY_THROW ); - m_xBarSettings.set( m_pCommandBar->GetBarSettings(), uno::UNO_QUERY_THROW ); - m_bIsMenu = m_pCommandBar->IsMenu(); - if( m_xBarSettings->hasElements() ) - { - m_bHasElements = sal_True; - } - } - else if( m_pCommandBarControl ) - { - } - else - { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Parent needs to be a ScVbaCommandBar or a ScVbaCommandBarControl"), uno::Reference< uno::XInterface >() ); - } -} -rtl::OUString -ScVbaCommandBarControls::GetControlNameByIndex( const sal_Int32 nIndex ) throw ( uno::RuntimeException ) -{ - sal_Int32 nCount = 0; - if( m_bHasElements ) - { - sal_Int32 nBarSettingsCount = m_xBarSettings->getCount(); - for( sal_Int32 i = 0; i < nBarSettingsCount; i++ ) - { - beans::PropertyValues aMenuValues; - m_xBarSettings->getByIndex( i ) >>= aMenuValues; - for( sal_Int32 j = 0; j < aMenuValues.getLength(); j++ ) - { - if( aMenuValues[j].Name.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii( "CommandURL" ) ) ) - { - nCount++; - if( nIndex == nCount ) - { - rtl::OUString sCommandURL; - aMenuValues[j].Value >>= sCommandURL; - sal_Int32 nLastIndex = sCommandURL.lastIndexOf( rtl::OUString::createFromAscii(":") ); - if( ( nLastIndex != -1 ) && ( ( nLastIndex +1 ) < sCommandURL.getLength() ) ) - { - sCommandURL = sCommandURL.copy( nLastIndex + 1 ); - return sCommandURL; - } - } - } - } - } - } - else - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Out of bound" ), uno::Reference< uno::XInterface >() ); - return rtl::OUString(); -} - -// Attributes -sal_Int32 SAL_CALL -ScVbaCommandBarControls::getCount() throw (uno::RuntimeException) -{ - sal_Int32 nCount = 0; - if( m_bHasElements ) - { - sal_Int32 nBarSettingsCount = m_xBarSettings->getCount(); - for( sal_Int32 i = 0; i < nBarSettingsCount; i++ ) - { - beans::PropertyValues aMenuValues; - m_xBarSettings->getByIndex( i ) >>= aMenuValues; - for( sal_Int32 j = 0; j < aMenuValues.getLength(); j++ ) - { - if( aMenuValues[j].Name.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii( "CommandURL" ) ) ) - { - nCount++; - } - } - } - } - return nCount; -} -// XEnumerationAccess -uno::Type SAL_CALL -ScVbaCommandBarControls::getElementType() throw ( uno::RuntimeException ) -{ - return XCommandBarControls::static_type( 0 ); -} -uno::Reference< container::XEnumeration > -ScVbaCommandBarControls::createEnumeration() throw ( uno::RuntimeException ) -{ - return uno::Reference< container::XEnumeration >( new CommandBarControlEnumeration( this ) ); -} -uno::Any -ScVbaCommandBarControls::createCollectionObject( const uno::Any& aSource ) -{ - // only surport the aSource as a name string, because this class is a API wrapper - rtl::OUString sName; - if( aSource >>= sName ) - return uno::makeAny( uno::Reference< XCommandBarControl > ( new ScVbaCommandBarControl( this, mxContext, sName ) ) ); - return uno::Any(); -} - -// Methods -uno::Any SAL_CALL -ScVbaCommandBarControls::Item( const uno::Any& aIndex, const uno::Any& /*aIndex*/ ) throw (uno::RuntimeException) -{ - if( aIndex.getValueTypeClass() == uno::TypeClass_STRING ) - { - return createCollectionObject( aIndex ); - } - sal_Int32 nIndex = 0; - if( aIndex >>= nIndex ) - { - return createCollectionObject( uno::makeAny( GetControlNameByIndex( nIndex ) ) ); - } - - return uno::Any(); -} -uno::Reference< XCommandBarControl > SAL_CALL -ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const uno::Any& /*Parameter*/, const uno::Any& Before, const uno::Any& Temporary ) throw (script::BasicErrorException, uno::RuntimeException) -{ - // Parameter is not supported - // the following name needs to be individually created; - rtl::OUString sCaption( rtl::OUString::createFromAscii("custom Control") ); - rtl::OUString sCommand( rtl::OUString::createFromAscii("macro:///Standard.Module1.Test()") ); - sal_Int32 nType =0; - sal_Int32 nPosition = 0; - sal_Int32 nId; - sal_Bool bTemporary = sal_True; - - if( Type.hasValue() ) - if( Type >>= nType ) - { - // evalute the type of the new control - } - if( Id.hasValue() ) - if( Id >>= nId ) - { - // evalute the action of the new control - } - if( Before.hasValue() ) - if( Before >>= nPosition ) - { - // evalute the position of the new Control - } - if( Temporary.hasValue() ) - if( Temporary >>= bTemporary ) - { - // evalute the temporary of the new Control - } - return uno::Reference< XCommandBarControl > ( new ScVbaCommandBarControl( this, mxContext, sCaption, sCommand, nPosition, bTemporary ) ); -} - -// XHelperInterface -rtl::OUString& -ScVbaCommandBarControls::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControls") ); - return sImplName; -} -uno::Sequence -ScVbaCommandBarControls::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarControls" ) ); - } - return aServiceNames; -} - diff --git a/sc/source/ui/vba/vbacommandbarcontrols.hxx b/sc/source/ui/vba/vbacommandbarcontrols.hxx deleted file mode 100644 index 9243d55697d7..000000000000 --- a/sc/source/ui/vba/vbacommandbarcontrols.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_COMMANDBARCONTROLS_HXX -#define SC_VBA_COMMANDBARCONTROLS_HXX - -#include - -#include "vbahelperinterface.hxx" -#include "vbacommandbar.hxx" -#include "vbacollectionimpl.hxx" - -class ScVbaCommandBarControl; - -typedef CollTestImplHelper< ov::XCommandBarControls > CommandBarControls_BASE; - -class ScVbaCommandBarControls : public CommandBarControls_BASE -{ -private: - sal_Bool m_bIsMenu; - sal_Bool m_bHasElements; - ScVbaCommandBar* m_pCommandBar; - ScVbaCommandBarControl* m_pCommandBarControl; - css::uno::Reference< ov::XHelperInterface > m_xParentHardRef; - css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager; - css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers; - css::uno::Reference< css::container::XIndexContainer > m_xBarSettings; - -public: - ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess ) throw( css::uno::RuntimeException ); - css::uno::Reference< css::ui::XUIConfigurationManager > GetUICfgManager() { return m_xUICfgManager; }; - css::uno::Reference< css::ui::XUIConfigurationPersistence > GetUICfgPers() { return m_xUICfgPers; }; - css::uno::Reference< css::container::XIndexContainer > GetBarSettings() { return m_xBarSettings; }; - sal_Bool IsMenu() { return m_bIsMenu; }; - ScVbaCommandBar* GetParentCommandBar() { return m_pCommandBar; }; - ScVbaCommandBarControl* GetParentCommandBarControl() { return m_pCommandBarControl; }; - rtl::OUString GetParentToolBarName() - { - if( m_pCommandBar ) return m_pCommandBar->GetToolBarName(); - else return rtl::OUString(); - } - rtl::OUString GetControlNameByIndex( const sal_Int32 nIndex ) throw ( css::uno::RuntimeException ); - - // Attributes - virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); - // XEnumerationAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); - - // Methods - virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< ov::XCommandBarControl > SAL_CALL Add( const css::uno::Any& Type, const css::uno::Any& Id, const css::uno::Any& Parameter, const css::uno::Any& Before, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException); - // XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; - -#endif//SC_VBA_COMMANDBARCONTROLS_HXX diff --git a/sc/source/ui/vba/vbacommandbars.cxx b/sc/source/ui/vba/vbacommandbars.cxx deleted file mode 100644 index 101b62902460..000000000000 --- a/sc/source/ui/vba/vbacommandbars.cxx +++ /dev/null @@ -1,247 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include -#include -#include - -#include "vbacommandbars.hxx" -#include "vbacommandbar.hxx" - -using namespace com::sun::star; -using namespace ooo::vba; - -typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarEnumeration_BASE; - -static rtl::OUString sSpreadsheetDocumentUrl( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) ); -static rtl::OUString sTextDocumentUrl( rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ) ); -static rtl::OUString sWindowStateConfUrl( rtl::OUString::createFromAscii( "com.sun.star.ui.WindowStateConfiguration" ) ); - -class CommandBarEnumeration : public CommandBarEnumeration_BASE -{ - uno::Reference< uno::XComponentContext > m_xContext; - uno::Reference< XCommandBars > m_xCommandBars; - uno::Sequence< rtl::OUString > m_sNames; - sal_Int32 m_nCurrentPosition; -public: - CommandBarEnumeration( const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBars > xCommandBars, const uno::Sequence< rtl::OUString > sNames ) : m_xContext( xContext ), m_xCommandBars( xCommandBars ), m_sNames( sNames ), m_nCurrentPosition( 0 ) - { - } - virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException ) - { - if( m_nCurrentPosition < m_sNames.getLength() ) - return sal_True; - return sal_False; - } - virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ) - { - if( hasMoreElements() ) - { - rtl::OUString sName( m_sNames[ m_nCurrentPosition ] ); - m_nCurrentPosition = m_nCurrentPosition + 1; - if( sName.indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 ) - { - sal_Int32 nLastIndex = sName.lastIndexOf( rtl::OUString::createFromAscii( "/" ) ); - if( ( nLastIndex != -1 ) && ( ( nLastIndex + 1 ) < sName.getLength() ) ) - { - sName = sName.copy( nLastIndex + 1); - if( sName.getLength() > 0 ) - { - uno::Reference< XHelperInterface > xHelperInterface( m_xCommandBars, uno::UNO_QUERY_THROW ); - uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( xHelperInterface, m_xContext, sName, sal_True, sal_False ) ); - if( xCommandBar.is() ) - return uno::makeAny( xCommandBar ); - else - return nextElement(); - } - else - return nextElement(); - } - } - else - return nextElement(); - } - else - throw container::NoSuchElementException(); - return uno::Any(); - } -}; - - -ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess > xIndexAccess ) : CommandBars_BASE( xParent, xContext, xIndexAccess ) -{ - retrieveObjects(); -} -void -ScVbaCommandBars::retrieveObjects() throw ( uno::RuntimeException ) -{ - uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument(), uno::UNO_QUERY_THROW ); - if( xServiceInfo->supportsService( sSpreadsheetDocumentUrl ) ) - { - m_sModuleName = sSpreadsheetDocumentUrl; - } - else if( xServiceInfo->supportsService( sTextDocumentUrl ) ) - { - m_sModuleName = sTextDocumentUrl; - } - else - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Unsupported Document" ), uno::Reference< uno::XInterface >() ); - - uno::Reference < lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - uno::Reference < container::XNameAccess > xNameAccess( xMSF->createInstance( sWindowStateConfUrl ), uno::UNO_QUERY_THROW ); - m_xNameAccess.set( xNameAccess->getByName( m_sModuleName ), uno::UNO_QUERY_THROW ); -} - -// XEnumerationAccess -uno::Type SAL_CALL -ScVbaCommandBars::getElementType() throw ( uno::RuntimeException ) -{ - return XCommandBars::static_type( 0 ); -} -uno::Reference< container::XEnumeration > -ScVbaCommandBars::createEnumeration() throw ( uno::RuntimeException ) -{ - return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( mxContext, this, m_xNameAccess->getElementNames() ) ); -} - -uno::Any -ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) -{ - // aSource should be a name at this time, because of the class is API wrapper. - rtl::OUString sToolBarName; - if( aSource >>= sToolBarName ) - { - sToolBarName = sToolBarName.toAsciiLowerCase(); - if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Worksheet Menu Bar") ) ) - { - return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, 0 ) ) ); - } - else if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) ) - { - return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, 1 ) ) ); - } - else if( checkToolBarExist( sToolBarName ) ) - { - return uno::makeAny( uno::Reference< XCommandBar > (new ScVbaCommandBar( this, mxContext, sToolBarName, sal_True, sal_False ) ) ); - } - } - return uno::Any(); -} - -// XCommandBars -uno::Reference< XCommandBar > SAL_CALL -ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Position*/, const css::uno::Any& /*MenuBar*/, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException) -{ - // Position - MsoBar MenuBar - sal_Bool - // Currently only the Name is supported. - rtl::OUString sName; - if( !( Name >>= sName ) ) - { - sName = rtl::OUString::createFromAscii("Custom1"); - } - sal_Bool bTemporary = false; - if( !( Temporary >>= bTemporary ) ) - { - bTemporary = sal_True; - } - return uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, sName.toAsciiLowerCase(), bTemporary, sal_True ) ); -} -sal_Int32 SAL_CALL -ScVbaCommandBars::getCount() throw(css::uno::RuntimeException) -{ - // Filter out all toolbars from the window collection - sal_Int32 nCount = 0; - uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames(); - for( sal_Int32 i = 0; i < allNames.getLength(); i++ ) - { - if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 ) - { - nCount++; - } - } - return nCount; -} - -// ScVbaCollectionBaseImpl -uno::Any SAL_CALL -ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException ) -{ - if( aIndex.getValueTypeClass() == uno::TypeClass_STRING ) - { - return createCollectionObject( aIndex ); - } - return uno::Any(); -} - -sal_Bool -ScVbaCommandBars::checkToolBarExist( rtl::OUString sToolBarName ) -{ - CommandBarNameMap::const_iterator iter = mCommandBarNameMap.find( sToolBarName.toAsciiLowerCase() ); - if( iter != mCommandBarNameMap.end() ) - { - return sal_True; - } - uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames(); - for( sal_Int32 i = 0; i < allNames.getLength(); i++ ) - { - if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 ) - { - if( allNames[i].indexOf( sToolBarName ) != -1 ) - { - return sal_True; - } - } - } - return sal_False; -} - -// XHelperInterface -rtl::OUString& -ScVbaCommandBars::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBars") ); - return sImplName; -} -uno::Sequence -ScVbaCommandBars::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBars" ) ); - } - return aServiceNames; -} - diff --git a/sc/source/ui/vba/vbacommandbars.hxx b/sc/source/ui/vba/vbacommandbars.hxx deleted file mode 100644 index b9de44ee79d6..000000000000 --- a/sc/source/ui/vba/vbacommandbars.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_COMMANDBARS_HXX -#define SC_VBA_COMMANDBARS_HXX - -#include -#include -#include - -#include - -#include "vbahelperinterface.hxx" -#include "vbacollectionimpl.hxx" - -typedef CollTestImplHelper< ov::XCommandBars > CommandBars_BASE; - -class ScVbaCommandBars : public CommandBars_BASE -{ -private: - css::uno::Reference< css::container::XNameAccess > m_xNameAccess; - rtl::OUString m_sModuleName; - void retrieveObjects() throw( css::uno::RuntimeException ); -public: - ScVbaCommandBars( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess ); - - sal_Bool checkToolBarExist( rtl::OUString sToolBarName ); - rtl::OUString GetModuleName(){ return m_sModuleName; }; - css::uno::Reference< css::container::XNameAccess > GetWindows() - { - retrieveObjects(); - return m_xNameAccess; - }; - // XCommandBars - virtual css::uno::Reference< ov::XCommandBar > SAL_CALL Add( const css::uno::Any& Name, const css::uno::Any& Position, const css::uno::Any& MenuBar, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException); - // XEnumerationAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); - - virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Item( const css::uno::Any& aIndex, const css::uno::Any& /*aIndex2*/ ) throw( css::uno::RuntimeException); - // XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; - -#endif//SC_VBA_COMMANDBARS_HXX diff --git a/sc/source/ui/vba/vbacomment.hxx b/sc/source/ui/vba/vbacomment.hxx index 6676d09bd660..8601fa303844 100644 --- a/sc/source/ui/vba/vbacomment.hxx +++ b/sc/source/ui/vba/vbacomment.hxx @@ -39,7 +39,7 @@ #include #include -#include "vbahelperinterface.hxx" +#include typedef InheritedHelperInterfaceImpl1< ov::excel::XComment > ScVbaComment_BASE; diff --git a/sc/source/ui/vba/vbacomments.hxx b/sc/source/ui/vba/vbacomments.hxx index 098dfd5153a3..be876ab2f76e 100644 --- a/sc/source/ui/vba/vbacomments.hxx +++ b/sc/source/ui/vba/vbacomments.hxx @@ -34,8 +34,8 @@ #include -#include "vbahelper.hxx" -#include "vbacollectionimpl.hxx" +#include "excelvbahelper.hxx" +#include #include "vbacomment.hxx" typedef CollTestImplHelper< ov::excel::XComments > ScVbaComments_BASE; diff --git a/sc/source/ui/vba/vbacondition.hxx b/sc/source/ui/vba/vbacondition.hxx index ac44130e5127..823e889ae298 100644 --- a/sc/source/ui/vba/vbacondition.hxx +++ b/sc/source/ui/vba/vbacondition.hxx @@ -31,7 +31,7 @@ #define SC_VBA_CONDITION_HXX #include #include -#include "vbahelperinterface.hxx" +#include #include template< typename Ifc1 > diff --git a/sc/source/ui/vba/vbacontrol.cxx b/sc/source/ui/vba/vbacontrol.cxx index eaf9365016ec..e69de29bb2d1 100644 --- a/sc/source/ui/vba/vbacontrol.cxx +++ b/sc/source/ui/vba/vbacontrol.cxx @@ -1,468 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbacontrol.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef VBA_OOBUILD_HACK -#include -#endif -#include"vbacontrol.hxx" -#include"vbacombobox.hxx" -#include "vbabutton.hxx" -#include "vbalabel.hxx" -#include "vbatextbox.hxx" -#include "vbaradiobutton.hxx" -#include "vbalistbox.hxx" -#include "vbatogglebutton.hxx" -#include "vbacheckbox.hxx" -#include "vbaframe.hxx" -#include "vbascrollbar.hxx" -#include "vbaprogressbar.hxx" -#include "vbamultipage.hxx" -#include "vbaspinbutton.hxx" -#include "vbaimage.hxx" - - -using namespace com::sun::star; -using namespace ooo::vba; - -uno::Reference< css::awt::XWindowPeer > -ScVbaControl::getWindowPeer() throw (uno::RuntimeException) -{ - uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); - - uno::Reference< awt::XControlModel > xControlModel; - uno::Reference< css::awt::XWindowPeer > xWinPeer; - if ( !xControlShape.is() ) - { - // would seem to be a Userform control - uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY_THROW ); - xWinPeer = xControl->getPeer(); - return xWinPeer; - } - // form control - xControlModel.set( xControlShape->getControl(), uno::UNO_QUERY_THROW ); - - uno::Reference< view::XControlAccess > xControlAccess( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - try - { - uno::Reference< awt::XControl > xControl( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY ); - xWinPeer = xControl->getPeer(); - } - catch( uno::Exception ) - { - throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ), - uno::Reference< uno::XInterface >() ); - } - return xWinPeer; -} - -//ScVbaControlListener -class ScVbaControlListener: public cppu::WeakImplHelper1< lang::XEventListener > -{ -private: - ScVbaControl *pControl; -public: - ScVbaControlListener( ScVbaControl *pTmpControl ); - virtual ~ScVbaControlListener(); - virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException ); -}; - -ScVbaControlListener::ScVbaControlListener( ScVbaControl *pTmpControl ): pControl( pTmpControl ) -{ -} - -ScVbaControlListener::~ScVbaControlListener() -{ -} - -void SAL_CALL -ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeException ) -{ - if( pControl ) - { - pControl->removeResouce(); - pControl = NULL; - } -} - -//ScVbaControl - -ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), m_xControl( xControl ), m_xModel( xModel ) -{ - //add listener - m_xEventListener.set( new ScVbaControlListener( this ) ); - setGeometryHelper( pGeomHelper ); - uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); - xComponent->addEventListener( m_xEventListener ); - - //init m_xProps - uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ; - uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ; - if ( xControlShape.is() ) // form control - m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW ); - else if ( xUserFormControl.is() ) // userform control - m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW ); -} - -ScVbaControl::~ScVbaControl() -{ - if( m_xControl.is() ) -{ - uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); - xComponent->removeEventListener( m_xEventListener ); -} -} - -void -ScVbaControl::setGeometryHelper( AbstractGeometryAttributes* pHelper ) -{ - mpGeometryHelper.reset( pHelper ); -} - -void ScVbaControl::removeResouce() throw( uno::RuntimeException ) -{ - uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); - xComponent->removeEventListener( m_xEventListener ); - m_xControl= NULL; - m_xProps = NULL; -} - -//In design model has different behavior -sal_Bool SAL_CALL ScVbaControl::getEnabled() throw (uno::RuntimeException) -{ - uno::Any aValue = m_xProps->getPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ) ); - sal_Bool bRet = false; - aValue >>= bRet; - return bRet; -} - -void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeException) -{ - uno::Any aValue( bVisible ); - m_xProps->setPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ), aValue); - -} - -sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException) -{ - sal_Bool bVisible = sal_False; - m_xProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ) ) >>= bVisible; - return bVisible; -} - -void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException) -{ - m_xProps->setPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ), uno::makeAny( bVisible ) ); -} -double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException) -{ - return mpGeometryHelper->getHeight(); -} -void SAL_CALL ScVbaControl::setHeight( double _height ) throw (uno::RuntimeException) -{ - mpGeometryHelper->setHeight( _height ); -} - -double SAL_CALL ScVbaControl::getWidth() throw (uno::RuntimeException) -{ - return mpGeometryHelper->getWidth(); -} -void SAL_CALL ScVbaControl::setWidth( double _width ) throw (uno::RuntimeException) -{ - mpGeometryHelper->setWidth( _width ); -} - -double SAL_CALL -ScVbaControl::getLeft() throw (uno::RuntimeException) -{ - return mpGeometryHelper->getLeft(); -} - -void SAL_CALL -ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException) -{ - mpGeometryHelper->setLeft( _left ); - -} - -double SAL_CALL -ScVbaControl::getTop() throw (uno::RuntimeException) -{ - return mpGeometryHelper->getTop(); -} - -void SAL_CALL -ScVbaControl::setTop( double _top ) throw (uno::RuntimeException) -{ - mpGeometryHelper->setTop( _top ); -} - -uno::Reference< uno::XInterface > SAL_CALL -ScVbaControl::getObject() throw (uno::RuntimeException) -{ - uno::Reference< msforms::XControl > xRet( this ); - return xRet; -} - -void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException) -{ - uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY_THROW ); - xWin->setFocus(); -} - -rtl::OUString SAL_CALL -ScVbaControl::getControlSource() throw (uno::RuntimeException) -{ -// #FIXME I *hate* having these upstream differences -// but this is necessary until I manage to upstream other -// dependant parts -#ifdef VBA_OOBUILD_HACK - rtl::OUString sControlSource; - uno::Reference< form::binding::XBindableValue > xBindable( m_xProps, uno::UNO_QUERY ); - if ( xBindable.is() ) - { - try - { - uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellAddressConversion" ))), uno::UNO_QUERY ); - uno::Reference< beans::XPropertySet > xProps( xBindable->getValueBinding(), uno::UNO_QUERY_THROW ); - table::CellAddress aAddress; - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundCell") ) ) >>= aAddress; - xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address") ), uno::makeAny( aAddress ) ); - xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sControlSource; - } - catch( uno::Exception& ) - { - } - } - return sControlSource; -#else - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getControlSource not supported") ), uno::Reference< uno::XInterface >()); // not supported -#endif -} - -void SAL_CALL -ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno::RuntimeException) -{ -#ifdef VBA_OOBUILD_HACK - rtl::OUString sEmpty; - svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, _controlsource, sEmpty ); -#else - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setControlSource not supported ") ).concat( _controlsource ), uno::Reference< uno::XInterface >()); // not supported -#endif -} - -rtl::OUString SAL_CALL -ScVbaControl::getRowSource() throw (uno::RuntimeException) -{ -#ifdef VBA_OOBUILD_HACK - rtl::OUString sRowSource; - uno::Reference< form::binding::XListEntrySink > xListSink( m_xProps, uno::UNO_QUERY ); - if ( xListSink.is() ) - { - try - { - uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellRangeAddressConversion" ))), uno::UNO_QUERY ); - - uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY_THROW ); - table::CellRangeAddress aAddress; - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellRange") ) ) >>= aAddress; - xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address")), uno::makeAny( aAddress ) ); - xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sRowSource; - } - catch( uno::Exception& ) - { - } - } - return sRowSource; -#else - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getRowSource not supported") ), uno::Reference< uno::XInterface >()); // not supported -#endif -} - -void SAL_CALL -ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException) -{ -#ifdef VBA_OOBUILD_HACK - rtl::OUString sEmpty; - svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, sEmpty, _rowsource ); -#else - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setRowSource not supported ") ).concat( _rowsource ), uno::Reference< uno::XInterface >()); // not supported -#endif -} - -rtl::OUString SAL_CALL -ScVbaControl::getName() throw (uno::RuntimeException) -{ - rtl::OUString sName; - m_xProps->getPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName; - return sName; - -} - -void SAL_CALL -ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException) -{ - m_xProps->setPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) ); - } -//ScVbaControlFactory - -ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel ) -{ -} - -ScVbaControl* ScVbaControlFactory::createControl() throw (uno::RuntimeException) -{ - return createControl( m_xModel ); -} -ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException) -{ - uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); - if ( xControlShape.is() ) // form controls - return createControl( xControlShape, xParent ); - uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY ); - if ( !xControl.is() ) - throw uno::RuntimeException(); // really we should be more informative - return createControl( xControl, xParent ); - -} - -ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< uno::XInterface >& /*xParent*/ ) throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW ); - sal_Int32 nClassId = -1; - const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") ); - xProps->getPropertyValue( sClassId ) >>= nClassId; - uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess - switch( nClassId ) - { - case form::FormComponentType::COMBOBOX: - return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::COMMANDBUTTON: - return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::FIXEDTEXT: - return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::TEXTFIELD: - return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::RADIOBUTTON: - return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::LISTBOX: - return new ScVbaListBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::SPINBUTTON: - return new ScVbaSpinButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::IMAGECONTROL: - return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - default: - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Donot support this Control Type." ), uno::Reference< uno::XInterface >() ); - } -} - -ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW ); - uno::Reference< lang::XServiceInfo > xServiceInfo( xProps, uno::UNO_QUERY_THROW ); - ScVbaControl* pControl = NULL; - uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess - if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) ) - pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) ) - pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) ) - pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) ) - { - sal_Bool bToggle = sal_False; - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle; - if ( bToggle ) - pControl = new ScVbaToggleButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else - pControl = new ScVbaButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - } - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) ) - pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) ) - pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) ) - pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) ) - pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) ) - pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) ) - pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) ) - pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) ) - pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) ) - pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else - throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() ); - return pControl; -} - -rtl::OUString& -ScVbaControl::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControl") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaControl::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Control" ) ); - } - return aServiceNames; -} - - diff --git a/sc/source/ui/vba/vbacontrol.hxx b/sc/source/ui/vba/vbacontrol.hxx deleted file mode 100644 index 02f340ac05ee..000000000000 --- a/sc/source/ui/vba/vbacontrol.hxx +++ /dev/null @@ -1,111 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbacontrol.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_CONTROL_HXX -#define SC_VBA_CONTROL_HXX - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "vbahelper.hxx" -#include "vbahelperinterface.hxx" - -//typedef ::cppu::WeakImplHelper1< ov::msforms::XControl > ControlImpl_BASE; -typedef InheritedHelperInterfaceImpl1< ov::msforms::XControl > ControlImpl_BASE; - -class ScVbaControl : public ControlImpl_BASE -{ -private: - com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener; -protected: - std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper; - css::uno::Reference< css::beans::XPropertySet > m_xProps; - css::uno::Reference< css::uno::XInterface > m_xControl; - css::uno::Reference< css::frame::XModel > m_xModel; - - virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException); -public: - ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, - const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper ); - virtual ~ScVbaControl(); - // This class will own the helper, so make sure it is allocated from - // the heap - void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper ); - // XControl - virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException); - virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); - virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException); - virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException); - virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException); - virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getTop() throw (css::uno::RuntimeException); - virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException); - virtual void SAL_CALL SetFocus( ) throw (css::uno::RuntimeException); - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getControlSource() throw (css::uno::RuntimeException); - virtual void SAL_CALL setControlSource( const rtl::OUString& _controlsource ) throw (css::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getRowSource() throw (css::uno::RuntimeException); - virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); - virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException); - //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape - virtual void removeResouce() throw( css::uno::RuntimeException ); - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; - - -class ScVbaControlFactory -{ -public: - ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext, - const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel ); - ScVbaControl* createControl() throw ( css::uno::RuntimeException ); - ScVbaControl* createControl( const css::uno::Reference< css::uno::XInterface >& xParent ) throw ( css::uno::RuntimeException ); -private: - ScVbaControl* createControl( const css::uno::Reference< css::awt::XControl >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException ); - ScVbaControl* createControl( const css::uno::Reference< css::drawing::XControlShape >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException ); - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::uno::XInterface > m_xControl; - css::uno::Reference< css::frame::XModel > m_xModel; -}; - -#endif//SC_VBA_CONTROL_HXX diff --git a/sc/source/ui/vba/vbacontrols.cxx b/sc/source/ui/vba/vbacontrols.cxx deleted file mode 100644 index 6faf418df206..000000000000 --- a/sc/source/ui/vba/vbacontrols.cxx +++ /dev/null @@ -1,227 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * $Revision$ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "vbacontrols.hxx" -#include "vbacontrol.hxx" -#include -#include -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - -typedef ::cppu::WeakImplHelper2< container::XNameAccess, container::XIndexAccess > ArrayWrapImpl; - -typedef std::hash_map< rtl::OUString, sal_Int32, ::rtl::OUStringHash, - ::std::equal_to< ::rtl::OUString > > ControlIndexMap; -typedef std::vector< uno::Reference< awt::XControl > > ControlVec; - -class ControlArrayWrapper : public ArrayWrapImpl -{ - uno::Reference< awt::XControlContainer > mxDialog; - uno::Sequence< ::rtl::OUString > msNames; - ControlVec mControls; - ControlIndexMap mIndices; - - rtl::OUString getControlName( const uno::Reference< awt::XControl >& xCtrl ) - { - uno::Reference< beans::XPropertySet > xProp( xCtrl->getModel(), uno::UNO_QUERY ); - rtl::OUString sName; - xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName; - return sName; - } - -public: - - ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog ) - { - mxDialog.set( xDialog, uno::UNO_QUERY_THROW ); - uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls(); - - msNames.realloc( sXControls.getLength() ); - for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i ) - { - uno::Reference< awt::XControl > xCtrl = sXControls[ i ]; - msNames[ i ] = getControlName( xCtrl ); - mControls.push_back( xCtrl ); - mIndices[ msNames[ i ] ] = i; - } - } - - // XElementAccess - virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) - { - return awt::XControl::static_type(0); - } - - virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) - { - return ( mControls.size() > 0 ); - } - - // XNameAcess - virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - if ( !hasByName( aName ) ) - throw container::NoSuchElementException(); - return getByIndex( mIndices[ aName ] ); - } - - virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) - { - return msNames; - } - - virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException) - { - ControlIndexMap::iterator it = mIndices.find( aName ); - return it != mIndices.end(); - } - - // XElementAccess - virtual ::sal_Int32 SAL_CALL getCount( ) throw (css::uno::RuntimeException) - { - return mControls.size(); - } - - virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) - { - if ( Index < 0 || Index >= static_cast< sal_Int32 >( mControls.size() ) ) - throw lang::IndexOutOfBoundsException(); - return uno::makeAny( mControls[ Index ] ); - } -}; - - -class ControlsEnumWrapper : public EnumerationHelper_BASE -{ - uno::Reference m_xParent; - uno::Reference m_xContext; - uno::Reference m_xIndexAccess; - uno::Reference m_xDlg; - sal_Int32 nIndex; - -public: - - ControlsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< awt::XControl >& xDlg ) : m_xParent( xParent ), m_xContext( xContext), m_xIndexAccess( xIndexAccess ), m_xDlg( xDlg ), nIndex( 0 ) {} - - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) - { - return ( nIndex < m_xIndexAccess->getCount() ); - } - - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - if ( nIndex < m_xIndexAccess->getCount() ) - { - uno::Reference< frame::XModel > xModel; - uno::Reference< uno::XInterface > xControl; - m_xIndexAccess->getByIndex( nIndex++ ) >>= xControl; - // Create control from awt::XControl - ScVbaControlFactory aFac( m_xContext, xControl, xModel ); - uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( m_xDlg->getModel() ) ); - return uno::makeAny( xVBAControl ); - } - throw container::NoSuchElementException(); - } - -}; - - -uno::Reference -lcl_controlsWrapper( const uno::Reference< awt::XControl >& xDlg ) -{ - return new ControlArrayWrapper( xDlg ); -} - -ScVbaControls::ScVbaControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, - const css::uno::Reference< awt::XControl >& xDialog ) - : ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) ) -{ - mxDialog.set( xDialog, uno::UNO_QUERY_THROW ); -} - -uno::Reference< container::XEnumeration > -ScVbaControls::createEnumeration() throw (uno::RuntimeException) -{ - uno::Reference< container::XEnumeration > xEnum( new ControlsEnumWrapper( mxParent, mxContext, m_xIndexAccess, mxDialog ) ); - if ( !xEnum.is() ) - throw uno::RuntimeException(); - return xEnum; -} - -uno::Any -ScVbaControls::createCollectionObject( const css::uno::Any& aSource ) -{ - // Create control from awt::XControl - uno::Reference< awt::XControl > xControl; - aSource >>= xControl; - uno::Reference< frame::XModel > xModel; - ScVbaControlFactory aFac( mxContext, xControl, xModel ); - uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( mxDialog->getModel() ) ); - return uno::makeAny( xVBAControl ); -} - -void SAL_CALL -ScVbaControls::Move( double cx, double cy ) throw (uno::RuntimeException) -{ - uno::Reference< container::XEnumeration > xEnum( createEnumeration() ); - while ( xEnum->hasMoreElements() ) - { - uno::Reference< msforms::XControl > xControl( xEnum->nextElement(), uno::UNO_QUERY_THROW ); - xControl->setLeft( xControl->getLeft() + cx ); - xControl->setTop( xControl->getTop() + cy ); - } -} - -uno::Type -ScVbaControls::getElementType() throw (uno::RuntimeException) -{ - return ooo::vba::msforms::XControl::static_type(0); -} -rtl::OUString& -ScVbaControls::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControls") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaControls::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Controls" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbacontrols.hxx b/sc/source/ui/vba/vbacontrols.hxx deleted file mode 100644 index bdb25ff3d5d2..000000000000 --- a/sc/source/ui/vba/vbacontrols.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * $Revision$ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_CONTROLS_HXX -#define SC_VBA_CONTROLS_HXX - -#include -#include -#include - -#include "vbacollectionimpl.hxx" -#include "vbahelper.hxx" - -typedef CollTestImplHelper< ov::msforms::XControls > ControlsImpl_BASE; - -class ScVbaControls : public ControlsImpl_BASE -{ - css::uno::Reference< css::awt::XControl > mxDialog; -protected: - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -public: - ScVbaControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, - const css::uno::Reference< css::awt::XControl >& xDialog ); - // XControls - virtual void SAL_CALL Move( double cx, double cy ) throw (css::uno::RuntimeException); - // XEnumerationAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); - - // ScVbaCollectionBaseImpl - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); - -}; -#endif //SC_VBA_OLEOBJECTS_HXX - diff --git a/sc/source/ui/vba/vbadialog.cxx b/sc/source/ui/vba/vbadialog.cxx index eb0cdfa6386e..06faebc3a37b 100644 --- a/sc/source/ui/vba/vbadialog.cxx +++ b/sc/source/ui/vba/vbadialog.cxx @@ -27,39 +27,11 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include - -#include -#include -#include - -#include - -#include "vbahelper.hxx" #include "vbadialog.hxx" -#include "vbaglobals.hxx" using namespace ::ooo::vba; using namespace ::com::sun::star; -// fails silently -void -ScVbaDialog::Show() throw(uno::RuntimeException) -{ - rtl::OUString aURL; - uno::Reference< frame::XModel > xModel = getCurrentDocument(); - if ( xModel.is() ) - { - aURL = mapIndexToName( mnIndex ); - if( aURL.getLength() ) - throw uno::RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ), - uno::Reference< XInterface > () ); - dispatchRequests( xModel, aURL ); - } -} - - static const rtl::OUString aStringList[]= { rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Open" ) ), @@ -102,7 +74,7 @@ ScVbaDialog::mapIndexToName( sal_Int32 nIndex ) rtl::OUString& ScVbaDialog::getServiceImplName() { - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPivotTable") ); + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaDialog") ); return sImplName; } @@ -113,7 +85,7 @@ ScVbaDialog::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.PivotTable" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Dialog" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbadialog.hxx b/sc/source/ui/vba/vbadialog.hxx index 8b488abebb19..77be9341f7f3 100644 --- a/sc/source/ui/vba/vbadialog.hxx +++ b/sc/source/ui/vba/vbadialog.hxx @@ -31,27 +31,20 @@ #define SC_VBA_DIALOG_HXX #include - -#include -#include -#include #include +#include +#include -#include "vbahelperinterface.hxx" -#include "vbadialog.hxx" - -typedef InheritedHelperInterfaceImpl1< ov::excel::XDialog > ScVbaDialog_BASE; +typedef cppu::ImplInheritanceHelper1< VbaDialogBase, ov::excel::XDialog > ScVbaDialog_BASE; class ScVbaDialog : public ScVbaDialog_BASE { - sal_Int32 mnIndex; public: - ScVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, sal_Int32 nIndex, const css::uno::Reference< css::uno::XComponentContext > xContext ):ScVbaDialog_BASE( xParent, xContext ), mnIndex( nIndex ) {} + ScVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nIndex ):ScVbaDialog_BASE( xParent, xContext, xModel, nIndex ) {} virtual ~ScVbaDialog() {} // Methods - virtual void SAL_CALL Show() throw (css::uno::RuntimeException); - rtl::OUString mapIndexToName( sal_Int32 nIndex ); + virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ); // XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence getServiceNames(); diff --git a/sc/source/ui/vba/vbadialogs.cxx b/sc/source/ui/vba/vbadialogs.cxx index 1dca41d5d1e1..aa2161f33c21 100644 --- a/sc/source/ui/vba/vbadialogs.cxx +++ b/sc/source/ui/vba/vbadialogs.cxx @@ -27,18 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include - -#include -#include -#include #include - -#include - -#include "vbahelper.hxx" #include "vbadialogs.hxx" -#include "vbaglobals.hxx" #include "vbadialog.hxx" using namespace ::ooo::vba; @@ -49,26 +39,19 @@ ScVbaDialogs::Dummy() throw (uno::RuntimeException) { } -::sal_Int32 -ScVbaDialogs::getCount() throw (uno::RuntimeException) -{ - //#TODO #FIXEME - //SC_VBA_STUB(); - return 0; -} - uno::Any ScVbaDialogs::Item( const uno::Any &aItem ) throw (uno::RuntimeException) { sal_Int32 nIndex = 0; aItem >>= nIndex; - uno::Reference< excel::XDialog > aDialog( new ScVbaDialog( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication(), uno::UNO_QUERY_THROW ), nIndex, mxContext ) ); + uno::Reference< excel::XDialog > aDialog( new ScVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), mxContext, m_xModel, nIndex ) ); return uno::Any( aDialog ); } + rtl::OUString& ScVbaDialogs::getServiceImplName() { - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaWorksheet") ); + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaDialogs") ); return sImplName; } @@ -79,7 +62,7 @@ ScVbaDialogs::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Worksheet" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Dialogs" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbadialogs.hxx b/sc/source/ui/vba/vbadialogs.hxx index 40eeb78663a2..a1785defc255 100644 --- a/sc/source/ui/vba/vbadialogs.hxx +++ b/sc/source/ui/vba/vbadialogs.hxx @@ -30,25 +30,22 @@ #ifndef SC_VBA_DIALOGS_HXX #define SC_VBA_DIALOGS_HXX -#include - #include #include #include -#include "vbahelperinterface.hxx" +#include +#include +#include -class ScModelObj; - -typedef InheritedHelperInterfaceImpl1< ov::excel::XDialogs > ScVbaDialogs_BASE; +typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::excel::XDialogs > ScVbaDialogs_BASE; class ScVbaDialogs : public ScVbaDialogs_BASE { public: - ScVbaDialogs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext ): ScVbaDialogs_BASE( xParent, xContext ) {} + ScVbaDialogs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel ): ScVbaDialogs_BASE( xParent, xContext, xModel ) {} virtual ~ScVbaDialogs() {} // XCollection - virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException); // XDialogs diff --git a/sc/source/ui/vba/vbafillformat.cxx b/sc/source/ui/vba/vbafillformat.cxx deleted file mode 100644 index 3b25efcb614a..000000000000 --- a/sc/source/ui/vba/vbafillformat.cxx +++ /dev/null @@ -1,202 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbafillformat.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include -#include -#include -#include "vbafillformat.hxx" -#include "vbacolorformat.hxx" - -using namespace ooo::vba; -using namespace com::sun::star; - -ScVbaFillFormat::ScVbaFillFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : ScVbaFillFormat_BASE( xParent, xContext ), m_xShape( xShape ) -{ - m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); - m_nFillStyle = drawing::FillStyle_SOLID; - m_nForeColor = 0; - m_nBackColor = 0; - m_nGradientAngle = 0; -} - -void -ScVbaFillFormat::setFillStyle( drawing::FillStyle nFillStyle ) throw (uno::RuntimeException) -{ - m_nFillStyle = nFillStyle; - if( m_nFillStyle == drawing::FillStyle_GRADIENT ) - { - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_GRADIENT ) ); - awt::Gradient aGradient; - // AXIAL - // RADIAL - // ELLIPTICAL - // SQUARE - // RECT - aGradient.Style = awt::GradientStyle_LINEAR; - aGradient.StartColor = ForeColor()->getRGB(); - aGradient.EndColor = BackColor()->getRGB(); - aGradient.Angle = m_nGradientAngle; - aGradient.Border = 0; - aGradient.XOffset = 0; - aGradient.YOffset = 0; - aGradient.StartIntensity = 100; - aGradient.EndIntensity = 100; - aGradient.StepCount = 1; - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillGradient"), uno::makeAny( aGradient ) ); - } - else if( m_nFillStyle == drawing::FillStyle_SOLID ) - { - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny(drawing::FillStyle_SOLID) ); - } -} - -void -ScVbaFillFormat::setForeColorAndInternalStyle( sal_Int32 nForeColor ) throw (css::uno::RuntimeException) -{ - m_nForeColor = nForeColor; - setFillStyle( m_nFillStyle ); -} - -// Attributes -sal_Bool SAL_CALL -ScVbaFillFormat::getVisible() throw (uno::RuntimeException) -{ - drawing::FillStyle nFillStyle; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= nFillStyle; - if( nFillStyle == drawing::FillStyle_NONE ) - return sal_False; - return sal_True; -} - -void SAL_CALL -ScVbaFillFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) -{ - drawing::FillStyle aFillStyle; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= aFillStyle; - if( !_visible ) - { - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_NONE ) ); - } - else - { - if( aFillStyle == drawing::FillStyle_NONE ) - { - setFillStyle( m_nFillStyle ); - } - } -} - -double SAL_CALL -ScVbaFillFormat::getTransparency() throw (uno::RuntimeException) -{ - sal_Int16 nTransparence = 0; - double dTransparence = 0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ) ) >>= nTransparence; - dTransparence = static_cast( nTransparence ); - dTransparence /= 100; - return dTransparence; -} - -void SAL_CALL -ScVbaFillFormat::setTransparency( double _transparency ) throw (uno::RuntimeException) -{ - sal_Int16 nTransparence = static_cast< sal_Int16 >( _transparency * 100 ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ), uno::makeAny( nTransparence ) ); -} - - -// Methods -void SAL_CALL -ScVbaFillFormat::Solid() throw (uno::RuntimeException) -{ - setFillStyle( drawing::FillStyle_SOLID ); -} - -void SAL_CALL -ScVbaFillFormat::TwoColorGradient( sal_Int32 style, sal_Int32 /*variant*/ ) throw (uno::RuntimeException) -{ - if( style == office::MsoGradientStyle::msoGradientHorizontal ) - { - m_nGradientAngle = 0; - setFillStyle( drawing::FillStyle_GRADIENT ); - } - else if( style == office::MsoGradientStyle::msoGradientVertical ) - { - m_nGradientAngle = 900; - setFillStyle( drawing::FillStyle_GRADIENT ); - } - else if( style == office::MsoGradientStyle::msoGradientDiagonalDown ) - { - m_nGradientAngle = 450; - setFillStyle( drawing::FillStyle_GRADIENT ); - } - else if( style == office::MsoGradientStyle::msoGradientDiagonalUp ) - { - m_nGradientAngle = 900 + 450; - setFillStyle( drawing::FillStyle_GRADIENT ); - } -} - -uno::Reference< msforms::XColorFormat > SAL_CALL -ScVbaFillFormat::BackColor() throw (uno::RuntimeException) -{ - if( !m_xColorFormat.is() ) - m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_BACKCOLOR ) ); - return m_xColorFormat; -} - -uno::Reference< msforms::XColorFormat > SAL_CALL -ScVbaFillFormat::ForeColor() throw (uno::RuntimeException) -{ - if( !m_xColorFormat.is() ) - m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_FORECOLOR ) ); - return m_xColorFormat; -} - - -rtl::OUString& -ScVbaFillFormat::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFillFormat") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaFillFormat::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.FillFormat" ) ); - } - return aServiceNames; -} - diff --git a/sc/source/ui/vba/vbafillformat.hxx b/sc/source/ui/vba/vbafillformat.hxx deleted file mode 100644 index 03029c89dbe4..000000000000 --- a/sc/source/ui/vba/vbafillformat.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbafillformat.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_XFILLFORMAT_HXX -#define SC_VBA_XFILLFORMAT_HXX - -#include -#include -#include -#include "vbahelperinterface.hxx" - -typedef InheritedHelperInterfaceImpl1< ov::msforms::XFillFormat > ScVbaFillFormat_BASE; - -class ScVbaFillFormat : public ScVbaFillFormat_BASE -{ -private: - css::uno::Reference< css::drawing::XShape > m_xShape; - css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; - css::uno::Reference< ov::msforms::XColorFormat > m_xColorFormat; - css::drawing::FillStyle m_nFillStyle; - sal_Int32 m_nForeColor; - sal_Int32 m_nBackColor; - sal_Int16 m_nGradientAngle; -private: - void setFillStyle( css::drawing::FillStyle nFillStyle ) throw (css::uno::RuntimeException); -protected: - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); - -public: - ScVbaFillFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ); - - void setForeColorAndInternalStyle( sal_Int32 nForeColor ) throw (css::uno::RuntimeException); - // Attributes - virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); - virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getTransparency() throw (css::uno::RuntimeException); - virtual void SAL_CALL setTransparency( double _transparency ) throw (css::uno::RuntimeException); - - // Methods - virtual void SAL_CALL Solid() throw (css::uno::RuntimeException); - virtual void SAL_CALL TwoColorGradient( sal_Int32 style, sal_Int32 variant ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException); - virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException); - -}; - -#endif//SC_VBA_XFILLFORMAT_HXX diff --git a/sc/source/ui/vba/vbafont.cxx b/sc/source/ui/vba/vbafont.cxx index ee7004ae2fba..cb54532384b5 100644 --- a/sc/source/ui/vba/vbafont.cxx +++ b/sc/source/ui/vba/vbafont.cxx @@ -46,37 +46,14 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; -// use local constants there is no need to expose these constants -// externally. Looking at the Format->Character dialog it seem that -// these may infact be even be calculated. Leave hardcoded for now -// #FIXEME #TBD investigate the code for dialog mentioned above - -// The font baseline is not specified. -const short NORMAL = 0; - -// specifies a superscripted. -const short SUPERSCRIPT = 33; - -// specifies a subscripted. -const short SUBSCRIPT = -33; - -// specifies a hight of superscripted font - const sal_Int8 SUPERSCRIPTHEIGHT = 58; - -// specifies a hight of subscripted font -const sal_Int8 SUBSCRIPTHEIGHT = 58; - -// specifies a hight of normal font -const short NORMALHEIGHT = 100; - -ScVbaFont::ScVbaFont( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const ScVbaPalette& dPalette, uno::Reference< beans::XPropertySet > xPropertySet, ScCellRangeObj* pRangeObj ) throw ( uno::RuntimeException ) : ScVbaFont_BASE( xParent, xContext ), mxFont( xPropertySet, css::uno::UNO_QUERY_THROW ), mPalette( dPalette ), mpRangeObj( pRangeObj ) +ScVbaFont::ScVbaFont( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const ScVbaPalette& dPalette, uno::Reference< beans::XPropertySet > xPropertySet, ScCellRangeObj* pRangeObj ) throw ( uno::RuntimeException ) : ScVbaFont_BASE( xParent, xContext, dPalette.getPalette(), xPropertySet ), mPalette( dPalette ), mpRangeObj( pRangeObj ) { } SfxItemSet* ScVbaFont::GetDataSet() { - SfxItemSet* pDataSet = ScVbaCellRangeAccess::GetDataSet( mpRangeObj ); + SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( mpRangeObj ); return pDataSet; } @@ -243,19 +220,13 @@ ScVbaFont::getSubscript() throw ( uno::RuntimeException ) return uno::makeAny( ( nValue == SUBSCRIPT ) ); } -void SAL_CALL -ScVbaFont::setSize( const uno::Any& aValue ) throw( uno::RuntimeException ) -{ - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ), aValue ); -} - uno::Any SAL_CALL ScVbaFont::getSize() throw ( uno::RuntimeException ) { if ( GetDataSet() ) if ( GetDataSet()->GetItemState( ATTR_FONT_HEIGHT, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); - return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ) ); + return ScVbaFont_BASE::getSize(); } void SAL_CALL @@ -267,43 +238,22 @@ ScVbaFont::setColorIndex( const uno::Any& _colorindex ) throw( uno::RuntimeExcep // handled properly here if ( !nIndex || ( nIndex == excel::XlColorIndex::xlColorIndexAutomatic ) ) + { nIndex = 1; // check defualt ( assume black ) - --nIndex; // OOo indices are zero bases - uno::Reference< container::XIndexAccess > xIndex = mPalette.getPalette(); - // setColor expects colors in XL RGB values - // #FIXME this is daft we convert OO RGB val to XL RGB val and - // then back again to OO RGB value - setColor( OORGBToXLRGB(xIndex->getByIndex( nIndex )) ); + ScVbaFont_BASE::setColorIndex( uno::makeAny( nIndex ) ); + } + else + ScVbaFont_BASE::setColorIndex( _colorindex ); } uno::Any SAL_CALL ScVbaFont::getColorIndex() throw ( uno::RuntimeException ) { - sal_Int32 nColor = 0; if ( GetDataSet() ) if ( GetDataSet()->GetItemState( ATTR_FONT_COLOR, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); - - // getColor returns Xl ColorValue, need to convert it to OO val - // as the palette deals with OO RGB values - // #FIXME this is daft in getColor we convert OO RGB val to XL RGB val - // and then back again to OO RGB value - XLRGBToOORGB( getColor() ) >>= nColor; - uno::Reference< container::XIndexAccess > xIndex = mPalette.getPalette(); - sal_Int32 nElems = xIndex->getCount(); - sal_Int32 nIndex = -1; - for ( sal_Int32 count=0; countgetByIndex( count ) >>= nPaletteColor; - if ( nPaletteColor == nColor ) - { - nIndex = count + 1; // 1 based - break; - } - } - return uno::makeAny( nIndex ); + return ScVbaFont_BASE::getColorIndex(); } ////////////////////////////////////////////////////////////////////////////////////////// @@ -396,28 +346,13 @@ ScVbaFont::getFontStyle() throw ( uno::RuntimeException ) return uno::makeAny( aStyles.makeStringAndClear() ); } -void SAL_CALL -ScVbaFont::setBold( const uno::Any& aValue ) throw( uno::RuntimeException ) -{ - sal_Bool bValue = sal_False; - aValue >>= bValue; - double fBoldValue = awt::FontWeight::NORMAL; - if( bValue ) - fBoldValue = awt::FontWeight::BOLD; - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ), ( uno::Any )fBoldValue ); - -} - uno::Any SAL_CALL ScVbaFont::getBold() throw ( uno::RuntimeException ) { if ( GetDataSet() ) if ( GetDataSet()->GetItemState( ATTR_FONT_WEIGHT, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); - - double fValue = 0.0; - mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ) ) >>= fValue; - return uno::makeAny( fValue == awt::FontWeight::BOLD ); + return ScVbaFont_BASE::getBold(); } void SAL_CALL @@ -481,32 +416,13 @@ ScVbaFont::getUnderline() throw ( uno::RuntimeException ) return uno::makeAny( nValue ); } -void SAL_CALL -ScVbaFont::setStrikethrough( const uno::Any& aValue ) throw ( uno::RuntimeException ) -{ - sal_Bool bValue = sal_False; - aValue >>= bValue; - short nValue = awt::FontStrikeout::NONE; - if( bValue ) - nValue = awt::FontStrikeout::SINGLE; - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ), ( uno::Any )nValue ); -} - uno::Any SAL_CALL ScVbaFont::getStrikethrough() throw ( uno::RuntimeException ) { if ( GetDataSet() ) if ( GetDataSet()->GetItemState( ATTR_FONT_CROSSEDOUT, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); - short nValue = 0; - mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ) ) >>= nValue; - return uno::Any( nValue == awt::FontStrikeout::SINGLE ); -} - -void SAL_CALL -ScVbaFont::setShadow( const uno::Any& aValue ) throw ( uno::RuntimeException ) -{ - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), aValue ); + return ScVbaFont_BASE::getStrikethrough(); } uno::Any SAL_CALL @@ -515,18 +431,7 @@ ScVbaFont::getShadow() throw (uno::RuntimeException) if ( GetDataSet() ) if ( GetDataSet()->GetItemState( ATTR_FONT_SHADOWED, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); - return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) ); -} - -void SAL_CALL -ScVbaFont::setItalic( const uno::Any& aValue ) throw ( uno::RuntimeException ) -{ - sal_Bool bValue = sal_False; - aValue >>= bValue; - short nValue = awt::FontSlant_NONE; - if( bValue ) - nValue = awt::FontSlant_ITALIC; - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ), ( uno::Any )nValue ); + return ScVbaFont_BASE::getShadow(); } uno::Any SAL_CALL @@ -536,17 +441,7 @@ ScVbaFont::getItalic() throw ( uno::RuntimeException ) if ( GetDataSet()->GetItemState( ATTR_FONT_POSTURE, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); - awt::FontSlant aFS; - mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ) ) >>= aFS; - return uno::makeAny( aFS == awt::FontSlant_ITALIC ); -} - -void SAL_CALL -ScVbaFont::setName( const uno::Any& aValue ) throw ( uno::RuntimeException ) -{ - rtl::OUString sString; - aValue >>= sString; - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), aValue); + return ScVbaFont_BASE::getItalic(); } uno::Any SAL_CALL @@ -555,22 +450,17 @@ ScVbaFont::getName() throw ( uno::RuntimeException ) if ( GetDataSet() ) if ( GetDataSet()->GetItemState( ATTR_FONT, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); - return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ) ); + return ScVbaFont_BASE::getName(); } uno::Any ScVbaFont::getColor() throw (uno::RuntimeException) { + // #TODO #FIXME - behave like getXXX above ( wrt. GetDataSet ) uno::Any aAny; aAny = OORGBToXLRGB( mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) ) ); return aAny; } -void -ScVbaFont::setColor( const uno::Any& _color ) throw (uno::RuntimeException) -{ - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) , XLRGBToOORGB(_color)); -} - void SAL_CALL ScVbaFont::setOutlineFont( const uno::Any& aValue ) throw ( uno::RuntimeException ) { diff --git a/sc/source/ui/vba/vbafont.hxx b/sc/source/ui/vba/vbafont.hxx index a0b9b2ebf140..625985564cda 100644 --- a/sc/source/ui/vba/vbafont.hxx +++ b/sc/source/ui/vba/vbafont.hxx @@ -32,19 +32,19 @@ #include -#include #include -#include "vbahelperinterface.hxx" +#include +#include +#include #include "vbapalette.hxx" class ScTableSheetsObj; class ScCellRangeObj; -typedef InheritedHelperInterfaceImpl1< ov::excel::XFont > ScVbaFont_BASE; +typedef cppu::ImplInheritanceHelper1< VbaFontBase, ov::excel::XFont > ScVbaFont_BASE; class ScVbaFont : public ScVbaFont_BASE { - css::uno::Reference< css::beans::XPropertySet > mxFont; ScVbaPalette mPalette; ScCellRangeObj* mpRangeObj; SfxItemSet* GetDataSet(); @@ -54,7 +54,6 @@ public: // Attributes virtual css::uno::Any SAL_CALL getSize() throw (css::uno::RuntimeException); - virtual void SAL_CALL setSize( const css::uno::Any& _size ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getStandardFontSize() throw (css::uno::RuntimeException); virtual void SAL_CALL setStandardFontSize( const css::uno::Any& _standardfontsize ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getStandardFont() throw (css::uno::RuntimeException); @@ -64,23 +63,17 @@ public: virtual css::uno::Any SAL_CALL getColorIndex() throw (css::uno::RuntimeException); virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getBold() throw (css::uno::RuntimeException); - virtual void SAL_CALL setBold( const css::uno::Any& _bold ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getUnderline() throw (css::uno::RuntimeException); virtual void SAL_CALL setUnderline( const css::uno::Any& _underline ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getStrikethrough() throw (css::uno::RuntimeException); - virtual void SAL_CALL setStrikethrough( const css::uno::Any& _strikethrough ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getShadow() throw (css::uno::RuntimeException); - virtual void SAL_CALL setShadow( const css::uno::Any& _shadow ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getItalic() throw (css::uno::RuntimeException); - virtual void SAL_CALL setItalic( const css::uno::Any& _italic ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getSubscript() throw (css::uno::RuntimeException); virtual void SAL_CALL setSubscript( const css::uno::Any& _subscript ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getSuperscript() throw (css::uno::RuntimeException); virtual void SAL_CALL setSuperscript( const css::uno::Any& _superscript ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getName() throw (css::uno::RuntimeException); - virtual void SAL_CALL setName( const css::uno::Any& _name ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getColor() throw (css::uno::RuntimeException) ; - virtual void SAL_CALL setColor( const css::uno::Any& _color ) throw (css::uno::RuntimeException) ; virtual css::uno::Any SAL_CALL getOutlineFont() throw (css::uno::RuntimeException) ; virtual void SAL_CALL setOutlineFont( const css::uno::Any& _outlinefont ) throw (css::uno::RuntimeException) ; // XHelperInterface diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx index a627ed3a4d92..1d30f92e1c6c 100644 --- a/sc/source/ui/vba/vbaformat.cxx +++ b/sc/source/ui/vba/vbaformat.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -341,7 +342,7 @@ template< typename Ifc1 > uno::Any SAL_CALL ScVbaFormat::Borders( const uno::Any& Index ) throw (script::BasicErrorException, uno::RuntimeException ) { - ScVbaPalette aPalette( getDocShell( mxModel ) ); + ScVbaPalette aPalette( excel::getDocShell( mxModel ) ); uno::Reference< XCollection > xColl = new ScVbaBorders( thisHelperIface(), ScVbaFormat_BASE::mxContext, uno::Reference< table::XCellRange >( mxPropertySet, uno::UNO_QUERY_THROW ), aPalette ); if ( Index.hasValue() ) @@ -355,7 +356,7 @@ template< typename Ifc1 > uno::Reference< excel::XFont > SAL_CALL ScVbaFormat::Font( ) throw (script::BasicErrorException, uno::RuntimeException) { - ScVbaPalette aPalette( getDocShell( mxModel ) ); + ScVbaPalette aPalette( excel::getDocShell( mxModel ) ); return new ScVbaFont( thisHelperIface(), ScVbaFormat_BASE::mxContext, aPalette, mxPropertySet ); } diff --git a/sc/source/ui/vba/vbaformat.hxx b/sc/source/ui/vba/vbaformat.hxx index afb5e5a45c29..cb33ad818f59 100644 --- a/sc/source/ui/vba/vbaformat.hxx +++ b/sc/source/ui/vba/vbaformat.hxx @@ -39,7 +39,7 @@ #include #include #include -#include "vbahelperinterface.hxx" +#include template< typename Ifc1 > class ScVbaFormat : public InheritedHelperInterfaceImpl1< Ifc1 > diff --git a/sc/source/ui/vba/vbaformatconditions.cxx b/sc/source/ui/vba/vbaformatconditions.cxx index 06067d470177..1048cd91d2d3 100644 --- a/sc/source/ui/vba/vbaformatconditions.cxx +++ b/sc/source/ui/vba/vbaformatconditions.cxx @@ -36,6 +36,7 @@ #include "vbaformatcondition.hxx" #include "vbaworkbook.hxx" #include "vbastyles.hxx" +#include "vbaglobals.hxx" using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -50,7 +51,7 @@ static rtl::OUString sStyleNamePrefix( RTL_CONSTASCII_USTRINGPARAM("Excel_CondFo ScVbaFormatConditions::ScVbaFormatConditions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< sheet::XSheetConditionalEntries >& _xSheetConditionalEntries, const uno::Reference< frame::XModel >& xModel ) : ScVbaFormatConditions_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( _xSheetConditionalEntries, uno::UNO_QUERY_THROW ) ), mxSheetConditionalEntries( _xSheetConditionalEntries ) { mxRangeParent.set( xParent, uno::UNO_QUERY_THROW ); - uno::Reference< excel::XWorkbook > xWorkbook = new ScVbaWorkbook( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel ); + uno::Reference< excel::XWorkbook > xWorkbook = new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), xContext, xModel ); mxStyles.set( xWorkbook->Styles( uno::Any() ), uno::UNO_QUERY_THROW ); uno::Reference< sheet::XCellRangeAddressable > xCellRange( mxRangeParent->getCellRange(), uno::UNO_QUERY_THROW ); mxParentRangePropertySet.set( xCellRange, uno::UNO_QUERY_THROW ); diff --git a/sc/source/ui/vba/vbaformatconditions.hxx b/sc/source/ui/vba/vbaformatconditions.hxx index e5524a746638..177ddd168f35 100644 --- a/sc/source/ui/vba/vbaformatconditions.hxx +++ b/sc/source/ui/vba/vbaformatconditions.hxx @@ -35,7 +35,7 @@ #include #include #include -#include "vbacollectionimpl.hxx" +#include typedef CollTestImplHelper< ov::excel::XFormatConditions > ScVbaFormatConditions_BASE; class ScVbaFormatConditions: public ScVbaFormatConditions_BASE diff --git a/sc/source/ui/vba/vbaframe.cxx b/sc/source/ui/vba/vbaframe.cxx deleted file mode 100644 index 24f8884e4d3b..000000000000 --- a/sc/source/ui/vba/vbaframe.cxx +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include "vbaframe.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); -ScVbaFrame::ScVbaFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ -} - -// Attributes -rtl::OUString SAL_CALL -ScVbaFrame::getCaption() throw (css::uno::RuntimeException) -{ - rtl::OUString Label; - m_xProps->getPropertyValue( LABEL ) >>= Label; - return Label; -} - -void SAL_CALL -ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) -{ - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); -} - -uno::Any SAL_CALL -ScVbaFrame::getValue() throw (css::uno::RuntimeException) -{ - return uno::makeAny( getCaption() ); -} - -void SAL_CALL -ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) -{ - rtl::OUString sCaption; - _value >>= sCaption; - setCaption( sCaption ); -} - -rtl::OUString& -ScVbaFrame::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFrame") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaFrame::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbaframe.hxx b/sc/source/ui/vba/vbaframe.hxx deleted file mode 100644 index 60204571c749..000000000000 --- a/sc/source/ui/vba/vbaframe.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_FRAME_HXX -#define SC_VBA_FRAME_HXX -#include -#include - -#include "vbacontrol.hxx" -#include "vbahelper.hxx" - -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XLabel > FrameImpl_BASE; - -class ScVbaFrame : public FrameImpl_BASE -{ -public: - ScVbaFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); - // Attributes - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; -#endif //SC_VBA_LABEL_HXX diff --git a/sc/source/ui/vba/vbaglobals.cxx b/sc/source/ui/vba/vbaglobals.cxx index 216a8a3d1f70..982289f0002e 100644 --- a/sc/source/ui/vba/vbaglobals.cxx +++ b/sc/source/ui/vba/vbaglobals.cxx @@ -27,13 +27,14 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "helperdecl.hxx" +#include #include "vbaglobals.hxx" #include #include #include +#include #include "vbaapplication.hxx" #include "vbaworksheet.hxx" @@ -49,11 +50,20 @@ using namespace ::ooo::vba; // ScVbaGlobals // ============================================================================= -ScVbaGlobals::ScVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext ) - :m_xContext( rxContext ) +//ScVbaGlobals::ScVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext, ) : ScVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext ) +rtl::OUString sDocCtxName( RTL_CONSTASCII_USTRINGPARAM("ExcelDocumentContext") ); + +ScVbaGlobals::ScVbaGlobals( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& rxContext ) : ScVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext, sDocCtxName ) { OSL_TRACE("ScVbaGlobals::ScVbaGlobals()"); - mxApplication = uno::Reference< excel::XApplication > ( new ScVbaApplication( m_xContext) ); + + uno::Sequence< beans::PropertyValue > aInitArgs( 2 ); + aInitArgs[ 0 ].Name = rtl::OUString::createFromAscii("Application"); + aInitArgs[ 0 ].Value = uno::makeAny( getApplication() ); + aInitArgs[ 1 ].Name = sDocCtxName; + aInitArgs[ 1 ].Value = uno::makeAny( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ) ); + + init( aInitArgs ); } ScVbaGlobals::~ScVbaGlobals() @@ -61,23 +71,6 @@ ScVbaGlobals::~ScVbaGlobals() OSL_TRACE("ScVbaGlobals::~ScVbaGlobals"); } -// Will throw if singleton can't be accessed -uno::Reference< XGlobals > -ScVbaGlobals::getGlobalsImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) -{ - uno::Reference< XGlobals > xGlobals( - xContext->getValueByName( ::rtl::OUString::createFromAscii( - "/singletons/ooo.vba.theGlobals") ), uno::UNO_QUERY); - - if ( !xGlobals.is() ) - { - throw uno::RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Couldn't access Globals" ) ), - uno::Reference< XInterface >() ); - } - return xGlobals; -} - // ============================================================================= // XGlobals // ============================================================================= @@ -85,14 +78,16 @@ uno::Reference ScVbaGlobals::getApplication() throw (uno::RuntimeException) { // OSL_TRACE("In ScVbaGlobals::getApplication"); - return mxApplication; + if ( !mxApplication.is() ) + mxApplication.set( new ScVbaApplication( mxContext) ); + return mxApplication; } uno::Reference< excel::XWorkbook > SAL_CALL ScVbaGlobals::getActiveWorkbook() throw (uno::RuntimeException) { // OSL_TRACE("In ScVbaGlobals::getActiveWorkbook"); - uno::Reference< excel::XWorkbook > xWorkbook( mxApplication->getActiveWorkbook(), uno::UNO_QUERY); + uno::Reference< excel::XWorkbook > xWorkbook( getApplication()->getActiveWorkbook(), uno::UNO_QUERY); if ( xWorkbook.is() ) { return xWorkbook; @@ -103,22 +98,28 @@ ScVbaGlobals::getActiveWorkbook() throw (uno::RuntimeException) } +uno::Reference< excel::XWindow > SAL_CALL +ScVbaGlobals::getActiveWindow() throw (uno::RuntimeException) +{ + return getApplication()->getActiveWindow(); +} + uno::Reference< excel::XWorksheet > SAL_CALL ScVbaGlobals::getActiveSheet() throw (uno::RuntimeException) { - return mxApplication->getActiveSheet(); + return getApplication()->getActiveSheet(); } uno::Any SAL_CALL ScVbaGlobals::WorkBooks( const uno::Any& aIndex ) throw (uno::RuntimeException) { - return uno::Any( mxApplication->Workbooks(aIndex) ); + return uno::Any( getApplication()->Workbooks(aIndex) ); } uno::Any SAL_CALL ScVbaGlobals::WorkSheets(const uno::Any& aIndex) throw (uno::RuntimeException) { - return mxApplication->Worksheets( aIndex ); + return getApplication()->Worksheets( aIndex ); } uno::Any SAL_CALL ScVbaGlobals::Sheets( const uno::Any& aIndex ) throw (uno::RuntimeException) @@ -126,26 +127,6 @@ ScVbaGlobals::Sheets( const uno::Any& aIndex ) throw (uno::RuntimeException) return WorkSheets( aIndex ); } -::uno::Sequence< ::uno::Any > SAL_CALL -ScVbaGlobals::getGlobals( ) throw (::uno::RuntimeException) -{ - sal_uInt32 nMax = 0; - uno::Sequence< uno::Any > maGlobals(4); - maGlobals[ nMax++ ] <<= ScVbaGlobals::getGlobalsImpl(m_xContext); - maGlobals[ nMax++ ] <<= mxApplication; - - uno::Reference< excel::XWorkbook > xWorkbook = mxApplication->getActiveWorkbook(); - if( xWorkbook.is() ) - { - maGlobals[ nMax++ ] <<= xWorkbook; - uno::Reference< excel::XWorksheet > xWorksheet = xWorkbook->getActiveSheet(); - if( xWorksheet.is() ) - maGlobals[ nMax++ ] <<= xWorksheet; - } - maGlobals.realloc( nMax ); - return maGlobals; -} - uno::Any SAL_CALL ScVbaGlobals::Range( const uno::Any& Cell1, const uno::Any& Cell2 ) throw (uno::RuntimeException) { @@ -158,13 +139,140 @@ ScVbaGlobals::Names( const css::uno::Any& aIndex ) throw ( uno::RuntimeException return getApplication()->Names( aIndex ); } +uno::Reference< excel::XRange > SAL_CALL +ScVbaGlobals::getActiveCell() throw (uno::RuntimeException) +{ + return getApplication()->getActiveCell(); +} + +uno::Reference< XAssistant > SAL_CALL +ScVbaGlobals::getAssistant() throw (uno::RuntimeException) +{ + return getApplication()->getAssistant(); +} + +uno::Any SAL_CALL +ScVbaGlobals::getSelection() throw (uno::RuntimeException) +{ + return getApplication()->getSelection(); +} + +uno::Reference< excel::XWorkbook > SAL_CALL +ScVbaGlobals::getThisWorkbook() throw (uno::RuntimeException) +{ + return getApplication()->getThisWorkbook(); +} +void SAL_CALL +ScVbaGlobals::Calculate() throw (::com::sun::star::script::BasicErrorException, ::com::sun::star::uno::RuntimeException) +{ + return getApplication()->Calculate(); +} + +uno::Reference< excel::XRange > SAL_CALL +ScVbaGlobals::Cells( const uno::Any& RowIndex, const uno::Any& ColumnIndex ) throw (uno::RuntimeException) +{ + return getApplication()->getActiveSheet()->Cells( RowIndex, ColumnIndex ); +} +uno::Reference< excel::XRange > SAL_CALL +ScVbaGlobals::Columns( const uno::Any& aIndex ) throw (uno::RuntimeException) +{ + return getApplication()->getActiveSheet()->Columns( aIndex ); +} + +uno::Any SAL_CALL +ScVbaGlobals::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException) +{ + uno::Reference< XApplicationBase > xBase( getApplication(), uno::UNO_QUERY_THROW ); + return xBase->CommandBars( aIndex ); +} + +css::uno::Reference< ov::excel::XRange > SAL_CALL +ScVbaGlobals::Union( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException) +{ + return getApplication()->Union( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30 ); +} +css::uno::Reference< ov::excel::XRange > SAL_CALL +ScVbaGlobals::Intersect( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException) +{ + return getApplication()->Intersect( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30 ); +} + +uno::Any SAL_CALL +ScVbaGlobals::Evaluate( const ::rtl::OUString& Name ) throw (uno::RuntimeException) +{ + return getApplication()->Evaluate( Name ); +} + +css::uno::Any SAL_CALL +ScVbaGlobals::WorksheetFunction( ) throw (css::uno::RuntimeException) +{ + return getApplication()->WorksheetFunction(); +} + +uno::Any SAL_CALL +ScVbaGlobals::Windows( const uno::Any& aIndex ) throw (uno::RuntimeException) +{ + return getApplication()->Windows( aIndex ); +} + +uno::Reference< excel::XRange > SAL_CALL +ScVbaGlobals::Rows( const uno::Any& aIndex ) throw (uno::RuntimeException) +{ + return getApplication()->getActiveSheet()->Rows( aIndex ); + +} + +uno::Sequence< ::rtl::OUString > SAL_CALL +ScVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException) +{ + static bool bInit = false; + static uno::Sequence< rtl::OUString > serviceNames( ScVbaGlobals_BASE::getAvailableServiceNames() ); + if ( !bInit ) + { + rtl::OUString names[] = { + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Range" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Workbook" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Window" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Worksheet" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Application" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Hyperlink" ) ), + }; + sal_Int32 nExcelServices = ( sizeof( names )/ sizeof( names[0] ) ); + sal_Int32 startIndex = serviceNames.getLength(); + serviceNames.realloc( serviceNames.getLength() + nExcelServices ); + for ( sal_Int32 index = 0; index < nExcelServices; ++index ) + serviceNames[ startIndex + index ] = names[ index ]; + bInit = true; + } + return serviceNames; +} + +rtl::OUString& +ScVbaGlobals::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaGlobals") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaGlobals::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Globals" ) ); + } + return aServiceNames; +} + namespace globals { namespace sdecl = comphelper::service_decl; -sdecl::class_ > serviceImpl; +sdecl::vba_service_class_ > serviceImpl; extern sdecl::ServiceDecl const serviceDecl( serviceImpl, "ScVbaGlobals", - "ooo.vba.Globals" ); + "ooo.vba.excel.Globals" ); } diff --git a/sc/source/ui/vba/vbaglobals.hxx b/sc/source/ui/vba/vbaglobals.hxx index f24032d14ad9..25d36af55c8d 100644 --- a/sc/source/ui/vba/vbaglobals.hxx +++ b/sc/source/ui/vba/vbaglobals.hxx @@ -33,43 +33,65 @@ #include #include #include -#include +#include +#include #include -#include "vbahelper.hxx" +#include "excelvbahelper.hxx" +#include // ============================================================================= // class ScVbaGlobals // ============================================================================= - typedef ::cppu::WeakImplHelper1< - ov::XGlobals > ScVbaGlobals_BASE; - +typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::excel::XGlobals > ScVbaGlobals_BASE; class ScVbaGlobals : public ScVbaGlobals_BASE { - private: - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< ov::excel::XApplication > mxApplication; - public: - - ScVbaGlobals( - css::uno::Reference< css::uno::XComponentContext >const& rxContext ); - virtual ~ScVbaGlobals(); - - static css::uno::Reference< ov::XGlobals > getGlobalsImpl(const css::uno::Reference< css::uno::XComponentContext >& ) throw (css::uno::RuntimeException); - - // XGlobals + css::uno::Reference< ov::excel::XApplication > mxApplication; virtual css::uno::Reference< ov::excel::XApplication > SAL_CALL getApplication() throw (css::uno::RuntimeException); + public: + + ScVbaGlobals( css::uno::Sequence< css::uno::Any > const& aArgs, + css::uno::Reference< css::uno::XComponentContext >const& rxContext ); + //ScVbaGlobals( + // css::uno::Reference< css::uno::XComponentContext >const& rxContext, ); + virtual ~ScVbaGlobals(); + + // XGlobals virtual css::uno::Reference< ov::excel::XWorkbook > SAL_CALL getActiveWorkbook() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::XAssistant > SAL_CALL getAssistant() throw (css::uno::RuntimeException); + virtual void SAL_CALL Calculate( ) throw (::com::sun::star::script::BasicErrorException, ::com::sun::star::uno::RuntimeException); + + virtual css::uno::Any SAL_CALL getSelection() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getActiveCell() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XWorkbook > SAL_CALL getThisWorkbook() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Cells( const css::uno::Any& RowIndex, const css::uno::Any& ColumnIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Columns( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Evaluate( const ::rtl::OUString& Name ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL WorkSheets(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL WorkBooks(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL WorksheetFunction( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Windows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL Sheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); - virtual css::uno::Sequence< css::uno::Any > SAL_CALL getGlobals( ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL Range( const css::uno::Any& Cell1, const css::uno::Any& Cell2 ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ::ooo::vba::excel::XRange > SAL_CALL Rows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw ( css::uno::RuntimeException ); + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Intersect( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Union( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + + + + // XMultiServiceFactory + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); }; #endif // diff --git a/sc/source/ui/vba/vbahelper.cxx b/sc/source/ui/vba/vbahelper.cxx index 359a6c3d42ce..e010d1cf10f3 100644 --- a/sc/source/ui/vba/vbahelper.cxx +++ b/sc/source/ui/vba/vbahelper.cxx @@ -826,3 +826,5 @@ ScVbaCellRangeAccess::GetDataSet( ScCellRangeObj* pRangeObj ) } // openoffice } //org +======= +>>>>>>> other diff --git a/sc/source/ui/vba/vbahelper.hxx b/sc/source/ui/vba/vbahelper.hxx deleted file mode 100644 index 3def6b078096..000000000000 --- a/sc/source/ui/vba/vbahelper.hxx +++ /dev/null @@ -1,352 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbahelper.hxx,v $ - * $Revision: 1.5.32.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_HELPER_HXX -#define SC_VBA_HELPER_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cellsuno.hxx" - -namespace css = ::com::sun::star; - -namespace ooo -{ - namespace vba - { - template < class T > - css::uno::Reference< T > getXSomethingFromArgs( css::uno::Sequence< css::uno::Any > const & args, sal_Int32 nPos, bool bCanBeNull = true ) throw (css::lang::IllegalArgumentException) - { - if ( args.getLength() < ( nPos + 1) ) - throw css::lang::IllegalArgumentException(); - css::uno::Reference< T > aSomething( args[ nPos ], css::uno::UNO_QUERY ); - if ( !bCanBeNull && !aSomething.is() ) - throw css::lang::IllegalArgumentException(); - return aSomething; - } - css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException); - css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException); - - void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ; - void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ; - void dispatchExecute(css::uno::Reference< css::frame::XModel>& xModel, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON ); - void implnCopy(); - void implnPaste(); - void implnCut(); - void implnPasteSpecial(sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose); - css::uno::Reference< css::frame::XModel > - getCurrentDocument() throw (css::uno::RuntimeException); - ScTabViewShell* getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) ; - ScDocShell* getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) ; - ScTabViewShell* getCurrentBestViewShell(); - SfxViewFrame* getCurrentViewFrame(); - sal_Int32 OORGBToXLRGB( sal_Int32 ); - sal_Int32 XLRGBToOORGB( sal_Int32 ); - css::uno::Any OORGBToXLRGB( const css::uno::Any& ); - css::uno::Any XLRGBToOORGB( const css::uno::Any& ); - // provide a NULL object that can be passed as variant so that - // the object when passed to IsNull will return true. aNULL - // contains an empty object reference - const css::uno::Any& aNULL(); - void PrintOutHelper( const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, css::uno::Reference< css::frame::XModel >& xModel, sal_Bool bSelection ); - void PrintPreviewHelper( const css::uno::Any& EnableChanges, css::uno::Reference< css::frame::XModel >& xModel ); - - rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException ); - rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic ) - double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical); - double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); - double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); - - -class ScVbaCellRangeAccess -{ -public: - static SfxItemSet* GetDataSet( ScCellRangeObj* pRangeObj ); -}; - -class Millimeter -{ -//Factor to translate between points and hundredths of millimeters: -private: - static const double factor; - - double m_nMillimeter; - -public: - Millimeter():m_nMillimeter(0) {} - - Millimeter(double mm):m_nMillimeter(mm) {} - - void set(double mm) { m_nMillimeter = mm; } - void setInPoints(double points) - { - m_nMillimeter = points * 0.352777778; - // 25.4mm / 72 - } - - void setInHundredthsOfOneMillimeter(double hmm) - { - m_nMillimeter = hmm / 100; - } - - double get() - { - return m_nMillimeter; - } - double getInHundredthsOfOneMillimeter() - { - return m_nMillimeter * 100; - } - double getInPoints() - { - return m_nMillimeter * 2.834645669; // 72 / 25.4mm - } - - static sal_Int32 getInHundredthsOfOneMillimeter(double points) - { - sal_Int32 mm = static_cast(points * factor); - return mm; - } - - static double getInPoints(int _hmm) - { - double points = double( static_cast(_hmm) / factor); - return points; - } -}; - -class AbstractGeometryAttributes // probably should replace the ShapeHelper below -{ -public: - virtual ~AbstractGeometryAttributes() {} - virtual double getLeft() = 0; - virtual void setLeft( double ) = 0; - virtual double getTop() = 0; - virtual void setTop( double ) = 0; - virtual double getHeight() = 0; - virtual void setHeight( double ) = 0; - virtual double getWidth() = 0; - virtual void setWidth( double ) = 0; -}; - -class ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes -{ -public: - css::uno::Reference< ooo::vba::msforms::XShape > m_xShape; - ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ); - virtual double getLeft() - { - return m_xShape->getLeft(); - } - virtual void setLeft( double nLeft ) - { - m_xShape->setLeft( nLeft ); - } - virtual double getTop() - { - return m_xShape->getTop(); - } - virtual void setTop( double nTop ) - { - m_xShape->setTop( nTop ); - } - - virtual double getHeight() - { - return m_xShape->getHeight(); - } - virtual void setHeight( double nHeight ) - { - m_xShape->setHeight( nHeight ); - } - virtual double getWidth() - { - return m_xShape->getWidth(); - } - virtual void setWidth( double nWidth) - { - m_xShape->setHeight( nWidth ); - } - - -}; -#define VBA_LEFT "PositionX" -#define VBA_TOP "PositionY" -class UserFormGeometryHelper : public AbstractGeometryAttributes -{ - - css::uno::Reference< css::beans::XPropertySet > mxModel; -public: - UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl ); - virtual double getLeft(); - virtual void setLeft( double nLeft ); - virtual double getTop(); - virtual void setTop( double nTop ); - virtual double getHeight(); - virtual void setHeight( double nHeight ); - virtual double getWidth(); - virtual void setWidth( double nWidth); -}; - -class ShapeHelper -{ -protected: - css::uno::Reference< css::drawing::XShape > xShape; -public: - ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape ) - { - if( !xShape.is() ) - throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() ); - } - - double getHeight() - { - return Millimeter::getInPoints(xShape->getSize().Height); - } - - - void setHeight(double _fheight) throw ( css::script::BasicErrorException ) - { - try - { - css::awt::Size aSize = xShape->getSize(); - aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight); - xShape->setSize(aSize); - } - catch ( css::uno::Exception& /*e*/) - { - throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); - } - } - - - double getWidth() - { - return Millimeter::getInPoints(xShape->getSize().Width); - } - - void setWidth(double _fWidth) throw ( css::script::BasicErrorException ) - { - try - { - css::awt::Size aSize = xShape->getSize(); - aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth); - xShape->setSize(aSize); - } - catch (css::uno::Exception& /*e*/) - { - throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); - } - } - - - double getLeft() - { - return Millimeter::getInPoints(xShape->getPosition().X); - } - - - void setLeft(double _fLeft) - { - css::awt::Point aPoint = xShape->getPosition(); - aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft); - xShape->setPosition(aPoint); - } - - - double getTop() - { - return Millimeter::getInPoints(xShape->getPosition().Y); - } - - - void setTop(double _fTop) - { - css::awt::Point aPoint = xShape->getPosition(); - aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop); - xShape->setPosition(aPoint); - } - -}; - -class ContainerUtilities -{ - -public: - static rtl::OUString getUniqueName( const css::uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator); - static rtl::OUString getUniqueName( const css::uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix ); - - static sal_Int32 FieldInList( const css::uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString ); -}; - -// really just a a place holder to ease the porting pain -class DebugHelper -{ -public: - static void exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException ) - { - // #TODO #FIXME ( do we want to support additionalArg here ) - throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString::createFromAscii(" ") ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() ); - } - - static void exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException ) - { - exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument ); - } - - static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException ) - { - exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() ); - } -}; - } // openoffice -} // org - -namespace ov = ooo::vba; - -#ifdef DEBUG -# define SC_VBA_FIXME(a) OSL_TRACE( a ) -# define SC_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ )) -#else -# define SC_VBA_FIXME(a) -# define SC_VBA_STUB() -#endif - -#endif diff --git a/sc/source/ui/vba/vbahelperinterface.hxx b/sc/source/ui/vba/vbahelperinterface.hxx deleted file mode 100644 index 567741cfafbc..000000000000 --- a/sc/source/ui/vba/vbahelperinterface.hxx +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbahelperinterface.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_HELPERINTERFACE_HXX -#define SC_VBA_HELPERINTERFACE_HXX - -#include -#include -#include "vbahelper.hxx" -#include "vbaglobals.hxx" - -// use this class when you have an a object like -// interface XAnInterface which contains XHelperInterface in its inheritance hierarchy -// interface XAnInterface -// { -// interface XHelperInterface; -// [attribute, string] name; -// } -// or -// interface XAnInterface : XHelperInterface; -// { -// [attribute, string] name; -// } -// -// then this class can provide a default implementation of XHelperInterface, -// you can use it like this -// typedef InheritedHelperInterfaceImpl< XAnInterface > > AnInterfaceImpl_BASE; -// class AnInterfaceImpl : public AnInterfaceImpl_BASE -// { -// public: -// AnInterface( const Reference< HelperInterface >& xParent ) : AnInterfaceImpl_BASE( xParent ) {} -// // implement XAnInterface methods only, no need to implement the XHelperInterface -// // methods -// virtual void setName( const OUString& ); -// virtual OUString getName(); -// } -// -const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.HelperServiceBase" ) ); - -template< typename Ifc1 > -class InheritedHelperInterfaceImpl : public Ifc1 -{ -protected: - css::uno::WeakReference< ov::XHelperInterface > mxParent; - css::uno::Reference< css::uno::XComponentContext > mxContext; -public: - InheritedHelperInterfaceImpl() {} - InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {} - virtual rtl::OUString& getServiceImplName() = 0; - virtual css::uno::Sequence getServiceNames() = 0; - - // XHelperInterface Methods - virtual ::sal_Int32 SAL_CALL getCreator() throw (css::script::BasicErrorException, css::uno::RuntimeException) - { - return 0x53756E4F; - } - virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return mxParent; } - - virtual css::uno::Any SAL_CALL Application( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return css::uno::makeAny( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication() ); } - - - // XServiceInfo Methods - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) { return getServiceImplName(); } - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException) - { - css::uno::Sequence< rtl::OUString > sServices = getSupportedServiceNames(); - const rtl::OUString* pStart = sServices.getConstArray(); - const rtl::OUString* pEnd = pStart + sServices.getLength(); - for ( ; pStart != pEnd ; ++pStart ) - if ( (*pStart).equals( ServiceName ) ) - return sal_True; - return sal_False; - } - virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException) - { - css::uno::Sequence< rtl::OUString > aNames = getServiceNames();; - return aNames; - } - }; - -template< typename Ifc1 > -class InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > - -{ -typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base; -public: - InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {} - -}; -#endif diff --git a/sc/source/ui/vba/vbahyperlink.cxx b/sc/source/ui/vba/vbahyperlink.cxx index 27bcfaa28145..f6aa8cf8c4cb 100644 --- a/sc/source/ui/vba/vbahyperlink.cxx +++ b/sc/source/ui/vba/vbahyperlink.cxx @@ -32,7 +32,7 @@ * MA 02111-1307 USA * ************************************************************************/ -#include "helperdecl.hxx" +#include #include "vbahyperlink.hxx" #include #include diff --git a/sc/source/ui/vba/vbahyperlink.hxx b/sc/source/ui/vba/vbahyperlink.hxx index 2789b4d133b2..a72eeb325ac6 100644 --- a/sc/source/ui/vba/vbahyperlink.hxx +++ b/sc/source/ui/vba/vbahyperlink.hxx @@ -40,7 +40,7 @@ #include #include -#include "vbahelperinterface.hxx" +#include typedef InheritedHelperInterfaceImpl1< ov::excel::XHyperlink > HyperlinkImpl_BASE; diff --git a/sc/source/ui/vba/vbaimage.cxx b/sc/source/ui/vba/vbaimage.cxx deleted file mode 100644 index 7e6cd34c191e..000000000000 --- a/sc/source/ui/vba/vbaimage.cxx +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * $Revision$ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "vbaimage.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); -ScVbaImage::ScVbaImage( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ImageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ -} - -rtl::OUString& -ScVbaImage::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaImage") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaImage::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Image" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbaimage.hxx b/sc/source/ui/vba/vbaimage.hxx deleted file mode 100644 index 9d4b33818663..000000000000 --- a/sc/source/ui/vba/vbaimage.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * $Revision$ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_IMAGE_HXX -#define SC_VBA_IMAGE_HXX -#include -#include - -#include "vbacontrol.hxx" -#include "vbahelper.hxx" - -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XImage > ImageImpl_BASE; - -class ScVbaImage : public ImageImpl_BASE -{ -public: - ScVbaImage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; -#endif //SC_VBA_IMAGE_HXX diff --git a/sc/source/ui/vba/vbainterior.cxx b/sc/source/ui/vba/vbainterior.cxx index bb85b6c21922..9c309c997ed3 100644 --- a/sc/source/ui/vba/vbainterior.cxx +++ b/sc/source/ui/vba/vbainterior.cxx @@ -163,10 +163,18 @@ ScVbaInterior::setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno sal_Int32 nIndex = 0; _colorindex >>= nIndex; - // setColor expects colors in XL RGB values - // #FIXME this is daft we convert OO RGB val to XL RGB val and - // then back again to OO RGB value - setColor( OORGBToXLRGB( GetIndexColor( nIndex ) ) ); + // hackly for excel::XlColorIndex::xlColorIndexNone + if( nIndex == excel::XlColorIndex::xlColorIndexNone ) + { + m_xProps->setPropertyValue( BACKCOLOR, uno::makeAny( sal_Int32( -1 ) ) ); + } + else + { + // setColor expects colors in XL RGB values + // #FIXME this is daft we convert OO RGB val to XL RGB val and + // then back again to OO RGB value + setColor( OORGBToXLRGB( GetIndexColor( nIndex ) ) ); + } } uno::Any ScVbaInterior::GetIndexColor( const sal_Int32& nColorIndex ) @@ -204,13 +212,21 @@ uno::Any SAL_CALL ScVbaInterior::getColorIndex() throw ( css::uno::RuntimeException ) { sal_Int32 nColor = 0; + // hackly for excel::XlColorIndex::xlColorIndexNone + uno::Any aColor = m_xProps->getPropertyValue( BACKCOLOR ); + if( ( aColor >>= nColor ) && ( nColor == -1 ) ) + { + nColor = excel::XlColorIndex::xlColorIndexNone; + return uno::makeAny( nColor ); + } + // getColor returns Xl ColorValue, need to convert it to OO val // as the palette deals with OO RGB values // #FIXME this is daft in getColor we convert OO RGB val to XL RGB val // and then back again to OO RGB value XLRGBToOORGB( getColor() ) >>= nColor; - return uno::makeAny( GetIndexColor( nColor ) ); + return uno::makeAny( GetColorIndex( nColor ) ); } Color ScVbaInterior::GetPatternColor( const Color& rPattColor, const Color& rBackColor, sal_uInt32 nXclPattern ) diff --git a/sc/source/ui/vba/vbainterior.hxx b/sc/source/ui/vba/vbainterior.hxx index 1184d33e6cd9..d3ca677d4890 100644 --- a/sc/source/ui/vba/vbainterior.hxx +++ b/sc/source/ui/vba/vbainterior.hxx @@ -34,9 +34,10 @@ #include #include #include +#include #include -#include "vbahelperinterface.hxx" +#include class ScDocument; diff --git a/sc/source/ui/vba/vbalabel.cxx b/sc/source/ui/vba/vbalabel.cxx deleted file mode 100644 index 0a7614ee4eb0..000000000000 --- a/sc/source/ui/vba/vbalabel.cxx +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbalabel.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "vbalabel.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); -ScVbaLabel::ScVbaLabel( const css::uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : LabelImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ -} - -// Attributes -rtl::OUString SAL_CALL -ScVbaLabel::getCaption() throw (css::uno::RuntimeException) -{ - rtl::OUString Label; - m_xProps->getPropertyValue( LABEL ) >>= Label; - return Label; -} - -void SAL_CALL -ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) -{ - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); -} -uno::Any SAL_CALL -ScVbaLabel::getValue() throw (css::uno::RuntimeException) -{ - return uno::makeAny( getCaption() ); -} - -void SAL_CALL -ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) -{ - rtl::OUString sCaption; - _value >>= sCaption; - setCaption( sCaption ); -} - - -rtl::OUString& -ScVbaLabel::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaLabel::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbalabel.hxx b/sc/source/ui/vba/vbalabel.hxx deleted file mode 100644 index 7ced8b65f731..000000000000 --- a/sc/source/ui/vba/vbalabel.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbalabel.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_LABEL_HXX -#define SC_VBA_LABEL_HXX -#include -#include - -#include "vbacontrol.hxx" -#include "vbahelper.hxx" -#include - -typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XLabel, css::script::XDefaultProperty > LabelImpl_BASE; - -class ScVbaLabel : public LabelImpl_BASE -{ -public: - ScVbaLabel( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); - // Attributes - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); - // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } -}; -#endif //SC_VBA_LABEL_HXX diff --git a/sc/source/ui/vba/vbalineformat.cxx b/sc/source/ui/vba/vbalineformat.cxx deleted file mode 100644 index 8e99086f74da..000000000000 --- a/sc/source/ui/vba/vbalineformat.cxx +++ /dev/null @@ -1,458 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbalineformat.cxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include -#include -#include -#include -#include -#include "vbalineformat.hxx" -#include "vbacolorformat.hxx" - -using namespace ooo::vba; -using namespace com::sun::star; - -ScVbaLineFormat::ScVbaLineFormat( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : ScVbaLineFormat_BASE( xParent, xContext ), m_xShape( xShape ) -{ - m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); - m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid; - m_nLineWeight = 1; -} - -sal_Int32 -ScVbaLineFormat::calculateArrowheadSize() -{ - return 0; -} - -sal_Int32 -ScVbaLineFormat::convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName ) -{ - sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone; - if (sLineName.equals(rtl::OUString::createFromAscii("Small Arrow")) || - sLineName.equals(rtl::OUString::createFromAscii("Arrow")) || - sLineName.equals(rtl::OUString::createFromAscii("msArrowEnd")) || - sLineName.equals(rtl::OUString::createFromAscii("Double Arrow"))) - { - // msoArrowheadTriangle - nLineType = office::MsoArrowheadStyle::msoArrowheadTriangle; - } - else if (sLineName.equals(rtl::OUString::createFromAscii("Square 45")) || - sLineName.equals(rtl::OUString::createFromAscii("Square")) || - sLineName.equals(rtl::OUString::createFromAscii("msArrowDiamondEnd"))) - { - // msoArrowheadDiamond - nLineType = office::MsoArrowheadStyle::msoArrowheadDiamond; - } - else if (sLineName.equals(rtl::OUString::createFromAscii("Circle")) || - sLineName.equals(rtl::OUString::createFromAscii("msArrowOvalEnd")) || - sLineName.equals(rtl::OUString::createFromAscii("Dimension Lines")) ) - { - // msoArrowheadOval - nLineType = office::MsoArrowheadStyle::msoArrowheadOval; - } - else if (sLineName.equals(rtl::OUString::createFromAscii("Arrow concave")) || - sLineName.equals(rtl::OUString::createFromAscii("msArrowStealthEnd"))) - { - // msoArrowheadStealth - nLineType = office::MsoArrowheadStyle::msoArrowheadStealth; - } - else if (sLineName.equals(rtl::OUString::createFromAscii("Rounded short Arrow")) || - sLineName.equals(rtl::OUString::createFromAscii("Rounded large Arrow")) || - sLineName.equals(rtl::OUString::createFromAscii("Symmetric Arrow")) || - sLineName.equals(rtl::OUString::createFromAscii("msArrowOpenEnd")) || - sLineName.equals(rtl::OUString::createFromAscii("Line Arrow"))) - { - // msoArrowheadOpen - nLineType = office::MsoArrowheadStyle::msoArrowheadOpen; - } - else - { - // msoArrowheadNone - nLineType = office::MsoArrowheadStyle::msoArrowheadNone; - } - return nLineType; -} - -rtl::OUString -ScVbaLineFormat::convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadStyle ) throw (uno::RuntimeException) -{ - switch( nArrowheadStyle ) - { - case office::MsoArrowheadStyle::msoArrowheadNone: - return rtl::OUString(rtl::OUString::createFromAscii( "" ) ); - case office::MsoArrowheadStyle::msoArrowheadStealth: - return rtl::OUString::createFromAscii( "Arrow concave" ); - case office::MsoArrowheadStyle::msoArrowheadOpen: - return rtl::OUString::createFromAscii("Line Arrow" ); - case office::MsoArrowheadStyle::msoArrowheadOval: - return rtl::OUString::createFromAscii("Circle" ); - case office::MsoArrowheadStyle::msoArrowheadDiamond: - return rtl::OUString::createFromAscii( "Square 45" ); - case office::MsoArrowheadStyle::msoArrowheadTriangle: - return rtl::OUString::createFromAscii( "Arrow" ); - default: - throw uno::RuntimeException( rtl::OUString::createFromAscii("Invalid Arrow Style!"), uno::Reference< uno::XInterface >() ); - } -} - -// Attributes -sal_Int32 SAL_CALL -ScVbaLineFormat::getBeginArrowheadStyle() throw (uno::RuntimeException) -{ - sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone; - rtl::OUString sLineName; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ) ) >>= sLineName; - if( ( sLineName.getLength() > 7 ) && ( sLineName.indexOf( rtl::OUString::createFromAscii( "msArray" ) ) ) != -1 ) - { - sal_Int32 nIndex = sLineName.indexOf( rtl::OUString::createFromAscii(" ") ); - rtl::OUString sName = sLineName.copy( 0, nIndex ); - //sal_Int32 nSize = sLineName.copy( nIndex + 1 ).toInt32(); - nLineType = convertLineStartEndNameToArrowheadStyle( sName ); - } - else - { - nLineType = convertLineStartEndNameToArrowheadStyle( sLineName ); - } - return nLineType; -} - -void SAL_CALL -ScVbaLineFormat::setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (uno::RuntimeException) -{ - rtl::OUString sArrayName = convertArrowheadStyleToLineStartEndName( _beginarrowheadstyle ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ), uno::makeAny( sArrayName ) ); -} - -sal_Int32 SAL_CALL -ScVbaLineFormat::getBeginArrowheadLength() throw (uno::RuntimeException) -{ - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -} - -void SAL_CALL -ScVbaLineFormat::setBeginArrowheadLength( sal_Int32 /*_beginarrowheadlength*/ ) throw (uno::RuntimeException) -{ - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -} - -sal_Int32 SAL_CALL -ScVbaLineFormat::getBeginArrowheadWidth() throw (uno::RuntimeException) -{ - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -} - -void SAL_CALL -ScVbaLineFormat::setBeginArrowheadWidth( sal_Int32 /*_beginarrowheadwidth*/ ) throw (uno::RuntimeException) -{ - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -} - -sal_Int32 SAL_CALL -ScVbaLineFormat::getEndArrowheadStylel() throw (uno::RuntimeException) -{ - return 0; -} - -void SAL_CALL -ScVbaLineFormat::setEndArrowheadStylel( sal_Int32 /*_endarrowheadstylel*/ ) throw (uno::RuntimeException) -{ -} - -sal_Int32 SAL_CALL -ScVbaLineFormat::getEndArrowheadLength() throw (uno::RuntimeException) -{ - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -} - -void SAL_CALL -ScVbaLineFormat::setEndArrowheadLength( sal_Int32 /*_endarrowheadlength*/ ) throw (uno::RuntimeException) -{ - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -} - -sal_Int32 SAL_CALL -ScVbaLineFormat::getEndArrowheadWidth() throw (uno::RuntimeException) -{ - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -} - -void SAL_CALL -ScVbaLineFormat::setEndArrowheadWidth( sal_Int32 /*_endarrowheadwidth*/ ) throw (uno::RuntimeException) -{ - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -} - -double SAL_CALL -ScVbaLineFormat::getWeight() throw (uno::RuntimeException) -{ - sal_Int32 nLineWidth=0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineWidth") ) >>= nLineWidth; - double dLineWidth = Millimeter::getInPoints( nLineWidth ); - return dLineWidth; -} - -void SAL_CALL -ScVbaLineFormat::setWeight( double _weight ) throw (uno::RuntimeException) -{ - if( _weight < 0 ) - throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter: Must be positv."), uno::Reference< uno::XInterface >() ); - if( _weight == 0 ) - _weight = 0.5; - m_nLineWeight = _weight; - Millimeter aMillimeter; - aMillimeter.setInPoints( _weight ); - - sal_Int32 nLineWidth = static_cast( aMillimeter.getInHundredthsOfOneMillimeter() ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineWidth" ), uno::makeAny( nLineWidth ) ); - setDashStyle( m_nLineDashStyle ); -} - -sal_Bool SAL_CALL -ScVbaLineFormat::getVisible() throw (uno::RuntimeException) -{ - drawing::LineStyle aLineStyle; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle; - if( aLineStyle == drawing::LineStyle_NONE ) - { - return sal_False; - } - return sal_True; -} - -void SAL_CALL -ScVbaLineFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) -{ - drawing::LineStyle aLineStyle; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle; - if( !_visible ) - { - aLineStyle = drawing::LineStyle_NONE; - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) ); - } - else - { - if( aLineStyle == drawing::LineStyle_NONE ) - { - setDashStyle( m_nLineDashStyle ); - } - } -} - -double SAL_CALL -ScVbaLineFormat::getTransparency() throw (uno::RuntimeException) -{ - sal_Int16 nTransparency = 0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ) ) >>= nTransparency; - double fTransparency = static_cast( nTransparency ); - return fTransparency / 100; -} - -void SAL_CALL -ScVbaLineFormat::setTransparency( double _transparency ) throw (uno::RuntimeException) -{ - sal_Int16 nTransparency = static_cast( _transparency * 100 ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ), uno::makeAny( nTransparency ) ); -} - -sal_Int16 SAL_CALL -ScVbaLineFormat::getStyle() throw (uno::RuntimeException) -{ - //OpenOffice.org only supports one LineStyle (other than the DashStyles) - //Therefore we can only return the SingleLine - return 1; -} - -void SAL_CALL -ScVbaLineFormat::setStyle( sal_Int16 /*_style */) throw (uno::RuntimeException) -{ - //OpenOffice.org only supports one LineStyle (other than the DashStyles) - //Therefore we do not set the LineStyle, because it maybe is already set - //to Dashed or Single Line. Setting the 'Visible' or 'DashStyle' properties - //will be done with the according methods. -} - -sal_Int32 SAL_CALL -ScVbaLineFormat::getDashStyle() throw (uno::RuntimeException) -{ - drawing::LineStyle eLineStyle; - //LineStyle integer in Xray - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= eLineStyle; - if( eLineStyle == drawing::LineStyle_SOLID ) - m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid; - else - { - drawing::LineDash aLineDash; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineDash" ) ) >>= aLineDash; - if( aLineDash.Dots == 0 ) - { - //LineDash - //LineLongDash - m_nLineDashStyle = office::MsoLineDashStyle::msoLineDash; - if( aLineDash.Distance > 0 && ( aLineDash.DashLen / aLineDash.Distance > 1 ) ) - { - m_nLineDashStyle = office::MsoLineDashStyle::msoLineLongDash; - } - } - else if( aLineDash.Dots == 1 ) - { - // LineDashDot - // LineLongDashDot - // LineSquareDot - // LineRoundDot ! not supported - m_nLineDashStyle = office::MsoLineDashStyle::msoLineDashDot; - if( aLineDash.Dashes == 0 ) - { - m_nLineDashStyle = office::MsoLineDashStyle::msoLineSquareDot; - } - else - { - if( aLineDash.Distance > 0 && ( aLineDash.DashLen / aLineDash.Distance > 1 ) ) - { - m_nLineDashStyle = office::MsoLineDashStyle::msoLineLongDashDot; - } - } - } - else if( aLineDash.Dots == 2 ) - { - // LineDashDotDot - m_nLineDashStyle = office::MsoLineDashStyle::msoLineDashDotDot; - } - } - - return m_nLineDashStyle; -} - -void SAL_CALL -ScVbaLineFormat::setDashStyle( sal_Int32 _dashstyle ) throw (uno::RuntimeException) -{ - m_nLineDashStyle = _dashstyle; - if( _dashstyle == office::MsoLineDashStyle::msoLineSolid ) - { - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID )); - } - else - { - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_DASH ) ); - drawing::LineDash pLineDash; - Millimeter aMillimeter( m_nLineWeight ); - sal_Int32 nPixel = static_cast< sal_Int32 >( aMillimeter.getInHundredthsOfOneMillimeter() ); - switch( _dashstyle ) - { - case office::MsoLineDashStyle::msoLineDashDot: - pLineDash.Dots = 1; - pLineDash.DotLen = nPixel; - pLineDash.Dashes = 1; - pLineDash.DashLen = 5 * nPixel; - pLineDash.Distance = 4 * nPixel; - break; - case office::MsoLineDashStyle::msoLineLongDashDot: - pLineDash.Dots = 1; - pLineDash.DotLen = nPixel; - pLineDash.Dashes = 1; - pLineDash.DashLen = 10 * nPixel; - pLineDash.Distance = 4 * nPixel; - break; - case office::MsoLineDashStyle::msoLineDash: - pLineDash.Dots = 0; - pLineDash.DotLen = 0; - pLineDash.Dashes = 1; - pLineDash.DashLen = 6 * nPixel; - pLineDash.Distance = 4 * nPixel; - break; - case office::MsoLineDashStyle::msoLineDashDotDot: - pLineDash.Dots = 2; - pLineDash.DotLen = nPixel; - pLineDash.Dashes = 1; - pLineDash.DashLen = 10 * nPixel; - pLineDash.Distance = 3 * nPixel; - break; - case office::MsoLineDashStyle::msoLineLongDash: - pLineDash.Dots = 0; - pLineDash.DotLen = 0; - pLineDash.Dashes = 1; - pLineDash.DashLen = 10 * nPixel; - pLineDash.Distance = 4 * nPixel; - break; - case office::MsoLineDashStyle::msoLineSquareDot: - pLineDash.Dots = 1; - pLineDash.DotLen = nPixel; - pLineDash.Dashes = 0; - pLineDash.DashLen = 0; - pLineDash.Distance = nPixel; - break; - case office::MsoLineDashStyle::msoLineRoundDot: - pLineDash.Dots = 1; - pLineDash.DotLen = nPixel; - pLineDash.Dashes = 0; - pLineDash.DashLen = 0; - pLineDash.Distance = nPixel; - break; - default: - throw uno::RuntimeException( rtl::OUString::createFromAscii("this MsoLineDashStyle is not supported."), uno::Reference< uno::XInterface >() ); - } - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineDash" ), uno::makeAny( pLineDash ) ); - } -} - -// Methods -uno::Reference< msforms::XColorFormat > SAL_CALL -ScVbaLineFormat::BackColor() throw (uno::RuntimeException) -{ - return uno::Reference< msforms::XColorFormat >( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ::ColorFormatType::LINEFORMAT_BACKCOLOR ) ); -} - -uno::Reference< msforms::XColorFormat > SAL_CALL -ScVbaLineFormat::ForeColor() throw (uno::RuntimeException) -{ - return uno::Reference< msforms::XColorFormat >( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ::ColorFormatType::LINEFORMAT_FORECOLOR ) ); -} - - -rtl::OUString& -ScVbaLineFormat::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLineFormat") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaLineFormat::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.LineFormat" ) ); - } - return aServiceNames; -} - - diff --git a/sc/source/ui/vba/vbalineformat.hxx b/sc/source/ui/vba/vbalineformat.hxx deleted file mode 100644 index 70a950ebb2a1..000000000000 --- a/sc/source/ui/vba/vbalineformat.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbalineformat.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_XLINEFORMAT_HXX -#define SC_VBA_XLINEFORMAT_HXX - -#include -#include -#include -#include "vbahelperinterface.hxx" - -typedef InheritedHelperInterfaceImpl1< ov::msforms::XLineFormat > ScVbaLineFormat_BASE; - -class ScVbaLineFormat : public ScVbaLineFormat_BASE -{ -private: - css::uno::Reference< css::drawing::XShape > m_xShape; - css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; - sal_Int32 m_nLineDashStyle; - double m_nLineWeight; -protected: - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); - sal_Int32 convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName ); - rtl::OUString convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadStyle ) throw (css::uno::RuntimeException); - sal_Int32 calculateArrowheadSize(); -public: - ScVbaLineFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ); - - // Attributes - virtual sal_Int32 SAL_CALL getBeginArrowheadStyle() throw (css::uno::RuntimeException); - virtual void SAL_CALL setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBeginArrowheadLength() throw (css::uno::RuntimeException); - virtual void SAL_CALL setBeginArrowheadLength( sal_Int32 _beginarrowheadlength ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBeginArrowheadWidth() throw (css::uno::RuntimeException); - virtual void SAL_CALL setBeginArrowheadWidth( sal_Int32 _beginarrowheadwidth ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getEndArrowheadStylel() throw (css::uno::RuntimeException); - virtual void SAL_CALL setEndArrowheadStylel( sal_Int32 _endarrowheadstylel ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getEndArrowheadLength() throw (css::uno::RuntimeException); - virtual void SAL_CALL setEndArrowheadLength( sal_Int32 _endarrowheadlength ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getEndArrowheadWidth() throw (css::uno::RuntimeException); - virtual void SAL_CALL setEndArrowheadWidth( sal_Int32 _endarrowheadwidth ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getWeight() throw (css::uno::RuntimeException); - virtual void SAL_CALL setWeight( double _weight ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); - virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getTransparency() throw (css::uno::RuntimeException); - virtual void SAL_CALL setTransparency( double _transparency ) throw (css::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getStyle() throw (css::uno::RuntimeException); - virtual void SAL_CALL setStyle( sal_Int16 _style ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getDashStyle() throw (css::uno::RuntimeException); - virtual void SAL_CALL setDashStyle( sal_Int32 _dashstyle ) throw (css::uno::RuntimeException); - - // Methods - virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException); - virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException); -}; - -#endif//SC_VBA_XLINEFORMAT_HXX diff --git a/sc/source/ui/vba/vbalistbox.cxx b/sc/source/ui/vba/vbalistbox.cxx deleted file mode 100644 index d50653ebb844..000000000000 --- a/sc/source/ui/vba/vbalistbox.cxx +++ /dev/null @@ -1,289 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbalistbox.cxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include - -#include "vbalistbox.hxx" -#include "vbapropvalue.hxx" -#include -#include -#include - -using namespace com::sun::star; -using namespace ooo::vba; - -const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") ); -const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ); -const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ); - - -ScVbaListBox::ScVbaListBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ListBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ - mpListHelper.reset( new ListControlHelper( m_xProps ) ); -} - -// Attributes -void SAL_CALL -ScVbaListBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException) -{ - sal_Int32 nIndex = 0; - _value >>= nIndex; - Selected( nIndex ); -} - -uno::Any SAL_CALL -ScVbaListBox::getListIndex() throw (uno::RuntimeException) -{ - uno::Sequence< sal_Int16 > sSelection; - m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection; - if ( sSelection.getLength() == 0 ) - return uno::Any( sal_Int32( -1 ) ); - return uno::Any( sSelection[ 0 ] ); -} - -uno::Any SAL_CALL -ScVbaListBox::getValue() throw (uno::RuntimeException) -{ - uno::Sequence< sal_Int16 > sSelection; - uno::Sequence< rtl::OUString > sItems; - m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection; - m_xProps->getPropertyValue( ITEMS ) >>= sItems; - if( getMultiSelect() ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Attribute use invalid." ), uno::Reference< uno::XInterface >() ); - uno::Any aRet; - if ( sSelection.getLength() ) - aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] ); - return aRet; -} - -void SAL_CALL -ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException) -{ - if( getMultiSelect() ) - { - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Attribute use invalid." ), uno::Reference< uno::XInterface >() ); - } - rtl::OUString sValue = getAnyAsString( _value ); - uno::Sequence< rtl::OUString > sList; - m_xProps->getPropertyValue( ITEMS ) >>= sList; - uno::Sequence< sal_Int16 > nList; - sal_Int16 nLength = static_cast( sList.getLength() ); - sal_Int16 nValue = -1; - sal_Int16 i = 0; - for( i = 0; i < nLength; i++ ) - { - if( sList[i].equals( sValue ) ) - { - nValue = i; - break; - } - } - if( nValue == -1 ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Attribute use invalid." ), uno::Reference< uno::XInterface >() ); - - uno::Sequence< sal_Int16 > nSelectedIndices(1); - nSelectedIndices[ 0 ] = nValue; - m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) ); - m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); -} - -::rtl::OUString SAL_CALL -ScVbaListBox::getText() throw (uno::RuntimeException) -{ - rtl::OUString result; - getValue() >>= result; - return result; -} - -void SAL_CALL -ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException) -{ - setValue( uno::makeAny( _text ) ); // seems the same -} - -sal_Bool SAL_CALL -ScVbaListBox::getMultiSelect() throw (css::uno::RuntimeException) -{ - sal_Bool bMultiSelect = sal_False; - m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= bMultiSelect; - return bMultiSelect; -} - -void SAL_CALL -ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException) -{ - m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) ); -} - -css::uno::Any SAL_CALL -ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException) -{ - uno::Sequence< rtl::OUString > sList; - m_xProps->getPropertyValue( ITEMS ) >>= sList; - sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() ); - // no choice but to do a horror cast as internally - // the indices are but sal_Int16 - sal_Int16 nIndex = static_cast< sal_Int16 >( index ); - if( nIndex < 0 || nIndex >= nLength ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Error Number." ), uno::Reference< uno::XInterface >() ); - m_nIndex = nIndex; - return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) ); -} - -// Methods -void SAL_CALL -ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException) -{ - mpListHelper->AddItem( pvargItem, pvargIndex ); - } - -void SAL_CALL -ScVbaListBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException) -{ - mpListHelper->removeItem( index ); -} - -void SAL_CALL -ScVbaListBox::Clear( ) throw (uno::RuntimeException) -{ - mpListHelper->Clear(); -} - -// this is called when something like the following vba code is used -// to set the selected state of particular entries in the Listbox -// ListBox1.Selected( 3 ) = false -//PropListener -void -ScVbaListBox::setValueEvent( const uno::Any& value ) -{ - sal_Bool bValue = sal_False; - if( !(value >>= bValue) ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Invalid type\n. need boolean." ), uno::Reference< uno::XInterface >() ); - uno::Sequence< sal_Int16 > nList; - m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nList; - sal_Int16 nLength = static_cast( nList.getLength() ); - sal_Int16 nIndex = m_nIndex; - for( sal_Int16 i = 0; i < nLength; i++ ) - { - if( nList[i] == nIndex ) - { - if( bValue ) - return; - else - { - for( ; i < nLength - 1; i++ ) - { - nList[i] = nList[i + 1]; - } - nList.realloc( nLength - 1 ); - //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); - m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) ); - return; - } - } - } - if( bValue ) - { - if( getMultiSelect() ) - { - nList.realloc( nLength + 1 ); - nList[nLength] = nIndex; - } - else - { - nList.realloc( 1 ); - nList[0] = nIndex; - } - m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); - } -} - -// this is called when something like the following vba code is used -// to determine the selected state of particular entries in the Listbox -// msgbox ListBox1.Selected( 3 ) - -css::uno::Any -ScVbaListBox::getValueEvent() -{ - uno::Sequence< sal_Int16 > nList; - m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= nList; - sal_Int32 nLength = nList.getLength(); - sal_Int32 nIndex = m_nIndex; - - for( sal_Int32 i = 0; i < nLength; i++ ) - { - if( nList[i] == nIndex ) - return uno::makeAny( sal_True ); - } - - return uno::makeAny( sal_False ); -} - -void SAL_CALL -ScVbaListBox::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException) -{ - ScVbaControl::setRowSource( _rowsource ); - mpListHelper->setRowSource( _rowsource ); -} - -sal_Int32 SAL_CALL -ScVbaListBox::getListCount() throw (uno::RuntimeException) -{ - return mpListHelper->getListCount(); -} - -uno::Any SAL_CALL -ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException) -{ - return mpListHelper->List( pvargIndex, pvarColumn ); -} - -rtl::OUString& -ScVbaListBox::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaListBox") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaListBox::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ScVbaListBox" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbalistbox.hxx b/sc/source/ui/vba/vbalistbox.hxx deleted file mode 100644 index 69697d3ae623..000000000000 --- a/sc/source/ui/vba/vbalistbox.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbalistbox.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_LISTBOX_HXX -#define SC_VBA_LISTBOX_HXX -#include -#include -#include -#include -#include - -#include "vbacontrol.hxx" -#include "vbapropvalue.hxx" -#include "vbalistcontrolhelper.hxx" -#include "vbahelper.hxx" - -typedef cppu::ImplInheritanceHelper2 ListBoxImpl_BASE; -class ScVbaListBox : public ListBoxImpl_BASE - ,public PropListener -{ - std::auto_ptr< ListControlHelper > mpListHelper; - rtl::OUString sSourceName; - rtl::OUString msDftPropName; - - sal_Int16 m_nIndex; - -public: - ScVbaListBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); - - // Attributes - virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException); - virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); - virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException); - - // Methods - virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException); - virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException); - // XControl - virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); - - // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } - - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); - - //PropListener - virtual void setValueEvent( const css::uno::Any& value ); - virtual css::uno::Any getValueEvent(); - - -}; - -#endif // diff --git a/sc/source/ui/vba/vbalistcontrolhelper.cxx b/sc/source/ui/vba/vbalistcontrolhelper.cxx deleted file mode 100644 index e51b751290ac..000000000000 --- a/sc/source/ui/vba/vbalistcontrolhelper.cxx +++ /dev/null @@ -1,145 +0,0 @@ -#include - -using namespace com::sun::star; -using namespace ooo::vba; - -const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ); - -void SAL_CALL -ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException) -{ - if ( pvargItem.hasValue() ) - { - uno::Sequence< rtl::OUString > sList; - m_xProps->getPropertyValue( ITEMS ) >>= sList; - - sal_Int32 nIndex = sList.getLength(); - - if ( pvargIndex.hasValue() ) - pvargIndex >>= nIndex; - - rtl::OUString sString = getAnyAsString( pvargItem ); - - // if no index specified or item is to be appended to end of - // list just realloc the array and set the last item - if ( nIndex == sList.getLength() ) - { - sal_Int32 nOldSize = sList.getLength(); - sList.realloc( nOldSize + 1 ); - sList[ nOldSize ] = sString; - } - else - { - // just copy those elements above the one to be inserted - std::vector< rtl::OUString > sVec; - // reserve just the amount we need to copy - sVec.reserve( sList.getLength() - nIndex ); - - // point at first element to copy - rtl::OUString* pString = sList.getArray() + nIndex; - const rtl::OUString* pEndString = sList.getArray() + sList.getLength(); - // insert the new element - sVec.push_back( sString ); - // copy elements - for ( ; pString != pEndString; ++pString ) - sVec.push_back( *pString ); - - sList.realloc( sList.getLength() + 1 ); - - // point at first element to be overwritten - pString = sList.getArray() + nIndex; - pEndString = sList.getArray() + sList.getLength(); - std::vector< rtl::OUString >::iterator it = sVec.begin(); - for ( ; pString != pEndString; ++pString, ++it) - *pString = *it; - // - } - - m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) ); - - } -} - -void SAL_CALL -ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeException) -{ - sal_Int32 nIndex = 0; - // for int index - if ( index >>= nIndex ) - { - uno::Sequence< rtl::OUString > sList; - m_xProps->getPropertyValue( ITEMS ) >>= sList; - if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid index" ), uno::Reference< uno::XInterface > () ); - if( sList.hasElements() ) - { - if( sList.getLength() == 1 ) - { - Clear(); - return; - } - for( sal_Int32 i = nIndex; i < ( sList.getLength()-1 ); i++ ) - { - sList[i] = sList[i+1]; - } - sList.realloc( sList.getLength() - 1 ); - } - - m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) ); - } -} - -void SAL_CALL -ListControlHelper::Clear( ) throw (uno::RuntimeException) -{ - // urk, setValue doesn't seem to work !! - //setValue( uno::makeAny( sal_Int16() ) ); - m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) ); -} - -void SAL_CALL -ListControlHelper::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException) -{ - if ( _rowsource.getLength() == 0 ) - Clear(); -} - -sal_Int32 SAL_CALL -ListControlHelper::getListCount() throw (uno::RuntimeException) -{ - uno::Sequence< rtl::OUString > sList; - m_xProps->getPropertyValue( ITEMS ) >>= sList; - return sList.getLength(); -} - -uno::Any SAL_CALL -ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException) -{ - uno::Sequence< rtl::OUString > sList; - m_xProps->getPropertyValue( ITEMS ) >>= sList; - sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() ); - uno::Any aRet; - if ( pvargIndex.hasValue() ) - { - sal_Int16 nIndex = -1; - pvargIndex >>= nIndex; - if( nIndex < 0 || nIndex >= nLength ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Bad row Index" ), uno::Reference< uno::XInterface >() ); - aRet <<= sList[ nIndex ]; - } - else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Bad column Index" ), uno::Reference< uno::XInterface >() ); - else // List() ( e.g. no args ) - { - uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength ); - for ( sal_Int32 i = 0; i < nLength; ++i ) - { - sReturnArray[ i ].realloc( 10 ); - sReturnArray[ i ][ 0 ] = sList[ i ]; - } - aRet = uno::makeAny( sReturnArray ); - } - return aRet; -} diff --git a/sc/source/ui/vba/vbalistcontrolhelper.hxx b/sc/source/ui/vba/vbalistcontrolhelper.hxx deleted file mode 100644 index f1ebe117733f..000000000000 --- a/sc/source/ui/vba/vbalistcontrolhelper.hxx +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SC_VBA_LISTCONTROLHELPER -#define SC_VBA_LISTCONTROLHELPER - -#include "vbahelper.hxx" - -class ListControlHelper -{ - css::uno::Reference< css::beans::XPropertySet > m_xProps; - -public: - ListControlHelper( const css::uno::Reference< css::beans::XPropertySet >& rxControl ) : m_xProps( rxControl ){} - virtual ~ListControlHelper() {} - virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException); - virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException); - virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException); -}; -#endif diff --git a/sc/source/ui/vba/vbamultipage.cxx b/sc/source/ui/vba/vbamultipage.cxx deleted file mode 100644 index 69410dbadc64..000000000000 --- a/sc/source/ui/vba/vbamultipage.cxx +++ /dev/null @@ -1,132 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include "vbamultipage.hxx" -#include -#include "vbapages.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - -// uno servicename com.sun.star.awt.UnoControlProgressBarMode -const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ); -const rtl::OUString SVALUEMAX( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ); -const rtl::OUString SSTEP( RTL_CONSTASCII_USTRINGPARAM("Step") ); - -typedef cppu::WeakImplHelper1< container::XIndexAccess > PagesImpl_Base; -class PagesImpl : public PagesImpl_Base -{ - sal_Int32 mnPages; -public: - PagesImpl( sal_Int32 nPages ) : mnPages( nPages ) {} - virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) { return mnPages; } - virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, ::uno::RuntimeException) - { - if ( Index < 0 || Index > mnPages ) - throw lang::IndexOutOfBoundsException(); - return uno::makeAny( uno::Reference< uno::XInterface >() ); - } - // XElementAccess - virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException) - { - // no Pages object yet #FIXME - //return msforms::XPage::static_type(0); - return uno::XInterface::static_type(0); - } - virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) - { - return ( mnPages > 0 ); - } -}; -uno::Reference< container::XIndexAccess > -ScVbaMultiPage::getPages( sal_Int32 nPages ) -{ - return new PagesImpl( nPages ); -} - -ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, const uno::Reference< uno::XInterface >& xDialog ) : MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ - mxDialogProps.set( xDialog, uno::UNO_QUERY_THROW ); - // set dialog step to value of multipage pseudo model - setValue(getValue()); -} - -// Attributes -sal_Int32 SAL_CALL -ScVbaMultiPage::getValue() throw (css::uno::RuntimeException) -{ - sal_Int32 nValue = 0; - m_xProps->getPropertyValue( SVALUE ) >>= nValue; - return nValue; -} - -void SAL_CALL -ScVbaMultiPage::setValue( const sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException) -{ - // track change in dialog ( dialog value is 1 based, 0 is a special value ) - m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) ); - mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) ); -} - - -rtl::OUString& -ScVbaMultiPage::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMultiPage") ); - return sImplName; -} - -uno::Any SAL_CALL -ScVbaMultiPage::Pages( const uno::Any& index ) throw (uno::RuntimeException) -{ - sal_Int32 nValue = 0; - m_xProps->getPropertyValue( SVALUEMAX ) >>= nValue; - uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( nValue ) ) ); - if ( !index.hasValue() ) - return uno::makeAny( xColl ); - return xColl->Item( uno::makeAny( index ), uno::Any() ); -} - -uno::Sequence< rtl::OUString > -ScVbaMultiPage::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.MultiPage" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbamultipage.hxx b/sc/source/ui/vba/vbamultipage.hxx deleted file mode 100644 index 03db35dff790..000000000000 --- a/sc/source/ui/vba/vbamultipage.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_MULTIPAGE_HXX -#define SC_VBA_MULTIPAGE_HXX -#include -#include -#include - -#include "vbacontrol.hxx" -#include "vbahelper.hxx" -//#include -#include - -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XMultiPage > MultiPageImpl_BASE; - -class ScVbaMultiPage : public MultiPageImpl_BASE -{ - css::uno::Reference< css::container::XIndexAccess > getPages( sal_Int32 nPages ); - css::uno::Reference< css::beans::XPropertySet > mxDialogProps; -public: - ScVbaMultiPage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, const css::uno::Reference< css::uno::XInterface >& xDialog ); - // Attributes - virtual sal_Int32 SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( sal_Int32 _value ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Pages( const css::uno::Any& index ) throw (css::uno::RuntimeException); - - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); - // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } -}; -#endif //SC_VBA_LABEL_HXX diff --git a/sc/source/ui/vba/vbaname.cxx b/sc/source/ui/vba/vbaname.cxx index 72ef5afb3b7f..0d82f4ee45f8 100644 --- a/sc/source/ui/vba/vbaname.cxx +++ b/sc/source/ui/vba/vbaname.cxx @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "helperdecl.hxx" +#include #include #include @@ -64,7 +64,8 @@ ScVbaName::~ScVbaName() css::uno::Reference< ov::excel::XWorksheet > ScVbaName::getWorkSheet() throw (css::uno::RuntimeException) { - return ScVbaGlobals::getGlobalsImpl( mxContext )->getActiveSheet(); + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); + return xApplication->getActiveSheet(); } ::rtl::OUString @@ -234,7 +235,7 @@ ScVbaName::setRefersToR1C1Local( const ::rtl::OUString & rRefersTo ) throw (css: css::uno::Reference< ov::excel::XRange > ScVbaName::getRefersToRange() throw (css::uno::RuntimeException) { - uno::Reference< ov::excel::XRange > xRange = ScVbaRange::getRangeObjectForName( mxContext, mxNamedRange->getName(), getDocShell( mxModel ), formula::FormulaGrammar::CONV_XL_R1C1 ); + uno::Reference< ov::excel::XRange > xRange = ScVbaRange::getRangeObjectForName( mxContext, mxNamedRange->getName(), excel::getDocShell( mxModel ), formula::FormulaGrammar::CONV_XL_R1C1 ); return xRange; } diff --git a/sc/source/ui/vba/vbaname.hxx b/sc/source/ui/vba/vbaname.hxx index 691a882cb3e1..6fb585100d4c 100644 --- a/sc/source/ui/vba/vbaname.hxx +++ b/sc/source/ui/vba/vbaname.hxx @@ -34,7 +34,9 @@ #include #include -#include "vbahelperinterface.hxx" +#include + +class ScDocument; typedef InheritedHelperInterfaceImpl1< ov::excel::XName > NameImpl_BASE; diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx index 1bd3a2359377..043e7d386f15 100644 --- a/sc/source/ui/vba/vbanames.cxx +++ b/sc/source/ui/vba/vbanames.cxx @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "helperdecl.hxx" +#include #include #include @@ -81,7 +81,7 @@ ScDocument * ScVbaNames::getScDocument() { uno::Reference< frame::XModel > xModel( getModel() , uno::UNO_QUERY_THROW ); - ScTabViewShell * pTabViewShell = getBestViewShell( xModel ); + ScTabViewShell * pTabViewShell = excel::getBestViewShell( xModel ); if ( !pTabViewShell ) throw uno::RuntimeException( rtl::OUString::createFromAscii("No ViewShell available"), uno::Reference< uno::XInterface >() ); ScViewData* pViewData = pTabViewShell->GetViewData(); diff --git a/sc/source/ui/vba/vbanames.hxx b/sc/source/ui/vba/vbanames.hxx index 02a86da325b5..524277bdc0bd 100644 --- a/sc/source/ui/vba/vbanames.hxx +++ b/sc/source/ui/vba/vbanames.hxx @@ -34,7 +34,10 @@ #include #include #include -#include "vbacollectionimpl.hxx" +#include + +class ScDocument; +class ScDocShell; typedef CollTestImplHelper< ov::excel::XNames > ScVbaNames_BASE; diff --git a/sc/source/ui/vba/vbaoleobject.cxx b/sc/source/ui/vba/vbaoleobject.cxx index 455141cf03fd..64e5f05f90e1 100644 --- a/sc/source/ui/vba/vbaoleobject.cxx +++ b/sc/source/ui/vba/vbaoleobject.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include "vbaoleobject.hxx" @@ -61,8 +62,9 @@ ScVbaOLEObject::ScVbaOLEObject( const uno::Reference< XHelperInterface >& xParen xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW ); xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW ); css::uno::Reference< css::frame::XModel > xModel( xChild->getParent(), uno::UNO_QUERY_THROW ); - css::uno::Reference< css::view::XControlAccess > xControlAccess( xModel->getCurrentController(), css::uno::UNO_QUERY_THROW ); - m_xWindowPeer = xControlAccess->getControl( xControlModel )->getPeer(); + uno::Reference xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW ); + m_xControl.set( xControlProvider->createControl( xControlShape, xModel ) ); } uno::Reference< uno::XInterface > SAL_CALL @@ -74,98 +76,76 @@ ScVbaOLEObject::getObject() throw (uno::RuntimeException) sal_Bool SAL_CALL ScVbaOLEObject::getEnabled() throw (uno::RuntimeException) { - uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW ); - return xWindow2->isEnabled(); + return m_xControl->getEnabled(); } void SAL_CALL ScVbaOLEObject::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException) { - uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW ); - xWindow2->setEnable( _enabled ); + m_xControl->setEnabled( _enabled ); } sal_Bool SAL_CALL ScVbaOLEObject::getVisible() throw (uno::RuntimeException) { - uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW ); - return xWindow2->isVisible(); + OSL_TRACE("OleObject %s returning visible %s", rtl::OUStringToOString( m_xControl->getName(), RTL_TEXTENCODING_UTF8 ).getStr(), m_xControl->getVisible() ? "true" : "false" ); + return m_xControl->getVisible(); } void SAL_CALL ScVbaOLEObject::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) { - uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW ); - xWindow2->setVisible( _visible ); + OSL_TRACE("OleObject %s set visible %s", rtl::OUStringToOString( m_xControl->getName(), RTL_TEXTENCODING_UTF8 ).getStr(), _visible ? "true" : "false" ); + m_xControl->setVisible( _visible ); } double SAL_CALL ScVbaOLEObject::getLeft() throw (uno::RuntimeException) { - uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); - return mm2pt( xShape->getPosition().X / 100 ); + return m_xControl->getLeft(); } void SAL_CALL ScVbaOLEObject::setLeft( double _left ) throw (uno::RuntimeException) { - awt::Point oldPosition; - uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); - oldPosition = xShape->getPosition(); - oldPosition.X = pt2mm( _left ) * 100; - xShape->setPosition( oldPosition ); + m_xControl->setLeft( _left ); } double SAL_CALL ScVbaOLEObject::getTop() throw (uno::RuntimeException) { - uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); - return mm2pt( xShape->getPosition().Y / 100 ); + return m_xControl->getTop(); } void SAL_CALL ScVbaOLEObject::setTop( double _top ) throw (uno::RuntimeException) { - awt::Point oldPosition; - uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); - oldPosition = xShape->getPosition(); - oldPosition.Y = pt2mm( _top ) * 100;; - xShape->setPosition( oldPosition ); + m_xControl->setTop( _top ); } double SAL_CALL ScVbaOLEObject::getHeight() throw (uno::RuntimeException) { - uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); - return mm2pt( xShape->getSize().Height / 100 );//1pt = 1/72in + return m_xControl->getHeight(); } void SAL_CALL ScVbaOLEObject::setHeight( double _height ) throw (uno::RuntimeException) { - awt::Size oldSize; - uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); - oldSize = xShape->getSize(); - oldSize.Height = pt2mm( _height ) * 100; - xShape->setSize( oldSize ); + m_xControl->setHeight( _height ); } double SAL_CALL ScVbaOLEObject::getWidth() throw (uno::RuntimeException) { - uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); - return mm2pt ( xShape->getSize().Width / 100 ); + return m_xControl->getWidth(); } void SAL_CALL ScVbaOLEObject::setWidth( double _width ) throw (uno::RuntimeException) { - awt::Size oldSize; - uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); - oldSize = xShape->getSize(); - oldSize.Width = pt2mm( _width ) * 100; - xShape->setSize( oldSize ); + m_xControl->setWidth( _width ); } rtl::OUString& ScVbaOLEObject::getServiceImplName() diff --git a/sc/source/ui/vba/vbaoleobject.hxx b/sc/source/ui/vba/vbaoleobject.hxx index 1b900aacf916..9ad6d6acc2b6 100644 --- a/sc/source/ui/vba/vbaoleobject.hxx +++ b/sc/source/ui/vba/vbaoleobject.hxx @@ -32,20 +32,20 @@ #include #include -#include #include +#include -#include "vbahelperinterface.hxx" +#include typedef InheritedHelperInterfaceImpl1< ov::excel::XOLEObject > OLEObjectImpl_BASE; class ScVbaOLEObject : public OLEObjectImpl_BASE { - css::uno::Reference< css::awt::XWindowPeer > m_xWindowPeer; protected: css::uno::Reference< css::drawing::XControlShape > m_xControlShape; virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence getServiceNames(); + css::uno::Reference< ov::msforms::XControl> m_xControl; public: ScVbaOLEObject( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::drawing::XControlShape > xControlShape ); diff --git a/sc/source/ui/vba/vbaoleobjects.hxx b/sc/source/ui/vba/vbaoleobjects.hxx index 3d2c1b82c6a5..6372a1d2acf3 100644 --- a/sc/source/ui/vba/vbaoleobjects.hxx +++ b/sc/source/ui/vba/vbaoleobjects.hxx @@ -33,8 +33,8 @@ #include #include -#include "vbacollectionimpl.hxx" -#include "vbahelper.hxx" +#include +#include "excelvbahelper.hxx" typedef CollTestImplHelper< ov::excel::XOLEObjects > OLEObjectsImpl_BASE; diff --git a/sc/source/ui/vba/vbaoutline.hxx b/sc/source/ui/vba/vbaoutline.hxx index 346ca973f021..423b97a34671 100644 --- a/sc/source/ui/vba/vbaoutline.hxx +++ b/sc/source/ui/vba/vbaoutline.hxx @@ -34,7 +34,7 @@ #include #include #include -#include "vbahelperinterface.hxx" +#include typedef InheritedHelperInterfaceImpl1< ov::excel::XOutline > ScVbaOutline_BASE; diff --git a/sc/source/ui/vba/vbapagebreak.cxx b/sc/source/ui/vba/vbapagebreak.cxx index 83fd0687c4c7..6e8357be7a8c 100644 --- a/sc/source/ui/vba/vbapagebreak.cxx +++ b/sc/source/ui/vba/vbapagebreak.cxx @@ -139,3 +139,37 @@ ScVbaHPageBreak::getServiceNames() return aServiceNames; } +template class ScVbaPageBreak< excel::XVPageBreak >; + +/* class ScVbaVPageBreak */ +ScVbaVPageBreak::ScVbaVPageBreak( const css::uno::Reference< ov::XHelperInterface >& xParent, + const css::uno::Reference< css::uno::XComponentContext >& xContext, + css::uno::Reference< css::beans::XPropertySet >& xProps, + css::sheet::TablePageBreakData aTablePageBreakData ) throw ( css::uno::RuntimeException ) +: ScVbaVPageBreak_BASE( xParent, xContext, xProps, aTablePageBreakData ) +{ +} + +ScVbaVPageBreak::~ScVbaVPageBreak() +{ +} + +rtl::OUString& +ScVbaVPageBreak::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaVPageBreak") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaVPageBreak::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.VPageBreak" ) ); + } + return aServiceNames; +} + diff --git a/sc/source/ui/vba/vbapagebreak.hxx b/sc/source/ui/vba/vbapagebreak.hxx index 0b05c8895711..2e83d3d9b6d6 100644 --- a/sc/source/ui/vba/vbapagebreak.hxx +++ b/sc/source/ui/vba/vbapagebreak.hxx @@ -33,12 +33,13 @@ #include #include #include +#include #include #include #include #include #include -#include "vbahelperinterface.hxx" +#include template< typename Ifc1 > class ScVbaPageBreak : public InheritedHelperInterfaceImpl1< Ifc1 > @@ -84,4 +85,22 @@ public: virtual css::uno::Sequence getServiceNames(); }; +//VPageBreak +typedef ScVbaPageBreak < ov::excel::XVPageBreak > ScVbaVPageBreak_BASE; + +class ScVbaVPageBreak : public ScVbaVPageBreak_BASE +{ +public: + ScVbaVPageBreak( const css::uno::Reference< ov::XHelperInterface >& xParent, + const css::uno::Reference< css::uno::XComponentContext >& xContext, + css::uno::Reference< css::beans::XPropertySet >& xProps, + css::sheet::TablePageBreakData aTablePageBreakData) throw (css::uno::RuntimeException); + + virtual ~ScVbaVPageBreak(); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + #endif diff --git a/sc/source/ui/vba/vbapagebreaks.cxx b/sc/source/ui/vba/vbapagebreaks.cxx index 7e04b982b530..c3b86b77d0bd 100644 --- a/sc/source/ui/vba/vbapagebreaks.cxx +++ b/sc/source/ui/vba/vbapagebreaks.cxx @@ -90,8 +90,8 @@ public: virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException); virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { - //if( m_bColumn ) - // return excel::XVPageBreak::static_type(0); + if( m_bColumn ) + return excel::XVPageBreak::static_type(0); return excel::XHPageBreak::static_type(0); } virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) @@ -137,8 +137,8 @@ uno::Any SAL_CALL RangePageBreaks::getByIndex( sal_Int32 Index ) throw (lang::In if( (nPos < xIndexAccess->getCount()) && (nPos > -1) ) { uno::Reference< beans::XPropertySet > xRowColPropertySet( xIndexAccess->getByIndex(nPos), uno::UNO_QUERY_THROW ); - //if( m_bColumn ) - // return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); + if( m_bColumn ) + return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); return uno::makeAny( uno::Reference< excel::XHPageBreak >( new ScVbaHPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); } } @@ -187,8 +187,8 @@ uno::Any RangePageBreaks::Add( const css::uno::Any& Before ) throw ( css::script sheet::TablePageBreakData aTablePageBreakData; aTablePageBreakData.ManualBreak = sal_True; aTablePageBreakData.Position = nAPIRowColIndex; - //if( m_bColumn ) - // return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); + if( m_bColumn ) + return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); return uno::makeAny( uno::Reference< excel::XHPageBreak >( new ScVbaHPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); } @@ -267,3 +267,64 @@ ScVbaHPageBreaks::getServiceNames() return aServiceNames; } +//VPageBreak +ScVbaVPageBreaks::ScVbaVPageBreaks( const uno::Reference< XHelperInterface >& xParent, + const uno::Reference< uno::XComponentContext >& xContext, + uno::Reference< sheet::XSheetPageBreak >& xSheetPageBreak ) throw ( uno::RuntimeException ) +: ScVbaVPageBreaks_BASE( xParent, xContext, new RangePageBreaks( xParent, xContext, xSheetPageBreak, sal_True ) ), + mxSheetPageBreak( xSheetPageBreak ) +{ +} + +ScVbaVPageBreaks::~ScVbaVPageBreaks() +{ +} + +uno::Any SAL_CALL +ScVbaVPageBreaks::Add( const uno::Any& Before ) throw ( script::BasicErrorException, uno::RuntimeException ) +{ + RangePageBreaks* pPageBreaks = dynamic_cast< RangePageBreaks* >( m_xIndexAccess.get() ); + if( pPageBreaks ) + { + return pPageBreaks->Add( Before ); + } + return uno::Any(); +} + +uno::Reference< container::XEnumeration > +ScVbaVPageBreaks::createEnumeration() throw ( uno::RuntimeException ) +{ + return new RangePageBreaksEnumWrapper( m_xIndexAccess ); +} + +uno::Any +ScVbaVPageBreaks::createCollectionObject( const css::uno::Any& aSource ) +{ + return aSource; // its already a pagebreak object +} + +uno::Type +ScVbaVPageBreaks::getElementType() throw ( uno::RuntimeException ) +{ + return excel::XVPageBreak::static_type( 0 ); +} + +rtl::OUString& +ScVbaVPageBreaks::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM( "ScVbaVPageBreaks" ) ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaVPageBreaks::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.VPageBreaks" ) ); + } + return aServiceNames; +} + diff --git a/sc/source/ui/vba/vbapagebreaks.hxx b/sc/source/ui/vba/vbapagebreaks.hxx index 26d3e6961297..5c90745d61ff 100644 --- a/sc/source/ui/vba/vbapagebreaks.hxx +++ b/sc/source/ui/vba/vbapagebreaks.hxx @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include #include #include @@ -41,8 +43,8 @@ #include #include #include -#include "vbahelperinterface.hxx" -#include "vbacollectionimpl.hxx" +#include +#include typedef CollTestImplHelper< ov::excel::XHPageBreaks > ScVbaHPageBreaks_BASE; @@ -68,4 +70,31 @@ public: virtual css::uno::Sequence getServiceNames(); }; +//VPageBreaks +typedef CollTestImplHelper< ov::excel::XVPageBreaks > ScVbaVPageBreaks_BASE; + +class ScVbaVPageBreaks : public ScVbaVPageBreaks_BASE +{ + css::uno::Reference< css::sheet::XSheetPageBreak > mxSheetPageBreak; + +public: + ScVbaVPageBreaks( const css::uno::Reference< ov::XHelperInterface >& xParent, + const css::uno::Reference< css::uno::XComponentContext >& xContext, + css::uno::Reference< css::sheet::XSheetPageBreak >& xSheetPageBreak ) throw ( css::uno::RuntimeException ); + + virtual ~ScVbaVPageBreaks(); + + // XVPageBreaks + virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Before ) throw ( css::script::BasicErrorException, css::uno::RuntimeException ); + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw ( css::uno::RuntimeException ); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw ( css::uno::RuntimeException ); + virtual css::uno::Any createCollectionObject( const css::uno::Any& ); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + #endif diff --git a/sc/source/ui/vba/vbapages.cxx b/sc/source/ui/vba/vbapages.cxx deleted file mode 100644 index 19f89aaefeed..000000000000 --- a/sc/source/ui/vba/vbapages.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include "vbapages.hxx" - -using namespace ::ooo::vba; -using namespace ::com::sun::star; -using namespace ::vos; - -ScVbaPages::ScVbaPages( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPages ) throw( lang::IllegalArgumentException ) : ScVbaPages_BASE( xParent, xContext, xPages ) -{ -} - -uno::Type SAL_CALL -ScVbaPages::getElementType() throw (uno::RuntimeException) -{ - // return msforms::XPage::static_type(0); - return uno::XInterface::static_type(0); -} - -uno::Any -ScVbaPages::createCollectionObject( const css::uno::Any& aSource ) -{ - return aSource; -} - -rtl::OUString& -ScVbaPages::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPages") ); - return sImplName; -} - -uno::Reference< container::XEnumeration > SAL_CALL -ScVbaPages::createEnumeration() throw (uno::RuntimeException) -{ - return uno::Reference< container::XEnumeration >(); -} - -uno::Sequence< rtl::OUString > -ScVbaPages::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Pages" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbapages.hxx b/sc/source/ui/vba/vbapages.hxx deleted file mode 100644 index 45ad882d759c..000000000000 --- a/sc/source/ui/vba/vbapages.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_PAGES_HXX -#define SC_VBA_PAGES_HXX - -#include -#include -#include -#include -#include -#include - -#include "vbacollectionimpl.hxx" -typedef CollTestImplHelper< -ov::msforms::XPages > ScVbaPages_BASE; - -class ScVbaPages : public ScVbaPages_BASE -{ -protected: - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -public: - ScVbaPages( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPages ) throw ( css::lang::IllegalArgumentException ); - virtual ~ScVbaPages() {} - // XEnumerationAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); - // ScVbaPages_BASE - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); - -}; -#endif//SC_VBA_SHAPE_HXX diff --git a/sc/source/ui/vba/vbapagesetup.cxx b/sc/source/ui/vba/vbapagesetup.cxx index 2e7dd57a7afd..cbc9360db523 100644 --- a/sc/source/ui/vba/vbapagesetup.cxx +++ b/sc/source/ui/vba/vbapagesetup.cxx @@ -31,6 +31,7 @@ #include "cellsuno.hxx" #include "convuno.hxx" #include "rangelst.hxx" +#include "excelvbahelper.hxx" #include #include #include @@ -52,10 +53,10 @@ ScVbaPageSetup::ScVbaPageSetup(const uno::Reference< XHelperInterface >& xParent const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSpreadsheet >& xSheet, const uno::Reference< frame::XModel >& xModel) throw (uno::RuntimeException): - ScVbaPageSetup_BASE( xParent, xContext ), - mxSheet( xSheet ), mxModel( xModel ) + ScVbaPageSetup_BASE( xParent, xContext ), mxSheet( xSheet ) { // query for current page style + mxModel.set( xModel, uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xSheetProps( mxSheet, uno::UNO_QUERY_THROW ); uno::Any aValue = xSheetProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageStyle" ))); rtl::OUString aStyleName; @@ -65,6 +66,8 @@ ScVbaPageSetup::ScVbaPageSetup(const uno::Reference< XHelperInterface >& xParent uno::Reference< container::XNameAccess > xStyleFamilies = xStyleFamiliesSup->getStyleFamilies(); uno::Reference< container::XNameAccess > xPageStyle( xStyleFamilies->getByName(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles"))), uno::UNO_QUERY_THROW ); mxPageProps.set( xPageStyle->getByName(aStyleName), uno::UNO_QUERY_THROW ); + mnOrientLandscape = excel::XlPageOrientation::xlLandscape; + mnOrientPortrait = excel::XlPageOrientation::xlPortrait; } rtl::OUString SAL_CALL ScVbaPageSetup::getPrintArea() throw (css::uno::RuntimeException) @@ -85,7 +88,7 @@ rtl::OUString SAL_CALL ScVbaPageSetup::getPrintArea() throw (css::uno::RuntimeEx ScUnoConversion::FillScRange( aRange, aSeq[i] ); aRangeList.Append( aRange ); } - ScDocument* pDoc = getDocShell( mxModel )->GetDocument(); + ScDocument* pDoc = excel::getDocShell( mxModel )->GetDocument(); aRangeList.Format( aPrintArea, nFlags, pDoc, formula::FormulaGrammar::CONV_XL_A1, ',' ); } @@ -106,7 +109,7 @@ void SAL_CALL ScVbaPageSetup::setPrintArea( const rtl::OUString& rAreas ) throw { ScRangeList aCellRanges; ScRange aRange; - if( getScRangeListForAddress( rAreas, getDocShell( mxModel ) , aRange, aCellRanges ) ) + if( getScRangeListForAddress( rAreas, excel::getDocShell( mxModel ) , aRange, aCellRanges ) ) { uno::Sequence< table::CellRangeAddress > aSeq( aCellRanges.Count() ); USHORT i=0; @@ -121,290 +124,24 @@ void SAL_CALL ScVbaPageSetup::setPrintArea( const rtl::OUString& rAreas ) throw } } -double SAL_CALL ScVbaPageSetup::getTopMargin() throw (css::uno::RuntimeException) -{ - sal_Bool headerOn = sal_False; - sal_Int32 topMargin = 0; - sal_Int32 headerHeight = 0; - - try - { - uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))); - aValue >>= headerOn; - - aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))); - aValue >>= topMargin; - - if( headerOn ) - { - aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))); - aValue >>= headerHeight; - topMargin += headerHeight; - } - } - catch( uno::Exception& ) - { - } - - return Millimeter::getInPoints( topMargin ); -} - -void SAL_CALL ScVbaPageSetup::setTopMargin( double margin ) throw (css::uno::RuntimeException) -{ - sal_Int32 topMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); - sal_Bool headerOn = sal_False; - sal_Int32 headerHeight = 0; - - try - { - uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))); - aValue >>= headerOn; - - if( headerOn ) - { - aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))); - aValue >>= headerHeight; - topMargin -= headerHeight; - } - - aValue <<= topMargin; - mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), aValue ); - } - catch( uno::Exception& ) - { - } -} - -double SAL_CALL ScVbaPageSetup::getBottomMargin() throw (css::uno::RuntimeException) -{ - sal_Bool footerOn = sal_False; - sal_Int32 bottomMargin = 0; - sal_Int32 footerHeight = 0; - - try - { - uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))); - aValue >>= footerOn; - - aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))); - aValue >>= bottomMargin; - - if( footerOn ) - { - aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))); - aValue >>= footerHeight; - bottomMargin += footerHeight; - } - } - catch( uno::Exception& ) - { - } - - return Millimeter::getInPoints( bottomMargin ); -} - -void SAL_CALL ScVbaPageSetup::setBottomMargin( double margin ) throw (css::uno::RuntimeException) -{ - sal_Int32 bottomMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); - sal_Bool footerOn = sal_False; - sal_Int32 footerHeight = 0; - - try - { - uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))); - aValue >>= footerOn; - - if( footerOn ) - { - aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))); - aValue >>= footerHeight; - bottomMargin -= footerHeight; - } - - aValue <<= bottomMargin; - mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), aValue ); - } - catch( uno::Exception& ) - { - } -} - -double SAL_CALL ScVbaPageSetup::getRightMargin() throw (css::uno::RuntimeException) -{ - sal_Int32 rightMargin = 0; - try - { - uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin"))); - aValue >>= rightMargin; - } - catch( uno::Exception& ) - { - } - - return Millimeter::getInPoints( rightMargin );; -} - -void SAL_CALL ScVbaPageSetup::setRightMargin( double margin ) throw (css::uno::RuntimeException) -{ - sal_Int32 rightMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); - try - { - uno::Any aValue; - aValue <<= rightMargin; - mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin")), aValue ); - } - catch( uno::Exception& ) - { - } - -} - -double SAL_CALL ScVbaPageSetup::getLeftMargin() throw (css::uno::RuntimeException) -{ - sal_Int32 leftMargin = 0; - try - { - uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin"))); - aValue >>= leftMargin; - } - catch( uno::Exception& ) - { - } - - return Millimeter::getInPoints( leftMargin );; -} - -void SAL_CALL ScVbaPageSetup::setLeftMargin( double margin ) throw (css::uno::RuntimeException) -{ - sal_Int32 leftMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); - try - { - uno::Any aValue; - aValue <<= leftMargin; - mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin")), aValue ); - } - catch( uno::Exception& ) - { - } -} - double SAL_CALL ScVbaPageSetup::getHeaderMargin() throw (css::uno::RuntimeException) { - sal_Int32 headerMargin = 0; - try - { - uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))); - aValue >>= headerMargin; - } - catch( uno::Exception& ) - { - } - - return Millimeter::getInPoints( headerMargin );; + return VbaPageSetupBase::getHeaderMargin(); } void SAL_CALL ScVbaPageSetup::setHeaderMargin( double margin ) throw (css::uno::RuntimeException) { - sal_Int32 headerMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); - try - { - uno::Any aValue; - aValue <<= headerMargin; - mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), aValue ); - } - catch( uno::Exception& ) - { - } + VbaPageSetupBase::setHeaderMargin( margin ); } double SAL_CALL ScVbaPageSetup::getFooterMargin() throw (css::uno::RuntimeException) { - sal_Int32 footerMargin = 0; - try - { - uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))); - aValue >>= footerMargin; - } - catch( uno::Exception& ) - { - } - - return Millimeter::getInPoints( footerMargin );; + return VbaPageSetupBase::getFooterMargin(); } void SAL_CALL ScVbaPageSetup::setFooterMargin( double margin ) throw (css::uno::RuntimeException) { - sal_Int32 footerMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); - try - { - uno::Any aValue; - aValue <<= footerMargin; - mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), aValue ); - } - catch( uno::Exception& ) - { - } -} - -sal_Int32 SAL_CALL ScVbaPageSetup::getOrientation() throw (css::uno::RuntimeException) -{ - sal_Int32 orientation = excel::XlPageOrientation::xlPortrait; - try - { - sal_Bool isLandscape = sal_False; - uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape"))); - aValue >>= isLandscape; - - if( isLandscape ) - { - orientation = excel::XlPageOrientation::xlLandscape; - } - } - catch( uno::Exception& ) - { - } - return orientation; -} - -void SAL_CALL ScVbaPageSetup::setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException) -{ - if( ( orientation != excel::XlPageOrientation::xlPortrait ) && - ( orientation != excel::XlPageOrientation::xlLandscape ) ) - { - DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); - } - - try - { - sal_Bool isLandscape = sal_False; - uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape"))); - aValue >>= isLandscape; - - sal_Bool switchOrientation = sal_False; - if(( isLandscape && orientation != excel::XlPageOrientation::xlLandscape ) || - ( !isLandscape && orientation != excel::XlPageOrientation::xlPortrait )) - { - switchOrientation = sal_True; - } - - if( switchOrientation ) - { - aValue <<= !isLandscape; - uno::Any aHeight = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height"))); - uno::Any aWidth = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width"))); - mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape")), aValue ); - mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width")), aHeight ); - mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height")), aWidth ); - } - - if( isLandscape ) - { - orientation = excel::XlPageOrientation::xlLandscape; - } - } - catch( uno::Exception& ) - { - } + VbaPageSetupBase::setFooterMargin( margin ); } uno::Any SAL_CALL ScVbaPageSetup::getFitToPagesTall() throw (css::uno::RuntimeException) diff --git a/sc/source/ui/vba/vbapagesetup.hxx b/sc/source/ui/vba/vbapagesetup.hxx index e3cafc9fb78d..2b8b1fffde43 100644 --- a/sc/source/ui/vba/vbapagesetup.hxx +++ b/sc/source/ui/vba/vbapagesetup.hxx @@ -35,39 +35,28 @@ #include #include #include -#include "vbahelperinterface.hxx" +#include +#include -typedef InheritedHelperInterfaceImpl1< ov::excel::XPageSetup > ScVbaPageSetup_BASE; +typedef cppu::ImplInheritanceHelper1< VbaPageSetupBase, ov::excel::XPageSetup > ScVbaPageSetup_BASE; class ScVbaPageSetup : public ScVbaPageSetup_BASE { css::uno::Reference< css::sheet::XSpreadsheet > mxSheet; - css::uno::Reference< css::beans::XPropertySet > mxPageProps; - css::uno::Reference< css::frame::XModel > mxModel; public: ScVbaPageSetup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XSpreadsheet>& xSheet, - const css::uno::Reference< css::frame::XModel >& xModlel) throw (css::uno::RuntimeException); + const css::uno::Reference< css::frame::XModel >& xModel) throw (css::uno::RuntimeException); virtual ~ScVbaPageSetup(){} // Attribute virtual rtl::OUString SAL_CALL getPrintArea() throw (css::uno::RuntimeException); virtual void SAL_CALL setPrintArea( const rtl::OUString& rAreas ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getTopMargin() throw (css::uno::RuntimeException); - virtual void SAL_CALL setTopMargin( double margin ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getBottomMargin() throw (css::uno::RuntimeException); - virtual void SAL_CALL setBottomMargin( double margin ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getRightMargin() throw (css::uno::RuntimeException); - virtual void SAL_CALL setRightMargin( double margin ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getLeftMargin() throw (css::uno::RuntimeException); - virtual void SAL_CALL setLeftMargin( double margin ) throw (css::uno::RuntimeException); virtual double SAL_CALL getHeaderMargin() throw (css::uno::RuntimeException); - virtual void SAL_CALL setHeaderMargin( double margin ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getFooterMargin() throw (css::uno::RuntimeException); - virtual void SAL_CALL setFooterMargin( double margin ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getOrientation() throw (css::uno::RuntimeException); - virtual void SAL_CALL setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException); + void SAL_CALL setHeaderMargin( double margin ) throw (css::uno::RuntimeException); + double SAL_CALL getFooterMargin() throw (css::uno::RuntimeException); + void SAL_CALL setFooterMargin( double margin ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getFitToPagesTall() throw (css::uno::RuntimeException); virtual void SAL_CALL setFitToPagesTall( const css::uno::Any& fitToPagesTall ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getFitToPagesWide() throw (css::uno::RuntimeException); diff --git a/sc/source/ui/vba/vbapalette.cxx b/sc/source/ui/vba/vbapalette.cxx index d3bbbd6ae121..f9afaa00c191 100644 --- a/sc/source/ui/vba/vbapalette.cxx +++ b/sc/source/ui/vba/vbapalette.cxx @@ -92,7 +92,7 @@ ScVbaPalette::getDefaultPalette() } uno::Reference< container::XIndexAccess > -ScVbaPalette::getPalette() +ScVbaPalette::getPalette() const { uno::Reference< container::XIndexAccess > xIndex; uno::Reference< beans::XPropertySet > xProps; diff --git a/sc/source/ui/vba/vbapalette.hxx b/sc/source/ui/vba/vbapalette.hxx index aa1c8eb27d6c..388fd5908b6b 100644 --- a/sc/source/ui/vba/vbapalette.hxx +++ b/sc/source/ui/vba/vbapalette.hxx @@ -30,7 +30,7 @@ #ifndef SC_VBAPALETTE_HXX #define SC_VBAPALETTE_HXX -#include "vbahelper.hxx" +#include "excelvbahelper.hxx" #include #include @@ -42,7 +42,7 @@ public: ScVbaPalette( SfxObjectShell* pShell = NULL ) : m_pShell( pShell ){} // if no palette available e.g. because the document doesn't have a // palette defined then a default palette will be returned. - css::uno::Reference< css::container::XIndexAccess > getPalette(); + css::uno::Reference< css::container::XIndexAccess > getPalette() const; static css::uno::Reference< css::container::XIndexAccess > getDefaultPalette(); }; diff --git a/sc/source/ui/vba/vbapane.hxx b/sc/source/ui/vba/vbapane.hxx index 0f67bbf6038c..97eb3e8f366c 100644 --- a/sc/source/ui/vba/vbapane.hxx +++ b/sc/source/ui/vba/vbapane.hxx @@ -34,7 +34,7 @@ #include #include -#include"vbahelper.hxx" +#include"excelvbahelper.hxx" typedef cppu::WeakImplHelper1< ov::excel::XPane > PaneImpl_Base; diff --git a/sc/source/ui/vba/vbapictureformat.cxx b/sc/source/ui/vba/vbapictureformat.cxx deleted file mode 100644 index 0d79fc173d50..000000000000 --- a/sc/source/ui/vba/vbapictureformat.cxx +++ /dev/null @@ -1,147 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbapictureformat.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "vbapictureformat.hxx" - -using namespace ooo::vba; -using namespace com::sun::star; - -ScVbaPictureFormat::ScVbaPictureFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, - const css::uno::Reference< css::uno::XComponentContext >& xContext, - uno::Reference< drawing::XShape > xShape ) - throw( lang::IllegalArgumentException ) : ScVbaPictureFormat_BASE( xParent, xContext ), m_xShape( xShape ) -{ - m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); -} - -void -ScVbaPictureFormat::checkParameterRangeInDouble( double nRange, double nMin, double nMax ) throw (css::uno::RuntimeException) -{ - if( nRange < nMin ) - { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too small.") , uno::Reference< uno::XInterface >() ); - } - if( nRange > nMax ) - { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too high.") , uno::Reference< uno::XInterface >() ); - } -} - -// Attributes -double SAL_CALL -ScVbaPictureFormat::getBrightness() throw (uno::RuntimeException) -{ - sal_Int16 nLuminance = 0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance") ) >>= nLuminance; - double fBrightness = static_cast< double >( nLuminance ); - fBrightness = ( fBrightness +100 ) / 200; - return fBrightness; -} - -void SAL_CALL -ScVbaPictureFormat::setBrightness( double _brightness ) throw (uno::RuntimeException) -{ - checkParameterRangeInDouble( _brightness, 0.0, 1.0 ); - double fLuminance = _brightness * 200 - 100; - sal_Int16 nLuminance = static_cast< sal_Int16 >( fLuminance ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance"), uno::makeAny( nLuminance ) ); -} - -double SAL_CALL -ScVbaPictureFormat::getContrast() throw (uno::RuntimeException) -{ - sal_Int16 nContrast = 0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustContrast") ) >>= nContrast; - double fContrast = static_cast< double >( nContrast ); - fContrast = ( fContrast + 100 ) / 200; - return fContrast; -} - -void SAL_CALL -ScVbaPictureFormat::setContrast( double _contrast ) throw (uno::RuntimeException) -{ - checkParameterRangeInDouble( _contrast, 0.0, 1.0 ); - double fContrast = _contrast * 200 - 100; - sal_Int16 nContrast = static_cast< sal_Int16 >( fContrast ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustContrast"), uno::makeAny( nContrast ) ); -} - - -// Methods -void SAL_CALL -ScVbaPictureFormat::IncrementBrightness( double increment ) throw (uno::RuntimeException) -{ - double fBrightness = getBrightness(); - fBrightness += increment; - if( fBrightness < 0 ) - { - fBrightness = 0.0; - } - if( fBrightness > 1 ) - { - fBrightness = 1; - } - setBrightness( fBrightness ); -} - -void SAL_CALL -ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeException) -{ - double nContrast = getContrast(); - nContrast += increment; - if( increment < 0 ) - { - increment = 0.0; - } - if( increment > 1 ) - { - increment = 1.0; - } - setContrast( nContrast ); -} - - -rtl::OUString& -ScVbaPictureFormat::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPictureFormat") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaPictureFormat::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.PictureFormat" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbapictureformat.hxx b/sc/source/ui/vba/vbapictureformat.hxx deleted file mode 100644 index f7b63f94fcbd..000000000000 --- a/sc/source/ui/vba/vbapictureformat.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbapictureformat.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_PICTUREFORMAT_HXX -#define SC_VBA_PICTUREFORMAT_HXX - -#include -#include -#include -#include "vbahelperinterface.hxx" - -typedef InheritedHelperInterfaceImpl1< ov::msforms::XPictureFormat > ScVbaPictureFormat_BASE; - -class ScVbaPictureFormat : public ScVbaPictureFormat_BASE -{ -private: - css::uno::Reference< css::drawing::XShape > m_xShape; - css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -protected: - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -private: - void checkParameterRangeInDouble( double nRange, double nMin, double nMax ) throw (css::uno::RuntimeException); -public: - ScVbaPictureFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::drawing::XShape > xShape ) throw( css::lang::IllegalArgumentException ); - - // Attributes - virtual double SAL_CALL getBrightness() throw (css::uno::RuntimeException); - virtual void SAL_CALL setBrightness( double _brightness ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getContrast() throw (css::uno::RuntimeException); - virtual void SAL_CALL setContrast( double _contrast ) throw (css::uno::RuntimeException); - - // Methods - virtual void SAL_CALL IncrementBrightness( double increment ) throw (css::uno::RuntimeException); - virtual void SAL_CALL IncrementContrast( double increment ) throw (css::uno::RuntimeException); -}; - -#endif//SC_VBA_PICTUREFORMAT_HXX diff --git a/sc/source/ui/vba/vbapivotcache.hxx b/sc/source/ui/vba/vbapivotcache.hxx index 8a57401d2ff9..6e98344d115e 100644 --- a/sc/source/ui/vba/vbapivotcache.hxx +++ b/sc/source/ui/vba/vbapivotcache.hxx @@ -34,7 +34,7 @@ #include #include -#include "vbahelperinterface.hxx" +#include typedef InheritedHelperInterfaceImpl1 PivotCacheImpl_BASE; diff --git a/sc/source/ui/vba/vbapivottable.hxx b/sc/source/ui/vba/vbapivottable.hxx index 55f32a36e60d..7fccada818fc 100644 --- a/sc/source/ui/vba/vbapivottable.hxx +++ b/sc/source/ui/vba/vbapivottable.hxx @@ -33,8 +33,8 @@ #include #include #include -#include "vbahelper.hxx" -#include "vbahelperinterface.hxx" +#include "excelvbahelper.hxx" +#include typedef InheritedHelperInterfaceImpl1< ov::excel::XPivotTable > PivotTableImpl_BASE; diff --git a/sc/source/ui/vba/vbapivottables.hxx b/sc/source/ui/vba/vbapivottables.hxx index 6a6d5afb67a5..b2f71cdc3ff0 100644 --- a/sc/source/ui/vba/vbapivottables.hxx +++ b/sc/source/ui/vba/vbapivottables.hxx @@ -36,9 +36,9 @@ #include #include -#include "vbahelper.hxx" -#include "vbahelperinterface.hxx" -#include "vbacollectionimpl.hxx" +#include "excelvbahelper.hxx" +#include +#include typedef CollTestImplHelper< ov::excel::XPivotTables > ScVbaPivotTables_BASE; diff --git a/sc/source/ui/vba/vbaprogressbar.cxx b/sc/source/ui/vba/vbaprogressbar.cxx deleted file mode 100644 index 27f425f9b808..000000000000 --- a/sc/source/ui/vba/vbaprogressbar.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include "vbaprogressbar.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - -// uno servicename com.sun.star.awt.UnoControlProgressBarMode -const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ); - -ScVbaProgressBar::ScVbaProgressBar( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ProgressBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ -} - -// Attributes -uno::Any SAL_CALL -ScVbaProgressBar::getValue() throw (css::uno::RuntimeException) -{ - return m_xProps->getPropertyValue( SVALUE ); -} - -void SAL_CALL -ScVbaProgressBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) -{ - m_xProps->setPropertyValue( SVALUE, _value ); -} - -rtl::OUString& -ScVbaProgressBar::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaProgressBar") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaProgressBar::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbaprogressbar.hxx b/sc/source/ui/vba/vbaprogressbar.hxx deleted file mode 100644 index d040f08f98d6..000000000000 --- a/sc/source/ui/vba/vbaprogressbar.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_PROGRESSBAR_HXX -#define SC_VBA_PROGRESSBAR_HXX -#include -#include - -#include "vbacontrol.hxx" -#include "vbahelper.hxx" -#include - -typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XProgressBar, css::script::XDefaultProperty > ProgressBarImpl_BASE; - -class ScVbaProgressBar : public ProgressBarImpl_BASE -{ -public: - ScVbaProgressBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); - // Attributes - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); - // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } -}; -#endif //SC_VBA_LABEL_HXX diff --git a/sc/source/ui/vba/vbapropvalue.hxx b/sc/source/ui/vba/vbapropvalue.hxx index d6ddb33505e1..f521212f2ceb 100644 --- a/sc/source/ui/vba/vbapropvalue.hxx +++ b/sc/source/ui/vba/vbapropvalue.hxx @@ -32,7 +32,7 @@ #include #include -#include "vbahelper.hxx" +#include "excelvbahelper.hxx" typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE; diff --git a/sc/source/ui/vba/vbaradiobutton.cxx b/sc/source/ui/vba/vbaradiobutton.cxx deleted file mode 100644 index 3ce00bfd862b..000000000000 --- a/sc/source/ui/vba/vbaradiobutton.cxx +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbaradiobutton.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "vbaradiobutton.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); -const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") ); -ScVbaRadioButton::ScVbaRadioButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : RadioButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ -} - -// Attributes -rtl::OUString SAL_CALL -ScVbaRadioButton::getCaption() throw (css::uno::RuntimeException) -{ - rtl::OUString Label; - m_xProps->getPropertyValue( LABEL ) >>= Label; - return Label; -} - -void SAL_CALL -ScVbaRadioButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) -{ - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); -} - -uno::Any SAL_CALL -ScVbaRadioButton::getValue() throw (css::uno::RuntimeException) -{ - sal_Int16 nValue = -1; - m_xProps->getPropertyValue( STATE ) >>= nValue; - if( nValue != 0 ) - nValue = -1; -// return uno::makeAny( nValue ); -// I must be missing something MSO says value should be -1 if selected, 0 if not -// selected - return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False ); - -} - -void SAL_CALL -ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException) -{ - sal_Int16 nValue = 0; - sal_Bool bValue = sal_False; - if( _value >>= nValue ) - { - if( nValue == -1) - nValue = 1; - } - else if ( _value >>= bValue ) - { - if ( bValue ) - nValue = 1; - } - m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); -} - -rtl::OUString& -ScVbaRadioButton::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaRadioButton") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaRadioButton::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.RadioButton" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbaradiobutton.hxx b/sc/source/ui/vba/vbaradiobutton.hxx deleted file mode 100644 index f840030863dc..000000000000 --- a/sc/source/ui/vba/vbaradiobutton.hxx +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbaradiobutton.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_RADIOBUTTON_HXX -#define SC_VBA_RADIOBUTTON_HXX -#include -#include "vbacontrol.hxx" -#include "vbahelper.hxx" -#include - -typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > RadioButtonImpl_BASE; - -class ScVbaRadioButton : public RadioButtonImpl_BASE -{ -public: - ScVbaRadioButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); - // Attributes - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue(const com::sun::star::uno::Any&) throw (css::uno::RuntimeException); - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); - // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } - -}; -#endif //SC_VBA_RADIOBUTTON_HXX diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index d1ac4504ce96..f6c58c23f79a 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "helperdecl.hxx" +#include #include #include @@ -149,7 +149,6 @@ #include "rangelst.hxx" #include "convuno.hxx" #include "compiler.hxx" -#include "formula/grammar.hxx" #include "attrib.hxx" #include "undodat.hxx" #include "dbdocfun.hxx" @@ -162,7 +161,7 @@ #include "vbaglobals.hxx" #include "vbastyle.hxx" #include -#include +#include // begin test includes #include // end test includes @@ -256,7 +255,7 @@ ScCellRangeObj* ScVbaRange::getCellRangeObj() throw ( uno::RuntimeException ) SfxItemSet* ScVbaRange::getCurrentDataSet( ) throw ( uno::RuntimeException ) { ScCellRangeObj* pUnoCellRange = getCellRangeObj(); - SfxItemSet* pDataSet = ScVbaCellRangeAccess::GetDataSet( pUnoCellRange ); + SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( pUnoCellRange ); if ( !pDataSet ) throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't access Itemset for range" ) ), uno::Reference< uno::XInterface >() ); return pDataSet; @@ -473,7 +472,7 @@ public: if ( pUnoCellRange ) { - SfxItemSet* pDataSet = ScVbaCellRangeAccess::GetDataSet( pUnoCellRange ); + SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( pUnoCellRange ); SfxItemState eState = pDataSet->GetItemState( ATTR_VALUE_FORMAT, TRUE, NULL); // one of the cells in the range is not like the other ;-) // so return a zero length format to indicate that @@ -1979,7 +1978,7 @@ ScVbaRange::Select() throw (uno::RuntimeException) // ThisComponent.CurrentController.Frame.getContainerWindow.SetFocus try { - uno::Reference< frame::XController > xController( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_QUERY_THROW ); uno::Reference< awt::XWindow > xWin( xFrame->getContainerWindow(), uno::UNO_QUERY_THROW ); xWin->setFocus(); @@ -1999,9 +1998,9 @@ bool cellInRange( const table::CellRangeAddress& rAddr, const sal_Int32& nCol, c return false; } -void setCursor( const SCCOL& nCol, const SCROW& nRow, bool bInSel = true ) +void setCursor( const SCCOL& nCol, const SCROW& nRow, const uno::Reference< frame::XModel >& xModel, bool bInSel = true ) { - ScTabViewShell* pShell = getCurrentBestViewShell(); + ScTabViewShell* pShell = excel::getBestViewShell( xModel ); if ( pShell ) { if ( bInSel ) @@ -2027,11 +2026,19 @@ ScVbaRange::Activate() throw (uno::RuntimeException) RangeHelper thisRange( xCellRange ); uno::Reference< sheet::XCellRangeAddressable > xThisRangeAddress = thisRange.getCellRangeAddressable(); table::CellRangeAddress thisRangeAddress = xThisRangeAddress->getRangeAddress(); + uno::Reference< frame::XModel > xModel; + ScDocShell* pShell = getScDocShell(); + + if ( pShell ) + xModel = pShell->GetModel(); + + if ( !xModel.is() ) + throw uno::RuntimeException(); // get current selection - uno::Reference< sheet::XCellRangeAddressable > xRange( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY); + uno::Reference< sheet::XCellRangeAddressable > xRange( xModel->getCurrentSelection(), ::uno::UNO_QUERY); - uno::Reference< sheet::XSheetCellRanges > xRanges( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY); + uno::Reference< sheet::XSheetCellRanges > xRanges( xModel->getCurrentSelection(), ::uno::UNO_QUERY); if ( xRanges.is() ) { @@ -2040,7 +2047,7 @@ ScVbaRange::Activate() throw (uno::RuntimeException) { if ( cellInRange( nAddrs[index], thisRangeAddress.StartColumn, thisRangeAddress.StartRow ) ) { - setCursor( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ) ); + setCursor( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ), xModel ); return; } @@ -2048,7 +2055,7 @@ ScVbaRange::Activate() throw (uno::RuntimeException) } if ( xRange.is() && cellInRange( xRange->getRangeAddress(), thisRangeAddress.StartColumn, thisRangeAddress.StartRow ) ) - setCursor( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ) ); + setCursor( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ), xModel ); else { // if this range is multi cell select the range other @@ -2056,7 +2063,7 @@ ScVbaRange::Activate() throw (uno::RuntimeException) if ( isSingleCellRange() ) // This top-leftmost cell of this Range is not in the current // selection so just select this range - setCursor( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ), false ); + setCursor( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ), xModel, false ); else Select(); } @@ -2211,8 +2218,9 @@ ScVbaRange::Copy(const ::uno::Any& Destination) throw (uno::RuntimeException) } else { + uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange ); Select(); - implnCopy(); + excel::implnCopy( xModel ); } } @@ -2235,8 +2243,9 @@ ScVbaRange::Cut(const ::uno::Any& Destination) throw (uno::RuntimeException) xMover->moveRange( xDestination->getCellAddress(), xSource->getRangeAddress() ); } { + uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange ); Select(); - implnCut(); + excel::implnCut( xModel ); } } @@ -2544,9 +2553,12 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons { if ( m_Areas->getCount() > 1 ) throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("That command cannot be used on multiple selections" ) ), uno::Reference< uno::XInterface >() ); - uno::Reference< view::XSelectionSupplier > xSelection( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW ); + ScDocShell* pShell = getScDocShell(); + + uno::Reference< frame::XModel > xModel( ( pShell ? pShell->GetModel() : NULL ), uno::UNO_QUERY_THROW ); + uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); // save old selection - uno::Reference< uno::XInterface > xSel( getCurrentDocument()->getCurrentSelection() ); + uno::Reference< uno::XInterface > xSel( xModel->getCurrentSelection() ); // select this range xSelection->select( uno::makeAny( mxRange ) ); // set up defaults @@ -2566,7 +2578,7 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons USHORT nFlags = getPasteFlags(nPaste); USHORT nFormulaBits = getPasteFormulaBits(nOperation); - implnPasteSpecial(nFlags,nFormulaBits,bSkipBlanks,bTranspose); + excel::implnPasteSpecial(pShell->GetModel(), nFlags,nFormulaBits,bSkipBlanks,bTranspose); // restore selection xSelection->select( uno::makeAny( xSel ) ); } @@ -3235,13 +3247,15 @@ ScVbaRange::End( ::sal_Int32 Direction ) throw (uno::RuntimeException) // Save ActiveCell pos ( to restore later ) uno::Any aDft; - rtl::OUString sActiveCell = ScVbaGlobals::getGlobalsImpl( - mxContext )->getApplication()->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft ); + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); + rtl::OUString sActiveCell = xApplication->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft ); // position current cell upper left of this range Cells( uno::makeAny( (sal_Int32) 1 ), uno::makeAny( (sal_Int32) 1 ) )->Select(); - SfxViewFrame* pViewFrame = getCurrentViewFrame(); + uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange ); + + SfxViewFrame* pViewFrame = excel::getViewFrame( xModel ); if ( pViewFrame ) { SfxAllItemSet aArgs( SFX_APP()->GetPool() ); @@ -3277,18 +3291,17 @@ ScVbaRange::End( ::sal_Int32 Direction ) throw (uno::RuntimeException) } // result is the ActiveCell - rtl::OUString sMoved = ScVbaGlobals::getGlobalsImpl( - mxContext )->getApplication()->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft ); + rtl::OUString sMoved = xApplication->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft ); // restore old ActiveCell uno::Any aVoid; - uno::Reference< excel::XRange > xOldActiveCell( ScVbaGlobals::getGlobalsImpl( - mxContext )->getActiveSheet()->Range( uno::makeAny( sActiveCell ), aVoid ), uno::UNO_QUERY_THROW ); + + uno::Reference< excel::XRange > xOldActiveCell( xApplication->getActiveSheet()->Range( uno::makeAny( sActiveCell ), aVoid ), uno::UNO_QUERY_THROW ); xOldActiveCell->Select(); uno::Reference< excel::XRange > resultCell; - resultCell.set( ScVbaGlobals::getGlobalsImpl( - mxContext )->getActiveSheet()->Range( uno::makeAny( sMoved ), aVoid ), uno::UNO_QUERY_THROW ); + + resultCell.set( xApplication->getActiveSheet()->Range( uno::makeAny( sMoved ), aVoid ), uno::UNO_QUERY_THROW ); // return result @@ -3321,7 +3334,6 @@ ScVbaRange::characters( const uno::Any& Start, const uno::Any& Length ) throw (u void SAL_CALL ScVbaRange::Delete( const uno::Any& Shift ) throw (uno::RuntimeException) { - if ( m_Areas->getCount() > 1 ) { sal_Int32 nItems = m_Areas->getCount(); @@ -3333,6 +3345,8 @@ ScVbaRange::Delete( const uno::Any& Shift ) throw (uno::RuntimeException) return; } sheet::CellDeleteMode mode = sheet::CellDeleteMode_NONE ; + RangeHelper thisRange( mxRange ); + table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress(); if ( Shift.hasValue() ) { sal_Int32 nShift = 0; @@ -3350,13 +3364,17 @@ ScVbaRange::Delete( const uno::Any& Shift ) throw (uno::RuntimeException) } } else - if ( getRow() > getColumn() ) + { + bool bFullRow = ( thisAddress.StartColumn == 0 && thisAddress.EndColumn == MAXCOL ); + sal_Int32 nCols = thisAddress.EndColumn - thisAddress.StartColumn; + sal_Int32 nRows = thisAddress.EndRow - thisAddress.StartRow; + if ( mbIsRows || bFullRow || ( nCols >= nRows ) ) mode = sheet::CellDeleteMode_UP; else mode = sheet::CellDeleteMode_LEFT; - RangeHelper thisRange( mxRange ); + } uno::Reference< sheet::XCellRangeMovement > xCellRangeMove( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW ); - xCellRangeMove->removeRange( thisRange.getCellRangeAddressable()->getRangeAddress(), mode ); + xCellRangeMove->removeRange( thisAddress, mode ); } @@ -3394,7 +3412,7 @@ ScVbaRange::createEnumeration() throw (uno::RuntimeException) ::rtl::OUString SAL_CALL ScVbaRange::getDefaultMethodName( ) throw (uno::RuntimeException) { - const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Cells") ); + const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Item") ); return sName; } @@ -3751,7 +3769,7 @@ ScVbaRange::setPageBreak( const uno::Any& _pagebreak) throw (uno::RuntimeExcepti uno::Reference< frame::XModel > xModel = pShell->GetModel(); if ( xModel.is() ) { - ScTabViewShell* pViewShell = getBestViewShell( xModel ); + ScTabViewShell* pViewShell = excel::getBestViewShell( xModel ); if ( nPageBreak == excel::XlPageBreak::xlPageBreakManual ) pViewShell->InsertPageBreak( bColumn, TRUE, &aAddr); else if ( nPageBreak == excel::XlPageBreak::xlPageBreakNone ) @@ -3881,7 +3899,7 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC if ( Cell1.hasValue() && !Cell2.hasValue() && sRangeName.getLength() ) { const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges")); - uno::Reference< beans::XPropertySet > xPropSet( getCurrentDocument(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( getCurrentExcelDoc(xContext), uno::UNO_QUERY_THROW ); uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW ); uno::Reference< sheet::XCellRangeReferrer > xReferrer; @@ -3904,7 +3922,7 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC } } } - uno::Reference< sheet::XSpreadsheetView > xView( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY ); + uno::Reference< sheet::XSpreadsheetView > xView( getCurrentExcelDoc(xContext)->getCurrentController(), uno::UNO_QUERY ); uno::Reference< table::XCellRange > xSheetRange( xView->getActiveSheet(), uno::UNO_QUERY_THROW ); ScVbaRange* pRange = new ScVbaRange( uno::Reference< XHelperInterface >(), xContext, xSheetRange ); uno::Reference< excel::XRange > xVbSheetRange( pRange ); @@ -4351,8 +4369,10 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const } void SAL_CALL -ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& /*CopyOrigin*/ ) throw (uno::RuntimeException) +ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& CopyOrigin ) throw (uno::RuntimeException) { + sal_Bool bCopyOrigin = sal_True; + CopyOrigin >>= bCopyOrigin; // It appears ( from the web ) that the undocumented CopyOrigin // param should contain member of enum XlInsertFormatOrigin // which can have values xlFormatFromLeftOrAbove or xlFormatFromRightOrBelow @@ -4384,8 +4404,17 @@ ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& /*CopyOrigin*/ ) thro mode = sheet::CellInsertMode_RIGHT; } RangeHelper thisRange( mxRange ); + table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress(); uno::Reference< sheet::XCellRangeMovement > xCellRangeMove( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW ); - xCellRangeMove->insertCells( thisRange.getCellRangeAddressable()->getRangeAddress(), mode ); + xCellRangeMove->insertCells( thisAddress, mode ); + if ( bCopyOrigin ) + { + // After the insert ( this range ) actually has moved + ScRange aRange( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCROW >( thisAddress.StartRow ), static_cast< SCTAB >( thisAddress.Sheet ), static_cast< SCCOL >( thisAddress.EndColumn ), static_cast< SCROW >( thisAddress.EndRow ), static_cast< SCTAB >( thisAddress.Sheet ) ); + uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getDocShellFromRange( mxRange ) , aRange ) ); + uno::Reference< excel::XRange > xVbaRange( new ScVbaRange( getParent(), mxContext, xRange, mbIsRows, mbIsColumns ) ); + xVbaRange->PasteSpecial( uno::Any(), uno::Any(), uno::Any(), uno::Any() ); + } } void SAL_CALL @@ -4720,7 +4749,7 @@ ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& { xPrintAreas->setPrintAreas( printAreas ); uno::Reference< frame::XModel > xModel = pShell->GetModel(); - PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, xModel, sal_True ); + PrintOutHelper( excel::getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, sal_True ); } } } @@ -5034,6 +5063,7 @@ ScVbaRange::getStyle() throw (uno::RuntimeException) } uno::Reference< beans::XPropertySet > xProps( mxRange, uno::UNO_QUERY_THROW ); rtl::OUString sStyleName; + xProps->getPropertyValue(CELLSTYLE) >>= sStyleName; ScDocShell* pShell = getScDocShell(); uno::Reference< frame::XModel > xModel( pShell->GetModel() ); uno::Reference< excel::XStyle > xStyle = new ScVbaStyle( this, mxContext, sStyleName, xModel ); diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx index abc2f608bb62..1d2d82442be3 100644 --- a/sc/source/ui/vba/vbarange.hxx +++ b/sc/source/ui/vba/vbarange.hxx @@ -53,12 +53,15 @@ #include #include -//#include "vbahelperinterface.hxx" +//#include #include "vbaformat.hxx" +#include class ScTableSheetsObj; class ScCellRangesBase; class ScCellRangeObj; +class ScDocShell; +class ScDocument; //typedef InheritedHelperInterfaceImpl1< ov::excel::XRange > ScVbaRange_BASE; typedef ScVbaFormat< ov::excel::XRange > ScVbaRange_BASE; diff --git a/sc/source/ui/vba/vbascrollbar.cxx b/sc/source/ui/vba/vbascrollbar.cxx deleted file mode 100644 index 3da3230a8761..000000000000 --- a/sc/source/ui/vba/vbascrollbar.cxx +++ /dev/null @@ -1,139 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include "vbascrollbar.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - -const static rtl::OUString LARGECHANGE( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ); -const static rtl::OUString SMALLCHANGE( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ); -const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") ); -const static rtl::OUString SCROLLVALUE( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ); -const static rtl::OUString SCROLLMAX( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ); -const static rtl::OUString SCROLLMIN( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMin") ); - -ScVbaScrollBar::ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ScrollBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ -} - -// Attributes -uno::Any SAL_CALL -ScVbaScrollBar::getValue() throw (css::uno::RuntimeException) -{ - return m_xProps->getPropertyValue( SCROLLVALUE ); -} - -void SAL_CALL -ScVbaScrollBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) -{ - m_xProps->setPropertyValue( SCROLLVALUE, _value ); -} - -::sal_Int32 SAL_CALL -ScVbaScrollBar::getMax() throw (uno::RuntimeException) -{ - sal_Int32 nMax = 0; - m_xProps->getPropertyValue( SCROLLMAX ) >>= nMax; - return nMax; -} - -void SAL_CALL -ScVbaScrollBar::setMax( sal_Int32 nVal ) throw (uno::RuntimeException) -{ - m_xProps->setPropertyValue( SCROLLMAX, uno::makeAny( nVal ) ); -} - -::sal_Int32 SAL_CALL -ScVbaScrollBar::getMin() throw (uno::RuntimeException) -{ - sal_Int32 nVal = 0; - m_xProps->getPropertyValue( SCROLLMIN ) >>= nVal; - return nVal; -} - -void SAL_CALL -ScVbaScrollBar::setMin( sal_Int32 nVal ) throw (uno::RuntimeException) -{ - m_xProps->setPropertyValue( SCROLLMIN, uno::makeAny( nVal ) ); -} - -void SAL_CALL -ScVbaScrollBar::setLargeChange( ::sal_Int32 _largechange ) throw (uno::RuntimeException) -{ - m_xProps->setPropertyValue( LARGECHANGE, uno::makeAny( _largechange ) ); -} - -::sal_Int32 SAL_CALL -ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException) -{ - sal_Int32 nVal = 0; - m_xProps->getPropertyValue( LARGECHANGE ) >>= nVal; - return nVal; -} - -::sal_Int32 SAL_CALL -ScVbaScrollBar::getSmallChange() throw (uno::RuntimeException) -{ - sal_Int32 nSmallChange = 0; - m_xProps->getPropertyValue( SMALLCHANGE ) >>= nSmallChange; - return nSmallChange; -} - -void SAL_CALL -ScVbaScrollBar::setSmallChange( ::sal_Int32 _smallchange ) throw (uno::RuntimeException) -{ - m_xProps->setPropertyValue( SMALLCHANGE, uno::makeAny( _smallchange ) ); -} - -rtl::OUString& -ScVbaScrollBar::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaScrollBar") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaScrollBar::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbascrollbar.hxx b/sc/source/ui/vba/vbascrollbar.hxx deleted file mode 100644 index 04c4853cdbe4..000000000000 --- a/sc/source/ui/vba/vbascrollbar.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_SCROLLBAR_HXX -#define SC_VBA_SCROLLBAR_HXX -#include -#include - -#include "vbacontrol.hxx" -#include "vbahelper.hxx" - -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XScrollBar > ScrollBarImpl_BASE; - -class ScVbaScrollBar : public ScrollBarImpl_BASE -{ -public: - ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); - // Attributes - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getLargeChange() throw (css::uno::RuntimeException); - virtual void SAL_CALL setLargeChange( ::sal_Int32 _largechange ) throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getSmallChange() throw (css::uno::RuntimeException); - virtual void SAL_CALL setSmallChange( ::sal_Int32 _smallchange ) throw (css::uno::RuntimeException); - - - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; -#endif //SC_VBA_LABEL_HXX diff --git a/sc/source/ui/vba/vbaseriescollection.hxx b/sc/source/ui/vba/vbaseriescollection.hxx index ccd544fe4f26..48ec78025d79 100644 --- a/sc/source/ui/vba/vbaseriescollection.hxx +++ b/sc/source/ui/vba/vbaseriescollection.hxx @@ -31,9 +31,9 @@ #define SC_VBA_SERIESCOLLECTION_HXX #include -#include "vbahelperinterface.hxx" -#include "vbacollectionimpl.hxx" -#include "vbahelper.hxx" +#include +#include +#include "excelvbahelper.hxx" typedef CollTestImplHelper< ov::excel::XSeriesCollection > SeriesCollection_BASE; diff --git a/sc/source/ui/vba/vbashape.cxx b/sc/source/ui/vba/vbashape.cxx deleted file mode 100644 index 7b81682cb393..000000000000 --- a/sc/source/ui/vba/vbashape.cxx +++ /dev/null @@ -1,480 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbashape.cxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "vbashape.hxx" -#include "vbatextframe.hxx" -#include "vbalineformat.hxx" -#include "vbafillformat.hxx" -#include "vbapictureformat.hxx" - -using namespace ::ooo::vba; -using namespace ::com::sun::star; -using namespace ::vos; - -ScVbaShape::ScVbaShape( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XShapes >& xShapes, sal_Int32 nType ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( xParent, xContext ), m_xShape( xShape ), m_xShapes( xShapes ), m_nType( nType ) -{ - m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); - addListeners(); -} - -ScVbaShape::ScVbaShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( uno::Reference< XHelperInterface >(), xContext ), m_xShape( xShape ) -{ - // add listener - addListeners(); -} - -ScVbaShape::~ScVbaShape() -{ - // dtor must never ever throw - try - { - removeShapeListener(); - removeShapesListener(); - } - catch( uno::Exception& ) - { - } -} - -void SAL_CALL -ScVbaShape::disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException ) -{ - uno::Reference< drawing::XShapes > xShapes( rEventObject.Source, uno::UNO_QUERY ); - uno::Reference< drawing::XShape > xShape( rEventObject.Source, uno::UNO_QUERY ); - if ( xShapes.is() ) - removeShapesListener(); - if ( xShape.is() ) - removeShapeListener(); -} - - -void ScVbaShape::addListeners() -{ - uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY ); - if ( xComponent.is() ) - xComponent->addEventListener( this ); - - xComponent.set( m_xShapes, uno::UNO_QUERY ); - if ( xComponent.is() ) - xComponent->addEventListener( this ); -} - -void -ScVbaShape::removeShapeListener() throw( uno::RuntimeException ) -{ - if( m_xShape.is() ) - { - uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY_THROW ); - xComponent->removeEventListener( this ); - } - m_xShape = NULL; - m_xPropertySet = NULL; -} - -void -ScVbaShape::removeShapesListener() throw( uno::RuntimeException ) -{ - if( m_xShapes.is() ) - { - uno::Reference< lang::XComponent > xComponent( m_xShapes, uno::UNO_QUERY_THROW ); - xComponent->removeEventListener( this ); - } - m_xShapes = NULL; -} - -sal_Int32 -ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException) -{ - rtl::OUString sShapeType; - uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor( xShape, uno::UNO_QUERY_THROW ); - sShapeType = xShapeDescriptor->getShapeType(); - // office::MsoShapeType::msoDiagram to "com.sun.star.drawing.GroupShape" - if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GroupShape" ) ) ) - return office::MsoShapeType::msoGroup; - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) ) - return office::MsoShapeType::msoPicture; - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ControlShape" ) ) ) - return office::MsoShapeType::msoOLEControlObject; - // OOo don't support office::MsoShapeType::msoComment as a Shape. - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.OLE2Shape" ) ) ) - return office::MsoShapeType::msoChart; - // Art characters office::MsoShapeType::msoTextEffect, in OOo corresponding to "com.sun.star.drawing.CustomShape" - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ConnectorShape" ) ) ) - { - enum drawing::ConnectorType connectorType; - uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); - xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("EdgeKind")) >>= connectorType; - if( connectorType == drawing::ConnectorType_CURVE ) - return office::MsoShapeType::msoFreeform; - else if( connectorType == drawing::ConnectorType_LINE ) - return office::MsoShapeType::msoLine; - else - return office::MsoShapeType::msoAutoShape; - } - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.LineShape" ) ) ) - return office::MsoShapeType::msoLine; - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) ) || - sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape") ) ) - return office::MsoShapeType::msoAutoShape; - else - throw uno::RuntimeException( rtl::OUString::createFromAscii( "the shape type do not be surppored: " ) + sShapeType, uno::Reference< uno::XInterface >() ); -} - -// Attributes -rtl::OUString SAL_CALL -ScVbaShape::getName() throw (uno::RuntimeException) -{ - rtl::OUString sName; - uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW ); - sName = xNamed->getName(); - return sName; -} - -void SAL_CALL -ScVbaShape::setName( const rtl::OUString& _name ) throw (uno::RuntimeException) -{ - uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW ); - xNamed->setName( _name ); -} - -double SAL_CALL -ScVbaShape::getHeight() throw (uno::RuntimeException) -{ - return Millimeter::getInPoints( m_xShape->getSize().Height ); -} - -void SAL_CALL -ScVbaShape::setHeight( double _height ) throw (uno::RuntimeException) -{ - awt::Size aSize( m_xShape->getSize() ); - aSize.Height = Millimeter::getInHundredthsOfOneMillimeter( _height ); - m_xShape->setSize( aSize ); -} - -double SAL_CALL -ScVbaShape::getWidth() throw (uno::RuntimeException) -{ - return Millimeter::getInPoints( m_xShape->getSize().Width ); -} - -void SAL_CALL -ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException) -{ - awt::Size aSize( m_xShape->getSize() ); - aSize.Width = Millimeter::getInHundredthsOfOneMillimeter( _width ); - m_xShape->setSize( aSize ); -} - -double SAL_CALL -ScVbaShape::getLeft() throw (uno::RuntimeException) -{ - return Millimeter::getInPoints( m_xShape->getPosition().X ); -} - -void SAL_CALL -ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException) -{ - awt::Point oldPosition; - oldPosition = m_xShape->getPosition(); - oldPosition.X = Millimeter::getInHundredthsOfOneMillimeter( _left ); - m_xShape->setPosition( oldPosition ); -} - -double SAL_CALL -ScVbaShape::getTop() throw (uno::RuntimeException) -{ - return Millimeter::getInPoints( m_xShape->getPosition().Y ); -} - -void SAL_CALL -ScVbaShape::setTop( double _top ) throw (uno::RuntimeException) -{ - awt::Point oldPosition; - oldPosition = m_xShape->getPosition(); - oldPosition.Y = Millimeter::getInHundredthsOfOneMillimeter( _top ); - m_xShape->setPosition( oldPosition ); -} - -sal_Bool SAL_CALL -ScVbaShape::getVisible() throw (uno::RuntimeException) -{ - //UNO Shapes are always visible - return sal_True; -} - -void SAL_CALL -ScVbaShape::setVisible( sal_Bool /*_visible*/ ) throw (uno::RuntimeException) -{ - //UNO Shapes are always visible -} - -sal_Int32 SAL_CALL -ScVbaShape::getZOrderPosition() throw (uno::RuntimeException) -{ - sal_Int32 nZOrderPosition = 0; - uno::Any aZOrderPosition = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) ); - aZOrderPosition >>= nZOrderPosition; - return nZOrderPosition + 1; -} - -sal_Int32 SAL_CALL -ScVbaShape::getType() throw (uno::RuntimeException) -{ - return m_nType; -} - -double SAL_CALL -ScVbaShape::getRotation() throw (uno::RuntimeException) -{ - double dRotation = 0; - sal_Int32 nRotation = 0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ) ) >>= nRotation; - dRotation = static_cast< double >( nRotation /100 ); - return dRotation; -} - -void SAL_CALL -ScVbaShape::setRotation( double _rotation ) throw (uno::RuntimeException) -{ - sal_Int32 nRotation = static_cast < sal_Int32 > ( _rotation * 100 ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ), uno::makeAny( nRotation ) ); -} - -uno::Reference< msforms::XLineFormat > SAL_CALL -ScVbaShape::getLine() throw (uno::RuntimeException) -{ - // TODO should ongly return line - return uno::Reference< msforms::XLineFormat >( new ScVbaLineFormat( this, mxContext, m_xShape ) ); -} - -uno::Reference< msforms::XFillFormat > SAL_CALL -ScVbaShape::getFill() throw (uno::RuntimeException) -{ - return uno::Reference< msforms::XFillFormat >( new ScVbaFillFormat( this, mxContext, m_xShape ) ); -} - -uno::Reference< msforms::XPictureFormat > SAL_CALL -ScVbaShape::getPictureFormat() throw (uno::RuntimeException) -{ - return uno::Reference< msforms::XPictureFormat >( new ScVbaPictureFormat( this, mxContext, m_xShape ) ); -} - -// Methods -uno::Reference< excel::XTextFrame > SAL_CALL -ScVbaShape::TextFrame() throw (uno::RuntimeException) -{ - return uno::Reference< excel::XTextFrame >(new ScVbaTextFrame( getParent(), mxContext, m_xShape ) ); -} - -void SAL_CALL -ScVbaShape::Delete() throw (uno::RuntimeException) -{ - OGuard aGuard( Application::GetSolarMutex() ); - m_xShapes->remove( m_xShape ); -} - -void SAL_CALL -ScVbaShape::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException) -{ - sal_Int32 nOrderPositon; - uno::Any aOrderPostion = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) ); - aOrderPostion >>= nOrderPositon; - switch( ZOrderCmd ) - { - case office::MsoZOrderCmd::msoBringToFront: - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( SAL_MAX_INT32 ) ); - break; - case office::MsoZOrderCmd::msoSendToBack: - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( (sal_Int32)0 ) ); - break; - case office::MsoZOrderCmd::msoBringForward: - nOrderPositon += 1; - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) ); - break; - case office::MsoZOrderCmd::msoSendBackward: - if( nOrderPositon > 0 ) - { - nOrderPositon -= 1; - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) ); - } - break; - // below two commands use with Writer for text and image object. - case office::MsoZOrderCmd::msoBringInFrontOfText: - case office::MsoZOrderCmd::msoSendBehindText: - throw uno::RuntimeException( rtl::OUString::createFromAscii( "This ZOrderCmd is not implemented, it is use with writer." ), uno::Reference< uno::XInterface >() ); - default: - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid Parameter." ), uno::Reference< uno::XInterface >() ); - } -} - -void SAL_CALL -ScVbaShape::IncrementRotation( double Increment ) throw (uno::RuntimeException) -{ - double nCurrentRotation = getRotation(); - nCurrentRotation += Increment; - setRotation(nCurrentRotation); -} - -void SAL_CALL -ScVbaShape::IncrementLeft( double Increment ) throw (uno::RuntimeException) -{ - double nCurrentLeft = getLeft(); - nCurrentLeft += Increment; - setLeft(nCurrentLeft); -} - -void SAL_CALL -ScVbaShape::IncrementTop( double Increment ) throw (uno::RuntimeException) -{ - double nCurrentTop = getTop(); - nCurrentTop += Increment; - setTop(nCurrentTop); -} - -void SAL_CALL -ScVbaShape::ScaleHeight( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException) -{ - double nHeight = getHeight(); - double nNewHeight = nHeight * Factor; - if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft ) - { - setHeight(nNewHeight); - } - else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight ) - { - double nDeltaHeight = nNewHeight - nHeight; - double nNewTop = getTop() - nDeltaHeight; - setTop(nNewTop); - setHeight(nNewHeight); - } - else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle ) - { - double nDeltaHeight = (nNewHeight - nHeight) / 2; - double nNewTop = getTop() - nDeltaHeight; - setTop(nNewTop); - setHeight(nNewHeight); - } - else - { - throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() ); - } -} - -void SAL_CALL -ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException) -{ - double nWidth = getWidth(); - double nNewWidth = nWidth * Factor; - if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft ) - { - setWidth(nNewWidth); - } - else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight ) - { - double nDeltaWidth = nNewWidth - nWidth; - double nNewLeft = getLeft() - nDeltaWidth; - setLeft(nNewLeft); - setWidth(nNewWidth); - } - else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle ) - { - double nDeltaWidth = (nNewWidth - nWidth) / 2; - double nNewLeft = getLeft() - nDeltaWidth; - setLeft(nNewLeft); - setWidth(nNewWidth); - } - else - { - throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() ); - } -} - -void SAL_CALL -ScVbaShape::Select( const uno::Any& /*Replace*/ ) throw ( uno::RuntimeException ) -{ - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - xSelectSupp->select( uno::makeAny( m_xShape ) ); -} - -// This method should not be part of Shape, what we reall need to do is... -// dynamically create the appropriate objects e.g. TextBox, Oval, Picture etc. -// ( e.g. the ones that really do have ShapeRange as an attribute ) -#include "vbashaperange.hxx" - -uno::Any SAL_CALL -ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException ) -{ - // perhaps we should store a reference to the Shapes Collection - // in this class - // but anyway this method should not even be in this class - // #TODO not sure what the parent of the Shapes collection should be - - XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec aVec; - aVec.push_back( m_xShape ); - uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( aVec ) ); - uno::Reference< container::XChild > xChild( m_xShape, uno::UNO_QUERY_THROW ); - // #FIXME for want of a better parent, setting this - uno::Reference< msforms::XShapeRange > xShapeRange( new ScVbaShapeRange( mxParent, mxContext, xIndexAccess, uno::Reference< drawing::XDrawPage >( xChild->getParent(), uno::UNO_QUERY_THROW ) ) ); - if ( index.hasValue() ) - return xShapeRange->Item( index, uno::Any() ); - return uno::makeAny( xShapeRange ); -} - -rtl::OUString& -ScVbaShape::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShape") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaShape::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Shape" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbashape.hxx b/sc/source/ui/vba/vbashape.hxx deleted file mode 100644 index 5ae35500381d..000000000000 --- a/sc/source/ui/vba/vbashape.hxx +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbashape.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_SHAPE_HXX -#define SC_VBA_SHAPE_HXX - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "vbahelperinterface.hxx" - -typedef ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape; - -typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE; - -class ScVbaShape : public ScVbaShape_BASE -{ -friend class ConcreteXShapeHelper; // perhaps an accessor would be better -private: -protected: - css::uno::Reference< css::drawing::XShape > m_xShape; - css::uno::Reference< css::drawing::XShapes > m_xShapes; - css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; - sal_Int32 m_nType; - css::uno::Any m_aRange; - virtual void addListeners(); - virtual void removeShapeListener() throw( css::uno::RuntimeException ); - virtual void removeShapesListener() throw( css::uno::RuntimeException ); - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -public: - ScVbaShape( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::drawing::XShapes >& xShapes, sal_Int32 nType ) throw ( css::lang::IllegalArgumentException ); - ScVbaShape( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ) throw ( css::lang::IllegalArgumentException ); - virtual ~ScVbaShape(); - css::uno::Any getRange() { return m_aRange; }; - void setRange( css::uno::Any aRange ) { m_aRange = aRange; }; - - static sal_Int32 getType( const css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException); - - // Attributes - virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); - virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException); - virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException); - virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException); - virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getTop() throw (css::uno::RuntimeException); - virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); - virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getZOrderPosition() throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException); - virtual double SAL_CALL getRotation() throw (css::uno::RuntimeException); - virtual void SAL_CALL setRotation( double _rotation ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() throw (css::uno::RuntimeException); - virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() throw (css::uno::RuntimeException); - virtual css::uno::Reference< ov::msforms::XPictureFormat > SAL_CALL getPictureFormat() throw (css::uno::RuntimeException); - - // Methods - virtual css::uno::Reference< ov::excel::XTextFrame > SAL_CALL TextFrame( ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Delete() throw (css::uno::RuntimeException); - virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) throw (css::uno::RuntimeException); - virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException); - virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException); - virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException); - virtual void SAL_CALL ScaleHeight( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException); - virtual void SAL_CALL ScaleWidth( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException); - // Replace?? - virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) throw ( css::uno::RuntimeException ); - // XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException ); -}; -#endif//SC_VBA_SHAPE_HXX diff --git a/sc/source/ui/vba/vbashaperange.cxx b/sc/source/ui/vba/vbashaperange.cxx deleted file mode 100644 index 2298c65bae6f..000000000000 --- a/sc/source/ui/vba/vbashaperange.cxx +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbashaperange.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include - -#include "vbashaperange.hxx" -#include "vbashape.hxx" - -using namespace ::ooo::vba; -using namespace ::com::sun::star; - -class VbShapeRangeEnumHelper : public EnumerationHelper_BASE -{ - uno::Reference< XCollection > m_xParent; - uno::Reference m_xIndexAccess; - sal_Int32 nIndex; -public: - VbShapeRangeEnumHelper( const uno::Reference< XCollection >& xParent, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) - { - return ( nIndex < m_xIndexAccess->getCount() ); - } - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - ScVbaShapeRange* pCollectionImpl = dynamic_cast< ScVbaShapeRange* >(m_xParent.get()); - if ( pCollectionImpl && hasMoreElements() ) - return pCollectionImpl->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); - throw container::NoSuchElementException(); - } - -}; - -ScVbaShapeRange::ScVbaShapeRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xShapes, const uno::Reference< drawing::XDrawPage >& xDrawPage ) : ScVbaShapeRange_BASE( xParent, xContext, xShapes ), m_xDrawPage( xDrawPage ), m_nShapeGroupCount(0) -{ -} - -// Methods -void SAL_CALL -ScVbaShapeRange::Select( ) throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - xSelectSupp->select( uno::makeAny( getShapes() ) ); -} - -uno::Reference< msforms::XShape > SAL_CALL -ScVbaShapeRange::Group() throw (uno::RuntimeException) -{ - uno::Reference< drawing::XShapeGrouper > xShapeGrouper( m_xDrawPage, uno::UNO_QUERY_THROW ); - uno::Reference< drawing::XShapeGroup > xShapeGroup( xShapeGrouper->group( getShapes() ), uno::UNO_QUERY_THROW ); - uno::Reference< drawing::XShape > xShape( xShapeGroup, uno::UNO_QUERY_THROW ); - return uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, getShapes(), office::MsoShapeType::msoGroup ) ); -} - -uno::Reference< drawing::XShapes > -ScVbaShapeRange::getShapes() throw (uno::RuntimeException) -{ - if ( !m_xShapes.is() ) - { - uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - m_xShapes.set( xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.drawing.ShapeCollection" ) ), uno::UNO_QUERY_THROW ); - sal_Int32 nLen = m_xIndexAccess->getCount(); - for ( sal_Int32 index = 0; index < nLen; ++index ) - m_xShapes->add( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW ) ); - - } - return m_xShapes; -} - - -void SAL_CALL -ScVbaShapeRange::IncrementRotation( double Increment ) throw (uno::RuntimeException) -{ - sal_Int32 nLen = getCount(); - for ( sal_Int32 index = 1; index <= nLen; ++index ) - { - uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); - xShape->IncrementRotation( Increment ); - } -} - -void SAL_CALL -ScVbaShapeRange::IncrementLeft( double Increment ) throw (uno::RuntimeException) -{ - sal_Int32 nLen = getCount(); - for ( sal_Int32 index = 1; index <= nLen; ++index ) - { - uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); - xShape->IncrementLeft( Increment ); - } -} - -void SAL_CALL -ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException) -{ - sal_Int32 nLen = getCount(); - for ( sal_Int32 index = 1; index <= nLen; ++index ) - { - uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); - xShape->IncrementTop( Increment ); - } -} - -uno::Type SAL_CALL -ScVbaShapeRange::getElementType() throw (uno::RuntimeException) -{ - return msforms::XShape::static_type(0); -} - -uno::Reference< container::XEnumeration > SAL_CALL -ScVbaShapeRange::createEnumeration() throw (uno::RuntimeException) -{ - return new VbShapeRangeEnumHelper( this, m_xIndexAccess ); -} - -uno::Any -ScVbaShapeRange:: createCollectionObject( const css::uno::Any& aSource ) -{ - uno::Reference< drawing::XShape > xShape( aSource, uno::UNO_QUERY_THROW ); - // #TODO #FIXME Shape parent should always be the sheet the shapes belong - // to - uno::Reference< msforms::XShape > xVbShape( new ScVbaShape( uno::Reference< XHelperInterface >(), mxContext, xShape, getShapes(), ScVbaShape::getType( xShape ) ) ); - return uno::makeAny( xVbShape ); -} - -rtl::OUString& -ScVbaShapeRange::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShapeRange") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaShapeRange::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.ShapeRange" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbashaperange.hxx b/sc/source/ui/vba/vbashaperange.hxx deleted file mode 100644 index 27915d559e85..000000000000 --- a/sc/source/ui/vba/vbashaperange.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbashaperange.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_SHAPERANGE_HXX -#define SC_VBA_SHAPERANGE_HXX - -#include -#include - -#include "vbacollectionimpl.hxx" - -typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE; - -class ScVbaShapeRange : public ScVbaShapeRange_BASE -{ -private: - css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage; - css::uno::Reference< css::drawing::XShapes > m_xShapes; - sal_Int32 m_nShapeGroupCount; -protected: - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); - css::uno::Reference< css::drawing::XShapes > getShapes() throw (css::uno::RuntimeException) ; -public: - ScVbaShapeRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xShapes, const css::uno::Reference< css::drawing::XDrawPage>& xDrawShape ); - - // Methods - virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< ::ooo::vba::msforms::XShape > SAL_CALL Group() throw (css::uno::RuntimeException); - virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException); - virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException) ; - virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException); - //XEnumerationAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); - // ScVbaCollectionBaseImpl - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -}; - -#endif//SC_VBA_SHAPERANGE_HXX diff --git a/sc/source/ui/vba/vbashapes.cxx b/sc/source/ui/vba/vbashapes.cxx deleted file mode 100644 index 8aac090d0337..000000000000 --- a/sc/source/ui/vba/vbashapes.cxx +++ /dev/null @@ -1,394 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbashapes.cxx,v $ - * $Revision: 1.3.32.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include -#include -#include -#include - -#include "vbashapes.hxx" -#include "vbashape.hxx" -#include "vbashaperange.hxx" - -using namespace ::ooo::vba; -using namespace ::com::sun::star; - -class VbShapeEnumHelper : public EnumerationHelper_BASE -{ - uno::Reference m_xParent; - uno::Reference m_xIndexAccess; - sal_Int32 nIndex; -public: - VbShapeEnumHelper( const uno::Reference< msforms::XShapes >& xParent, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) - { - return ( nIndex < m_xIndexAccess->getCount() ); - } - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - ScVbaShapes* pShapes = dynamic_cast< ScVbaShapes* >(m_xParent.get()); - if ( pShapes && hasMoreElements() ) - return pShapes->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); - throw container::NoSuchElementException(); - } - -}; - -void ScVbaShapes::initBaseCollection() -{ - if ( m_xNameAccess.is() ) // already has NameAccess - return; - // no NameAccess then use ShapeCollectionHelper - XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes; - sal_Int32 nLen = m_xIndexAccess->getCount(); - mShapes.reserve( nLen ); - for ( sal_Int32 index=0; index( m_xIndexAccess->getByIndex( index ) , uno::UNO_QUERY ) ); - uno::Reference< container::XIndexAccess > xShapes( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) ); - m_xIndexAccess.set( xShapes, uno::UNO_QUERY ); - m_xNameAccess.set( xShapes, uno::UNO_QUERY ); -} - -ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0) -{ - m_xShapes.set( xShapes, uno::UNO_QUERY_THROW ); - m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW ); - initBaseCollection(); -} - -uno::Reference< container::XEnumeration > -ScVbaShapes::createEnumeration() throw (uno::RuntimeException) -{ - return new VbShapeEnumHelper( this, m_xIndexAccess ); -} - -uno::Any -ScVbaShapes::createCollectionObject( const css::uno::Any& aSource ) -{ - if( aSource.hasValue() ) - { - uno::Reference< drawing::XShape > xShape( aSource, uno::UNO_QUERY_THROW ); - return uno::makeAny( uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ) ) ); - } - return uno::Any(); -} - -uno::Type -ScVbaShapes::getElementType() throw (uno::RuntimeException) -{ - return ooo::vba::msforms::XShape::static_type(0); -} -rtl::OUString& -ScVbaShapes::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShapes") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaShapes::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Shapes" ) ); - } - return aServiceNames; -} - -css::uno::Reference< css::container::XIndexAccess > -ScVbaShapes::getShapesByArrayIndices( const uno::Any& Index ) throw (uno::RuntimeException) -{ - if ( Index.getValueTypeClass() != uno::TypeClass_SEQUENCE ) - throw uno::RuntimeException(); - - uno::Reference< script::XTypeConverter > xConverter = getTypeConverter(mxContext); - uno::Any aConverted; - aConverted = xConverter->convertTo( Index, getCppuType((uno::Sequence< uno::Any >*)0) ); - - uno::Sequence< uno::Any > sIndices; - aConverted >>= sIndices; - XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes; - sal_Int32 nElems = sIndices.getLength(); - for( sal_Int32 index = 0; index < nElems; ++index ) - { - uno::Reference< drawing::XShape > xShape; - if ( sIndices[ index ].getValueTypeClass() == uno::TypeClass_STRING ) - { - rtl::OUString sName; - sIndices[ index ] >>= sName; - xShape.set( m_xNameAccess->getByName( sName ), uno::UNO_QUERY ); - } - else - { - sal_Int32 nIndex = 0; - sIndices[ index ] >>= nIndex; - // adjust for 1 based mso indexing - xShape.set( m_xIndexAccess->getByIndex( nIndex - 1 ), uno::UNO_QUERY ); - - } - // populate map with drawing::XShapes - if ( xShape.is() ) - mShapes.push_back( xShape ); - } - uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) ); - return xIndexAccess; -} - -uno::Any SAL_CALL -ScVbaShapes::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (uno::RuntimeException) -{ - // I don't think we need to support Array of indices for shapes -/* - if ( Index.getValueTypeClass() == uno::TypeClass_SEQUENCE ) - { - uno::Reference< container::XIndexAccess > xIndexAccess( getShapesByArrayIndices( Index ) ); - // return new collection instance - uno::Reference< XCollection > xShapesCollection( new ScVbaShapes( this->getParent(), mxContext, xIndexAccess ) ); - return uno::makeAny( xShapesCollection ); - } -*/ - return ScVbaShapes_BASE::Item( Index, Index2 ); -} - -uno::Reference< msforms::XShapeRange > SAL_CALL -ScVbaShapes::Range( const uno::Any& shapes ) throw (css::uno::RuntimeException) -{ - // shapes, can be an index or an array of indices - uno::Reference< container::XIndexAccess > xShapes; - if ( shapes.getValueTypeClass() == uno::TypeClass_SEQUENCE ) - xShapes = getShapesByArrayIndices( shapes ); - else - { - // wrap single index into a sequence - uno::Sequence< uno::Any > sIndices(1); - sIndices[ 0 ] = shapes; - uno::Any aIndex; - aIndex <<= sIndices; - xShapes = getShapesByArrayIndices( aIndex ); - } - return new ScVbaShapeRange( getParent(), mxContext, xShapes, m_xDrawPage ); -} - -void SAL_CALL -ScVbaShapes::SelectAll() throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - try - { - xSelectSupp->select( uno::makeAny( m_xShapes ) ); - } - // viewuno.cxx ScTabViewObj::select will throw IllegalArgumentException - // if one of the shapes is no 'markable' e.g. a button - // the method still works - catch( lang::IllegalArgumentException& ) - { - } -} - -uno::Reference< drawing::XShape > -ScVbaShapes::createShape( rtl::OUString service ) throw (css::uno::RuntimeException) -{ - uno::Reference< lang::XMultiServiceFactory > xMSF( getCurrentDocument(), uno::UNO_QUERY_THROW ); - uno::Reference< drawing::XShape > xShape( xMSF->createInstance( service ), uno::UNO_QUERY_THROW ); - return xShape; -} - -uno::Any -ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException) -{ - rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape" ) ); - sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX ); - sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY ); - sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); - sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); - - uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW ); - m_xShapes->add( xShape ); - - rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Rectangle" ) ); - setDefaultShapeProperties( xShape ); - setShape_NameProperty( xShape, sName ); - - awt::Point aMovePositionIfRange(0, 0); - awt::Point position; - position.X = nXPos - aMovePositionIfRange.X; - position.Y = nYPos - aMovePositionIfRange.Y; - xShape->setPosition( position ); - - awt::Size size; - size.Height = nHeight; - size.Width = nWidth; - xShape->setSize( size ); - - ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ); - pScVbaShape->setRange( aRange ); - return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); -} - -uno::Any -ScVbaShapes::AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException) -{ - rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.EllipseShape" ) ); - sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX ); - sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY ); - sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); - sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); - - uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW ); - m_xShapes->add( xShape ); - - awt::Point aMovePositionIfRange( 0, 0 ); - //TODO helperapi using a writer document - /* - XDocument xDocument = (XDocument)getParent(); - if (AnyConverter.isVoid(_aRange)) - { - _aRange = xDocument.Range(new Integer(0), new Integer(1)); - // Top&Left in Word is Top&Left of the paper and not the writeable area. - aMovePositionIfRange = calculateTopLeftMargin((HelperInterfaceAdaptor)xDocument); - } - - setShape_AnchorTypeAndRangeProperty(xShape, _aRange); - */ - rtl::OUString name = createName( rtl::OUString::createFromAscii( "Oval" )); - setDefaultShapeProperties(xShape); - setShape_NameProperty(xShape, name); - - awt::Point position; - position.X = nXPos - aMovePositionIfRange.X; - position.Y = nYPos - aMovePositionIfRange.Y; - xShape->setPosition(position); - - awt::Size size; - size.Height = nHeight; - size.Width = nWidth; - xShape->setSize(size); - - ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ); - pScVbaShape->setRange( aRange ); - return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); -} - -//helpeapi calc -uno::Any SAL_CALL -ScVbaShapes::AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (uno::RuntimeException) -{ - sal_Int32 nLineWidth = endX - StartX; - sal_Int32 nLineHeight = endY - StartY; - - sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); - sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); - sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( StartX ); - sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( StartY ); - - uno::Reference< drawing::XShape > xShape( createShape( rtl::OUString::createFromAscii("com.sun.star.drawing.LineShape") ), uno::UNO_QUERY_THROW ); - m_xShapes->add( xShape ); - - awt::Point aMovePositionIfRange( 0, 0 ); - - rtl::OUString name = createName( rtl::OUString::createFromAscii( "Line" ) ); - setDefaultShapeProperties(xShape); - setShape_NameProperty(xShape, name); - - awt::Point position; - position.X = nXPos - aMovePositionIfRange.X; - position.Y = nYPos - aMovePositionIfRange.Y; - xShape->setPosition(position); - - awt::Size size; - size.Height = nHeight; - size.Width = nWidth; - xShape->setSize(size); - - ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ); - return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); -} - -uno::Any SAL_CALL -ScVbaShapes::AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) -{ - uno::Any _aAnchor; - if (_nType == office::MsoAutoShapeType::msoShapeRectangle) - { - return AddRectangle(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor); - } - else if (_nType == office::MsoAutoShapeType::msoShapeOval) - { - return AddEllipse(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor); - } - return uno::Any(); -} - -void -ScVbaShapes::setDefaultShapeProperties( uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); - xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillStyle" ), uno::makeAny( rtl::OUString::createFromAscii( "SOLID" ) ) ); - xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor"), uno::makeAny( sal_Int32(0xFFFFFF) ) ); - xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap"), uno::makeAny( text::WrapTextMode_THROUGHT ) ); - //not find in OOo2.3 - //xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Opaque"), uno::makeAny( sal_True ) ); -} - -void -ScVbaShapes::setShape_NameProperty( uno::Reference< css::drawing::XShape > xShape, rtl::OUString sName ) -{ - uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); - try - { - xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Name" ), uno::makeAny( sName ) ); - } - catch( script::BasicErrorException e ) - { - } -} - -rtl::OUString -ScVbaShapes::createName( rtl::OUString sName ) -{ - sal_Int32 nActNumber = 1 + m_nNewShapeCount; - m_nNewShapeCount++; - sName += rtl::OUString::valueOf( nActNumber ); - return sName; -} - -#if 0 -//TODO helperapi using a writer document -awt::Point -calculateTopLeftMargin( uno::Reference< XHelperInterface > xDocument ) -{ - awt::Point aPoint( 0, 0 ); - uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY_THROW ); - return awt::Point(); -} -#endif diff --git a/sc/source/ui/vba/vbashapes.hxx b/sc/source/ui/vba/vbashapes.hxx deleted file mode 100644 index 94f68ff6718b..000000000000 --- a/sc/source/ui/vba/vbashapes.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbashapes.hxx,v $ - * $Revision: 1.3.32.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_SHAPES_HXX -#define SC_VBA_SHAPES_HXX - -#include -#include -#include -#include - -#include "vbahelperinterface.hxx" - -#include "vbacollectionimpl.hxx" - -typedef CollTestImplHelper< ov::msforms::XShapes > ScVbaShapes_BASE; - -class ScVbaShapes : public ScVbaShapes_BASE -{ -private: - css::uno::Reference< css::drawing::XShapes > m_xShapes; - css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage; - sal_Int32 m_nNewShapeCount; - void initBaseCollection(); -protected: - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); - virtual css::uno::Reference< css::container::XIndexAccess > getShapesByArrayIndices( const css::uno::Any& Index ) throw (css::uno::RuntimeException); - css::uno::Reference< css::drawing::XShape > createShape( rtl::OUString service ) throw (css::uno::RuntimeException); - css::uno::Any AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException); - css::uno::Any AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException); - rtl::OUString createName( rtl::OUString sName ); - //TODO helperapi using a writer document - //css::awt::Point calculateTopLeftMargin( css::uno::Reference< ov::XHelperInterface > xDocument ); - -public: - ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes ); - static void setDefaultShapeProperties( css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException); - static void setShape_NameProperty( css::uno::Reference< css::drawing::XShape > xShape, rtl::OUString sName ); - //XEnumerationAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); - - virtual void SAL_CALL SelectAll() throw (css::uno::RuntimeException); - //helper::calc - virtual css::uno::Any SAL_CALL AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< ov::msforms::XShapeRange > SAL_CALL Range( const css::uno::Any& shapes ) throw (css::uno::RuntimeException); - // ScVbaCollectionBaseImpl - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); - virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw (css::uno::RuntimeException); -}; - -#endif//SC_VBA_SHAPES_HXX diff --git a/sc/source/ui/vba/vbaspinbutton.cxx b/sc/source/ui/vba/vbaspinbutton.cxx deleted file mode 100644 index c9da8cf8827c..000000000000 --- a/sc/source/ui/vba/vbaspinbutton.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include "vbaspinbutton.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - -const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") ); -const static rtl::OUString SPINVALUE( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ); -const static rtl::OUString SPINMAX( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ); -const static rtl::OUString SPINMIN( RTL_CONSTASCII_USTRINGPARAM("SpinValueMin") ); - -ScVbaSpinButton::ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : SpinButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ -} - -// Attributes -uno::Any SAL_CALL -ScVbaSpinButton::getValue() throw (css::uno::RuntimeException) -{ - return m_xProps->getPropertyValue( SPINVALUE ); -} - -void SAL_CALL -ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) -{ - m_xProps->setPropertyValue( SPINVALUE, _value ); -} - -::sal_Int32 SAL_CALL -ScVbaSpinButton::getMax() throw (uno::RuntimeException) -{ - sal_Int32 nMax = 0; - m_xProps->getPropertyValue( SPINMAX ) >>= nMax; - return nMax; -} - -void SAL_CALL -ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException) -{ - m_xProps->setPropertyValue( SPINMAX, uno::makeAny( nVal ) ); -} - -::sal_Int32 SAL_CALL -ScVbaSpinButton::getMin() throw (uno::RuntimeException) -{ - sal_Int32 nVal = 0; - m_xProps->getPropertyValue( SPINMIN ) >>= nVal; - return nVal; -} - -void SAL_CALL -ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException) -{ - m_xProps->setPropertyValue( SPINMIN, uno::makeAny( nVal ) ); -} - -rtl::OUString& -ScVbaSpinButton::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaSpinButton") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaSpinButton::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbaspinbutton.hxx b/sc/source/ui/vba/vbaspinbutton.hxx deleted file mode 100644 index 338d71f34dec..000000000000 --- a/sc/source/ui/vba/vbaspinbutton.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_SPINBUTTON_HXX -#define SC_VBA_SPINBUTTON_HXX -#include -#include - -#include "vbacontrol.hxx" -#include "vbahelper.hxx" - -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XSpinButton > SpinButtonImpl_BASE; - -class ScVbaSpinButton : public SpinButtonImpl_BASE -{ -public: - ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); - // Attributes - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException); - - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; -#endif //SC_VBA_SPINBUTTON_HXX diff --git a/sc/source/ui/vba/vbastyle.cxx b/sc/source/ui/vba/vbastyle.cxx index fbcfb0b97f65..8b7731c2d358 100644 --- a/sc/source/ui/vba/vbastyle.cxx +++ b/sc/source/ui/vba/vbastyle.cxx @@ -71,7 +71,7 @@ void ScVbaStyle::initialise() throw ( uno::RuntimeException ) } -ScVbaStyle::ScVbaStyle( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const rtl::OUString& sStyleName, const uno::Reference< frame::XModel >& _xModel ) throw ( script::BasicErrorException, uno::RuntimeException ) : ScVbaStyle_BASE( xParent, xContext, lcl_getStyleProps( sStyleName, _xModel ), _xModel, false ) +ScVbaStyle::ScVbaStyle( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const rtl::OUString& sStyleName, const uno::Reference< frame::XModel >& _xModel ) throw ( script::BasicErrorException, uno::RuntimeException ) : ScVbaStyle_BASE( xParent, xContext, lcl_getStyleProps( sStyleName, _xModel ), _xModel, false ), mxModel( _xModel ) { try { @@ -83,7 +83,7 @@ ScVbaStyle::ScVbaStyle( const uno::Reference< ov::XHelperInterface >& xParent, c } } -ScVbaStyle::ScVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet, const uno::Reference< frame::XModel >& _xModel ) throw ( script::BasicErrorException, uno::RuntimeException ) : ScVbaStyle_BASE( xParent, xContext, _xPropertySet, _xModel, false ) +ScVbaStyle::ScVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet, const uno::Reference< frame::XModel >& _xModel ) throw ( script::BasicErrorException, uno::RuntimeException ) : ScVbaStyle_BASE( xParent, xContext, _xPropertySet, _xModel, false ), mxModel( _xModel ) { try { diff --git a/sc/source/ui/vba/vbastyles.cxx b/sc/source/ui/vba/vbastyles.cxx index 18111fc5eae7..6cb35d19a67e 100644 --- a/sc/source/ui/vba/vbastyles.cxx +++ b/sc/source/ui/vba/vbastyles.cxx @@ -29,6 +29,7 @@ ************************************************************************/ #include "vbastyles.hxx" #include "vbastyle.hxx" +#include using namespace ::ooo::vba; using namespace ::com::sun::star; diff --git a/sc/source/ui/vba/vbastyles.hxx b/sc/source/ui/vba/vbastyles.hxx index 4ad8980fe201..1e238a9d1c13 100644 --- a/sc/source/ui/vba/vbastyles.hxx +++ b/sc/source/ui/vba/vbastyles.hxx @@ -31,7 +31,7 @@ #define SC_VBA_STYLES_HXX #include #include -#include "vbacollectionimpl.hxx" +#include typedef CollTestImplHelper< ov::excel::XStyles > ScVbaStyles_BASE; class ScVbaStyles: public ScVbaStyles_BASE diff --git a/sc/source/ui/vba/vbatextbox.cxx b/sc/source/ui/vba/vbatextbox.cxx deleted file mode 100644 index f6574550c0c9..000000000000 --- a/sc/source/ui/vba/vbatextbox.cxx +++ /dev/null @@ -1,137 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbatextbox.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include - -#include "vbatextbox.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - - -ScVbaTextBox::ScVbaTextBox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialog ) : TextBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialog( bDialog ) -{ -} - -// Attributes -uno::Any SAL_CALL -ScVbaTextBox::getValue() throw (css::uno::RuntimeException) -{ - return uno::makeAny( getText() ); -} - -void SAL_CALL -ScVbaTextBox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException) -{ - rtl::OUString sVal = getAnyAsString( _value ); - setText( sVal ); -} - -//getString() will cause some imfo lose. -rtl::OUString SAL_CALL -ScVbaTextBox::getText() throw (css::uno::RuntimeException) -{ - uno::Any aValue; - aValue = m_xProps->getPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ) ); - rtl::OUString sString; - aValue >>= sString; - return sString; -} - -void SAL_CALL -ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException) -{ - if ( !mbDialog ) - { - uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW ); - xTextRange->setString( _text ); -} - else - m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), uno::makeAny( _text ) ); -} - -sal_Int32 SAL_CALL -ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException) -{ - uno::Any aValue; - aValue = m_xProps->getPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ) ); - sal_Int32 nMaxLength = 0; - aValue >>= nMaxLength; - return nMaxLength; -} - -void SAL_CALL -ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException) -{ - uno::Any aValue( _maxlength ); - m_xProps->setPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue); -} - -sal_Bool SAL_CALL -ScVbaTextBox::getMultiline() throw (css::uno::RuntimeException) -{ - uno::Any aValue; - aValue = m_xProps->getPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ) ); - sal_Bool bRet = false; - aValue >>= bRet; - return bRet; -} - -void SAL_CALL -ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException) -{ - uno::Any aValue( _multiline ); - m_xProps->setPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), aValue); -} - -rtl::OUString& -ScVbaTextBox::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextBox") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaTextBox::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.TextBox" ) ); - } - return aServiceNames; -} diff --git a/sc/source/ui/vba/vbatextbox.hxx b/sc/source/ui/vba/vbatextbox.hxx deleted file mode 100644 index b9d22ced414c..000000000000 --- a/sc/source/ui/vba/vbatextbox.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbatextbox.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SC_VBA_TEXTBOX_HXX -#define SC_VBA_TEXTBOX_HXX -#include -#include -#include "vbacontrol.hxx" -#include "vbahelper.hxx" - -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XTextBox > TextBoxImpl_BASE; - -class ScVbaTextBox : public TextBoxImpl_BASE -{ - bool mbDialog; -public: - ScVbaTextBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialog = false ); - // Attributes - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); - virtual void SAL_CALL setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getMaxLength() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getMultiline() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException); - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; -#endif //SC_VBA_TEXTBOX_HXX diff --git a/sc/source/ui/vba/vbatextboxshape.cxx b/sc/source/ui/vba/vbatextboxshape.cxx index 82af63e5754e..b8148e129220 100644 --- a/sc/source/ui/vba/vbatextboxshape.cxx +++ b/sc/source/ui/vba/vbatextboxshape.cxx @@ -41,7 +41,7 @@ using namespace com::sun::star; using namespace ooo::vba; -ScVbaTextBoxShape::ScVbaTextBoxShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XShapes >& xShapes, const uno::Reference< frame::XModel >& xModel ) : TextBoxShapeImpl_BASE( uno::Reference< XHelperInterface >(), xContext, xShape, xShapes, ScVbaShape::getType( xShape ) ) +ScVbaTextBoxShape::ScVbaTextBoxShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XShapes >& xShapes, const uno::Reference< frame::XModel >& xModel ) : TextBoxShapeImpl_BASE( uno::Reference< XHelperInterface >(), xContext, xShape, xShapes, xModel, ScVbaShape::getType( xShape ) ) { m_xTextRange.set( xShape , uno::UNO_QUERY_THROW ); m_xModel.set( xModel ); @@ -62,7 +62,7 @@ ScVbaTextBoxShape::setText( const rtl::OUString& _text ) throw (css::uno::Runtim uno::Reference< excel::XCharacters > SAL_CALL ScVbaTextBoxShape::characters( const uno::Any& Start, const uno::Any& Length ) throw (uno::RuntimeException) { - ScDocShell* pDocShell = getDocShell( m_xModel ); + ScDocShell* pDocShell = excel::getDocShell( m_xModel ); ScDocument* pDoc = pDocShell ? pDocShell->GetDocument() : NULL; if ( !pDoc ) diff --git a/sc/source/ui/vba/vbatextboxshape.hxx b/sc/source/ui/vba/vbatextboxshape.hxx index c8c79b626069..733849e6be12 100644 --- a/sc/source/ui/vba/vbatextboxshape.hxx +++ b/sc/source/ui/vba/vbatextboxshape.hxx @@ -37,8 +37,8 @@ #include #include #include -#include "vbashape.hxx" -#include "vbahelper.hxx" +#include +#include "excelvbahelper.hxx" #include "vbacharacters.hxx" typedef cppu::ImplInheritanceHelper1< ScVbaShape, ov::msforms::XTextBoxShape > TextBoxShapeImpl_BASE; diff --git a/sc/source/ui/vba/vbatextframe.cxx b/sc/source/ui/vba/vbatextframe.cxx index f66d83c22c2d..81a8f0b5654c 100644 --- a/sc/source/ui/vba/vbatextframe.cxx +++ b/sc/source/ui/vba/vbatextframe.cxx @@ -27,6 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +#include #include #include #include "vbatextframe.hxx" @@ -35,121 +36,19 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; -ScVbaTextFrame::ScVbaTextFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< drawing::XShape > xShape ) : ScVbaTextFrame_BASE( xParent, xContext ), m_xShape( xShape ) +ScVbaTextFrame::ScVbaTextFrame( uno::Sequence< uno::Any> const & args, uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : ScVbaTextFrame_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< drawing::XShape >( args, 1, false ) ) { - m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); } -void -ScVbaTextFrame::setAsMSObehavior() -{ - //set property TextWordWrap default as False. - // TextFitToSize control the text content. it seems we should set the default as False. - // com.sun.star.drawing.TextFitToSizeType.NONE - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap" ), uno::makeAny( sal_False ) ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextFitToSize" ), uno::makeAny( drawing::TextFitToSizeType_NONE ) ); -} - -sal_Int32 ScVbaTextFrame::getMargin( rtl::OUString sMarginType ) -{ - sal_Int32 nMargin = 0; - uno::Any aMargin = m_xPropertySet->getPropertyValue( sMarginType ); - aMargin >>= nMargin; - return nMargin; -} - -void ScVbaTextFrame::setMargin( rtl::OUString sMarginType, float fMargin ) -{ - sal_Int32 nMargin = Millimeter::getInHundredthsOfOneMillimeter( fMargin ); - m_xPropertySet->setPropertyValue( sMarginType, uno::makeAny( nMargin ) ); -} - -// Attributes -sal_Bool SAL_CALL -ScVbaTextFrame::getAutoSize() throw (uno::RuntimeException) -{ - // I don't know why, but in OOo, TextAutoGrowHeight is the property control autosize. not TextFitToSize. - // TextFitToSize control the text content. - // and in mso, there isnot option TextWordWrap which means auto wrap. the default is False. - sal_Bool bAutosize = sal_False; - uno::Any aTextAutoGrowHeight = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ) ); - aTextAutoGrowHeight >>= bAutosize; - return bAutosize; -} - -void SAL_CALL -ScVbaTextFrame::setAutoSize( sal_Bool _autosize ) throw (uno::RuntimeException) -{ - setAsMSObehavior(); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ), uno::makeAny( _autosize ) ); -} - -float SAL_CALL -ScVbaTextFrame::getMarginBottom() throw (uno::RuntimeException) -{ - sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ) ); - float fMargin = (float)Millimeter::getInPoints( nMargin ); - return fMargin; -} - -void SAL_CALL -ScVbaTextFrame::setMarginBottom( float _marginbottom ) throw (uno::RuntimeException) -{ - setMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ), _marginbottom ); -} - -float SAL_CALL -ScVbaTextFrame::getMarginTop() throw (uno::RuntimeException) -{ - sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ) ); - float fMargin = (float)Millimeter::getInPoints( nMargin ); - return fMargin; -} - -void SAL_CALL -ScVbaTextFrame::setMarginTop( float _margintop ) throw (uno::RuntimeException) -{ - setMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ), _margintop ); -} - -float SAL_CALL -ScVbaTextFrame::getMarginLeft() throw (uno::RuntimeException) -{ - sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ) ); - float fMargin = (float)Millimeter::getInPoints( nMargin ); - return fMargin; -} - -void SAL_CALL -ScVbaTextFrame::setMarginLeft( float _marginleft ) throw (uno::RuntimeException) -{ - setMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ), _marginleft ); -} - -float SAL_CALL -ScVbaTextFrame::getMarginRight() throw (uno::RuntimeException) -{ - sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextRightDistance" ) ); - float fMargin = (float)Millimeter::getInPoints( nMargin ); - return fMargin; -} - -void SAL_CALL -ScVbaTextFrame::setMarginRight( float _marginright ) throw (uno::RuntimeException) -{ - setMargin( rtl::OUString::createFromAscii( "TextRightDistance" ), _marginright ); -} - - // Methods -uno::Reference< ov::excel::XCharacters > SAL_CALL +uno::Any SAL_CALL ScVbaTextFrame::Characters() throw (uno::RuntimeException) { uno::Reference< text::XSimpleText > xSimpleText( m_xShape, uno::UNO_QUERY_THROW ); ScVbaPalette aPalette( SfxObjectShell::Current() ); uno::Any aStart( sal_Int32( 1 ) ); uno::Any aLength(sal_Int32( -1 ) ); - return uno::Reference< ov::excel::XCharacters >( new ScVbaCharacters( this, mxContext, aPalette, xSimpleText, aStart, aLength, sal_True ) ); + return uno::makeAny( uno::Reference< ov::excel::XCharacters >( new ScVbaCharacters( this, mxContext, aPalette, xSimpleText, aStart, aLength, sal_True ) ) ); } rtl::OUString& @@ -171,3 +70,12 @@ ScVbaTextFrame::getServiceNames() return aServiceNames; } +namespace textframe +{ +namespace sdecl = comphelper::service_decl; +sdecl::vba_service_class_ > serviceImpl; +extern sdecl::ServiceDecl const serviceDecl( + serviceImpl, + "ScVbaTextFrame", + "ooo.vba.excel.TextFrame" ); +} diff --git a/sc/source/ui/vba/vbatextframe.hxx b/sc/source/ui/vba/vbatextframe.hxx index 6bb75551c00c..8aa85f34be09 100644 --- a/sc/source/ui/vba/vbatextframe.hxx +++ b/sc/source/ui/vba/vbatextframe.hxx @@ -29,45 +29,23 @@ ************************************************************************/ #ifndef SC_VBA_TEXTFRAME_HXX #define SC_VBA_TEXTFRAME_HXX -#include -#include -#include #include +#include +#include -#include "vbahelperinterface.hxx" -#include "vbapalette.hxx" - -typedef InheritedHelperInterfaceImpl1< ov::excel::XTextFrame > ScVbaTextFrame_BASE; +//typedef InheritedHelperInterfaceImpl1< ov::excel::XTextFrame > ScVbaTextFrame_BASE; +typedef cppu::ImplInheritanceHelper1< VbaTextFrame, ov::excel::XTextFrame > ScVbaTextFrame_BASE; class ScVbaTextFrame : public ScVbaTextFrame_BASE { -private: - css::uno::Reference< ov::excel::XCharacters > m_xCharacters; - css::uno::Reference< css::drawing::XShape > m_xShape; - css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -protected: +public: + ScVbaTextFrame( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext ) throw ( css::lang::IllegalArgumentException ); + virtual ~ScVbaTextFrame() {} + // Methods + virtual css::uno::Any SAL_CALL Characters( ) throw (css::uno::RuntimeException); + // XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence getServiceNames(); - virtual void setAsMSObehavior(); - sal_Int32 getMargin( rtl::OUString sMarginType ); - void setMargin( rtl::OUString sMarginType, float fMargin ); -public: - ScVbaTextFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext , css::uno::Reference< css::drawing::XShape > xShape); - virtual ~ScVbaTextFrame() {} - // Attributes - virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException); - virtual void SAL_CALL setAutoSize( sal_Bool _autosize ) throw (css::uno::RuntimeException); - virtual float SAL_CALL getMarginBottom() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMarginBottom( float _marginbottom ) throw (css::uno::RuntimeException); - virtual float SAL_CALL getMarginTop() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMarginTop( float _margintop ) throw (css::uno::RuntimeException); - virtual float SAL_CALL getMarginLeft() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMarginLeft( float _marginleft ) throw (css::uno::RuntimeException); - virtual float SAL_CALL getMarginRight() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMarginRight( float _marginright ) throw (css::uno::RuntimeException); - - // Methods - virtual css::uno::Reference< ov::excel::XCharacters > SAL_CALL Characters( ) throw (css::uno::RuntimeException); }; diff --git a/sc/source/ui/vba/vbatitle.hxx b/sc/source/ui/vba/vbatitle.hxx index 3d6c597bc67a..e696640d757f 100644 --- a/sc/source/ui/vba/vbatitle.hxx +++ b/sc/source/ui/vba/vbatitle.hxx @@ -30,14 +30,15 @@ #ifndef SC_VBA_TITLE_HXX #define SC_VBA_TITLE_HXX -#include "vbahelperinterface.hxx" -#include "vbahelper.hxx" +#include +#include "excelvbahelper.hxx" #include "vbainterior.hxx" #include "vbafont.hxx" #include "vbapalette.hxx" #include #include #include +#include #include #include diff --git a/sc/source/ui/vba/vbatogglebutton.cxx b/sc/source/ui/vba/vbatogglebutton.cxx deleted file mode 100644 index d49b2e89affe..000000000000 --- a/sc/source/ui/vba/vbatogglebutton.cxx +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include "vbatogglebutton.hxx" -#include - -using namespace com::sun::star; -using namespace ooo::vba; - - -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); -const static rtl::OUString TOGGLE( RTL_CONSTASCII_USTRINGPARAM("Toggle") ); -const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") ); -ScVbaToggleButton::ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) -{ - OSL_TRACE("ScVbaToggleButton(ctor)"); - m_xProps->setPropertyValue( TOGGLE, uno::makeAny( sal_True ) ); -} - -ScVbaToggleButton::~ScVbaToggleButton() -{ - OSL_TRACE("~ScVbaToggleButton(dtor)"); -} - -// Attributes -rtl::OUString SAL_CALL -ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException) -{ - rtl::OUString Label; - m_xProps->getPropertyValue( LABEL ) >>= Label; - return Label; -} - -void SAL_CALL -ScVbaToggleButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) -{ - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); -} - -uno::Any SAL_CALL -ScVbaToggleButton::getValue() throw (uno::RuntimeException) -{ - sal_Int16 nState = 0; - m_xProps->getPropertyValue( STATE ) >>= nState; - return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) ); -} - -void SAL_CALL -ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException) -{ - sal_Int16 nState = 0; - _value >>= nState; - OSL_TRACE( "nState - %d", nState ); - nState = ( nState == -1 ) ? 1 : 0; - OSL_TRACE( "nState - %d", nState ); - m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) ); -} - -rtl::OUString& -ScVbaToggleButton::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaToggleButton") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaToggleButton::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ToggleButton" ) ); - } - return aServiceNames; -} - diff --git a/sc/source/ui/vba/vbatogglebutton.hxx b/sc/source/ui/vba/vbatogglebutton.hxx deleted file mode 100644 index 752eac718b18..000000000000 --- a/sc/source/ui/vba/vbatogglebutton.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_TOGGLEBUTTON_HXX -#define SC_VBA_TOGGLEBUTTON_HXX -#include -#include - -#include "vbacontrol.hxx" -#include "vbahelper.hxx" - -typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XToggleButton, css::script::XDefaultProperty > ToggleButtonImpl_BASE; - -class ScVbaToggleButton : public ToggleButtonImpl_BASE -{ - rtl::OUString msDftPropName; -public: - ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); - ~ScVbaToggleButton(); - // Attributes - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); - // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } -}; -#endif //SC_VBA_TOGGLEBUTTON_HXX diff --git a/sc/source/ui/vba/vbauserform.cxx b/sc/source/ui/vba/vbauserform.cxx deleted file mode 100644 index 9c50347ad839..000000000000 --- a/sc/source/ui/vba/vbauserform.cxx +++ /dev/null @@ -1,228 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#include "helperdecl.hxx" -#include "vbauserform.hxx" -#include -#include -#include -#include -#include -#include -#include "unonames.hxx" -#include "vbacontrols.hxx" - -using namespace ::ooo::vba; -using namespace ::com::sun::star; - -// some little notes -// XDialog implementation has the following interesting bits -// a Controls property ( which is an array of the container controls ) -// each item in the controls array is a XControl, where the model is -// basically a property bag -// additionally the XDialog instance has itself a model -// this model has a ControlModels ( array of models ) property -// the models in ControlModels can be accessed by name -// also the XDialog is a XControl ( to access the model above - -ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) throw ( lang::IllegalArgumentException ) : ScVbaUserForm_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext, getXSomethingFromArgs< uno::XInterface >( aArgs, 1 ), getXSomethingFromArgs< frame::XModel >( aArgs, 2 ), static_cast< ooo::vba::AbstractGeometryAttributes* >(0) ), m_pDocShell( 0 ), mbDispose( true ) -{ - m_xDialog.set( m_xControl, uno::UNO_QUERY_THROW ); - uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW ); - m_pDocShell = getDocShell( m_xModel ); - m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW ); - setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) ); -} - -ScVbaUserForm::~ScVbaUserForm() -{ -} - -void SAL_CALL -ScVbaUserForm::Show( ) throw (uno::RuntimeException) -{ - OSL_TRACE("ScVbaUserForm::Show( )"); - short aRet = 0; - if ( m_xDialog.is() ) - aRet = m_xDialog->execute(); - OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet); - if ( mbDispose ) - { - try - { - uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY_THROW ); - m_xDialog = NULL; - xComp->dispose(); - mbDispose = false; - } - catch( uno::Exception& ) - { - } - } -} - -rtl::OUString SAL_CALL -ScVbaUserForm::getCaption() throw (::com::sun::star::uno::RuntimeException) -{ - rtl::OUString sCaption; - m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ) ) >>= sCaption; - return sCaption; -} -void -ScVbaUserForm::setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) -{ - m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), uno::makeAny( _caption ) ); -} - -void SAL_CALL -ScVbaUserForm::Hide( ) throw (uno::RuntimeException) -{ - mbDispose = false; // hide not dispose - if ( m_xDialog.is() ) - m_xDialog->endExecute(); -} - -void SAL_CALL -ScVbaUserForm::RePaint( ) throw (uno::RuntimeException) -{ - // do nothing -} - -void SAL_CALL -ScVbaUserForm::UnloadObject( ) throw (uno::RuntimeException) -{ - mbDispose = true; - if ( m_xDialog.is() ) - m_xDialog->endExecute(); -} - -rtl::OUString& -ScVbaUserForm::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaUserForm") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaUserForm::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.UserForm" ) ); - } - return aServiceNames; -} - -uno::Reference< beans::XIntrospectionAccess > SAL_CALL -ScVbaUserForm::getIntrospection( ) throw (uno::RuntimeException) -{ - return uno::Reference< beans::XIntrospectionAccess >(); -} - -uno::Any SAL_CALL -ScVbaUserForm::invoke( const ::rtl::OUString& /*aFunctionName*/, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ ) throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) -{ - throw uno::RuntimeException(); // unsupported operation -} - -void SAL_CALL -ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) -{ - uno::Any aObject = getValue( aPropertyName ); - // The Object *must* support XDefaultProperty here because getValue will - // only return properties that are Objects ( e.g. controls ) - // e.g. Userform1.aControl = something - // 'aControl' has to support XDefaultProperty to make sense here - uno::Reference< script::XDefaultProperty > xDfltProp( aObject, uno::UNO_QUERY_THROW ); - rtl::OUString aDfltPropName = xDfltProp->getDefaultPropertyName(); - uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObject ) ); - uno::Reference< beans::XPropertySet > xPropSet( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY_THROW ); - xPropSet->setPropertyValue( aDfltPropName, aValue ); -} - -uno::Any SAL_CALL -ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); - uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW ); - uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName ); - ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); - uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); - ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); - pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); - return uno::makeAny( xVBAControl ); -} - -::sal_Bool SAL_CALL -ScVbaUserForm::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException) -{ - return sal_False; -} -uno::Any SAL_CALL -ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException) -{ - uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); - uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl ) ); - if ( index.hasValue() ) - return uno::makeAny( xControls->Item( index, uno::Any() ) ); - return uno::makeAny( xControls ); -} - -::sal_Bool SAL_CALL -ScVbaUserForm::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException) -{ - uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY ); - OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is() ); - if ( xControl.is() ) - { - uno::Reference< container::XNameAccess > xNameAccess( xControl->getModel(), uno::UNO_QUERY_THROW ); - sal_Bool bRes = xNameAccess->hasByName( aName ); - OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is(), bRes ); - return bRes; - } - return sal_False; -} - -namespace userform -{ -namespace sdecl = comphelper::service_decl; -sdecl::vba_service_class_ > serviceImpl; -extern sdecl::ServiceDecl const serviceDecl( - serviceImpl, - "ScVbaUserForm", - "ooo.vba.excel.UserForm" ); -} - diff --git a/sc/source/ui/vba/vbauserform.hxx b/sc/source/ui/vba/vbauserform.hxx deleted file mode 100644 index 2c8a1b72f728..000000000000 --- a/sc/source/ui/vba/vbauserform.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef SC_VBA_USERFORM_HXX -#define SC_VBA_USERFORM_HXX - -#include -#include -#include -#include - -#include "vbahelperinterface.hxx" -#include "vbacontrol.hxx" - -//typedef InheritedHelperInterfaceImpl1< ov::msforms::XUserForm > ScVbaUserForm_BASE; -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XUserForm > ScVbaUserForm_BASE; - -class ScVbaUserForm : public ScVbaUserForm_BASE -{ -private: - css::uno::Reference< css::awt::XDialog > m_xDialog; - ScDocShell* m_pDocShell; - bool mbDispose; -protected: -public: - ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException ); - virtual ~ScVbaUserForm(); - // XUserForm - virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException); - // XIntrospection - virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getCaption() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL Hide( ) throw (css::uno::RuntimeException); - virtual void SAL_CALL UnloadObject( ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& index ) throw (css::uno::RuntimeException); - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence getServiceNames(); -}; -#endif diff --git a/sc/source/ui/vba/vbavalidation.hxx b/sc/source/ui/vba/vbavalidation.hxx index 60d24ac0c6c5..cef989aa3cea 100644 --- a/sc/source/ui/vba/vbavalidation.hxx +++ b/sc/source/ui/vba/vbavalidation.hxx @@ -33,7 +33,7 @@ #include #include #include -#include "vbahelperinterface.hxx" +#include typedef InheritedHelperInterfaceImpl1 ValidationImpl_BASE; diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index a38ba7c9ed46..d782fb95dc70 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -27,10 +27,11 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "helperdecl.hxx" +#include #include "vbawindow.hxx" #include "vbaworksheets.hxx" #include "vbaworksheet.hxx" +#include "vbaglobals.hxx" #include "vbapane.hxx" #include #include @@ -57,6 +58,9 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; using namespace ::ooo::vba::excel::XlWindowState; +// nameExists defined in vbaworksheet.cxx +bool nameExists( uno::Reference & xSpreadDoc, ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException ); + typedef std::hash_map< rtl::OUString, SCTAB, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameIndexHash; @@ -118,7 +122,7 @@ public: ScDocShell* pDocShell = (ScDocShell*)pModel->GetEmbeddedObject(); if ( !pDocShell ) throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain docshell" ) ), uno::Reference< uno::XInterface >() ); - ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); if ( !pViewShell ) throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain view shell" ) ), uno::Reference< uno::XInterface >() ); @@ -202,14 +206,13 @@ public: }; -ScVbaWindow::ScVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowImpl_BASE( xParent, xContext ), m_xModel( xModel ) +ScVbaWindow::ScVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowImpl_BASE( xParent, xContext, xModel ) { init(); } ScVbaWindow::ScVbaWindow( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xContext ) - : WindowImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), - m_xModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) ) + : WindowImpl_BASE( args, xContext ) { init(); } @@ -306,8 +309,7 @@ ScVbaWindow::getCaption() throw (uno::RuntimeException) if ( ( nCrudLen + nCrudIndex ) == sTitle.getLength() ) { sTitle = sTitle.copy( 0, nCrudIndex ); - uno::Reference< ov::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5 - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( xTemp->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); rtl::OUString sName = workbook.getName(); // rather bizare hack to make sure the name behavior // is like XL @@ -343,7 +345,7 @@ uno::Any SAL_CALL ScVbaWindow::getScrollRow() throw (uno::RuntimeException) { sal_Int32 nValue = 0; - ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); if ( pViewShell ) { ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart(); @@ -356,7 +358,7 @@ ScVbaWindow::getScrollRow() throw (uno::RuntimeException) void SAL_CALL ScVbaWindow::setScrollRow( const uno::Any& _scrollrow ) throw (uno::RuntimeException) { - ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); if ( pViewShell ) { sal_Int32 scrollRow = 0; @@ -371,7 +373,7 @@ uno::Any SAL_CALL ScVbaWindow::getScrollColumn() throw (uno::RuntimeException) { sal_Int32 nValue = 0; - ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); if ( pViewShell ) { ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart(); @@ -384,7 +386,7 @@ ScVbaWindow::getScrollColumn() throw (uno::RuntimeException) void SAL_CALL ScVbaWindow::setScrollColumn( const uno::Any& _scrollcolumn ) throw (uno::RuntimeException) { - ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); if ( pViewShell ) { sal_Int32 scrollColumn = 0; @@ -399,7 +401,7 @@ uno::Any SAL_CALL ScVbaWindow::getWindowState() throw (uno::RuntimeException) { sal_Int32 nwindowState = xlNormal; - ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame(); SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() ); if ( pTop ) @@ -421,7 +423,7 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeE { sal_Int32 nwindowState = xlMaximized; _windowstate >>= nwindowState; - ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame(); SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() ); if ( pTop ) @@ -444,8 +446,7 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeE void ScVbaWindow::Activate() throw (css::uno::RuntimeException) { - uno::Reference< ov::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5 - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( xTemp->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); workbook.Activate(); } @@ -453,8 +454,7 @@ ScVbaWindow::Activate() throw (css::uno::RuntimeException) void ScVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& FileName, const uno::Any& RouteWorkBook ) throw (uno::RuntimeException) { - uno::Reference< ov::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5 - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( xTemp->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); workbook.Close(SaveChanges, FileName, RouteWorkBook ); } @@ -467,13 +467,15 @@ ScVbaWindow::ActivePane() throw (script::BasicErrorException, uno::RuntimeExcept uno::Reference< excel::XRange > SAL_CALL ScVbaWindow::ActiveCell( ) throw (script::BasicErrorException, uno::RuntimeException) { - return ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication()->getActiveCell(); + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); + return xApplication->getActiveCell(); } uno::Any SAL_CALL ScVbaWindow::Selection( ) throw (script::BasicErrorException, uno::RuntimeException) { - return ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication()->getSelection(); + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); + return xApplication->getSelection(); } ::sal_Bool SAL_CALL @@ -736,30 +738,25 @@ ScVbaWindow::getZoom() throw (uno::RuntimeException) void SAL_CALL ScVbaWindow::setZoom( const uno::Any& _zoom ) throw (uno::RuntimeException) { - uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - rtl::OUString sZoomType( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_ZOOMTYPE ) ); - sal_Int16 nZoomType = view::DocumentZoomType::PAGE_WIDTH; - if( _zoom.getValueTypeClass() == uno::TypeClass_BOOLEAN ) - { - //zoom type is PAGE_WIDTH_EXACT in helperapi, it seems that there is a issue for this zoom type in current OOo. - // so PAGE_WIDTH is used. - xProps->setPropertyValue(sZoomType, uno::makeAny( nZoomType )); - } - else - { - nZoomType = view::DocumentZoomType::BY_VALUE; - rtl::OUString sZoomValue( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_ZOOMVALUE )); - sal_Int16 nZoomValue = 100; - _zoom >>= nZoomValue; - xProps->setPropertyValue( sZoomType, uno::makeAny( nZoomType )); - xProps->setPropertyValue( sZoomValue, uno::makeAny( nZoomValue )); - } + sal_Int16 nZoom = 100; + _zoom >>= nZoom; + uno::Reference xSpreadDoc( m_xModel, uno::UNO_QUERY_THROW ); + uno::Reference< excel::XWorksheet > xActiveSheet = ActiveSheet(); + SCTAB nTab = 0; + rtl::OUString sName = xActiveSheet->getName(); + bool bSheetExists = nameExists (xSpreadDoc, sName, nTab); + if ( !bSheetExists ) + throw uno::RuntimeException(); + std::vector< SCTAB > vTabs; + vTabs.push_back( nTab ); + excel::implSetZoom( m_xModel, nZoom, vTabs ); } uno::Reference< excel::XWorksheet > SAL_CALL ScVbaWindow::ActiveSheet( ) throw (script::BasicErrorException, uno::RuntimeException) { - return ScVbaGlobals::getGlobalsImpl(mxContext)->getApplication()->getActiveSheet(); + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); + return xApplication->getActiveSheet(); } uno::Any SAL_CALL @@ -787,121 +784,9 @@ ScVbaWindow::setView( const uno::Any& _view) throw (uno::RuntimeException) default: DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); } - dispatchExecute( m_xModel, nSlot ); -} - -sal_Bool SAL_CALL -ScVbaWindow::getVisible() throw (uno::RuntimeException) -{ - sal_Bool bVisible = sal_True; - uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW ); - uno::Reference< css::awt::XWindow2 > xWindow2 (xWindow, uno::UNO_QUERY_THROW ); - if( xWindow2.is() ) - { - bVisible = xWindow2->isVisible(); - } - return bVisible; -} - -void SAL_CALL -ScVbaWindow::setVisible(sal_Bool _visible) throw (uno::RuntimeException) -{ - uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW ); - if( xWindow.is() ) - { - xWindow->setVisible( _visible ); - } -} - -css::awt::Rectangle getPosSize( const uno::Reference< frame::XModel >& xModel ) -{ - css::awt::Rectangle aRect; - uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW ); - if( xWindow.is() ) - { - aRect = xWindow->getPosSize(); - } - return aRect; -} - -void setPosSize( const uno::Reference< frame::XModel >& xModel, sal_Int32 nValue, USHORT nFlag ) -{ - uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW ); - if( xWindow.is() ) - { - css::awt::Rectangle aRect = xWindow->getPosSize(); - switch( nFlag ) - { - case css::awt::PosSize::X: - xWindow->setPosSize( nValue, aRect.Y, 0, 0, css::awt::PosSize::X ); - break; - case css::awt::PosSize::Y: - xWindow->setPosSize( aRect.X, nValue, 0, 0, css::awt::PosSize::Y ); - break; - case css::awt::PosSize::WIDTH: - xWindow->setPosSize( 0, 0, nValue, aRect.Height, css::awt::PosSize::WIDTH ); - break; - case css::awt::PosSize::HEIGHT: - xWindow->setPosSize( 0, 0, aRect.Width, nValue, css::awt::PosSize::HEIGHT ); - break; - default: - break; - } - } -} - -sal_Int32 SAL_CALL -ScVbaWindow::getHeight() throw (uno::RuntimeException) -{ - css::awt::Rectangle aRect = getPosSize(m_xModel); - return aRect.Height; -} - -void SAL_CALL -ScVbaWindow::setHeight( sal_Int32 _height ) throw (uno::RuntimeException) -{ - setPosSize(m_xModel, _height, css::awt::PosSize::HEIGHT); -} - -sal_Int32 SAL_CALL -ScVbaWindow::getLeft() throw (uno::RuntimeException) -{ - css::awt::Rectangle aRect = getPosSize(m_xModel); - return aRect.X; -} - -void SAL_CALL -ScVbaWindow::setLeft( sal_Int32 _left ) throw (uno::RuntimeException) -{ - setPosSize(m_xModel, _left, css::awt::PosSize::X); -} -sal_Int32 SAL_CALL -ScVbaWindow::getTop() throw (uno::RuntimeException) -{ - css::awt::Rectangle aRect = getPosSize(m_xModel); - return aRect.Y; -} - -void SAL_CALL -ScVbaWindow::setTop( sal_Int32 _top ) throw (uno::RuntimeException) -{ - setPosSize(m_xModel, _top, css::awt::PosSize::Y); -} -sal_Int32 SAL_CALL -ScVbaWindow::getWidth() throw (uno::RuntimeException) -{ - css::awt::Rectangle aRect = getPosSize(m_xModel); - return aRect.Width; -} - -void SAL_CALL -ScVbaWindow::setWidth( sal_Int32 _width ) throw (uno::RuntimeException) -{ - setPosSize(m_xModel, _width, css::awt::PosSize::WIDTH); + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); + if ( pViewShell ) + dispatchExecute( pViewShell, nSlot ); } sal_Int32 SAL_CALL @@ -924,14 +809,14 @@ void SAL_CALL ScVbaWindow::PrintOut( const css::uno::Any& From, const css::uno::Any&To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { // need test, print current active sheet - PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, m_xModel, sal_True ); + PrintOutHelper( excel::getBestViewShell( m_xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, sal_True ); } void SAL_CALL ScVbaWindow::PrintPreview( const css::uno::Any& EnableChanges ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { // need test, print preview current active sheet - PrintPreviewHelper( EnableChanges, m_xModel ); + PrintPreviewHelper( EnableChanges, excel::getBestViewShell( m_xModel ) ); } rtl::OUString& diff --git a/sc/source/ui/vba/vbawindow.hxx b/sc/source/ui/vba/vbawindow.hxx index b32f3b99398a..968d258961c8 100644 --- a/sc/source/ui/vba/vbawindow.hxx +++ b/sc/source/ui/vba/vbawindow.hxx @@ -39,15 +39,16 @@ #include #include -#include "vbahelperinterface.hxx" +#include +#include #include "vbaworkbook.hxx" -typedef InheritedHelperInterfaceImpl1 WindowImpl_BASE; +//typedef InheritedHelperInterfaceImpl1 WindowImpl_BASE; +typedef cppu::ImplInheritanceHelper1< VbaWindowBase, ov::excel::XWindow > WindowImpl_BASE; class ScVbaWindow : public WindowImpl_BASE { private: - css::uno::Reference< css::frame::XModel > m_xModel; css::uno::Reference< css::sheet::XViewPane > m_xViewPane; css::uno::Reference< css::sheet::XViewFreezable > m_xViewFreezable; css::uno::Reference< css::sheet::XViewSplitable > m_xViewSplitable; @@ -82,10 +83,6 @@ public: virtual void SAL_CALL setDisplayWorkbookTabs( ::sal_Bool _bDisplayWorkbookTabs ) throw (css::uno::RuntimeException); virtual ::sal_Bool SAL_CALL getFreezePanes() throw (css::uno::RuntimeException); virtual void SAL_CALL setFreezePanes( ::sal_Bool _bFreezePanes ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getHeight() throw (css::uno::RuntimeException) ; - virtual void SAL_CALL setHeight( sal_Int32 _height ) throw (css::uno::RuntimeException) ; - virtual sal_Int32 SAL_CALL getLeft() throw (css::uno::RuntimeException) ; - virtual void SAL_CALL setLeft( sal_Int32 _left ) throw (css::uno::RuntimeException) ; virtual ::sal_Bool SAL_CALL getSplit() throw (css::uno::RuntimeException); virtual void SAL_CALL setSplit( ::sal_Bool _bSplit ) throw (css::uno::RuntimeException); virtual sal_Int32 SAL_CALL getSplitColumn() throw (css::uno::RuntimeException) ; @@ -100,14 +97,8 @@ public: virtual void SAL_CALL setScrollRow( const css::uno::Any& _scrollrow ) throw (css::uno::RuntimeException) ; virtual css::uno::Any SAL_CALL getScrollColumn() throw (css::uno::RuntimeException) ; virtual void SAL_CALL setScrollColumn( const css::uno::Any& _scrollcolumn ) throw (css::uno::RuntimeException) ; - virtual sal_Int32 SAL_CALL getTop() throw (css::uno::RuntimeException) ; - virtual void SAL_CALL setTop( sal_Int32 _top ) throw (css::uno::RuntimeException) ; virtual css::uno::Any SAL_CALL getView() throw (css::uno::RuntimeException); virtual void SAL_CALL setView( const css::uno::Any& _view ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); - virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getWidth() throw (css::uno::RuntimeException) ; - virtual void SAL_CALL setWidth( sal_Int32 _width ) throw (css::uno::RuntimeException) ; virtual css::uno::Any SAL_CALL getWindowState() throw (css::uno::RuntimeException); virtual void SAL_CALL setWindowState( const css::uno::Any& _windowstate ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getZoom() throw (css::uno::RuntimeException); diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx index b14a31c7c42c..ae16efdebcf4 100644 --- a/sc/source/ui/vba/vbawindows.cxx +++ b/sc/source/ui/vba/vbawindows.cxx @@ -37,6 +37,7 @@ #include #include "vbawindow.hxx" +#include "vbaglobals.hxx" //#include "vbaworkbook.hxx" using namespace ::com::sun::star; @@ -47,15 +48,15 @@ sal_Int32, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameIndexHash; -uno::Reference< XHelperInterface > lcl_createWorkbookHIParent( const uno::Reference< frame::XModel >& xModel, const uno::Reference< uno::XComponentContext >& xContext ) +uno::Reference< XHelperInterface > lcl_createWorkbookHIParent( const uno::Reference< frame::XModel >& xModel, const uno::Reference< uno::XComponentContext >& xContext, const uno::Any& aApplication ) { - return new ScVbaWorkbook( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel ); + return new ScVbaWorkbook( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel ); } -uno::Any ComponentToWindow( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext ) +uno::Any ComponentToWindow( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext, const uno::Any& aApplication ) { uno::Reference< frame::XModel > xModel( aSource, uno::UNO_QUERY_THROW ); - uno::Reference< excel::XWindow > xWin( new ScVbaWindow( lcl_createWorkbookHIParent( xModel, xContext ), xContext,xModel ) ); + uno::Reference< excel::XWindow > xWin( new ScVbaWindow( lcl_createWorkbookHIParent( xModel, xContext, aApplication ), xContext,xModel ) ); return uno::makeAny( xWin ); } @@ -108,12 +109,13 @@ public: class WindowEnumImpl : public WindowComponentEnumImpl { + uno::Any m_aApplication; public: - WindowEnumImpl(const uno::Reference< uno::XComponentContext >& xContext, const Components& components ):WindowComponentEnumImpl( xContext, components ) {} - WindowEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ): WindowComponentEnumImpl( xContext ) {} + WindowEnumImpl(const uno::Reference< uno::XComponentContext >& xContext, const Components& components, const uno::Any& aApplication ):WindowComponentEnumImpl( xContext, components ), m_aApplication( aApplication ){} + WindowEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Any& aApplication ): WindowComponentEnumImpl( xContext ), m_aApplication( aApplication ) {} virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - return ComponentToWindow( WindowComponentEnumImpl::nextElement(), m_xContext ); + return ComponentToWindow( WindowComponentEnumImpl::nextElement(), m_xContext, m_aApplication ); } }; @@ -212,16 +214,19 @@ ScVbaWindows::ScVbaWindows( const uno::Reference< ov::XHelperInterface >& xParen { } +ScVbaWindows::ScVbaWindows( const uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWindows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess > ( new WindowsAccessImpl( xContext ) ) ) +{ +} uno::Reference< container::XEnumeration > ScVbaWindows::createEnumeration() throw (uno::RuntimeException) { - return new WindowEnumImpl( mxContext ); + return new WindowEnumImpl( mxContext, Application() ); } uno::Any ScVbaWindows::createCollectionObject( const css::uno::Any& aSource ) { - return ComponentToWindow( aSource, mxContext ); + return ComponentToWindow( aSource, mxContext, Application() ); } uno::Type @@ -230,12 +235,6 @@ ScVbaWindows::getElementType() throw (uno::RuntimeException) return excel::XWindows::static_type(0); } -uno::Reference< XCollection > -ScVbaWindows::Windows( const css::uno::Reference< css::uno::XComponentContext >& xContext ) -{ - uno::Reference< container::XIndexAccess > xIndex( new WindowsAccessImpl( xContext ) ); - return new ScVbaWindows( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext , xIndex ); -} void SAL_CALL ScVbaWindows::Arrange( ::sal_Int32 /*ArrangeStyle*/, const uno::Any& /*ActiveWorkbook*/, const uno::Any& /*SyncHorizontal*/, const uno::Any& /*SyncVertical*/ ) throw (uno::RuntimeException) diff --git a/sc/source/ui/vba/vbawindows.hxx b/sc/source/ui/vba/vbawindows.hxx index 3c828d4e3355..5aff0094ebf3 100644 --- a/sc/source/ui/vba/vbawindows.hxx +++ b/sc/source/ui/vba/vbawindows.hxx @@ -35,8 +35,8 @@ #include -#include "vbahelper.hxx" -#include "vbacollectionimpl.hxx" +#include "excelvbahelper.hxx" +#include typedef CollTestImplHelper< ov::excel::XWindows > ScVbaWindows_BASE; @@ -45,6 +45,7 @@ class ScVbaWindows : public ScVbaWindows_BASE { public: ScVbaWindows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ); + ScVbaWindows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext ); virtual ~ScVbaWindows() {} // XEnumerationAccess @@ -57,8 +58,6 @@ public: // ScVbaCollectionBaseImpl virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); - static css::uno::Reference< ov::XCollection > Windows( const css::uno::Reference< css::uno::XComponentContext >& xContext ); - // XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence getServiceNames(); diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx index c89de4c2a10a..498d77e79a14 100644 --- a/sc/source/ui/vba/vbaworkbook.cxx +++ b/sc/source/ui/vba/vbaworkbook.cxx @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "helperdecl.hxx" +#include #include #include @@ -46,12 +46,13 @@ #include "vbaworkbook.hxx" #include "vbawindows.hxx" #include "vbastyles.hxx" -#include "vbahelper.hxx" +#include "excelvbahelper.hxx" #include "vbapalette.hxx" #include #include #include "vbanames.hxx" // Amelia Wang #include "nameuno.hxx" +#include "docoptio.hxx" // Much of the impl. for the equivalend UNO module is // sc/source/ui/unoobj/docuno.cxx, viewuno.cxx @@ -64,7 +65,7 @@ class ActiveSheet : public ScVbaWorksheet protected: virtual uno::Reference< frame::XModel > getModel() { - return getCurrentDocument(); + return getCurrentExcelDoc( mxContext ); } virtual uno::Reference< sheet::XSpreadsheet > getSheet() { @@ -192,7 +193,7 @@ ScVbaWorkbook::init() if ( !ColorData.getLength() ) ResetColors(); } -ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext) :ScVbaWorkbook_BASE( xParent, xContext ), mxModel(NULL) +ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext) :ScVbaWorkbook_BASE( xParent, xContext ) { //#FIXME this persists the color data per office instance and // not per workbook instance, need to hook the data into XModel @@ -203,58 +204,27 @@ ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface init(); } -ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::frame::XModel > xModel ) : ScVbaWorkbook_BASE( xParent, xContext ), mxModel( xModel ) +ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::frame::XModel > xModel ) : ScVbaWorkbook_BASE( xParent, xContext, xModel ) { init(); } ScVbaWorkbook::ScVbaWorkbook( uno::Sequence< uno::Any> const & args, - uno::Reference< uno::XComponentContext> const & xContext ) : ScVbaWorkbook_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) ) + uno::Reference< uno::XComponentContext> const & xContext ) : ScVbaWorkbook_BASE( args, xContext ) { init(); } -::rtl::OUString -ScVbaWorkbook::getName() throw (uno::RuntimeException) -{ - rtl::OUString sName = getModel()->getURL(); - if ( sName.getLength() ) - { - - INetURLObject aURL( getModel()->getURL() ); - ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName ); - } - else - { - const static rtl::OUString sTitle( RTL_CONSTASCII_USTRINGPARAM("Title" ) ); - // process "UntitledX - $(PRODUCTNAME)" - uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); - xProps->getPropertyValue(sTitle ) >>= sName; - sal_Int32 pos = 0; - sName = sName.getToken(0,' ',pos); - } - return sName; -} -::rtl::OUString -ScVbaWorkbook::getPath() throw (uno::RuntimeException) -{ - INetURLObject aURL( getModel()->getURL() ); - aURL.CutLastName(); - return aURL.GetURLPath(); -} - -::rtl::OUString -ScVbaWorkbook::getFullName() throw (uno::RuntimeException) -{ - INetURLObject aURL( getModel()->getURL() ); - return aURL.GetURLPath(); -} uno::Reference< excel::XWorksheet > ScVbaWorkbook::getActiveSheet() throw (uno::RuntimeException) { - return new ActiveSheet( this, mxContext ); + uno::Reference< frame::XModel > xModel( getCurrentExcelDoc( mxContext ) ); + uno::Reference< sheet::XSpreadsheet > xSheet; + uno::Reference< sheet::XSpreadsheetView > xView( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); + if ( xView.is() ) + xSheet = xView->getActiveSheet(); + return new ScVbaWorksheet( this, mxContext, xSheet, xModel ); } uno::Any SAL_CALL ScVbaWorkbook::Sheets( const uno::Any& aIndex ) throw (uno::RuntimeException) @@ -281,89 +251,17 @@ ScVbaWorkbook::Worksheets( const uno::Any& aIndex ) throw (uno::RuntimeException uno::Any SAL_CALL ScVbaWorkbook::Windows( const uno::Any& aIndex ) throw (uno::RuntimeException) { - uno::Reference< XCollection > xWindows = ScVbaWindows::Windows( mxContext ); + + uno::Reference< excel::XWindows > xWindows( new ScVbaWindows( getParent(), mxContext ) ); if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID ) return uno::Any( xWindows ); return uno::Any( xWindows->Item( aIndex, uno::Any() ) ); } -void -ScVbaWorkbook::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, - const uno::Any &rRouteArg ) throw (uno::RuntimeException) + +void SAL_CALL +ScVbaWorkbook::Activate() throw (uno::RuntimeException) { - sal_Bool bSaveChanges = sal_False; - rtl::OUString aFileName; - sal_Bool bRouteWorkbook = sal_True; - - rSaveArg >>= bSaveChanges; - sal_Bool bFileName = ( rFileArg >>= aFileName ); - rRouteArg >>= bRouteWorkbook; - uno::Reference< frame::XStorable > xStorable( getModel(), uno::UNO_QUERY_THROW ); - uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); - - if( bSaveChanges ) - { - if( xStorable->isReadonly() ) - { - throw uno::RuntimeException(::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "Unable to save to a read only file ") ), - uno::Reference< XInterface >() ); - } - if( bFileName ) - xStorable->storeAsURL( aFileName, uno::Sequence< beans::PropertyValue >(0) ); - else - xStorable->store(); - } - else - xModifiable->setModified( false ); - - uno::Reference< util::XCloseable > xCloseable( getModel(), uno::UNO_QUERY ); - - if( xCloseable.is() ) - // use close(boolean DeliverOwnership) - - // The boolean parameter DeliverOwnership tells objects vetoing the close process that they may - // assume ownership if they object the closure by throwing a CloseVetoException - // Here we give up ownership. To be on the safe side, catch possible veto exception anyway. - xCloseable->close(sal_True); - // If close is not supported by this model - try to dispose it. - // But if the model disagree with a reset request for the modify state - // we shouldn't do so. Otherwhise some strange things can happen. - else - { - uno::Reference< lang::XComponent > xDisposable ( getCurrentDocument(), uno::UNO_QUERY ); - if ( xDisposable.is() ) - xDisposable->dispose(); - } -} - -void -ScVbaWorkbook::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException) -{ - rtl::OUString rPassword; - uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); - SC_VBA_FIXME(("Workbook::Protect stub")); - if( aPassword >>= rPassword ) - xProt->protect( rPassword ); - else - xProt->protect( rtl::OUString() ); -} - -void -ScVbaWorkbook::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException) -{ - rtl::OUString rPassword; - uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); - if( !getProtectStructure() ) - throw uno::RuntimeException(::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "File is already unprotected" ) ), - uno::Reference< XInterface >() ); - else - { - if( aPassword >>= rPassword ) - xProt->unprotect( rPassword ); - else - xProt->unprotect( rtl::OUString() ); - } + VbaDocumentBase::Activate(); } ::sal_Bool @@ -373,26 +271,20 @@ ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException) return xProt->isProtected(); } -void -ScVbaWorkbook::setSaved( sal_Bool bSave ) throw (uno::RuntimeException) +::sal_Bool SAL_CALL ScVbaWorkbook::getPrecisionAsDisplayed() throw (uno::RuntimeException) { - uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); - xModifiable->setModified( bSave ); + uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW ); + ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument(); + return pDoc->GetDocOptions().IsCalcAsShown(); } -sal_Bool -ScVbaWorkbook::getSaved() throw (uno::RuntimeException) +void SAL_CALL ScVbaWorkbook::setPrecisionAsDisplayed( sal_Bool _precisionAsDisplayed ) throw (uno::RuntimeException) { - uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); - return xModifiable->isModified(); -} - -void -ScVbaWorkbook::Save() throw (uno::RuntimeException) -{ - rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Save")); - uno::Reference< frame::XModel > xModel = getModel(); - dispatchRequests(xModel,url); + uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW ); + ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument(); + ScDocOptions aOpt = pDoc->GetDocOptions(); + aOpt.SetCalcAsShown( _precisionAsDisplayed ); + pDoc->SetDocOptions( aOpt ); } void @@ -407,13 +299,6 @@ ScVbaWorkbook::SaveCopyAs( const rtl::OUString& sFileName ) throw ( uno::Runtime xStor->storeToURL( aURL, storeProps ); } -void -ScVbaWorkbook::Activate() throw (uno::RuntimeException) -{ - uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); - xFrame->activate(); -} - css::uno::Any SAL_CALL ScVbaWorkbook::Styles( const::uno::Any& Item ) throw (uno::RuntimeException) { @@ -465,7 +350,7 @@ ScVbaWorkbook::getCodeName() throw (css::uno::RuntimeException) { #ifdef VBA_OOBUILD_HACK uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW ); - ScDocument* pDoc = getDocShell( xModel )->GetDocument(); + ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument(); ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions(); ScExtDocSettings pExtSettings = pExtOptions->GetDocSettings(); ::rtl::OUString sGlobCodeName = pExtSettings.maGlobCodeName; @@ -479,7 +364,7 @@ void SAL_CALL ScVbaWorkbook::setCodeName( const ::rtl::OUString& sGlobCodeName ) throw (css::uno::RuntimeException) { uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW ); - ScDocument* pDoc = getDocShell( xModel )->GetDocument(); + ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument(); ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions(); ScExtDocSettings pExtSettings = pExtOptions->GetDocSettings(); pExtSettings.maGlobCodeName = sGlobCodeName; diff --git a/sc/source/ui/vba/vbaworkbook.hxx b/sc/source/ui/vba/vbaworkbook.hxx index 67d14dac148c..cf221fd934a0 100644 --- a/sc/source/ui/vba/vbaworkbook.hxx +++ b/sc/source/ui/vba/vbaworkbook.hxx @@ -32,21 +32,20 @@ #include #include -#include "vbahelperinterface.hxx" +#include +#include class ScModelObj; -typedef InheritedHelperInterfaceImpl1< ov::excel::XWorkbook > ScVbaWorkbook_BASE; +typedef cppu::ImplInheritanceHelper1< VbaDocumentBase, ov::excel::XWorkbook > ScVbaWorkbook_BASE; class ScVbaWorkbook : public ScVbaWorkbook_BASE { - css::uno::Reference< css::frame::XModel > mxModel; static css::uno::Sequence< sal_Int32 > ColorData; void initColorData( const css::uno::Sequence< sal_Int32 >& sColors ); void init(); protected: - virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; } ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext); public: ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, @@ -55,24 +54,15 @@ public: virtual ~ScVbaWorkbook() {} // Attributes - virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getFullName() throw (css::uno::RuntimeException); virtual ::sal_Bool SAL_CALL getProtectStructure() throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getSaved() throw (css::uno::RuntimeException); - virtual void SAL_CALL setSaved( sal_Bool bSave ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getPrecisionAsDisplayed() throw (css::uno::RuntimeException); + virtual void SAL_CALL setPrecisionAsDisplayed( sal_Bool _precisionAsDisplayed ) throw (css::uno::RuntimeException); // Methods virtual css::uno::Any SAL_CALL Worksheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL Sheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL Windows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges, - const css::uno::Any &aFileName, - const css::uno::Any &bRouteWorkbook ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Save() throw (css::uno::RuntimeException); virtual void SAL_CALL Activate() throw (css::uno::RuntimeException); // Amelia Wang virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx index 40c8370f4aec..b2f194bff6c5 100644 --- a/sc/source/ui/vba/vbaworkbooks.cxx +++ b/sc/source/ui/vba/vbaworkbooks.cxx @@ -56,7 +56,7 @@ #include "vbaglobals.hxx" #include "vbaworkbook.hxx" #include "vbaworkbooks.hxx" -#include "vbahelper.hxx" +#include #include #include @@ -65,180 +65,33 @@ using namespace ::com::sun::star; const sal_Int16 CUSTOM_CHAR = 5; -typedef std::hash_map< rtl::OUString, -sal_Int32, ::rtl::OUStringHash, -::std::equal_to< ::rtl::OUString > > NameIndexHash; - -typedef std::vector < uno::Reference< sheet::XSpreadsheetDocument > > WorkBooks; - -typedef ::cppu::WeakImplHelper1< container::XEnumeration > SpreadSheetDocEnumImpl_BASE; - static uno::Any -getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSpreadsheetDocument > &xDoc ) +getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSpreadsheetDocument > &xDoc, const uno::Any& aApplication ) { // FIXME: fine as long as ScVbaWorkbook is stateless ... uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY ); if( !xModel.is() ) return uno::Any(); - ScVbaWorkbook *pWb = new ScVbaWorkbook( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel ); + ScVbaWorkbook *pWb = new ScVbaWorkbook( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel ); return uno::Any( uno::Reference< excel::XWorkbook > (pWb) ); } - -// #FIXME clearly this is a candidate for some sort of helper base class as -// this is a copy of SelectedSheetsEnum ( vbawindow.cxx ) - -class SpreadSheetDocEnumImpl : public SpreadSheetDocEnumImpl_BASE -{ - uno::Reference< uno::XComponentContext > m_xContext; - WorkBooks m_books; - WorkBooks::const_iterator m_it; - -public: - SpreadSheetDocEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const WorkBooks& books ) throw ( uno::RuntimeException ) : m_xContext( xContext ), m_books( books ) - { - m_it = m_books.begin(); - } - SpreadSheetDocEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : m_xContext( xContext ) - { - uno::Reference< lang::XMultiComponentFactory > xSMgr( - m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - - uno::Reference< frame::XDesktop > xDesktop - (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), m_xContext), uno::UNO_QUERY_THROW ); - uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration(); - while( mxComponents->hasMoreElements() ) - { - uno::Reference< sheet::XSpreadsheetDocument > xNext( mxComponents->nextElement(), uno::UNO_QUERY ); - if ( xNext.is() ) - m_books.push_back( xNext ); - } - m_it = m_books.begin(); - } - // XEnumeration - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) - { - return m_it != m_books.end(); - } - - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - if ( !hasMoreElements() ) - { - throw container::NoSuchElementException(); - } - return makeAny( *(m_it++) ); - } -}; - class WorkBookEnumImpl : public EnumerationHelperImpl { + uno::Any m_aApplication; public: - WorkBookEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ){} + WorkBookEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Any& aApplication ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), m_aApplication( aApplication ) {} virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { uno::Reference< sheet::XSpreadsheetDocument > xDoc( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); - return getWorkbook( m_xContext, xDoc ); + return getWorkbook( m_xContext, xDoc, m_aApplication ); } }; -// #FIXME clearly this is also a candidate for some sort of helper base class as -// a very similar one is used in vbawindow ( SelectedSheetsEnumAccess ) -// Maybe a template base class that does all of the operations on the hashmap -// and vector only, and the sub-class does everything else -// => ctor, createEnumeration & factory method need be defined ( to be called -// by getByIndex, getByName ) -typedef ::cppu::WeakImplHelper3< container::XEnumerationAccess - , com::sun::star::container::XIndexAccess - , com::sun::star::container::XNameAccess - > WorkBooksAccessImpl_BASE; - -class WorkBooksAccessImpl : public WorkBooksAccessImpl_BASE -{ - uno::Reference< uno::XComponentContext > m_xContext; - WorkBooks m_books; - NameIndexHash namesToIndices; -public: - WorkBooksAccessImpl( const uno::Reference< uno::XComponentContext >& xContext ):m_xContext( xContext ) - { - uno::Reference< container::XEnumeration > xEnum = new SpreadSheetDocEnumImpl( m_xContext ); - sal_Int32 nIndex=0; - while( xEnum->hasMoreElements() ) - { - uno::Reference< sheet::XSpreadsheetDocument > xNext( xEnum->nextElement(), uno::UNO_QUERY ); - if ( xNext.is() ) - { - m_books.push_back( xNext ); - uno::Reference< frame::XModel > xModel( xNext, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given - INetURLObject aURL( xModel->getURL() ); - namesToIndices[ aURL.GetLastName() ] = nIndex++; - } - } - - } - - //XEnumerationAccess - virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) - { - return new SpreadSheetDocEnumImpl( m_xContext, m_books ); - } - // XIndexAccess - virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) - { - return m_books.size(); - } - virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw ( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) - { - if ( Index < 0 - || static_cast< WorkBooks::size_type >(Index) >= m_books.size() ) - throw lang::IndexOutOfBoundsException(); - return makeAny( m_books[ Index ] ); // returns xspreadsheetdoc - } - - //XElementAccess - virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) - { - return sheet::XSpreadsheetDocument::static_type(0); - } - - virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) - { - return (m_books.size() > 0); - } - - //XNameAccess - virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - NameIndexHash::const_iterator it = namesToIndices.find( aName ); - if ( it == namesToIndices.end() ) - throw container::NoSuchElementException(); - return makeAny( m_books[ it->second ] ); - - } - - virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) - { - uno::Sequence< ::rtl::OUString > names( namesToIndices.size() ); - ::rtl::OUString* pString = names.getArray(); - NameIndexHash::const_iterator it = namesToIndices.begin(); - NameIndexHash::const_iterator it_end = namesToIndices.end(); - for ( ; it != it_end; ++it, ++pString ) - *pString = it->first; - return names; - } - - virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) - { - NameIndexHash::const_iterator it = namesToIndices.find( aName ); - return (it != namesToIndices.end()); - } - -}; - -ScVbaWorkbooks::ScVbaWorkbooks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWorkbooks_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new WorkBooksAccessImpl( xContext ) ) ) +ScVbaWorkbooks::ScVbaWorkbooks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWorkbooks_BASE( xParent, xContext, VbaDocumentsBase::EXCEL_DOCUMENT ) { } // XEnumerationAccess @@ -254,46 +107,32 @@ ScVbaWorkbooks::createEnumeration() throw (uno::RuntimeException) // the state of this object ( although it should ) would be // safer to create an enumeration based on this objects state // rather than one effectively based of the desktop component - return new WorkBookEnumImpl( mxContext, uno::Reference< container::XEnumeration >( new SpreadSheetDocEnumImpl(mxContext) ) ); + uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); + return new WorkBookEnumImpl( mxContext, xEnumerationAccess->createEnumeration(), Application() ); } uno::Any ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource ) { - uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY ); - return getWorkbook( mxContext, xDoc ); + uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY_THROW ); + return getWorkbook( mxContext, xDoc, Application() ); } uno::Any SAL_CALL ScVbaWorkbooks::Add() throw (uno::RuntimeException) { - uno::Reference< lang::XMultiComponentFactory > xSMgr( - mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - - uno::Reference< frame::XComponentLoader > xLoader( - xSMgr->createInstanceWithContext( - ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), - mxContext), uno::UNO_QUERY_THROW ); - uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc") ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, - uno::Sequence< beans::PropertyValue >(0) ); - uno::Reference xSpreadDoc( xComponent, uno::UNO_QUERY_THROW ); + uno::Reference xSpreadDoc( VbaDocumentsBase::Add() , uno::UNO_QUERY_THROW ); if( xSpreadDoc.is() ) - return getWorkbook( mxContext, xSpreadDoc ); + return getWorkbook( mxContext, xSpreadDoc, Application() ); return uno::Any(); } void ScVbaWorkbooks::Close() throw (uno::RuntimeException) { - uno::Reference< lang::XMultiComponentFactory > xSMgr( - mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc")); - dispatchRequests(xModel,url); + VbaDocumentsBase::Close(); } bool @@ -337,24 +176,15 @@ uno::Any ScVbaWorkbooks::Open( const rtl::OUString& rFileName, const uno::Any& /*UpdateLinks*/, const uno::Any& ReadOnly, const uno::Any& Format, const uno::Any& /*Password*/, const uno::Any& /*WriteResPassword*/, const uno::Any& /*IgnoreReadOnlyRecommended*/, const uno::Any& /*Origin*/, const uno::Any& Delimiter, const uno::Any& /*Editable*/, const uno::Any& /*Notify*/, const uno::Any& /*Converter*/, const uno::Any& /*AddToMru*/ ) throw (uno::RuntimeException) { // we need to detect if this is a URL, if not then assume its a file path - rtl::OUString aURL; - INetURLObject aObj; + rtl::OUString aURL; + INetURLObject aObj; aObj.SetURL( rFileName ); bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID; if ( bIsURL ) aURL = rFileName; else osl::FileBase::getFileURLFromSystemPath( rFileName, aURL ); - uno::Reference< lang::XMultiComponentFactory > xSMgr( - mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XDesktop > xDesktop - (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop") , mxContext), - uno::UNO_QUERY_THROW ); - uno::Reference< frame::XComponentLoader > xLoader( - xSMgr->createInstanceWithContext( - ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), - mxContext), - uno::UNO_QUERY_THROW ); + uno::Sequence< beans::PropertyValue > sProps(0); sal_Int32 nIndex = 0; @@ -421,30 +251,20 @@ ScVbaWorkbooks::Open( const rtl::OUString& rFileName, const uno::Any& /*UpdateLi else if ( !isSpreadSheetFile( sType ) ) throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Bad Format")), uno::Reference< uno::XInterface >() ); - if ( ReadOnly.hasValue() ) - { - sal_Bool bIsReadOnly = sal_False; ReadOnly >>= bIsReadOnly; - if ( bIsReadOnly ) - { - static const rtl::OUString sReadOnly( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ); - sProps.realloc( sProps.getLength() + 1 ); - sProps[ nIndex ].Name = sReadOnly; - sProps[ nIndex++ ].Value = uno::makeAny( (sal_Bool)sal_True ); - } - } - - uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( aURL, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_default") ), - frame::FrameSearchFlag::CREATE, - sProps); - uno::Reference xSpreadDoc( xComponent, uno::UNO_QUERY_THROW ); - uno::Any aRet = getWorkbook( mxContext, xSpreadDoc ); + uno::Reference xSpreadDoc( VbaDocumentsBase::Open( rFileName, ReadOnly, sProps ), uno::UNO_QUERY_THROW ); + uno::Any aRet = getWorkbook( mxContext, xSpreadDoc, Application() ); uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY ); if ( xWBook.is() ) xWBook->Activate(); return aRet; } +uno::Any +ScVbaWorkbooks::Open( const rtl::OUString& Filename, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException) +{ + return VbaDocumentsBase::Open( Filename, ReadOnly, rProps ); +} + rtl::OUString& ScVbaWorkbooks::getServiceImplName() { diff --git a/sc/source/ui/vba/vbaworkbooks.hxx b/sc/source/ui/vba/vbaworkbooks.hxx index cf766b04e688..891a8a333695 100644 --- a/sc/source/ui/vba/vbaworkbooks.hxx +++ b/sc/source/ui/vba/vbaworkbooks.hxx @@ -31,21 +31,20 @@ #define SC_VBA_WORKBOOKS_HXX -#include "vbacollectionimpl.hxx" -#include +#include #include #include -#include "vbahelper.hxx" +#include +#include "excelvbahelper.hxx" class ScModelObj; -typedef CollTestImplHelper< ov::excel::XWorkbooks > ScVbaWorkbooks_BASE; +typedef cppu::ImplInheritanceHelper1< VbaDocumentsBase, ov::excel::XWorkbooks > ScVbaWorkbooks_BASE; class ScVbaWorkbooks : public ScVbaWorkbooks_BASE { private: - css::uno::Reference< ov::XGlobals > getGlobals() throw (css::uno::RuntimeException); rtl::OUString getFileFilterType( const rtl::OUString& rString ); bool isTextFile( const rtl::OUString& rString ); bool isSpreadSheetFile( const rtl::OUString& rString ); @@ -68,6 +67,8 @@ public: virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& UpdateLinks, const css::uno::Any& ReadOnly, const css::uno::Any& Format, const css::uno::Any& Password, const css::uno::Any& WriteResPassword, const css::uno::Any& IgnoreReadOnlyRecommended, const css::uno::Any& Origin, const css::uno::Any& Delimiter, const css::uno::Any& Editable, const css::uno::Any& Notify, const css::uno::Any& Converter, const css::uno::Any& AddToMru ) throw (css::uno::RuntimeException); + // VbaDocumentsBase / XDocumentsBase (to avoid warning C4266 for hiding function on wntmsci) + virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException); }; #endif /* SC_VBA_WORKBOOKS_HXX */ diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index cd75ebd9af40..c382ffeb8afe 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -27,11 +27,12 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "helperdecl.hxx" +#include #include #include #include +#include #include #include #include @@ -58,6 +59,8 @@ #include #include #include +#include +#include #include @@ -82,10 +85,9 @@ #include "vbaworksheet.hxx" #include "vbachartobjects.hxx" #include "vbapivottables.hxx" -#include "vbacombobox.hxx" #include "vbaoleobject.hxx" #include "vbaoleobjects.hxx" -#include "vbashapes.hxx" +#include #include "vbapagesetup.hxx" #include "vbapagebreaks.hxx" @@ -94,7 +96,7 @@ #define DOESNOTEXIST -1 using namespace com::sun::star; using namespace ooo::vba; -static bool +bool nameExists( uno::Reference & xSpreadDoc, ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException ) { if (!xSpreadDoc.is()) @@ -257,6 +259,83 @@ ScVbaWorksheet::getIndex() throw (uno::RuntimeException) return getSheetID() + 1; } +sal_Int32 +ScVbaWorksheet::getEnableSelection() throw (uno::RuntimeException) +{ + uno::Reference xSpreadDoc( getModel(), uno::UNO_QUERY_THROW ); + SCTAB nTab = 0; + rtl::OUString aSheetName = getName(); + bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nTab); + if ( bSheetExists ) + { + uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW ); + ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument(); + ScTableProtection* pProtect = pDoc->GetTabProtection(nTab); + sal_Bool bLockedCells = sal_False; + sal_Bool bUnlockedCells = sal_False; + if( pProtect ) + { + bLockedCells = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS); + bUnlockedCells = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); + } + if( bLockedCells ) + return excel::XlEnableSelection::xlNoRestrictions; + if( bUnlockedCells ) + return excel::XlEnableSelection::xlUnlockedCells; + return excel::XlEnableSelection::xlNoSelection; + } + else + throw uno::RuntimeException(::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "Sheet Name does not exist. ") ), + uno::Reference< XInterface >() ); + return excel::XlEnableSelection::xlNoSelection; +} + + +void +ScVbaWorksheet::setEnableSelection( sal_Int32 nSelection ) throw (uno::RuntimeException) +{ + if( (nSelection != excel::XlEnableSelection::xlNoRestrictions) && + (nSelection != excel::XlEnableSelection::xlUnlockedCells) && + (nSelection != excel::XlEnableSelection::xlNoSelection) ) + { + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); + } + + uno::Reference xSpreadDoc( getModel(), uno::UNO_QUERY_THROW ); + SCTAB nTab = 0; + rtl::OUString aSheetName = getName(); + bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nTab); + if ( bSheetExists ) + { + uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW ); + ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument(); + ScTableProtection* pProtect = pDoc->GetTabProtection(nTab); + // default is xlNoSelection + sal_Bool bLockedCells = sal_False; + sal_Bool bUnlockedCells = sal_False; + if( nSelection == excel::XlEnableSelection::xlNoRestrictions ) + { + bLockedCells = sal_True; + bUnlockedCells = sal_True; + } + else if( nSelection == excel::XlEnableSelection::xlUnlockedCells ) + { + bUnlockedCells = sal_True; + } + if( pProtect ) + { + pProtect->setOption( ScTableProtection::SELECT_LOCKED_CELLS, bLockedCells ); + pProtect->setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, bUnlockedCells ); + } + } + else + throw uno::RuntimeException(::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "Sheet Name does not exist. ") ), + uno::Reference< XInterface >() ); + +} + uno::Reference< excel::XRange > ScVbaWorksheet::getUsedRange() throw (uno::RuntimeException) { @@ -292,6 +371,16 @@ ScVbaWorksheet::HPageBreaks( const uno::Any& aIndex ) throw (uno::RuntimeExcepti return uno::makeAny( xHPageBreaks ); } +uno::Any +ScVbaWorksheet::VPageBreaks( const uno::Any& aIndex ) throw ( uno::RuntimeException ) +{ + uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak( getSheet(), uno::UNO_QUERY_THROW ); + uno::Reference< excel::XVPageBreaks > xVPageBreaks( new ScVbaVPageBreaks( this, mxContext, xSheetPageBreak ) ); + if( aIndex.hasValue() ) + return xVPageBreaks->Item( aIndex, uno::Any()); + return uno::makeAny( xVPageBreaks ); +} + sal_Int32 ScVbaWorksheet::getStandardWidth() throw (uno::RuntimeException) { @@ -353,11 +442,11 @@ ScVbaWorksheet::Move( const uno::Any& Before, const uno::Any& After ) throw (uno uno::Reference xRange = new ScVbaRange( this, mxContext, xRange1); if (xRange.is()) xRange->Select(); - implnCopy(); + excel::implnCopy(mxModel); uno::Reference xModel = openNewDoc(aCurrSheetName); if (xModel.is()) { - implnPaste(); + excel::implnPaste(xModel); Delete(); } return ; @@ -391,11 +480,11 @@ ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After ) throw (uno uno::Reference xRange = new ScVbaRange( this, mxContext, xRange1); if (xRange.is()) xRange->Select(); - implnCopy(); + excel::implnCopy(mxModel); uno::Reference xModel = openNewDoc(aCurrSheetName); if (xModel.is()) { - implnPaste(); + excel::implnPaste(xModel); } return; } @@ -424,7 +513,7 @@ ScVbaWorksheet::Paste( const uno::Any& Destination, const uno::Any& /*Link*/ ) t uno::Reference xRange( Destination, uno::UNO_QUERY ); if ( xRange.is() ) xRange->Select(); - implnPaste(); + excel::implnPaste( mxModel ); } void @@ -624,7 +713,7 @@ ScVbaWorksheet::Shapes( const uno::Any& aIndex ) throw (uno::RuntimeException) uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); uno::Reference< container::XIndexAccess > xIndexAccess( xShapes, uno::UNO_QUERY_THROW ); - uno::Reference< msforms::XShapes> xVbaShapes( new ScVbaShapes( this, mxContext, xIndexAccess ) ); + uno::Reference< msforms::XShapes> xVbaShapes( new ScVbaShapes( this, mxContext, xIndexAccess, getModel() ) ); if ( aIndex.hasValue() ) return xVbaShapes->Item( aIndex, uno::Any() ); return uno::makeAny( xVbaShapes ); @@ -635,7 +724,7 @@ ScVbaWorksheet::ShowDataForm( ) throw (uno::RuntimeException) { #ifdef VBA_OOBUILD_HACK uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW ); - ScTabViewShell* pTabViewShell = getBestViewShell( xModel ); + ScTabViewShell* pTabViewShell = excel::getBestViewShell( xModel ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 @@ -676,16 +765,18 @@ ScVbaWorksheet::invoke( const ::rtl::OUString& aFunctionName, const uno::Sequenc } void SAL_CALL -ScVbaWorksheet::setValue( const ::rtl::OUString& /*aPropertyName*/, const uno::Any& /*aValue*/ ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) +ScVbaWorksheet::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) { - throw uno::RuntimeException(); // unsupported operation + setDefaultPropByIntrospection( uno::makeAny( getValue( aPropertyName ) ), aValue ); } uno::Any SAL_CALL ScVbaWorksheet::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException) { uno::Reference< drawing::XControlShape > xControlShape( getControlShape( aPropertyName ), uno::UNO_QUERY_THROW ); - ScVbaControlFactory controlFactory( mxContext, xControlShape, getModel() ); - uno::Reference< msforms::XControl > xControl( controlFactory.createControl( getModel() ) ); + + uno::Reference xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW ); + uno::Reference< msforms::XControl > xControl( xControlProvider->createControl( xControlShape, getModel() ) ); return uno::makeAny( xControl ); } @@ -869,10 +960,9 @@ ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::A bSelection = sal_True; uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW ); - PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, xModel, bSelection ); + PrintOutHelper( excel::getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection ); } - namespace worksheet { namespace sdecl = comphelper::service_decl; diff --git a/sc/source/ui/vba/vbaworksheet.hxx b/sc/source/ui/vba/vbaworksheet.hxx index 8fdee639c7c1..da88e1c4b06f 100644 --- a/sc/source/ui/vba/vbaworksheet.hxx +++ b/sc/source/ui/vba/vbaworksheet.hxx @@ -44,9 +44,11 @@ #include #include #include +#include #include -#include "vbahelperinterface.hxx" +#include +#include "address.hxx" typedef InheritedHelperInterfaceImpl1< ov::excel::XWorksheet > WorksheetImpl_BASE; @@ -93,9 +95,12 @@ public: virtual css::uno::Reference< ov::excel::XOutline > SAL_CALL Outline( ) throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XPageSetup > SAL_CALL PageSetup( ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL HPageBreaks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL VPageBreaks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getNext() throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getPrevious() throw (css::uno::RuntimeException); virtual sal_Int16 SAL_CALL getIndex() throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getEnableSelection() throw (css::uno::RuntimeException); + virtual void SAL_CALL setEnableSelection( sal_Int32 nSelection ) throw (css::uno::RuntimeException); // Methods virtual void SAL_CALL Activate() throw (css::uno::RuntimeException); diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx index 8a4dd0455bb5..dca004a74e65 100644 --- a/sc/source/ui/vba/vbaworksheets.cxx +++ b/sc/source/ui/vba/vbaworksheets.cxx @@ -209,16 +209,29 @@ ScVbaWorksheets::Add( const uno::Any& Before, const uno::Any& After, Count >>= nNewSheets; Type >>= nType; SCTAB nCount = 0; - Before >>= aStringSheet; - if (!aStringSheet.getLength()) + + uno::Reference< excel::XWorksheet > xBeforeAfterSheet; + + if ( Before.hasValue() ) { - After >>= aStringSheet; + if ( Before >>= xBeforeAfterSheet ) + aStringSheet = xBeforeAfterSheet->getName(); + else + Before >>= aStringSheet; + } + + if (!aStringSheet.getLength() && After.hasValue() ) + { + if ( After >>= xBeforeAfterSheet ) + aStringSheet = xBeforeAfterSheet->getName(); + else + After >>= aStringSheet; bBefore = sal_False; } if (!aStringSheet.getLength()) { - aStringSheet = ScVbaGlobals::getGlobalsImpl( - mxContext )->getApplication()->getActiveWorkbook()->getActiveSheet()->getName(); + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); + aStringSheet = xApplication->getActiveWorkbook()->getActiveSheet()->getName(); bBefore = sal_True; } nCount = static_cast< SCTAB >( m_xIndexAccess->getCount() ); @@ -252,7 +265,9 @@ ScVbaWorksheets::Add( const uno::Any& Before, const uno::Any& After, m_xSheets->insertNewByName(aStringName, nSheetIndex + i); result = getItemByStringIndex( aStringName ); } - + uno::Reference< excel::XWorksheet > xNewSheet( result, uno::UNO_QUERY ); + if ( xNewSheet.is() ) + xNewSheet->Activate(); return result; } @@ -295,7 +310,7 @@ ScVbaWorksheets::PrintOut( const uno::Any& From, const uno::Any& To, const uno:: if ( isSelectedSheets() ) bSelection = sal_True; - PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, mxModel, bSelection ); + PrintOutHelper( excel::getBestViewShell( mxModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection ); } uno::Any SAL_CALL @@ -336,7 +351,7 @@ ScVbaWorksheets::setVisible( const uno::Any& _visible ) throw (uno::RuntimeExcep void SAL_CALL ScVbaWorksheets::Select( const uno::Any& Replace ) throw (uno::RuntimeException) { - ScTabViewShell* pViewShell = getBestViewShell( mxModel ); + ScTabViewShell* pViewShell = excel::getBestViewShell( mxModel ); if ( !pViewShell ) throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain view shell" ) ), uno::Reference< uno::XInterface >() ); diff --git a/sc/source/ui/vba/vbaworksheets.hxx b/sc/source/ui/vba/vbaworksheets.hxx index 0cb2a4f33971..e816e8ecf212 100644 --- a/sc/source/ui/vba/vbaworksheets.hxx +++ b/sc/source/ui/vba/vbaworksheets.hxx @@ -36,9 +36,8 @@ #include #include #include -#include -#include "vbacollectionimpl.hxx" +#include class ScModelObj; diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 2d2cdd8efde3..cf64a07a2d95 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -209,6 +209,18 @@ BOOL lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam ) return bSort; } +// Added by PengYunQuan for Validity Cell Range Picker + void ScCellShell::ExecuteDB( SfxRequest& rReq ) { ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); @@ -1060,10 +1072,18 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) //CHINA001 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); //CHINA001 DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 - SfxAbstractTabDialog* pDlg = pFact->CreateScValidationDlg( NULL, &aArgSet, TAB_DLG_VALIDATION ); + //Modified by PengYunQuan for Validity Cell Range Picker DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 - if ( pDlg->Execute() == RET_OK ) + //Modified by PengYunQuan for Validity Cell Range Picker { const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); @@ -1142,7 +1162,11 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) pTabViewShell->SetValidation( aData ); rReq.Done( *pOutSet ); } - delete pDlg; + // Modified by PengYunQuan for Validity Cell Range Picker } } break; diff --git a/sc/source/ui/view/makefile.mk b/sc/source/ui/view/makefile.mk index 466ab5dc8627..d8f45c8a754f 100644 --- a/sc/source/ui/view/makefile.mk +++ b/sc/source/ui/view/makefile.mk @@ -161,7 +161,8 @@ EXCEPTIONSFILES= \ $(SLO)$/tabvwshb.obj \ $(SLO)$/viewdata.obj \ $(SLO)$/viewfun5.obj \ - $(SLO)$/viewfun7.obj + $(SLO)$/viewfun7.obj \ + $(SLO)$/reffact.obj # goal seek -O2 diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx index 66f9cb88fb2c..8b36ae6a480e 100644 --- a/sc/source/ui/view/reffact.cxx +++ b/sc/source/ui/view/reffact.cxx @@ -47,6 +47,9 @@ #include "acredlin.hxx" #include "simpref.hxx" #include "scmod.hxx" +//Added by PengYunQuan for Validity Cell Range Picker*/\ + if (!pViewShell) \ + pViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); \ DBG_ASSERT( pViewShell, "missing view shell :-(" ); \ pWindow = pViewShell ? \ pViewShell->CreateRefDialog( p, this, pInfo, pParentP, sid ) : NULL; \ @@ -355,3 +388,50 @@ IMPL_CHILD_CTOR( ScHighlightChgDlgWrapper, FID_CHG_SHOW ) /*------------------------------------------------------------------------*/ +//Added by PengYunQuan for Validity Cell Range Picker diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx index 497eb65fc76f..4c73d14d51be 100644 --- a/sc/source/ui/view/tabvwsh.cxx +++ b/sc/source/ui/view/tabvwsh.cxx @@ -96,6 +96,10 @@ SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL)) SFX_CHILDWINDOW_REGISTRATION(GalleryChildWindow::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScSpellDialogChildWindow::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() ); + + //Added by PengYunQuan for Validity Cell Range Picker } SFX_IMPL_VIEWFACTORY( ScTabViewShell, ScResId(STR_NONAME) ) diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index c3848b76b92b..c3c096a6a666 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -597,68 +597,105 @@ void ScViewData::SetViewShell( ScTabViewShell* pViewSh ) pView = NULL; } } - -void ScViewData::SetZoomType( SvxZoomType eNew, BOOL bAll ) +void ScViewData::CreateTabData( std::vector< SCTAB >& rvTabs ) { - if ( !bAll ) - CreateSelectedTabData(); // if zoom is set for a table, it must be stored + std::vector< SCTAB >::iterator it_end = rvTabs.end(); + for ( std::vector< SCTAB >::iterator it = rvTabs.begin(); it != it_end; ++it ) + if ( !pTabData[*it] ) + CreateTabData( *it ); +} - for ( SCTAB i = 0; i <= MAXTAB; i++ ) - if ( pTabData[i] && ( bAll || aMarkData.GetTableSelect(i) ) ) +void ScViewData::SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs ) +{ + BOOL bAll = ( tabs.size() == 0 ); + + if ( !bAll ) // create associated table data + CreateTabData( tabs ); + + std::vector< SCTAB >::iterator it_end = tabs.end(); + std::vector< SCTAB >::iterator it = tabs.begin(); + for ( SCTAB i = ( bAll ? 0 : *it ); ( bAll ? i <= MAXTAB : it != it_end ); ++i , ++it ) + { + if ( pTabData[i] ) pTabData[i]->eZoomType = eNew; + } if ( bAll ) eDefZoomType = eNew; } -void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, BOOL bAll ) +void ScViewData::SetZoomType( SvxZoomType eNew, BOOL bAll ) { - if ( !bAll ) - CreateSelectedTabData(); // if zoom is set for a table, it must be stored + std::vector< SCTAB > vTabs; // Empty for all tabs + if ( !bAll ) // get selected tabs + { + SCTAB nTabCount = pDoc->GetTableCount(); + for (SCTAB i=0; i& tabs ) +{ + BOOL bAll = ( tabs.size() == 0 ); + if ( !bAll ) // create associated table data + CreateTabData( tabs ); Fraction aFrac20( 1,5 ); Fraction aFrac400( 4,1 ); Fraction aValidX = rNewX; - if (aValidXaFrac400) aValidX = aFrac400; + if (aValidXaFrac400) + aValidX = aFrac400; Fraction aValidY = rNewY; - if (aValidYaFrac400) aValidY = aFrac400; + if (aValidYaFrac400) + aValidY = aFrac400; - if ( bPagebreak ) + std::vector< SCTAB >::iterator it_end = tabs.end(); + std::vector< SCTAB >::iterator it = tabs.begin(); + + for ( SCTAB i = ( bAll ? 0 : *it ); ( bAll ? i <= MAXTAB : it != it_end ); ++i , ++it ) { - for ( SCTAB i = 0; i <= MAXTAB; i++ ) - if ( pTabData[i] && ( bAll || aMarkData.GetTableSelect(i) ) ) + if ( pTabData[i] ) + { + if ( bPagebreak ) { pTabData[i]->aPageZoomX = aValidX; pTabData[i]->aPageZoomY = aValidY; } - if ( bAll ) - { - aDefPageZoomX = aValidX; - aDefPageZoomY = aValidY; - } - } - else - { - for ( SCTAB i = 0; i <= MAXTAB; i++ ) - if ( pTabData[i] && ( bAll || aMarkData.GetTableSelect(i) ) ) + else { pTabData[i]->aZoomX = aValidX; pTabData[i]->aZoomY = aValidY; } - if ( bAll ) - { - aDefZoomX = aValidX; - aDefZoomY = aValidY; } } - RefreshZoom(); } +void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, BOOL bAll ) +{ + std::vector< SCTAB > vTabs; + if ( !bAll ) // get selected tabs + { + SCTAB nTabCount = pDoc->GetTableCount(); + for (SCTAB i=0; i